Re: gtktoolbar - packed with invisible widgets ...
- From: Michael Meeks <michael ximian com>
- To: Soeren Sandmann <sandmann daimi au dk>
- Cc: Gtk Hackers <gtk-devel-list gnome org>
- Subject: Re: gtktoolbar - packed with invisible widgets ...
- Date: Fri, 20 Feb 2004 16:33:59 +0000
On Fri, 2004-02-20 at 13:57, Soeren Sandmann wrote:
> So that's why GtkToggleToolItem has this in its "toggled" handlere:
Right;
> - have a ::notify default handler in GtkToolItem that checks
> if the "pspec->name" parameter is "sensitive" and if so,
> updates priv->menu_item (if non-NULL) accordingly.
>
> - in gtk_tool_item_set_proxy_menu_item() sets the sensitivity
> correctly.
How about the attached ? may I commit ?
Thanks,
Michael.
--
michael ximian com <><, Pseudo Engineer, itinerant idiot
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtk+/ChangeLog,v
retrieving revision 1.4969
diff -u -p -u -r1.4969 ChangeLog
--- ChangeLog 20 Feb 2004 16:20:18 -0000 1.4969
+++ ChangeLog 20 Feb 2004 16:41:47 -0000
@@ -1,5 +1,12 @@
2004-02-20 Michael Meeks <michael ximian com>
+ * gtk/gtktoolitem.c (gtk_tool_item_property_notify): impl.
+ (gtk_tool_item_class_init): hook it up.
+ (gtk_tool_item_set_proxy_menu_item): synchronize sensitivity.
+
+ * gtk/gtktoolbutton.c (gtk_tool_button_property_notify):
+ chain to parent.
+
* tests/testtoolbar.c (main): re-arrange widgets to allow
more overflowing toolbar goodness.
Index: gtk/gtktoolbutton.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktoolbutton.c,v
retrieving revision 1.16
diff -u -p -u -r1.16 gtktoolbutton.c
--- gtk/gtktoolbutton.c 24 Jan 2004 22:29:18 -0000 1.16
+++ gtk/gtktoolbutton.c 20 Feb 2004 16:41:48 -0000
@@ -444,6 +444,8 @@ gtk_tool_button_property_notify (GObject
{
if (strcmp (pspec->name, "is_important"))
gtk_tool_button_construct_contents (GTK_TOOL_ITEM (object));
+
+ parent_class->notify (object, pspec);
}
static void
Index: gtk/gtktoolitem.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktoolitem.c,v
retrieving revision 1.19
diff -u -p -u -r1.19 gtktoolitem.c
--- gtk/gtktoolitem.c 17 Jan 2004 11:58:24 -0000 1.19
+++ gtk/gtktoolitem.c 20 Feb 2004 16:41:48 -0000
@@ -76,6 +76,8 @@ static void gtk_tool_item_get_property (
guint prop_id,
GValue *value,
GParamSpec *pspec);
+static void gtk_tool_item_property_notify (GObject *object,
+ GParamSpec *pspec);
static void gtk_tool_item_realize (GtkWidget *widget);
static void gtk_tool_item_unrealize (GtkWidget *widget);
static void gtk_tool_item_map (GtkWidget *widget);
@@ -136,6 +138,7 @@ gtk_tool_item_class_init (GtkToolItemCla
object_class->set_property = gtk_tool_item_set_property;
object_class->get_property = gtk_tool_item_get_property;
object_class->finalize = gtk_tool_item_finalize;
+ object_class->notify = gtk_tool_item_property_notify;
widget_class->realize = gtk_tool_item_realize;
widget_class->unrealize = gtk_tool_item_unrealize;
@@ -338,6 +341,17 @@ gtk_tool_item_get_property (GObject *
}
static void
+gtk_tool_item_property_notify (GObject *object,
+ GParamSpec *pspec)
+{
+ GtkToolItem *tool_item = GTK_TOOL_ITEM (object);
+
+ if (tool_item->priv->menu_item && strcmp (pspec->name, "sensitive"))
+ gtk_widget_set_sensitive (tool_item->priv->menu_item,
+ GTK_WIDGET_SENSITIVE (tool_item));
+}
+
+static void
create_drag_window (GtkToolItem *toolitem)
{
GtkWidget *widget;
@@ -1059,6 +1073,9 @@ gtk_tool_item_set_proxy_menu_item (GtkTo
{
g_object_ref (menu_item);
gtk_object_sink (GTK_OBJECT (menu_item));
+
+ gtk_widget_set_sensitive (menu_item,
+ GTK_WIDGET_SENSITIVE (tool_item));
}
tool_item->priv->menu_item = menu_item;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]