Git Repositories

2005-09-06 Benedikt Meurer <benny@xfce.org>
authorBenedikt Meurer <benny@xfce.org>
Tue, 6 Sep 2005 11:34:15 +0000 (11:34 +0000)
committerBenedikt Meurer <benny@xfce.org>
Tue, 6 Sep 2005 11:34:15 +0000 (11:34 +0000)
* thunar-vfs/thunar-vfs-uri.c: Invoke the parent's finalize method, as
  that will be required for language bindings once we have weak/toggle
  references for ExoObject.
* thunar/thunar-local-file.c(thunar_local_file_rename): Re-register with
  the VFS monitor if the rename succeeds.
* thunar-vfs/thunar-vfs-uri.c(thunar_vfs_uri_hash): Don't hash the
  hostname if it's NULL.
* thunar-vfs/thunar-vfs-uri.c(thunar_vfs_uri_equal): We don't need to
  query the hostname string here, as local files will always have host
  set to NULL.
* tests/test-thunar-vfs-uri.c(main): Extend the ThunarVfsURI test.
* pixmaps/, Makefile.am, configure.in.in, thunar/thunar-window.c,
  thunar/Makefile.am: Initial idea for the about dialog logo.

(Old svn revision: 17389)

ChangeLog
Makefile.am
configure.in.in
pixmaps/Makefile.am [new file with mode: 0644]
pixmaps/Thunar-about-logo.png [new file with mode: 0644]
tests/test-thunar-vfs-uri.c
thunar-vfs/thunar-vfs-uri.c
thunar/Makefile.am
thunar/thunar-local-file.c
thunar/thunar-window.c

index a154705..62cf740 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2005-09-06     Benedikt Meurer <benny@xfce.org>
+
+       * thunar-vfs/thunar-vfs-uri.c: Invoke the parent's finalize method, as
+         that will be required for language bindings once we have weak/toggle
+         references for ExoObject.
+       * thunar/thunar-local-file.c(thunar_local_file_rename): Re-register with
+         the VFS monitor if the rename succeeds.
+       * thunar-vfs/thunar-vfs-uri.c(thunar_vfs_uri_hash): Don't hash the
+         hostname if it's NULL.
+       * thunar-vfs/thunar-vfs-uri.c(thunar_vfs_uri_equal): We don't need to
+         query the hostname string here, as local files will always have host
+         set to NULL.
+       * tests/test-thunar-vfs-uri.c(main): Extend the ThunarVfsURI test.
+       * pixmaps/, Makefile.am, configure.in.in, thunar/thunar-window.c,
+         thunar/Makefile.am: Initial idea for the about dialog logo.
+
 2005-09-05     Benedikt Meurer <benny@xfce.org>
 
        * thunar-vfs/thunar-vfs-info.{c,h}, thunar-vfs/thunar-vfs-listdir-job.c:
index df74194..5ac96bd 100644 (file)
@@ -2,6 +2,7 @@
 
 SUBDIRS =                                                              \
        docs                                                            \
+       pixmaps                                                         \
        po                                                              \
        thunar-vfs                                                      \
        thunarx                                                         \
index f904e1a..1bc372e 100644 (file)
@@ -252,6 +252,7 @@ docs/Makefile
 docs/design/Makefile
 docs/papers/Makefile
 po/Makefile.in
+pixmaps/Makefile
 tests/Makefile
 tests/data/Makefile
 thunar/Makefile
diff --git a/pixmaps/Makefile.am b/pixmaps/Makefile.am
new file mode 100644 (file)
index 0000000..ca98f6a
--- /dev/null
@@ -0,0 +1,10 @@
+# $Id$
+
+pixmapsdir = $(datadir)/pixmaps/Thunar
+pixmaps_DATA =                                                         \
+       Thunar-about-logo.png
+
+EXTRA_DIST =                                                           \
+       $(pixmaps_DATA)
+
+# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
diff --git a/pixmaps/Thunar-about-logo.png b/pixmaps/Thunar-about-logo.png
new file mode 100644 (file)
index 0000000..d8b9d65
Binary files /dev/null and b/pixmaps/Thunar-about-logo.png differ
index c03aaaf..0dc9bed 100644 (file)
@@ -44,7 +44,7 @@ main (int argc, char **argv)
   g_assert (exo_str_is_equal (thunar_vfs_uri_get_name (a), "/"));
   g_assert (exo_str_is_equal (thunar_vfs_uri_get_path (a), "/"));
   g_assert (thunar_vfs_uri_parent (a) == NULL);
-  g_assert (exo_str_is_equal (thunar_vfs_uri_to_string (a, THUNAR_VFS_URI_HIDE_HOST), "file:///"));
+  g_assert (exo_str_is_equal (thunar_vfs_uri_to_string (a, 0), "file:///"));
 
   /* verify that URI parsing works */
   a = thunar_vfs_uri_new_for_path ("/tmp");
@@ -57,8 +57,8 @@ main (int argc, char **argv)
   b = thunar_vfs_uri_relative (a, "bin");
   g_assert (!thunar_vfs_uri_equal (a, b));
   g_assert (thunar_vfs_uri_equal (a, thunar_vfs_uri_parent (b)));
-  g_assert (exo_str_is_equal (thunar_vfs_uri_to_string (a, THUNAR_VFS_URI_HIDE_HOST), "file:///usr"));
-  g_assert (exo_str_is_equal (thunar_vfs_uri_to_string (b, THUNAR_VFS_URI_HIDE_HOST), "file:///usr/bin"));
+  g_assert (exo_str_is_equal (thunar_vfs_uri_to_string (a, 0), "file:///usr"));
+  g_assert (exo_str_is_equal (thunar_vfs_uri_to_string (b, 0), "file:///usr/bin"));
 
   /* verify that trash:// uris work */
   a = thunar_vfs_uri_new ("trash:", NULL);
@@ -72,6 +72,14 @@ main (int argc, char **argv)
   g_assert (thunar_vfs_uri_equal (a, b));
   g_assert (exo_str_is_equal (thunar_vfs_uri_to_string (a, 0), "trash:///"));
 
+  /* verify thunar_vfs_uri_to_string */
+  a = thunar_vfs_uri_new ("file:///a ", NULL);
+  b = thunar_vfs_uri_new ("file:///b+", NULL);
+  g_assert (exo_str_is_equal (thunar_vfs_uri_to_string (a, THUNAR_VFS_URI_STRING_UTF8), "file:///a "));
+  g_assert (exo_str_is_equal (thunar_vfs_uri_to_string (a, THUNAR_VFS_URI_STRING_ESCAPED), "file:///a%20"));
+  g_assert (exo_str_is_equal (thunar_vfs_uri_to_string (b, THUNAR_VFS_URI_STRING_UTF8), "file:///b+"));
+  g_assert (exo_str_is_equal (thunar_vfs_uri_to_string (b, THUNAR_VFS_URI_STRING_ESCAPED), "file:///b%2B"));
+
   return EXIT_SUCCESS;
 }
 
index 7ae16e9..0cd413a 100644 (file)
@@ -69,8 +69,9 @@ static const gchar *scheme_names[] =
 
 
 
-static const gchar *home_path;
-static gchar       *localhost;
+static ExoObjectClass *thunar_vfs_uri_parent_class;
+static const gchar    *home_path;
+static gchar          *localhost;
 
 #ifndef G_DISABLE_CHECKS
 G_LOCK_DEFINE_STATIC (debug_uris);
@@ -124,6 +125,9 @@ thunar_vfs_uri_class_init (ThunarVfsURIClass *klass)
 {
   ExoObjectClass *exoobject_class;
 
+  /* determine the parent class */
+  thunar_vfs_uri_parent_class = g_type_class_peek_parent (klass);
+
   /* determine the path to the current user's homedir */
   home_path = xfce_get_homedir ();
 
@@ -207,13 +211,7 @@ thunar_vfs_uri_finalize (ExoObject *object)
   /* free the path */
   g_free (uri->path);
 
-  /* We don't call the parent's finalize method here,
-   * because we know that ExoObject does not finalize
-   * anything. But this only works as long as we are
-   * a direct decendant of ExoObject, so be sure to
-   * verify that here.
-   */
-  g_assert (g_type_parent (THUNAR_VFS_TYPE_URI) == EXO_TYPE_OBJECT);
+  (*EXO_OBJECT_CLASS (thunar_vfs_uri_parent_class)->finalize) (object);
 }
 
 
@@ -773,7 +771,6 @@ thunar_vfs_uri_to_string (const ThunarVfsURI     *uri,
 guint
 thunar_vfs_uri_hash (gconstpointer uri)
 {
-  const gchar *host;
   const gchar *p;
   guint        h;
 
@@ -787,9 +784,8 @@ thunar_vfs_uri_hash (gconstpointer uri)
     h = (h << 5) - h + *p;
 
   /* hash the host (if present) */
-  host = thunar_vfs_uri_get_host (THUNAR_VFS_URI (uri));
-  if (G_LIKELY (host != NULL))
-    for (p = host; *p != '\0'; ++p)
+  if (G_LIKELY (THUNAR_VFS_URI (uri)->host != NULL))
+    for (p = THUNAR_VFS_URI (uri)->host; *p != '\0'; ++p)
       h = (h << 5) - h + *p;
 
   return h;
@@ -811,8 +807,6 @@ gboolean
 thunar_vfs_uri_equal (gconstpointer a,
                       gconstpointer b)
 {
-  const gchar *a_host;
-  const gchar *b_host;
   const gchar *a_name;
   const gchar *b_name;
   const gchar *a_path;
@@ -831,12 +825,6 @@ thunar_vfs_uri_equal (gconstpointer a,
   if (THUNAR_VFS_URI (a)->scheme != THUNAR_VFS_URI (b)->scheme)
     return FALSE;
 
-  /* compare the host names (TODO: speedup?!) */
-  a_host = thunar_vfs_uri_get_host (THUNAR_VFS_URI (a));
-  b_host = thunar_vfs_uri_get_host (THUNAR_VFS_URI (b));
-  if (!exo_str_is_equal (a_host, b_host))
-    return FALSE;
-
   a_name = THUNAR_VFS_URI (a)->name;
   b_name = THUNAR_VFS_URI (b)->name;
 
@@ -846,6 +834,10 @@ thunar_vfs_uri_equal (gconstpointer a,
   if (G_LIKELY (*ap != '\0' || *bp != '\0'))
     return FALSE;
 
+  /* compare the host names */
+  if (!exo_str_is_equal (THUNAR_VFS_URI (a)->host, THUNAR_VFS_URI (b)->host))
+    return FALSE;
+
   a_path = THUNAR_VFS_URI (a)->path;
   b_path = THUNAR_VFS_URI (b)->path;
 
index e42afc5..8181f88 100644 (file)
@@ -2,6 +2,7 @@
 
 INCLUDES =                                                             \
        -I$(top_srcdir)                                                 \
+       -DDATADIR=\"$(datadir)\"                                        \
        -DEXO_API_SUBJECT_TO_CHANGE                                     \
        -DEXO_DISABLE_DEPRECATED                                        \
        -DG_LOG_DOMAIN=\"Thunar\"                                       \
index 9674aa3..15ddf18 100644 (file)
@@ -259,6 +259,16 @@ thunar_local_file_rename (ThunarFile  *file,
   succeed = thunar_vfs_info_rename (local_file->info, name, error);
   if (G_LIKELY (succeed))
     {
+      /* need to re-register the monitor handle for the new uri */
+      if (G_LIKELY (local_file->handle != NULL))
+        {
+          /* drop the previous handle (with the old URI) */
+          thunar_vfs_monitor_remove (monitor, local_file->handle);
+
+          /* register the new handle (with the new URI) */
+          local_file->handle = thunar_vfs_monitor_add_file (monitor, local_file->info->uri, thunar_local_file_monitor, local_file);
+        }
+
       /* perform the rename on the file cache */
       _thunar_file_cache_rename (file, previous_uri);
 
index 4b74a4f..e7fe501 100644 (file)
@@ -584,6 +584,12 @@ thunar_window_action_about (GtkAction    *action,
     "this program; if not, write to the Free Software Foundation, Inc., 59 Temple\n"
     "Place, Suite 330, Boston, MA  02111-1307  USA.\n";
 
+  GdkPixbuf *logo;
+  
+  /* try to load the about logo */
+  logo = gdk_pixbuf_new_from_file (DATADIR "/pixmaps/Thunar/Thunar-about-logo.png", NULL);
+
+  /* open the about dialog */
   gtk_about_dialog_set_email_hook ((gpointer) exo_noop, NULL, NULL);
   gtk_about_dialog_set_url_hook ((gpointer) exo_noop, NULL, NULL);
   gtk_show_about_dialog (GTK_WINDOW (window),
@@ -591,11 +597,16 @@ thunar_window_action_about (GtkAction    *action,
                          "comments", _("Thunar is a fast and easy to use file manager\nfor the Xfce Desktop Environment."),
                          "copyright", "Copyright © 2004-2005 Benedikt Meurer",
                          "license", license,
+                         "logo", logo,
                          "name", PACKAGE_NAME,
                          "translator-credits", _("translator-credits"),
                          "version", PACKAGE_VERSION,
                          "website", "http://thunar.xfce.org/",
                          NULL);
+
+  /* release the about logo (if any) */
+  if (G_LIKELY (logo != NULL))
+    g_object_unref (G_OBJECT (logo));
 }