[Xfce4-commits] r23626 - in thunar/trunk: . thunar

Benedikt Meurer benny at xfce.org
Sat Nov 4 01:29:27 CET 2006


Author: benny
Date: 2006-11-04 00:29:23 +0000 (Sat, 04 Nov 2006)
New Revision: 23626

Modified:
   thunar/trunk/ChangeLog
   thunar/trunk/thunar/thunar-location-button.c
   thunar/trunk/thunar/thunar-location-buttons.c
Log:
2006-11-04	Benedikt Meurer <benny at xfce.org>

	* thunar/thunar-location-button.c, thunar/thunar-location-buttons.c:
	  Properly clean up the path bar when a folder on the path bar is
	  deleted.




Modified: thunar/trunk/ChangeLog
===================================================================
--- thunar/trunk/ChangeLog	2006-11-04 00:13:40 UTC (rev 23625)
+++ thunar/trunk/ChangeLog	2006-11-04 00:29:23 UTC (rev 23626)
@@ -1,5 +1,11 @@
 2006-11-04	Benedikt Meurer <benny at xfce.org>
 
+	* thunar/thunar-location-button.c, thunar/thunar-location-buttons.c:
+	  Properly clean up the path bar when a folder on the path bar is
+	  deleted.
+
+2006-11-04	Benedikt Meurer <benny at xfce.org>
+
 	* thunar/thunar-tree-model.c(thunar_tree_model_item_files_removed):
 	  The "row-has-child-toggled" signal must not be emitted if the
 	  children of the row did not change, otherwise newer GtkTreeView's

Modified: thunar/trunk/thunar/thunar-location-button.c
===================================================================
--- thunar/trunk/thunar/thunar-location-button.c	2006-11-04 00:13:40 UTC (rev 23625)
+++ thunar/trunk/thunar/thunar-location-button.c	2006-11-04 00:29:23 UTC (rev 23626)
@@ -50,6 +50,7 @@
 {
   CLICKED,
   CONTEXT_MENU,
+  GONE,
   LAST_SIGNAL,
 };
 
@@ -263,6 +264,21 @@
                   0, NULL, NULL,
                   g_cclosure_marshal_VOID__BOXED,
                   G_TYPE_NONE, 1, GDK_TYPE_EVENT);
+
+  /**
+   * ThunarLocationButton::gone:
+   * @location_button : a #ThunarLocationButton.
+   *
+   * Emitted by @location_button when the file associated with
+   * the button is deleted.
+   **/
+  location_button_signals[GONE] =
+    g_signal_new (I_("gone"),
+                  G_TYPE_FROM_CLASS (klass),
+                  G_SIGNAL_RUN_LAST,
+                  0, NULL, NULL,
+                  g_cclosure_marshal_VOID__VOID,
+                  G_TYPE_NONE, 0);
 }
 
 
@@ -509,8 +525,8 @@
   _thunar_return_if_fail (location_button->file == file);
   _thunar_return_if_fail (THUNAR_IS_FILE (file));
 
-  /* the file is gone, no need to keep the button around anymore */
-  gtk_widget_destroy (GTK_WIDGET (location_button));
+  /* the file is gone, emit the "gone" signal */
+  g_signal_emit (G_OBJECT (location_button), location_button_signals[GONE], 0);
 }
 
 

Modified: thunar/trunk/thunar/thunar-location-buttons.c
===================================================================
--- thunar/trunk/thunar/thunar-location-buttons.c	2006-11-04 00:13:40 UTC (rev 23625)
+++ thunar/trunk/thunar/thunar-location-buttons.c	2006-11-04 00:29:23 UTC (rev 23626)
@@ -112,6 +112,8 @@
 static void           thunar_location_buttons_context_menu              (ThunarLocationButton       *button,
                                                                          GdkEventButton             *event,
                                                                          ThunarLocationButtons      *buttons);
+static void           thunar_location_buttons_gone                      (ThunarLocationButton       *button,
+                                                                         ThunarLocationButtons      *buttons);
 static void           thunar_location_buttons_action_create_folder      (GtkAction                  *action,
                                                                          ThunarLocationButtons      *buttons);
 static void           thunar_location_buttons_action_down_folder        (GtkAction                  *action,
@@ -921,6 +923,7 @@
 
   /* connect signal handlers */
   g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (thunar_location_buttons_clicked), buttons);
+  g_signal_connect (G_OBJECT (button), "gone", G_CALLBACK (thunar_location_buttons_gone), buttons);
   g_signal_connect (G_OBJECT (button), "context-menu", G_CALLBACK (thunar_location_buttons_context_menu), buttons);
 
   return button;
@@ -1216,6 +1219,24 @@
 
 
 static void
+thunar_location_buttons_gone (ThunarLocationButton  *button,
+                              ThunarLocationButtons *buttons)
+{
+  _thunar_return_if_fail (THUNAR_IS_LOCATION_BUTTON (button));
+  _thunar_return_if_fail (THUNAR_IS_LOCATION_BUTTONS (buttons));
+  _thunar_return_if_fail (g_list_find (buttons->list, button) != NULL);
+
+  /* drop all buttons up to the button that emitted the "gone" signal */
+  while (buttons->list->data != button)
+    gtk_widget_destroy (buttons->list->data);
+
+  /* drop the button itself */
+  gtk_widget_destroy (GTK_WIDGET (button));
+}
+
+
+
+static void
 thunar_location_buttons_context_menu (ThunarLocationButton  *button,
                                       GdkEventButton        *event,
                                       ThunarLocationButtons *buttons)



More information about the Xfce4-commits mailing list