Index: eggdropdowntoolbutton.c
===================================================================
RCS file: /cvs/gnome/libegg/libegg/dropdowntoolbutton/eggdropdowntoolbutton.c,v
retrieving revision 1.10
diff -u -p -r1.10 eggdropdowntoolbutton.c
--- eggdropdowntoolbutton.c	16 Sep 2004 14:29:19 -0000	1.10
+++ eggdropdowntoolbutton.c	25 Sep 2004 18:27:47 -0000
@@ -24,6 +24,8 @@
 
 #include "eggdropdowntoolbutton.h"
 
+#include <glib/gi18n.h>
+#include <gtk/gtkwidget.h>
 #include <gtk/gtktogglebutton.h>
 #include <gtk/gtkarrow.h>
 #include <gtk/gtkhbox.h>
@@ -48,12 +50,19 @@ static void egg_dropdown_tool_button_ini
 static void egg_dropdown_tool_button_class_init (EggDropdownToolButtonClass *klass);
 static void egg_dropdown_tool_button_finalize   (GObject *object);
 
-
-enum {
+enum
+{
   MENU_ACTIVATED,
   LAST_SIGNAL
 };
 
+enum
+{
+  PROP_0,
+  PROP_MENU,
+  LAST_PROP
+};
+
 static gint signals[LAST_SIGNAL];
 
 static GObjectClass *parent_class = NULL;
@@ -169,6 +178,46 @@ egg_dropdown_tool_button_toolbar_reconfi
 }
 
 static void
+egg_dropdown_tool_button_set_property (GObject      *object,
+                                       guint         prop_id,
+                                       const GValue *value,
+                                       GParamSpec   *pspec)
+{
+  EggDropdownToolButton *button = EGG_DROPDOWN_TOOL_BUTTON (object);
+
+  switch (prop_id)
+    {
+    case PROP_MENU:
+      egg_dropdown_tool_button_set_menu (button, g_value_get_object (value));
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+egg_dropdown_tool_button_get_property (GObject    *object,
+                                       guint       prop_id,
+                                       GValue     *value,
+                                       GParamSpec *pspec)
+{
+  EggDropdownToolButton *button = EGG_DROPDOWN_TOOL_BUTTON (object);
+
+  switch (prop_id)
+    {
+    case PROP_MENU:
+      g_value_set_object (value, button->priv->menu);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
 egg_dropdown_tool_button_class_init (EggDropdownToolButtonClass *klass)
 {
   GObjectClass *object_class;
@@ -181,6 +230,8 @@ egg_dropdown_tool_button_class_init (Egg
   toolitem_class = (GtkToolItemClass *)klass;
   toolbutton_class = (GtkToolButtonClass *)klass;
 
+  object_class->set_property = egg_dropdown_tool_button_set_property;
+  object_class->get_property = egg_dropdown_tool_button_get_property;
   object_class->finalize = egg_dropdown_tool_button_finalize;
   toolitem_class->set_tooltip = egg_dropdown_tool_button_set_tooltip;
   toolitem_class->toolbar_reconfigured = egg_dropdown_tool_button_toolbar_reconfigured;
@@ -194,6 +245,14 @@ egg_dropdown_tool_button_class_init (Egg
 		  g_cclosure_marshal_VOID__VOID,
 		  G_TYPE_NONE, 0);
 
+  g_object_class_install_property (object_class,
+                                   PROP_MENU,
+                                   g_param_spec_object ("menu",
+                                                        _("Menu"),
+                                                        _("The dropdown menu"),
+                                                        GTK_TYPE_MENU,
+                                                        G_PARAM_READABLE | G_PARAM_WRITABLE));
+
   g_type_class_add_private (object_class, sizeof (EggDropdownToolButtonPrivate));
 }
 
@@ -483,6 +542,7 @@ menu_deactivate_cb (GtkMenuShell        
  * @menu: the #GtkMenu associated with #EggDropdownToolButton
  *
  * Sets the #GtkMenu that is popped up when the user clicks on the arrow.
+ * If @menu is NULL, the arrow button becomes insensitive.
  *
  * Since:
  **/
@@ -493,10 +553,21 @@ egg_dropdown_tool_button_set_menu (EggDr
   EggDropdownToolButtonPrivate *priv;
 
   g_return_if_fail (EGG_IS_DROPDOWN_TOOL_BUTTON (button));
-  g_return_if_fail (GTK_IS_MENU (menu));
+  g_return_if_fail (GTK_IS_MENU (menu) || menu == NULL);
 
   priv = button->priv;
 
+  if (menu == NULL)
+    {
+      if (priv->menu)
+        g_object_unref (priv->menu);
+
+      priv->menu = NULL;
+      gtk_widget_set_sensitive (priv->arrow_button, FALSE);
+
+      return;
+    }
+
   if (priv->menu != GTK_MENU (menu))
     {
       if (priv->menu)
@@ -504,12 +575,16 @@ egg_dropdown_tool_button_set_menu (EggDr
 
       priv->menu = GTK_MENU (menu);
 
+      gtk_widget_set_sensitive (priv->arrow_button, TRUE);
+
       g_object_ref (priv->menu);
       gtk_object_sink (GTK_OBJECT (priv->menu));
 
       g_signal_connect (button->priv->menu, "deactivate",
                         G_CALLBACK (menu_deactivate_cb), button);
     }
+
+  g_object_notify (G_OBJECT (button), "menu");
 }
 
 /**
