[patch] [bug 458284] port to new tooltips API



Hi;

the patch (attached; from bug
http://bugzilla.gnome.org/show_bug.cgi?id=458284 ) ports nautilus to the
new gtk 2.11 tooltips API. Ok to commit ?

Regards,
	Christian

Index: src/nautilus-side-pane.c
===================================================================
--- src/nautilus-side-pane.c	(révision 13002)
+++ src/nautilus-side-pane.c	(copie de travail)
@@ -36,7 +36,6 @@
 #include <gtk/gtkimagemenuitem.h>
 #include <gtk/gtknotebook.h>
 #include <gtk/gtkstock.h>
-#include <gtk/gtktooltips.h>
 #include <gtk/gtktogglebutton.h>
 #include <glib/gi18n.h>
 
@@ -56,14 +55,13 @@ struct _NautilusSidePaneDetails {
 	GtkWidget *title_hbox;
 	GtkWidget *title_label;
 	GtkWidget *shortcut_box;
-	GtkTooltips *tooltips;
 	GList *panels;
 };
 
-static void nautilus_side_pane_class_init (GtkObjectClass *object_klass);
-static void nautilus_side_pane_init       (GtkObject      *object);
-static void nautilus_side_pane_destroy    (GtkObject      *object);
-static void nautilus_side_pane_finalize   (GObject        *object);
+static void nautilus_side_pane_class_init (NautilusSidePaneClass *klass);
+static void nautilus_side_pane_init       (GObject *object);
+static void nautilus_side_pane_dispose    (GObject *object);
+static void nautilus_side_pane_finalize   (GObject *object);
 
 enum {
 	CLOSE_REQUESTED,
@@ -96,7 +94,7 @@ side_panel_free (SidePanel *panel)
 {
 	g_free (panel->title);
 	g_free (panel->tooltip);
-	g_free (panel);
+	g_slice_free (SidePanel, panel);
 }
 
 static void
@@ -162,24 +160,21 @@ nautilus_side_pane_size_allocate (GtkWid
 
 /* initializing the class object by installing the operations we override */
 static void
-nautilus_side_pane_class_init (GtkObjectClass *object_klass)
+nautilus_side_pane_class_init (NautilusSidePaneClass *klass)
 {
-	GtkWidgetClass *widget_class;
 	GObjectClass *gobject_class;
-	
-	NautilusSidePaneClass *klass;
-	
-	widget_class = GTK_WIDGET_CLASS (object_klass);
-	klass = NAUTILUS_SIDE_PANE_CLASS (object_klass);
-	gobject_class = G_OBJECT_CLASS (object_klass);
+	GtkWidgetClass *widget_class;
+
+	gobject_class = G_OBJECT_CLASS (klass);
+	widget_class = GTK_WIDGET_CLASS (klass);
 	
 	gobject_class->finalize = nautilus_side_pane_finalize;
-	object_klass->destroy = nautilus_side_pane_destroy;
+	gobject_class->dispose = nautilus_side_pane_dispose;
 	widget_class->size_allocate = nautilus_side_pane_size_allocate;
 
 	signals[CLOSE_REQUESTED] = g_signal_new
 		("close_requested",
-		 G_TYPE_FROM_CLASS (object_klass),
+		 G_TYPE_FROM_CLASS (klass),
 		 G_SIGNAL_RUN_LAST,
 		 G_STRUCT_OFFSET (NautilusSidePaneClass,
 				  close_requested),
@@ -188,13 +183,15 @@ nautilus_side_pane_class_init (GtkObject
 		 G_TYPE_NONE, 0);
 	signals[SWITCH_PAGE] = g_signal_new
 		("switch_page",
-		 G_TYPE_FROM_CLASS (object_klass),
+		 G_TYPE_FROM_CLASS (klass),
 		 G_SIGNAL_RUN_LAST,
 		 G_STRUCT_OFFSET (NautilusSidePaneClass,
 				  switch_page),
 		 NULL, NULL,
 		 g_cclosure_marshal_VOID__OBJECT,
 		 G_TYPE_NONE, 1, GTK_TYPE_WIDGET);
+
+	g_type_class_add_private (gobject_class, sizeof (NautilusSidePaneDetails));
 }
 
 static void
@@ -313,7 +310,7 @@ menu_detach_callback (GtkWidget *widget,
 }
 
 static void
-nautilus_side_pane_init (GtkObject *object)
+nautilus_side_pane_init (GObject *object)
 {
 	NautilusSidePane *side_pane;
 	GtkWidget *frame;
@@ -326,7 +323,7 @@ nautilus_side_pane_init (GtkObject *obje
 
 	side_pane = NAUTILUS_SIDE_PANE (object);
 
-	side_pane->details = g_new0 (NautilusSidePaneDetails, 1);
+	side_pane->details = G_TYPE_INSTANCE_GET_PRIVATE (object, NAUTILUS_TYPE_SIDE_PANE, NautilusSidePaneDetails);
 
 	frame = gtk_frame_new (NULL);
 	side_pane->details->title_frame = frame;
@@ -419,16 +416,12 @@ nautilus_side_pane_init (GtkObject *obje
 	
 	gtk_widget_show (side_pane->details->menu);
 
-	side_pane->details->tooltips = gtk_tooltips_new ();
-	g_object_ref (side_pane->details->tooltips);
-	gtk_object_sink (GTK_OBJECT (side_pane->details->tooltips));
-
-	gtk_tooltips_set_tip (side_pane->details->tooltips, close_button,
-			      _("Close the side pane"), NULL);
+	gtk_widget_set_tooltip_text (close_button,
+				     _("Close the side pane"));
 }
 
 static void
-nautilus_side_pane_destroy (GtkObject *object)
+nautilus_side_pane_dispose (GObject *object)
 {
 	NautilusSidePane *side_pane;
 
@@ -439,12 +432,7 @@ nautilus_side_pane_destroy (GtkObject *o
 		side_pane->details->menu = NULL;
 	}
 
-	if (side_pane->details->tooltips) {
-		g_object_unref (side_pane->details->tooltips);
-		side_pane->details->tooltips = NULL;
-	}
-
-	EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
+	EEL_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
 }
 
 static void
@@ -461,8 +449,6 @@ nautilus_side_pane_finalize (GObject *ob
 
 	g_list_free (side_pane->details->panels);
 
-	g_free (side_pane->details);
-	
 	EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
 }
 
@@ -487,7 +473,7 @@ nautilus_side_pane_add_panel (NautilusSi
 	g_return_if_fail (title != NULL);
 	g_return_if_fail (tooltip != NULL);
 
-	panel = g_new0 (SidePanel, 1);
+	panel = g_slice_new0 (SidePanel);
 	panel->title = g_strdup (title);
 	panel->tooltip = g_strdup (tooltip);
 	panel->widget = widget;
@@ -597,7 +583,7 @@ create_shortcut (NautilusSidePane *side_
 	g_signal_connect (button, "clicked", 
 			  G_CALLBACK (shortcut_clicked_callback), side_pane);
 
-	gtk_tooltips_set_tip (side_pane->details->tooltips, button, panel->tooltip, NULL);
+	gtk_widget_set_tooltip_text (button, panel->tooltip);
 
 	image = gtk_image_new_from_pixbuf (pixbuf);
 	gtk_widget_show (image);
Index: src/nautilus-navigation-window.c
===================================================================
--- src/nautilus-navigation-window.c	(révision 13002)
+++ src/nautilus-navigation-window.c	(copie de travail)
@@ -182,8 +181,8 @@ location_button_create (NautilusNavigati
 			       "active", location_button_should_be_active (window),
 			       NULL);
 
-	gtk_tooltips_set_tip (window->details->tooltips, button,
-			      _("Toggle between button and text-based location bar"), NULL);
+	gtk_widget_set_tooltip_text (button,
+				     _("Toggle between button and text-based location bar"));
 
 	g_signal_connect (button, "toggled",
 			  G_CALLBACK (location_button_toggled_cb), window);
@@ -199,12 +198,8 @@ nautilus_navigation_window_init (Nautilu
 	GtkWidget *view_as_menu_vbox;
 	GtkToolItem *item;
 	GtkWidget *hbox, *vbox, *eventbox, *extras_vbox;
-	
-	window->details = g_new0 (NautilusNavigationWindowDetails, 1);
 
-	window->details->tooltips = gtk_tooltips_new ();
-	g_object_ref (window->details->tooltips);
-	gtk_object_sink (GTK_OBJECT (window->details->tooltips));
+	window->details = G_TYPE_INSTANCE_GET_PRIVATE (window, NAUTILUS_TYPE_NAVIGATION_WINDOW, NautilusNavigationWindowDetails);
 
 	window->details->content_paned = nautilus_horizontal_splitter_new ();
 	gtk_table_attach (GTK_TABLE (NAUTILUS_WINDOW (window)->details->table),
@@ -696,11 +691,6 @@ nautilus_navigation_window_destroy (GtkO
 
 	window->details->content_paned = NULL;
 
-	if (window->details->tooltips) {
-		g_object_unref (window->details->tooltips);
-		window->details->tooltips = NULL;
-	}
-	
 	GTK_OBJECT_CLASS (parent_class)->destroy (object);
 }
 
@@ -715,8 +705,6 @@ nautilus_navigation_window_finalize (GOb
 	nautilus_navigation_window_clear_back_list (window);
 	nautilus_navigation_window_clear_forward_list (window);
 
- 	g_free (window->details);
-
 	G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
@@ -1591,4 +1581,6 @@ nautilus_navigation_window_class_init (N
 	NAUTILUS_WINDOW_CLASS (class)->get_icon_name = real_get_icon_name;
 	NAUTILUS_WINDOW_CLASS (class)->get_default_size = real_get_default_size;
 	NAUTILUS_WINDOW_CLASS (class)->close = real_window_close;
+
+	g_type_class_add_private (G_OBJECT_CLASS (class), sizeof (NautilusNavigationWindowDetails));
 }
Index: src/nautilus-window-private.h
===================================================================
--- src/nautilus-window-private.h	(révision 13002)
+++ src/nautilus-window-private.h	(copie de travail)
@@ -123,7 +123,6 @@ struct _NautilusNavigationWindowDetails 
         
         /* Toolbar */
         GtkWidget *toolbar;
-        GtkTooltips *tooltips;
         GtkWidget *location_bar;
 
         guint extensions_toolbar_merge_id;
Index: src/nautilus-navigation-window.h
===================================================================
--- src/nautilus-navigation-window.h	(révision 13002)
+++ src/nautilus-navigation-window.h	(copie de travail)
@@ -72,8 +72,6 @@ struct _NautilusNavigationWindow {
         
         /* Widgets to keep track of (for state changes, etc) */      
         GtkWidget *zoom_control;
-
-	GtkTooltips *tooltips;
 };
 
 
Index: src/nautilus-query-editor.c
===================================================================
--- src/nautilus-query-editor.c	(révision 13002)
+++ src/nautilus-query-editor.c	(copie de travail)
@@ -45,7 +45,6 @@
 #include "gtk/gtkscrolledwindow.h"
 #include <gtk/gtkfilechooserbutton.h>
 #include "gtk/gtkcelllayout.h"
-#include "gtk/gtktooltips.h"
 #include "gtk/gtkcellrenderertext.h"
 #include <libgnomevfs/gnome-vfs-utils.h>
 #include <libgnomevfs/gnome-vfs-mime-info.h>
@@ -87,7 +86,6 @@ struct NautilusQueryEditorDetails {
 	gboolean is_visible;
 	GtkWidget *invisible_vbox;
 	GtkWidget *visible_vbox;
-	GtkTooltips *tooltips;
 
 	GList *rows;
 	
@@ -179,11 +177,6 @@ nautilus_query_editor_dispose (GObject *
 		eel_remove_weak_pointer (&editor->details->bar);
 	}
 
-	if (editor->details->tooltips) {
-		g_object_unref (editor->details->tooltips);
-		editor->details->tooltips = NULL;
-	}
-	
 	EEL_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
 }
 
@@ -931,9 +924,8 @@ nautilus_query_editor_add_row (NautilusQ
 
 	g_signal_connect (button, "clicked",
 			  G_CALLBACK (remove_row_cb), row);
-
-	gtk_tooltips_set_tip (editor->details->tooltips, button,
-			      _("Remove this criterion from the search"), NULL);
+	gtk_widget_set_tooltip_text (button,
+				     _("Remove this criterion from the search"));
 	
 	gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
 
@@ -991,12 +983,8 @@ nautilus_query_editor_init (NautilusQuer
 	g_signal_connect (button, "clicked",
 			  G_CALLBACK (edit_clicked), editor);
 
-	editor->details->tooltips = gtk_tooltips_new ();
-	g_object_ref (editor->details->tooltips);
-	gtk_object_sink (GTK_OBJECT (editor->details->tooltips));
-
-	gtk_tooltips_set_tip (editor->details->tooltips, button,
-			      _("Edit the saved search"), NULL);
+	gtk_widget_set_tooltip_text (button,
+				     _("Edit the saved search"));
 }
 
 void
@@ -1026,8 +1014,8 @@ finish_first_line (NautilusQueryEditor *
 	
 	gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
 
-	gtk_tooltips_set_tip (editor->details->tooltips, button,
-			      _("Add a new criterion to this search"), NULL);
+	gtk_widget_set_tooltip_text (button,
+				     _("Add a new criterion to this search"));
 
 	if (!editor->details->is_indexed) {
 		if (use_go) {
@@ -1036,9 +1024,9 @@ finish_first_line (NautilusQueryEditor *
 			button = gtk_button_new_with_label (_("Reload"));
 		}
 		gtk_widget_show (button);
-		
-		gtk_tooltips_set_tip (editor->details->tooltips, button,
-				      _("Perform or update the search"), NULL);
+
+		gtk_widget_set_tooltip_text (button,
+					     _("Perform or update the search"));
 		
 		g_signal_connect (button, "clicked",
 				  G_CALLBACK (go_search_cb), editor);
Index: src/nautilus-trash-bar.c
===================================================================
--- src/nautilus-trash-bar.c	(révision 13002)
+++ src/nautilus-trash-bar.c	(copie de travail)
@@ -33,7 +33,6 @@
 
 struct NautilusTrashBarPrivate
 {
-	GtkTooltips *tooltips;
 	GtkWidget   *button;
 };
 
@@ -74,20 +73,6 @@ nautilus_trash_bar_get_property (GObject
 }
 
 static void
-nautilus_trash_bar_finalize (GObject *object)
-{
-	NautilusTrashBar *bar;
-
-	bar = NAUTILUS_TRASH_BAR (object);
-
-	if (bar->priv->tooltips != NULL) {
-		g_object_unref (bar->priv->tooltips);
-	}
-
-	G_OBJECT_CLASS (nautilus_trash_bar_parent_class)->finalize (object);
-}
-
-static void
 nautilus_trash_bar_trash_state_changed (NautilusTrashMonitor *trash_monitor,
 					gboolean              state,
 					gpointer              data)
@@ -107,7 +92,6 @@ nautilus_trash_bar_class_init (NautilusT
 
 	object_class = G_OBJECT_CLASS (klass);
 
-	object_class->finalize     = nautilus_trash_bar_finalize;
 	object_class->get_property = nautilus_trash_bar_get_property;
 	object_class->set_property = nautilus_trash_bar_set_property;
 
@@ -144,14 +128,8 @@ nautilus_trash_bar_init (NautilusTrashBa
 
 	gtk_widget_set_sensitive (bar->priv->button,
 				  !nautilus_trash_monitor_is_empty ());
-
-	bar->priv->tooltips = gtk_tooltips_new ();
-	g_object_ref_sink (bar->priv->tooltips);
-
-	gtk_tooltips_set_tip (GTK_TOOLTIPS (bar->priv->tooltips),
-			      bar->priv->button,
-			      _("Delete all items in the Trash"),
-			      NULL);
+	gtk_widget_set_tooltip_text (bar->priv->button,
+				     _("Delete all items in the Trash"));
 
 	g_signal_connect (bar->priv->button,
 			  "clicked",
Index: configure.in
===================================================================
--- configure.in	(révision 13002)
+++ configure.in	(copie de travail)
@@ -14,7 +14,7 @@ m4_define(gnome_ui_minver,             2
 m4_define(gnome_vfs_minver,            2.14.2)
 m4_define(orbit_minver,                2.4.0)
 m4_define(pango_minver,                1.1.2)
-m4_define(gtk_minver,                  2.10.0)
+m4_define(gtk_minver,                  2.11.6)
 m4_define(rsvg_minver,                 2.0.1)
 m4_define(xml_minver,                  2.4.7)
 m4_define(startup_notification_minver, 0.8)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]