[Xfce4-commits] r29921 - in thunar/branches/migration-to-gio: . thunar

Jannis Pohlmann jannis at xfce.org
Thu Apr 30 15:52:43 CEST 2009


Author: jannis
Date: 2009-04-30 13:52:42 +0000 (Thu, 30 Apr 2009)
New Revision: 29921

Modified:
   thunar/branches/migration-to-gio/ChangeLog
   thunar/branches/migration-to-gio/thunar/thunar-abstract-icon-view.c
   thunar/branches/migration-to-gio/thunar/thunar-debug.c
   thunar/branches/migration-to-gio/thunar/thunar-details-view.c
   thunar/branches/migration-to-gio/thunar/thunar-dialogs.c
   thunar/branches/migration-to-gio/thunar/thunar-file.h
   thunar/branches/migration-to-gio/thunar/thunar-gtk-extensions.c
   thunar/branches/migration-to-gio/thunar/thunar-path-entry.c
   thunar/branches/migration-to-gio/thunar/thunar-preferences-dialog.c
   thunar/branches/migration-to-gio/thunar/thunar-standard-view.c
   thunar/branches/migration-to-gio/thunar/thunar-templates-action.c
   thunar/branches/migration-to-gio/thunar/thunar-text-renderer.c
   thunar/branches/migration-to-gio/thunar/thunar-tree-view.c
   thunar/branches/migration-to-gio/thunar/thunar-util.c
   thunar/branches/migration-to-gio/thunar/thunar-util.h
   thunar/branches/migration-to-gio/thunar/thunar-window.c
Log:
	* thunar/*.c: Remove all occurances of GLIB_CHECK_VERSION() and
	  GTK_CHECK_VERSION() because we depend on much more recent GLib/GTK+
	  versions now anyway.
	* thunar/thnuar-file.{c,h}, thunar/thunar-util.{c,h}: Actually, time_t
	  instead of guint64 is the correct type to use (fixes the previous
	  commit).
	* thunar/thunar-window.c: Implement thunar_window_directory_destroy()
	  around g_file_find_enclosing_mount(). I'm not 100% happy with this
	  implementation but it'll do for now. Open the home directory if the
	  new directory cannot be determined.

Modified: thunar/branches/migration-to-gio/ChangeLog
===================================================================
--- thunar/branches/migration-to-gio/ChangeLog	2009-04-30 13:07:11 UTC (rev 29920)
+++ thunar/branches/migration-to-gio/ChangeLog	2009-04-30 13:52:42 UTC (rev 29921)
@@ -1,5 +1,18 @@
 2009-04-30	Jannis Pohlmann <jannis at xfce.org>
 
+	* thunar/*.c: Remove all occurances of GLIB_CHECK_VERSION() and 
+	  GTK_CHECK_VERSION() because we depend on much more recent GLib/GTK+
+	  versions now anyway.
+	* thunar/thnuar-file.{c,h}, thunar/thunar-util.{c,h}: Actually, time_t
+	  instead of guint64 is the correct type to use (fixes the previous 
+	  commit).
+	* thunar/thunar-window.c: Implement thunar_window_directory_destroy()
+	  around g_file_find_enclosing_mount(). I'm not 100% happy with this
+	  implementation but it'll do for now. Open the home directory if the
+	  new directory cannot be determined.
+
+2009-04-30	Jannis Pohlmann <jannis at xfce.org>
+
 	* thunar/thunar-util.{c,h}: Replace ThunarVfsFileTime with guint64.
 
 2009-04-30	Jannis Pohlmann <jannis at xfce.org>

Modified: thunar/branches/migration-to-gio/thunar/thunar-abstract-icon-view.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-abstract-icon-view.c	2009-04-30 13:07:11 UTC (rev 29920)
+++ thunar/branches/migration-to-gio/thunar/thunar-abstract-icon-view.c	2009-04-30 13:52:42 UTC (rev 29921)
@@ -642,10 +642,8 @@
   GtkAction  *action = NULL;
   GdkPixbuf  *stock_icon = NULL;
   gchar      *stock_id;
-#if GTK_CHECK_VERSION(2,7,1)
   GdkColor    bg;
   cairo_t    *cr;
-#endif
 
   _thunar_return_val_if_fail (EXO_IS_ICON_VIEW (view), FALSE);
   _thunar_return_val_if_fail (THUNAR_IS_ABSTRACT_ICON_VIEW (abstract_icon_view), FALSE);
@@ -654,7 +652,6 @@
   _thunar_return_val_if_fail (abstract_icon_view->priv->gesture_release_id > 0, FALSE);
 
   /* shade the abstract_icon view content while performing mouse gestures */
-#if GTK_CHECK_VERSION(2,7,1)
   cr = gdk_cairo_create (event->window);
   bg = GTK_WIDGET (view)->style->base[GTK_STATE_NORMAL];
   cairo_set_source_rgba (cr, bg.red / 65535.0, bg.green / 65535.0, bg.blue / 65535.0, 0.7);
@@ -662,7 +659,6 @@
   cairo_clip (cr);
   cairo_paint (cr);
   cairo_destroy (cr);
-#endif
 
   /* determine the gesture action */
   action = thunar_abstract_icon_view_gesture_action (abstract_icon_view);

Modified: thunar/branches/migration-to-gio/thunar/thunar-debug.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-debug.c	2009-04-30 13:07:11 UTC (rev 29920)
+++ thunar/branches/migration-to-gio/thunar/thunar-debug.c	2009-04-30 13:52:42 UTC (rev 29921)
@@ -30,11 +30,7 @@
 
 #include <thunar/thunar-debug.h>
 
-#if GLIB_CHECK_VERSION(2,8,0)
 #include <glib/gstdio.h>
-#else
-#define g_access(filename, mode) access((filename),(mode))
-#endif
 
 
 

Modified: thunar/branches/migration-to-gio/thunar/thunar-details-view.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-details-view.c	2009-04-30 13:07:11 UTC (rev 29920)
+++ thunar/branches/migration-to-gio/thunar/thunar-details-view.c	2009-04-30 13:52:42 UTC (rev 29921)
@@ -250,9 +250,7 @@
   gtk_tree_view_set_enable_search (GTK_TREE_VIEW (tree_view), TRUE);
 
   /* enable rubberbanding (if supported) */
-#if GTK_CHECK_VERSION(2,9,0)
   gtk_tree_view_set_rubber_banding (GTK_TREE_VIEW (tree_view), TRUE);
-#endif
 
   /* connect to the default column model */
   details_view->column_model = thunar_column_model_get_default ();
@@ -575,11 +573,7 @@
 {
   _thunar_return_val_if_fail (THUNAR_IS_DETAILS_VIEW (standard_view), FALSE);
 
-#if GTK_CHECK_VERSION(2,8,0)
   return gtk_tree_view_get_visible_range (GTK_TREE_VIEW (GTK_BIN (standard_view)->child), start_path, end_path);
-#else
-  return FALSE;
-#endif
 }
 
 
@@ -809,22 +803,8 @@
   /* determine the list of tree view columns */
   for (column = 0; column < THUNAR_N_VISIBLE_COLUMNS; ++column)
     {
-#if GTK_CHECK_VERSION(2,8,0)
       /* just queue a resize on this column */
       gtk_tree_view_column_queue_resize (details_view->columns[column]);
-#else
-      /* determine the renderers for this column */
-      GList *renderers = gtk_tree_view_column_get_cell_renderers (details_view->columns[column]);
-      if (G_LIKELY (renderers != NULL))
-        {
-          /* this is really an awfull hack, but it works! It forces GtkTreeView to recalculate
-           * the dimensions of this column, and that's all that matters. We don't use it with
-           * newer Gtk+ versions either, so what the f*ck...
-           */
-          gtk_tree_view_column_set_cell_data_func (details_view->columns[column], renderers->data, NULL, NULL, NULL);
-          g_list_free (renderers);
-        }
-#endif
     }
 }
 

Modified: thunar/branches/migration-to-gio/thunar/thunar-dialogs.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-dialogs.c	2009-04-30 13:07:11 UTC (rev 29920)
+++ thunar/branches/migration-to-gio/thunar/thunar-dialogs.c	2009-04-30 13:52:42 UTC (rev 29921)
@@ -241,11 +241,7 @@
                          "documenters", documenters,
                          "license", XFCE_LICENSE_GPL,
                          "logo", logo,
-#if GTK_CHECK_VERSION(2,11,0)
                          "program-name", title,
-#else
-                         "name", title,
-#endif
                          "translator-credits", _("translator-credits"),
                          "version", PACKAGE_VERSION,
                          "website", "http://thunar.xfce.org/",

Modified: thunar/branches/migration-to-gio/thunar/thunar-file.h
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-file.h	2009-04-30 13:07:11 UTC (rev 29920)
+++ thunar/branches/migration-to-gio/thunar/thunar-file.h	2009-04-30 13:52:42 UTC (rev 29921)
@@ -156,7 +156,7 @@
 
 const gchar      *thunar_file_get_display_name     (const ThunarFile       *file);
 
-ThunarVfsFileTime thunar_file_get_date             (const ThunarFile       *file,
+time_t            thunar_file_get_date             (const ThunarFile       *file,
                                                     ThunarFileDateType      date_type);
 
 gchar            *thunar_file_get_date_string      (const ThunarFile       *file,

Modified: thunar/branches/migration-to-gio/thunar/thunar-gtk-extensions.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-gtk-extensions.c	2009-04-30 13:07:11 UTC (rev 29920)
+++ thunar/branches/migration-to-gio/thunar/thunar-gtk-extensions.c	2009-04-30 13:52:42 UTC (rev 29921)
@@ -88,11 +88,7 @@
   action = gtk_action_group_get_action (action_group, action_name);
 
   /* apply the sensitivity to the action */
-#if GTK_CHECK_VERSION(2,6,0)
   gtk_action_set_sensitive (action, sensitive);
-#else
-  g_object_set (G_OBJECT (action), "sensitive", sensitive, NULL);
-#endif
 }
 
 

Modified: thunar/branches/migration-to-gio/thunar/thunar-path-entry.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-path-entry.c	2009-04-30 13:07:11 UTC (rev 29920)
+++ thunar/branches/migration-to-gio/thunar/thunar-path-entry.c	2009-04-30 13:52:42 UTC (rev 29921)
@@ -286,9 +286,7 @@
 
   /* allocate a new entry completion for the given model */
   completion = gtk_entry_completion_new ();
-#if GTK_CHECK_VERSION(2,8,0)
   gtk_entry_completion_set_popup_single_match (completion, FALSE);
-#endif
   gtk_entry_completion_set_match_func (completion, thunar_path_entry_match_func, path_entry, NULL);
   g_signal_connect (G_OBJECT (completion), "match-selected", G_CALLBACK (thunar_path_entry_match_selected), path_entry);
 

Modified: thunar/branches/migration-to-gio/thunar/thunar-preferences-dialog.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-preferences-dialog.c	2009-04-30 13:07:11 UTC (rev 29920)
+++ thunar/branches/migration-to-gio/thunar/thunar-preferences-dialog.c	2009-04-30 13:52:42 UTC (rev 29921)
@@ -270,9 +270,6 @@
   gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Detailed List View"));
   gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Compact List View"));
   gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Last Active View"));
-#if !GTK_CHECK_VERSION(2,9,0)
-  g_signal_connect (G_OBJECT (combo), "changed", G_CALLBACK (g_object_notify), "active");
-#endif
   exo_mutual_binding_new_full (G_OBJECT (dialog->preferences), "default-view", G_OBJECT (combo), "active",
                                transform_view_string_to_index, transform_view_index_to_string, NULL, NULL);
   gtk_table_attach (GTK_TABLE (table), combo, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
@@ -343,9 +340,6 @@
       gtk_combo_box_append_text (GTK_COMBO_BOX (combo), date);
       g_free (date);
     }
-#if !GTK_CHECK_VERSION(2,9,0)
-  g_signal_connect (G_OBJECT (combo), "changed", G_CALLBACK (g_object_notify), "active");
-#endif
   exo_mutual_binding_new (G_OBJECT (dialog->preferences), "misc-date-style", G_OBJECT (combo), "active");
   gtk_table_attach (GTK_TABLE (table), combo, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
   thunar_gtk_label_set_a11y_relation (GTK_LABEL (label), combo);
@@ -390,9 +384,6 @@
   gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Large"));
   gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Larger"));
   gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Very Large"));
-#if !GTK_CHECK_VERSION(2,9,0)
-  g_signal_connect (G_OBJECT (combo), "changed", G_CALLBACK (g_object_notify), "active");
-#endif
   exo_mutual_binding_new_full (G_OBJECT (dialog->preferences), "shortcuts-icon-size", G_OBJECT (combo), "active",
                                transform_icon_size_to_index, transform_index_to_icon_size, NULL, NULL);
   gtk_table_attach (GTK_TABLE (table), combo, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
@@ -435,9 +426,6 @@
   gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Large"));
   gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Larger"));
   gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Very Large"));
-#if !GTK_CHECK_VERSION(2,9,0)
-  g_signal_connect (G_OBJECT (combo), "changed", G_CALLBACK (g_object_notify), "active");
-#endif
   exo_mutual_binding_new_full (G_OBJECT (dialog->preferences), "tree-icon-size", G_OBJECT (combo), "active",
                                transform_icon_size_to_index, transform_index_to_icon_size, NULL, NULL);
   gtk_table_attach (GTK_TABLE (table), combo, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
@@ -589,9 +577,6 @@
   gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Ask everytime"));
   gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Apply to Folder Only"));
   gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Apply to Folder and Contents"));
-#if !GTK_CHECK_VERSION(2,9,0)
-  g_signal_connect (G_OBJECT (combo), "changed", G_CALLBACK (g_object_notify), "active");
-#endif
   exo_mutual_binding_new (G_OBJECT (dialog->preferences), "misc-recursive-permissions", G_OBJECT (combo), "active");
   gtk_table_attach (GTK_TABLE (table), combo, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
   thunar_gtk_label_set_a11y_relation (GTK_LABEL (label), combo);

Modified: thunar/branches/migration-to-gio/thunar/thunar-standard-view.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-standard-view.c	2009-04-30 13:07:11 UTC (rev 29920)
+++ thunar/branches/migration-to-gio/thunar/thunar-standard-view.c	2009-04-30 13:52:42 UTC (rev 29921)
@@ -960,9 +960,7 @@
                                    GdkEventExpose *event)
 {
   gboolean result = FALSE;
-#if GTK_CHECK_VERSION(2,7,2)
   cairo_t *cr;
-#endif
   gint     x, y, width, height;
 
   /* let the scrolled window do it's work */
@@ -981,7 +979,6 @@
                         NULL, widget, "dnd",
                         x, y, width, height);
 
-#if GTK_CHECK_VERSION(2,7,2)
       /* the cairo version looks better here, so we use it if possible */
       cr = gdk_cairo_create (widget->window);
       cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
@@ -989,10 +986,6 @@
       cairo_rectangle (cr, x + 0.5, y + 0.5, width - 1, height - 1);
       cairo_stroke (cr);
       cairo_destroy (cr);
-#else
-      gdk_draw_rectangle (widget->window, widget->style->black_gc,
-                          FALSE, x, y, width - 1, height - 1);
-#endif
     }
 
   return result;

Modified: thunar/branches/migration-to-gio/thunar/thunar-templates-action.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-templates-action.c	2009-04-30 13:07:11 UTC (rev 29920)
+++ thunar/branches/migration-to-gio/thunar/thunar-templates-action.c	2009-04-30 13:52:42 UTC (rev 29921)
@@ -365,9 +365,7 @@
   /* determine the path to the ~/Templates folder */
   home_path = thunar_vfs_path_get_for_home ();
 
-#if GLIB_CHECK_VERSION(2,14,0)
   templates_dir = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_TEMPLATES));
-#endif /* GLIB_CHECK_VERSION(2,14,0) */
   if (G_UNLIKELY (templates_dir == NULL))
     {
       templates_dir = g_build_filename (G_DIR_SEPARATOR_S, xfce_get_homedir (),
@@ -382,13 +380,12 @@
 
   thunar_vfs_path_unref (home_path);
 
-#if GLIB_CHECK_VERSION(2, 14, 0)
-  if (!exo_str_is_equal (g_get_user_special_dir (G_USER_DIRECTORY_TEMPLATES), xfce_get_homedir ()))
+  if (!exo_str_is_equal (g_get_user_special_dir (G_USER_DIRECTORY_TEMPLATES), 
+                         xfce_get_homedir ()))
     {
       /* fill the menu with files/folders from the ~/Templates folder */
       thunar_templates_action_fill_menu (templates_action, templates_path, menu);
     }
-#endif
 
   /* check if any items were added to the menu */
   if (G_UNLIKELY (GTK_MENU_SHELL (menu)->children == NULL))

Modified: thunar/branches/migration-to-gio/thunar/thunar-text-renderer.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-text-renderer.c	2009-04-30 13:07:11 UTC (rev 29920)
+++ thunar/branches/migration-to-gio/thunar/thunar-text-renderer.c	2009-04-30 13:52:42 UTC (rev 29921)
@@ -488,11 +488,7 @@
 {
   ThunarTextRenderer *text_renderer = THUNAR_TEXT_RENDERER (renderer);
   GtkStateType        state;
-#if !GTK_CHECK_VERSION(2,8,0)
-  GdkPoint            points[8];
-#else
   cairo_t            *cr;
-#endif
   gint                x0, x1, y0, y1;
   gint                text_width;
   gint                text_height;
@@ -570,7 +566,6 @@
       x1 = x0 + text_width;
       y1 = y0 + text_height;
 
-#if GTK_CHECK_VERSION(2,8,0)
       /* Cairo produces nicer results than using a polygon
        * and so we use it directly if possible.
        */
@@ -587,20 +582,6 @@
       gdk_cairo_set_source_color (cr, &widget->style->base[state]);
       cairo_fill (cr);
       cairo_destroy (cr);
-#else
-      /* calculate a (more or less rounded) polygon */
-      points[0].x = x0 + 2; points[0].y = y0;
-      points[1].x = x1 - 2; points[1].y = y0;
-      points[2].x = x1;     points[2].y = y0 + 2;
-      points[3].x = x1;     points[3].y = y1 - 2;
-      points[4].x = x1 - 2; points[4].y = y1;
-      points[5].x = x0 + 2; points[5].y = y1;
-      points[6].x = x0;     points[6].y = y1 - 2;
-      points[7].x = x0;     points[7].y = y0 + 2;
-
-      /* render the indicator */
-      gdk_draw_polygon (window, widget->style->base_gc[state], TRUE, points, G_N_ELEMENTS (points));
-#endif
     }
 
   /* draw the focus indicator */

Modified: thunar/branches/migration-to-gio/thunar/thunar-tree-view.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-tree-view.c	2009-04-30 13:07:11 UTC (rev 29920)
+++ thunar/branches/migration-to-gio/thunar/thunar-tree-view.c	2009-04-30 13:52:42 UTC (rev 29921)
@@ -226,12 +226,10 @@
    */
   gint                    pressed_button;
 
-#if GTK_CHECK_VERSION(2,8,0)
   /* id of the signal used to queue a resize on the
    * column whenever the shortcuts icon size is changed.
    */
   gint                    queue_resize_signal_id;
-#endif
 
   /* set cursor to current directory idle source */
   gint                    cursor_idle_id;
@@ -429,10 +427,8 @@
   gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
 
   /* queue a resize on the column whenever the icon size is changed */
-#if GTK_CHECK_VERSION(2,8,0)
   view->queue_resize_signal_id = g_signal_connect_swapped (G_OBJECT (view->preferences), "notify::tree-icon-size",
                                                            G_CALLBACK (gtk_tree_view_column_queue_resize), column);
-#endif
 
   /* allocate the special icon renderer */
   view->icon_renderer = thunar_shortcuts_icon_renderer_new ();
@@ -480,9 +476,7 @@
   g_object_unref (G_OBJECT (view->provider_factory));
 
   /* disconnect the queue resize signal handler */
-#if GTK_CHECK_VERSION(2,8,0)
   g_signal_handler_disconnect (G_OBJECT (view->preferences), view->queue_resize_signal_id);
-#endif
 
   /* be sure to cancel the cursor idle source */
   if (G_UNLIKELY (view->cursor_idle_id >= 0))
@@ -2273,11 +2267,9 @@
 {
   ThunarTreeView *view = THUNAR_TREE_VIEW (user_data);
   GtkAdjustment  *vadjustment;
-#if GTK_CHECK_VERSION(2,8,0)
   GtkTreePath    *start_path;
   GtkTreePath    *end_path;
   GtkTreePath    *path;
-#endif
   gfloat          value;
   gint            offset;
   gint            y, h;
@@ -2311,7 +2303,6 @@
               /* apply the new value */
               gtk_adjustment_set_value (vadjustment, value);
 
-#if GTK_CHECK_VERSION(2,8,0)
               /* drop any pending expand timer source, as its confusing
                * if a path is expanded while scrolling through the view.
                * reschedule it if the drag dest path is still visible.
@@ -2346,7 +2337,6 @@
                       gtk_tree_path_free (end_path);
                     }
                 }
-#endif
             }
         }
     }

Modified: thunar/branches/migration-to-gio/thunar/thunar-util.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-util.c	2009-04-30 13:07:11 UTC (rev 29920)
+++ thunar/branches/migration-to-gio/thunar/thunar-util.c	2009-04-30 13:52:42 UTC (rev 29921)
@@ -169,7 +169,7 @@
  *               according to the @date_format.
  **/
 gchar*
-thunar_util_humanize_file_time (guint64         file_time,
+thunar_util_humanize_file_time (time_t          file_time,
                                 ThunarDateStyle date_style)
 {
   const gchar *date_format;
@@ -188,13 +188,8 @@
       if (date_style == THUNAR_DATE_STYLE_SIMPLE || date_style == THUNAR_DATE_STYLE_SHORT)
         {
           /* setup the dates for the time values */
-#if GLIB_CHECK_VERSION(2,10,0)
           g_date_set_time_t (&dfile, file_time);
           g_date_set_time_t (&dnow, time (NULL));
-#else
-          g_date_set_time (&dfile, (GTime) file_time);
-          g_date_set_time (&dnow, (GTime) time (NULL));
-#endif
 
           /* determine the difference in days */
           diff = g_date_get_julian (&dnow) - g_date_get_julian (&dfile);

Modified: thunar/branches/migration-to-gio/thunar/thunar-util.h
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-util.h	2009-04-30 13:07:11 UTC (rev 29920)
+++ thunar/branches/migration-to-gio/thunar/thunar-util.h	2009-04-30 13:52:42 UTC (rev 29921)
@@ -30,7 +30,7 @@
 gchar     *thunar_util_expand_filename    (const gchar    *filename,
                                            GError        **error);
 
-gchar     *thunar_util_humanize_file_time (guint64         file_time,
+gchar     *thunar_util_humanize_file_time (time_t          file_time,
                                            ThunarDateStyle date_style) G_GNUC_INTERNAL G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
 
 GdkScreen *thunar_util_parse_parent       (gpointer        parent,

Modified: thunar/branches/migration-to-gio/thunar/thunar-window.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-window.c	2009-04-30 13:07:11 UTC (rev 29920)
+++ thunar/branches/migration-to-gio/thunar/thunar-window.c	2009-04-30 13:52:42 UTC (rev 29921)
@@ -1870,7 +1870,6 @@
   ThunarFile    *home_file;
   GError        *error = NULL;
 
-  _thunar_return_if_fail (GTK_IS_ACTION (action));
   _thunar_return_if_fail (THUNAR_IS_WINDOW (window));
 
   /* determine the path to the home directory */
@@ -1958,84 +1957,72 @@
 thunar_window_action_open_desktop (GtkAction     *action,
                                    ThunarWindow  *window)
 {
-#if GLIB_CHECK_VERSION(2, 14, 0)
   _thunar_return_if_fail (GTK_IS_ACTION (action));
   _thunar_return_if_fail (THUNAR_IS_WINDOW (window));
 
   thunar_window_open_user_folder (action, window,
                                   THUNAR_USER_DIRECTORY_DESKTOP,
                                   "Desktop");
-#endif
 }
 
 static void
 thunar_window_action_open_documents (GtkAction     *action,
                                      ThunarWindow  *window)
 {
-#if GLIB_CHECK_VERSION(2, 14, 0)
   _thunar_return_if_fail (GTK_IS_ACTION (action));
   _thunar_return_if_fail (THUNAR_IS_WINDOW (window));
 
   thunar_window_open_user_folder (action, window,
                                   THUNAR_USER_DIRECTORY_DOCUMENTS,
                                   "Documents");
-#endif
 }
 
 static void
 thunar_window_action_open_downloads (GtkAction     *action,
                                      ThunarWindow  *window)
 {
-#if GLIB_CHECK_VERSION(2, 14, 0)
   _thunar_return_if_fail (GTK_IS_ACTION (action));
   _thunar_return_if_fail (THUNAR_IS_WINDOW (window));
 
   thunar_window_open_user_folder (action, window,
                                   THUNAR_USER_DIRECTORY_DOWNLOAD,
                                   "Downloads");
-#endif
 }
 
 static void
 thunar_window_action_open_music (GtkAction     *action,
                                  ThunarWindow  *window)
 {
-#if GLIB_CHECK_VERSION(2, 14, 0)
   _thunar_return_if_fail (GTK_IS_ACTION (action));
   _thunar_return_if_fail (THUNAR_IS_WINDOW (window));
 
   thunar_window_open_user_folder (action, window,
                                   THUNAR_USER_DIRECTORY_MUSIC,
                                   "Music");
-#endif
 }
 
 static void
 thunar_window_action_open_pictures (GtkAction     *action,
                                     ThunarWindow  *window)
 {
-#if GLIB_CHECK_VERSION(2, 14, 0)
   _thunar_return_if_fail (GTK_IS_ACTION (action));
   _thunar_return_if_fail (THUNAR_IS_WINDOW (window));
 
   thunar_window_open_user_folder (action, window,
                                   THUNAR_USER_DIRECTORY_PICTURES,
                                   "Pictures");
-#endif
 }
 
 static void
 thunar_window_action_open_public (GtkAction     *action,
                                   ThunarWindow  *window)
 {
-#if GLIB_CHECK_VERSION(2, 14, 0)
   _thunar_return_if_fail (GTK_IS_ACTION (action));
   _thunar_return_if_fail (THUNAR_IS_WINDOW (window));
 
   thunar_window_open_user_folder (action, window,
                                   THUNAR_USER_DIRECTORY_PUBLIC_SHARE,
                                   "Public");
-#endif
 }
 
 static void
@@ -2122,14 +2109,12 @@
 thunar_window_action_open_videos (GtkAction     *action,
                                   ThunarWindow  *window)
 {
-#if GLIB_CHECK_VERSION(2, 14, 0)
   _thunar_return_if_fail (GTK_IS_ACTION (action));
   _thunar_return_if_fail (THUNAR_IS_WINDOW (window));
 
   thunar_window_open_user_folder (action, window,
                                   THUNAR_USER_DIRECTORY_VIDEOS,
                                   "Videos");
-#endif
 }
 
 
@@ -2247,42 +2232,51 @@
 thunar_window_current_directory_destroy (ThunarFile   *current_directory,
                                          ThunarWindow *window)
 {
-  ThunarVfsPath *path;
-  ThunarVfsInfo *info;
-  ThunarFile    *file = NULL;
+  ThunarFile *new_directory = NULL;
+  GMount     *mount;
+  GFile      *path;
+  GFile      *tmp;
 
   _thunar_return_if_fail (THUNAR_IS_WINDOW (window));
   _thunar_return_if_fail (THUNAR_IS_FILE (current_directory));
   _thunar_return_if_fail (window->current_directory == current_directory);
 
   /* determine the path of the current directory */
-  path = thunar_file_get_path (current_directory);
+  path = thunar_file_get_file (current_directory);
 
-  /* determine the first still present parent directory */
-  for (path = thunar_vfs_path_get_parent (path); file == NULL && path != NULL; path = thunar_vfs_path_get_parent (path))
+  while (new_directory == NULL && path != NULL)
     {
-      /* try to determine the info for the path */
-      info = thunar_vfs_info_new_for_path (path, NULL);
-      if (G_LIKELY (info != NULL))
-        {
-          /* check if we have a directory here */
-          if (info->type == THUNAR_VFS_FILE_TYPE_DIRECTORY)
-            file = thunar_file_get_for_info (info);
+      /* TODO make this asynchronous if possible */
+      mount = g_file_find_enclosing_mount (path, NULL, NULL);
 
-          /* release the file info */
-          thunar_vfs_info_unref (info);
+      if (mount != NULL)
+        {
+          new_directory = thunar_file_get (path, NULL);
+          g_object_unref (mount);
         }
+
+      tmp = g_file_get_parent (path);
+      g_object_unref (path);
+      path = tmp;
     }
 
+  if (path != NULL)
+    g_object_unref (path);
+
   /* check if we have a new folder */
-  if (G_LIKELY (file != NULL))
+  if (G_LIKELY (new_directory != NULL))
     {
       /* enter the new folder */
-      thunar_window_set_current_directory (window, file);
+      thunar_window_set_current_directory (window, new_directory);
 
       /* release the file reference */
-      g_object_unref (G_OBJECT (file));
+      g_object_unref (new_directory);
     }
+  else
+    {
+      /* enter the home folder */
+      thunar_window_action_open_home (NULL, window);
+    }
 }
 
 




More information about the Xfce4-commits mailing list