[Xfce4-commits] <thunar:nick/gtk3> Fixup some missing stuff.

Nick Schermer noreply at xfce.org
Tue May 15 20:16:01 CEST 2012


Updating branch refs/heads/nick/gtk3
         to a2fe7889b28e5029fe49996f1c7ea83a00d55761 (commit)
       from 4270285820363ac029fa0a2568b9dd146fd3f9cb (commit)

commit a2fe7889b28e5029fe49996f1c7ea83a00d55761
Author: Nick Schermer <nick at xfce.org>
Date:   Tue May 15 20:14:15 2012 +0200

    Fixup some missing stuff.

 thunar/thunar-abstract-icon-view.c |    4 ++--
 thunar/thunar-folder.c             |   34 ++++++++++++++++++++++++++++++++--
 thunar/thunar-folder.h             |    2 ++
 thunar/thunar-path-entry.c         |   15 ++++++---------
 thunar/thunar-standard-view.c      |    4 ++--
 5 files changed, 44 insertions(+), 15 deletions(-)

diff --git a/thunar/thunar-abstract-icon-view.c b/thunar/thunar-abstract-icon-view.c
index 50c8e2c..aa38b64 100644
--- a/thunar/thunar-abstract-icon-view.c
+++ b/thunar/thunar-abstract-icon-view.c
@@ -215,13 +215,13 @@ thunar_abstract_icon_view_init (ThunarAbstractIconView *abstract_icon_view)
   exo_icon_view_set_selection_mode (EXO_ICON_VIEW (view), GTK_SELECTION_MULTIPLE);
 
   /* add the abstract icon renderer */
-  g_object_set (G_OBJECT (THUNAR_STANDARD_VIEW (abstract_icon_view)->icon_renderer), "follow-state", TRUE, NULL);
+  /* TODO g_object_set (G_OBJECT (THUNAR_STANDARD_VIEW (abstract_icon_view)->icon_renderer), "follow-state", TRUE, NULL); */
   gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (view), THUNAR_STANDARD_VIEW (abstract_icon_view)->icon_renderer, FALSE);
   gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (view), THUNAR_STANDARD_VIEW (abstract_icon_view)->icon_renderer,
                                  "file", THUNAR_COLUMN_FILE);
 
   /* add the name renderer */
-  g_object_set (G_OBJECT (THUNAR_STANDARD_VIEW (abstract_icon_view)->name_renderer), "follow-state", TRUE, NULL);
+  /* TODO g_object_set (G_OBJECT (THUNAR_STANDARD_VIEW (abstract_icon_view)->name_renderer), "follow-state", TRUE, NULL); */
   gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (view), THUNAR_STANDARD_VIEW (abstract_icon_view)->name_renderer, TRUE);
   gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (view), THUNAR_STANDARD_VIEW (abstract_icon_view)->name_renderer,
                                  "text", THUNAR_COLUMN_NAME);
diff --git a/thunar/thunar-folder.c b/thunar/thunar-folder.c
index 5f24bb4..6b447bf 100644
--- a/thunar/thunar-folder.c
+++ b/thunar/thunar-folder.c
@@ -44,6 +44,7 @@ enum
 /* signal identifiers */
 enum
 {
+  DESTROY,
   ERROR,
   FILES_ADDED,
   FILES_REMOVED,
@@ -88,6 +89,7 @@ struct _ThunarFolderClass
   GObjectClass __parent__;
 
   /* signals */
+  void (*destroy)       (ThunarFolder *folder);
   void (*error)         (ThunarFolder *folder,
                          const GError *error);
   void (*files_added)   (ThunarFolder *folder,
@@ -160,6 +162,20 @@ thunar_folder_class_init (ThunarFolderClass *klass)
                                                          "loading",
                                                          FALSE,
                                                          EXO_PARAM_READABLE));
+  /**
+   * ThunarFolder::destroy:
+   * @folder : a #ThunarFolder.
+   *
+   * Emitted when the #ThunarFolder is destroyed.
+   **/
+  folder_signals[DESTROY] =
+    g_signal_new (I_("destroy"),
+                  G_TYPE_FROM_CLASS (gobject_class),
+                  G_SIGNAL_RUN_LAST,
+                  G_STRUCT_OFFSET (ThunarFolderClass, destroy),
+                  NULL, NULL,
+                  g_cclosure_marshal_VOID__VOID,
+                  G_TYPE_NONE, 0);
 
   /**
    * ThunarFolder::error:
@@ -491,7 +507,7 @@ thunar_folder_file_destroyed (ThunarFileMonitor *file_monitor,
   if (G_UNLIKELY (folder->corresponding_file == file))
     {
       /* the folder is useless now */
-      g_object_unref (G_OBJECT (folder));
+      thunar_folder_destroy (folder);
     }
   else
     {
@@ -792,4 +808,18 @@ thunar_folder_reload (ThunarFolder *folder)
 
 
 
-
+/**
+ * thunar_folder_destroy:
+ * @folder : a #ThunarFolder instance.
+ *
+ * Destroy the @folder, this is a replacement for
+ * the old GtkObject:destroy signal which was been
+ * removed in gtk3.
+ **/
+void
+thunar_folder_destroy (ThunarFolder *folder)
+{
+  _thunar_return_if_fail (THUNAR_IS_FOLDER (folder));
+  g_signal_emit (G_OBJECT (folder), folder_signals[DESTROY], 0);
+  g_object_unref (G_OBJECT (folder));
+}
diff --git a/thunar/thunar-folder.h b/thunar/thunar-folder.h
index a111b62..2d9c465 100644
--- a/thunar/thunar-folder.h
+++ b/thunar/thunar-folder.h
@@ -44,6 +44,8 @@ gboolean      thunar_folder_get_loading            (const ThunarFolder *folder);
 
 void          thunar_folder_reload                 (ThunarFolder       *folder);
 
+void          thunar_folder_destroy                (ThunarFolder       *folder);
+
 G_END_DECLS;
 
 #endif /* !__THUNAR_FOLDER_H__ */
diff --git a/thunar/thunar-path-entry.c b/thunar/thunar-path-entry.c
index ad935e9..a6ec868 100644
--- a/thunar/thunar-path-entry.c
+++ b/thunar/thunar-path-entry.c
@@ -239,7 +239,7 @@ thunar_path_entry_editable_init (GtkEditableInterface *iface)
   thunar_path_entry_editable_parent_iface = iface;
 
   iface->changed = thunar_path_entry_changed;
-  iface->do_insert_text = thunar_path_entry_do_insert_text;
+  if(0)iface->do_insert_text = thunar_path_entry_do_insert_text;
 }
 
 
@@ -869,7 +869,7 @@ thunar_path_entry_changed (GtkEditable *editable)
 
       /* cleanup */
       if (G_LIKELY (folder != NULL))
-        g_object_unref (G_OBJECT (folder));
+        thunar_folder_destroy (folder);
     }
 
   /* update the current file if required */
@@ -960,19 +960,16 @@ thunar_path_entry_get_text_area_size (ThunarPathEntry *path_entry,
                                       gint            *width,
                                       gint            *height)
 {
-  GtkRequisition requisition;
-  GtkWidget     *widget = GTK_WIDGET (path_entry);
-  gint           xborder;
-  gint           yborder;
-
-  gtk_widget_get_preferred_size (widget, &requisition, NULL);
+  GtkWidget *widget = GTK_WIDGET (path_entry);
+  gint       xborder;
+  gint       yborder;
 
   thunar_path_entry_get_borders (path_entry, &xborder, &yborder);
 
   if (x != NULL) *x = xborder;
   if (y != NULL) *y = yborder;
   if (width  != NULL) *width  = gtk_widget_get_allocated_width (widget) - xborder * 2;
-  if (height != NULL) *height = requisition.height - yborder * 2;
+  if (height != NULL) *height = gtk_widget_get_allocated_height (widget) - yborder * 2;
 }
 
 
diff --git a/thunar/thunar-standard-view.c b/thunar/thunar-standard-view.c
index bfd324e..54fe1c9 100644
--- a/thunar/thunar-standard-view.c
+++ b/thunar/thunar-standard-view.c
@@ -1210,7 +1210,7 @@ thunar_standard_view_set_current_directory (ThunarNavigator *navigator,
 
   /* apply the new folder */
   thunar_list_model_set_folder (standard_view->model, folder);
-  g_object_unref (G_OBJECT (folder));
+  thunar_folder_destroy (folder);
 
   /* reconnect our model to the view */
   g_object_set (G_OBJECT (child), "model", standard_view->model, NULL);
@@ -2747,7 +2747,7 @@ thunar_standard_view_drag_data_received (GtkWidget          *view,
                       /* reload the folder corresponding to the file */
                       folder = thunar_folder_get_for_file (file);
                       thunar_folder_reload (folder);
-                      g_object_unref (G_OBJECT (folder));
+                      thunar_folder_destroy (folder);
                     }
 
                   /* cleanup */


More information about the Xfce4-commits mailing list