Two more patches



tooltips.patch -
  Adds tooltips to all widgets on the toolbar (was a regression).
  Also corrects a bug where the zoom widget had no right-click menu.

entry.patch - 
  Makes the topics entry widget do the following on Enter:
    1. If a partial or complete topic name is currently input,
       expand it using the first available matching topic, if any.
    2. If no partial or complete topic name is currently input,
       press the default widget for the dialog (eg. Add or Close)

? lib/libephymisc_la-ephy-dbus.loT
Index: lib/egg/egg-editable-toolbar.c
===================================================================
RCS file: /cvs/gnome/epiphany/lib/egg/egg-editable-toolbar.c,v
retrieving revision 1.83
diff -u -d -r1.83 egg-editable-toolbar.c
--- lib/egg/egg-editable-toolbar.c	30 Jan 2006 22:34:39 -0000	1.83
+++ lib/egg/egg-editable-toolbar.c	1 Feb 2006 10:47:51 -0000
@@ -85,6 +85,7 @@
   guint edit_mode;
   gboolean save_hidden;
   GtkWidget *fixed_toolbar;
+  GtkTooltips *tooltips;
   
   GtkWidget *selected;
   GtkActionGroup *actions;
@@ -419,37 +420,90 @@
 }
 
 static void
-connect_widget_signals (GtkWidget *proxy, EggEditableToolbar *etoolbar)
+fetch_all_children (GtkWidget *widget, GPtrArray *children)
 {
-  if (GTK_IS_CONTAINER (proxy))
+  g_ptr_array_add (children, widget);
+  
+  if (GTK_IS_CONTAINER (widget))
     {
-       gtk_container_foreach (GTK_CONTAINER (proxy),
-                              (GtkCallback) connect_widget_signals,
-                              (gpointer) etoolbar);
+       gtk_container_forall (GTK_CONTAINER (widget),
+			     (GtkCallback) fetch_all_children,
+			     (gpointer) children);
     }
+}
 
-  if (GTK_IS_TOOL_ITEM (proxy))
+static void
+connect_signals (GtkWidget *proxy,
+		 EggEditableToolbar *etoolbar)
+{
+  GPtrArray *children = g_ptr_array_new ();
+  GtkWidget *widget;
+  gint i;
+  
+  fetch_all_children (proxy, children);
+  
+  for (i = 0; i < children->len; i++)
     {
-      g_signal_connect_object (proxy, "drag_begin",
-			       G_CALLBACK (drag_begin_cb), 
-			       etoolbar, 0);
-      g_signal_connect_object (proxy, "drag_end",
-			       G_CALLBACK (drag_end_cb),
-			       etoolbar, 0);
-      g_signal_connect_object (proxy, "drag_data_get",
-			       G_CALLBACK (drag_data_get_cb), 
-			       etoolbar, 0);
-      g_signal_connect_object (proxy, "drag_data_delete",
-			       G_CALLBACK (drag_data_delete_cb),
-			       etoolbar, 0);
+      widget = GTK_WIDGET (g_ptr_array_index (children, i));
+
+      if (GTK_IS_TOOL_ITEM (widget))
+        {
+	  g_signal_connect_object (widget, "drag_begin",
+				   G_CALLBACK (drag_begin_cb), 
+				   etoolbar, 0);
+	  g_signal_connect_object (widget, "drag_end",
+				   G_CALLBACK (drag_end_cb),
+				   etoolbar, 0);
+	  g_signal_connect_object (widget, "drag_data_get",
+				   G_CALLBACK (drag_data_get_cb), 
+				   etoolbar, 0);
+	  g_signal_connect_object (widget, "drag_data_delete",
+				   G_CALLBACK (drag_data_delete_cb),
+				   etoolbar, 0);
+	}
+      
+      if (GTK_IS_BUTTON (widget) || GTK_IS_TOOL_ITEM (widget))
+        {
+	  g_signal_connect_object (widget, "button-press-event",
+				   G_CALLBACK (button_press_event_cb),
+				   etoolbar, 0);
+	}
     }
-    
-  if (GTK_IS_BUTTON (proxy) || GTK_IS_TOOL_ITEM (proxy))
+  
+  g_ptr_array_free (children, TRUE);
+}
+
+static void
+connect_tooltip (GtkWidget *proxy,
+		 EggEditableToolbar *etoolbar)
+{
+  GtkTooltips *tooltips = etoolbar->priv->tooltips;
+  GPtrArray *children = g_ptr_array_new ();
+  
+  GtkWidget *widget;
+  GtkAction *action;
+  char *label, *tooltip;
+  gint i;
+
+  action = g_object_get_data (G_OBJECT (proxy), "gtk-action");
+  if (action == NULL) return;
+  g_object_get (action, "tooltip", &tooltip, "label", &label, NULL);  
+  
+  fetch_all_children (proxy, children);
+  
+  for (i = 0; i < children->len; i++)
     {
-      g_signal_connect_object (proxy, "button-press-event",
-			       G_CALLBACK (button_press_event_cb),
-			       etoolbar, 0);
+      widget = GTK_WIDGET (g_ptr_array_index (children, i));
+
+      if (GTK_IS_BUTTON (widget) || !GTK_WIDGET_NO_WINDOW (widget))
+        {
+	  gtk_tooltips_set_tip (tooltips, widget, tooltip, label);
+	}
     }
+  
+  g_ptr_array_free (children, TRUE);
+  g_free (label);
+  g_free (tooltip);
 }
 
 static void
@@ -513,7 +567,7 @@
 
   name = egg_toolbars_model_item_nth (etoolbar->priv->model, toolbar_position, position);
   item = create_item_from_action (etoolbar, name);
-
+  
   return item;
 }
 
@@ -1030,7 +1084,8 @@
     
   gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, ipos);
   
-  connect_widget_signals (GTK_WIDGET (item), etoolbar);
+  connect_signals (GTK_WIDGET (item), etoolbar);
+  connect_tooltip (GTK_WIDGET (item), etoolbar);
   configure_item_cursor (item, etoolbar);
   configure_item_sensitivity (item, etoolbar);
   
@@ -1098,7 +1153,8 @@
             {
 	      gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, l);
               
-              connect_widget_signals (GTK_WIDGET (item), etoolbar);
+              connect_signals (GTK_WIDGET (item), etoolbar);
+	      connect_tooltip (GTK_WIDGET (item), etoolbar);
               configure_item_sensitivity (item, etoolbar);
             }
           else
@@ -1202,6 +1258,8 @@
   priv = etoolbar->priv = EGG_EDITABLE_TOOLBAR_GET_PRIVATE (etoolbar);
 
   priv->save_hidden = TRUE;
+  priv->tooltips = gtk_tooltips_new ();
+  gtk_tooltips_enable (priv->tooltips);
 }
 
 static void

Attachment: entry.patch
Description: application/drivel



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