summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tvb@src.gnome.org>2007-07-23 18:29:02 +0000
committerTristan Van Berkom <tvb@src.gnome.org>2007-07-23 18:29:02 +0000
commit8c6dea6f006dbdc0f5f53d6a27a14fc99721a865 (patch)
treefee1594995d4fa95bfa096d847864afa9072a7d1
parent174a98bdf562bff813a646dde7e9e2d06d9902e7 (diff)
downloadglade-8c6dea6f006dbdc0f5f53d6a27a14fc99721a865.tar.gz
Added parent options in placeholder context menus.
* gladeui/glade-popup.c: Added parent options in placeholder context menus. svn path=/trunk/; revision=1501
-rw-r--r--ChangeLog2
-rw-r--r--gladeui/glade-popup.c55
2 files changed, 27 insertions, 30 deletions
diff --git a/ChangeLog b/ChangeLog
index fd9c7bd8..7ea8b380 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,8 @@
debugging property values in plugins: glade_widget_property_string(),
glade_widget_pack_property_string().
+ * gladeui/glade-popup.c: Added parent options in placeholder context menus.
+
* plugins/gtk+/glade-gtk.c, plugins/gtk+/gtk+.xml.in: Reset label/markup/use-underline
properties at realize time, this fixes load time glitches with markup
and mnemonics (bug 396446).
diff --git a/gladeui/glade-popup.c b/gladeui/glade-popup.c
index b1482233..abadc983 100644
--- a/gladeui/glade-popup.c
+++ b/gladeui/glade-popup.c
@@ -319,7 +319,9 @@ glade_popup_action_populate_menu (GtkWidget *menu,
}
static GtkWidget *
-glade_popup_create_menu (GladeWidget *widget, gboolean packing)
+glade_popup_create_menu (GladeWidget *widget,
+ GladePlaceholder *placeholder,
+ gboolean packing)
{
GtkWidget *popup_menu;
gboolean sensitive;
@@ -333,53 +335,43 @@ glade_popup_create_menu (GladeWidget *widget, gboolean packing)
glade_popup_append_item (popup_menu, GTK_STOCK_COPY, NULL, TRUE,
glade_popup_copy_cb, widget);
+ /* paste is placholder specific when the popup is on a placeholder */
sensitive = glade_clipboard_get_has_selection (glade_app_get_clipboard ());
- glade_popup_append_item (popup_menu, GTK_STOCK_PASTE, NULL, sensitive,
- glade_popup_paste_cb, widget);
+ if (placeholder)
+ glade_popup_append_item (popup_menu, GTK_STOCK_PASTE, NULL, sensitive,
+ glade_popup_placeholder_paste_cb, placeholder);
+ else
+ glade_popup_append_item (popup_menu, GTK_STOCK_PASTE, NULL, sensitive,
+ glade_popup_paste_cb, widget);
glade_popup_append_item (popup_menu, GTK_STOCK_DELETE, NULL, TRUE,
glade_popup_delete_cb, widget);
- if (widget->actions || (packing && widget->packing_actions))
+
+ /* packing actions are a little different on placholders */
+ if (placeholder && placeholder->packing_actions)
{
GtkWidget *separator = gtk_menu_item_new ();
gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), separator);
gtk_widget_show (separator);
- glade_popup_action_populate_menu (popup_menu, widget, NULL, packing);
+ glade_popup_action_populate_menu_real (popup_menu,
+ placeholder->packing_actions,
+ G_CALLBACK (glade_popup_menuitem_ph_packing_activated),
+ placeholder);
}
-
- return popup_menu;
-}
-
-static GtkWidget *
-glade_popup_create_placeholder_menu (GladePlaceholder *placeholder)
-{
- GtkWidget *popup_menu;
- gboolean sensitive;
-
- popup_menu = gtk_menu_new ();
-
- sensitive = glade_clipboard_get_has_selection (glade_app_get_clipboard ());
- glade_popup_append_item (popup_menu, GTK_STOCK_PASTE, NULL, sensitive,
- glade_popup_placeholder_paste_cb, placeholder);
-
- if (placeholder->packing_actions)
+ else if (widget->actions || (packing && widget->packing_actions))
{
GtkWidget *separator = gtk_menu_item_new ();
gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), separator);
gtk_widget_show (separator);
- glade_popup_action_populate_menu_real (popup_menu,
- placeholder->packing_actions,
- G_CALLBACK (glade_popup_menuitem_ph_packing_activated),
- placeholder);
+ glade_popup_action_populate_menu (popup_menu, widget, NULL, packing);
}
-
+
return popup_menu;
}
-
static GtkWidget *
glade_popup_create_clipboard_menu (GladeWidget *widget)
{
@@ -411,7 +403,7 @@ glade_popup_widget_pop (GladeWidget *widget,
g_return_if_fail (GLADE_IS_WIDGET (widget));
- popup_menu = glade_popup_create_menu (widget, packing);
+ popup_menu = glade_popup_create_menu (widget, NULL, packing);
if (event)
{
@@ -431,13 +423,16 @@ void
glade_popup_placeholder_pop (GladePlaceholder *placeholder,
GdkEventButton *event)
{
+ GladeWidget *widget;
GtkWidget *popup_menu;
gint button;
gint event_time;
g_return_if_fail (GLADE_IS_PLACEHOLDER (placeholder));
- popup_menu = glade_popup_create_placeholder_menu (placeholder);
+ widget = glade_placeholder_get_parent (placeholder);
+
+ popup_menu = glade_popup_create_menu (widget, placeholder, TRUE);
if (event)
{