bonobo toolbar separator patch



Here's an updated version of the patch I submitted a few hours ago with
another bug fix in it. Once again, my plan is to submit these tomorrow (or
maybe Monday morning) unless I hear otherwise.

John Sullivan

ChangeLog entry:
================

2000-03-17  John Sullivan  <sullivan@eazel.com>

    * bonobo/bonobo-uih-toolbar.c:
    (toolbar_toplevel_item_create_widgets): Check for NULL
    toolbar_item before reffing and adding to hash table.
    The separator case does not create a widget. Added comments
    explaining this and why it is bad (can't remove later).
    (toolbar_toplevel_item_set_sensitivity_internal): Handle
    the NULL toolbar_widget case, since it's legitimate when
    the item is a separator. Added explanatory comment.
    (bonobo_toplevel_set_sensitivity): Changed name to
    bonobo_toplevel_item_set_sensitivity; made it call
    toolbar_toplevel_get_item instead of toolbar_toplevel_get_toolbar
    and bonobo_toplevel_item_set_sensitivity_internal instead of
    bonobo_toplevel_set_sensitivity_internal. Maybe both functions
    are needed for a complete implementation, but there was only
    one caller to this function and it expected the item version.
    Obviously this code path had never been followed.

    * bonobo/bonobo-ui-handler.h:
    (bonobo_ui_handler_toolbar_get_orientation),
    (bonobo_ui_handler_toolbar_set_orientation): Eliminated
    duplicate prototypes.


Patch:
======


Index: bonobo/bonobo-ui-handler.h
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-ui-handler.h,v
retrieving revision 1.36
diff -u -r1.36 bonobo-ui-handler.h
--- bonobo/bonobo-ui-handler.h    2000/03/02 20:05:59    1.36
+++ bonobo/bonobo-ui-handler.h    2000/03/18 01:23:42
@@ -343,11 +343,6 @@
 void                 bonobo_ui_handler_remove_toolbar    (BonoboUIHandler
*uih, const char *name);
 GList                *bonobo_ui_handler_get_toolbar_list
(BonoboUIHandler *uih);
 
-void                 bonobo_ui_handler_toolbar_set_orientation
(BonoboUIHandler *uih, const char *path,
-                                       GtkOrientation orientation);
-GtkOrientation             bonobo_ui_handler_toolbar_get_orientation
(BonoboUIHandler *uih, const char *path);
-
-
 
 void                 bonobo_ui_handler_toolbar_new        (BonoboUIHandler
*uih, const char *path,
                                      BonoboUIHandlerToolbarItemType type,
Index: bonobo/bonobo-uih-toolbar.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-uih-toolbar.c,v
retrieving revision 1.6
diff -u -r1.6 bonobo-uih-toolbar.c
--- bonobo/bonobo-uih-toolbar.c    2000/03/08 00:28:23    1.6
+++ bonobo/bonobo-uih-toolbar.c    2000/03/18 01:23:48
@@ -1140,6 +1140,10 @@
         break;
 
     case BONOBO_UI_HANDLER_TOOLBAR_SEPARATOR:
+        /* No toolbar_item in this case because GtkToolbar doesn't create a
widget. */
+        /* FIXME: Is it OK that you can't remove this item because it has
no representing widget?
+         * That probably will cause havoc with removing the whole list of
toolbar items.
+         */
         gtk_toolbar_insert_space (GTK_TOOLBAR (toolbar),
internal->item->pos);
         break;
 
@@ -1197,9 +1201,12 @@
         return;
     }
 
-    /* FIXME: Connect to signals and gtk_widget_add_accelerator */
-        gtk_object_ref (GTK_OBJECT (toolbar_item));
-    g_hash_table_insert (uih->top->path_to_toolbar_item_widget, g_strdup
(internal->item->path), toolbar_item);
+    /* toolbar_item is legitimately (?) NULL in at least the
BONOBO_UI_HANDLER_TOOLBAR_SEPARATOR case. */
+    if (toolbar_item != NULL) {
+        /* FIXME: Connect to signals and gtk_widget_add_accelerator */
+            gtk_object_ref (GTK_OBJECT (toolbar_item));
+        g_hash_table_insert (uih->top->path_to_toolbar_item_widget,
g_strdup (internal->item->path), toolbar_item);
+    }
 }
 
 static void
@@ -1302,9 +1309,11 @@
         return;
 
     toolbar_widget = toolbar_toplevel_item_get_widget (uih,
internal->item->path);
-    g_return_if_fail (toolbar_widget != NULL);
 
-    gtk_widget_set_sensitive (toolbar_widget, sensitive);
+    if (toolbar_widget != NULL) {
+        /* toolbar_widget is legitimately (?) NULL in at least the
BONOBO_UI_HANDLER_TOOLBAR_SEPARATOR case. */
+        gtk_widget_set_sensitive (toolbar_widget, sensitive);
+    }
 }
 
 static void
@@ -2324,15 +2333,14 @@
 }
 
 static void
-toolbar_toplevel_set_sensitivity (BonoboUIHandler *uih, const char *name,
-                  gboolean sensitive)
+toolbar_toplevel_item_set_sensitivity (BonoboUIHandler *uih, const char
*path, gboolean sensitive)
 {
-    ToolbarToolbarInternal *internal;
+    ToolbarItemInternal *internal;
 
-    internal = toolbar_toplevel_get_toolbar (uih, name);
+    internal = toolbar_toplevel_get_item (uih, path);
     g_return_if_fail (internal != NULL);
 
-    toolbar_toplevel_set_sensitivity_internal (uih, internal, sensitive);
+    toolbar_toplevel_item_set_sensitivity_internal (uih, internal,
sensitive);
 }
 
 static gboolean
@@ -2377,7 +2385,7 @@
     if (uih->top_level_uih != CORBA_OBJECT_NIL)
         toolbar_item_remote_set_sensitivity (uih, path, sensitive);
     else
-        toolbar_toplevel_set_sensitivity (uih, path, sensitive);
+        toolbar_toplevel_item_set_sensitivity (uih, path, sensitive);
 }
 
 static gboolean



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