[totem] main: Make it possible to add GMenu items from plugins
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem] main: Make it possible to add GMenu items from plugins
- Date: Wed, 8 May 2013 10:37:07 +0000 (UTC)
commit 254e5908700175c6792e3a2d98b6227ab0e92b65
Author: Bastien Nocera <hadess hadess net>
Date: Tue May 7 19:00:02 2013 +0200
main: Make it possible to add GMenu items from plugins
Rather than rely on GtkUIManager.
src/totem-object.c | 28 ++++++++++++++++++++++++++++
src/totem.h | 5 +++++
2 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/src/totem-object.c b/src/totem-object.c
index 116e44e..36feafe 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -526,6 +526,34 @@ totem_object_get_ui_manager (TotemObject *totem)
return totem->ui_manager;
}
+GMenu *
+totem_object_get_menu_section (TotemObject *totem,
+ const char *id)
+{
+ g_return_val_if_fail (TOTEM_IS_OBJECT (totem), NULL);
+
+ return (GMenu *) gtk_builder_get_object (totem->xml, id);
+}
+
+void
+totem_object_empty_menu_section (TotemObject *totem,
+ const char *id)
+{
+ GMenu *menu;
+ guint i;
+
+ g_return_val_if_fail (TOTEM_IS_OBJECT (totem), NULL);
+
+ menu = gtk_builder_get_object (totem->xml, id);
+
+ for (i = 0; i < g_menu_model_get_n_items (G_MENU_MODEL (menu)); i++) {
+ const char *action;
+ g_menu_model_get_item_attribute (G_MENU_MODEL (menu), i, G_MENU_ATTRIBUTE_ACTION, "s",
&action);
+ g_action_map_remove_action (G_ACTION_MAP (totem), action);
+ g_menu_remove (G_MENU (menu), i);
+ }
+}
+
/**
* totem_object_get_video_widget:
* @totem: a #TotemObject
diff --git a/src/totem.h b/src/totem.h
index b00a937..c6aea9d 100644
--- a/src/totem.h
+++ b/src/totem.h
@@ -189,6 +189,11 @@ gboolean totem_object_is_paused (TotemObject *totem);
gboolean totem_object_is_seekable (TotemObject *totem);
GtkWindow *totem_object_get_main_window (TotemObject *totem);
GtkUIManager *totem_object_get_ui_manager (TotemObject *totem);
+GMenu *totem_object_get_menu_section (TotemObject *totem,
+ const char *id);
+void totem_object_empty_menu_section (TotemObject *totem,
+ const char *id);
+
GtkWidget *totem_object_get_video_widget (TotemObject *totem);
char *totem_object_get_version (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]