diff options
author | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2011-01-05 18:47:11 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2011-01-05 18:47:11 +0900 |
commit | 0b47674c655bb089991da2ad4ba1832b543c1782 (patch) | |
tree | 48d84b7a549b1f4d48c98608831e5d717748aaf8 /src | |
parent | 0523a44db9680a39fed35f02b832201f237488e5 (diff) | |
download | glade-0b47674c655bb089991da2ad4ba1832b543c1782.tar.gz |
* gladeui/glade-widget-action.[ch], gladeui/glade-widget-adaptor.c, gladeui/glade-widget.[ch],
gladeui/glade-popup.c, plugins/gtk+/glade-gtk.c, src/glade-window.c:
- Privatized members of GladeWidgetAction
- Created glade_widget_action_class_new() and some accessors for better code in
the adaptor
- GWActionClass is now on the slice allocator
- Added glade_widget_action_set/get_visible()
- Removed glade_widget_remove[_pack]_action()
- Plugin makes actions invisible instead of removing them
- Everything updated for new sealed api
Diffstat (limited to 'src')
-rw-r--r-- | src/glade-window.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/src/glade-window.c b/src/glade-window.c index 65e6eee8..2b26fefd 100644 --- a/src/glade-window.c +++ b/src/glade-window.c @@ -363,19 +363,20 @@ create_recent_chooser_menu (GladeWindow * window, GtkRecentManager * manager) static void activate_action (GtkToolButton * toolbutton, GladeWidgetAction * action) { - GladeWidget *widget; + GladeWidget *widget; + GWActionClass *aclass = glade_widget_action_get_class (action); if ((widget = g_object_get_data (G_OBJECT (toolbutton), "glade-widget"))) glade_widget_adaptor_action_activate (glade_widget_get_adaptor (widget), glade_widget_get_object (widget), - action->klass->path); + aclass->path); } static void action_notify_sensitive (GObject * gobject, GParamSpec * arg1, GtkWidget * item) { GladeWidgetAction *action = GLADE_WIDGET_ACTION (gobject); - gtk_widget_set_sensitive (item, action->sensitive); + gtk_widget_set_sensitive (item, glade_widget_action_get_sensitive (action)); } static void @@ -417,23 +418,23 @@ add_actions (GladeWindow * window, GladeWidget * widget, GList * actions) for (l = actions; l; l = g_list_next (l)) { - GladeWidgetAction *a = l->data; + GladeWidgetAction *action = l->data; + GWActionClass *aclass = glade_widget_action_get_class (action); - if (!a->klass->important) + if (!aclass->important || !glade_widget_action_get_visible (action)) continue; - if (a->actions) + if (glade_widget_action_get_children (action)) { - g_warning - ("Trying to add a group action to the toolbar is unsupported"); + g_warning ("Trying to add a group action to the toolbar is unsupported"); continue; } - item = gtk_tool_button_new_from_stock ((a->klass->stock) ? a->klass->stock : "gtk-execute"); - if (a->klass->label) + item = gtk_tool_button_new_from_stock ((aclass->stock) ? aclass->stock : "gtk-execute"); + if (aclass->label) { - gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), a->klass->label); - gtk_widget_set_tooltip_text (GTK_WIDGET (item), a->klass->label); + gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), aclass->label); + gtk_widget_set_tooltip_text (GTK_WIDGET (item), aclass->label); } g_object_set_data (G_OBJECT (item), "glade-widget", widget); @@ -444,11 +445,12 @@ add_actions (GladeWindow * window, GladeWidget * widget, GList * actions) */ g_signal_connect_data (item, "clicked", G_CALLBACK (activate_action), - a, action_disconnect, 0); + action, action_disconnect, 0); - gtk_widget_set_sensitive (GTK_WIDGET (item), a->sensitive); + gtk_widget_set_sensitive (GTK_WIDGET (item), + glade_widget_action_get_sensitive (action)); - g_signal_connect (a, "notify::sensitive", + g_signal_connect (action, "notify::sensitive", G_CALLBACK (activate_action), GTK_WIDGET (item)); gtk_toolbar_insert (bar, item, -1); |