Skip to content


libpanel-applet: Add panel_applet_setup_menu_from_resource() API
Browse files Browse the repository at this point in the history
Add API to be able to use the new GResource framework.

origin commit:
  • Loading branch information
vuntz authored and raveit65 committed Apr 26, 2018
1 parent 45b2541 commit b6372ca
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions
Expand Up @@ -30,6 +30,7 @@ AC_PROG_LIBTOOL

AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources)
AC_PATH_PROG([GDBUS_CODEGEN], [gdbus-codegen])

Expand Down
40 changes: 40 additions & 0 deletions libmate-panel-applet/mate-panel-applet.c
Expand Up @@ -711,6 +711,46 @@ mate_panel_applet_setup_menu_from_file (MatePanelApplet *applet,
g_free (xml);

* mate_panel_applet_setup_menu_from_resource:
* @applet: a #MatePanelApplet.
* @resource_path: a resource path
* @action_group: a #GtkActionGroup.
* Sets up the context menu of @applet. @filename is a resource path to a menu
* XML file, containing a #GtkUIManager UI definition that describes how to
* display the menu items. @action_group contains the various #GtkAction that
* are referenced in @xml.
* See also the <link linkend="getting-started.context-menu">Context
* Menu</link> section.
* Since: 1.20.1
mate_panel_applet_setup_menu_from_resource (MatePanelApplet *applet,
const gchar *resource_path,
GtkActionGroup *action_group)
GBytes *bytes;
GError *error = NULL;

bytes = g_resources_lookup_data (resource_path,

if (bytes) {
mate_panel_applet_setup_menu (applet,
g_bytes_get_data (bytes, NULL),
} else {
g_warning ("%s", error->message);
g_error_free (error);

g_bytes_unref (bytes);

static void
mate_panel_applet_finalize (GObject *object)
Expand Down
3 changes: 3 additions & 0 deletions libmate-panel-applet/mate-panel-applet.h
Expand Up @@ -111,6 +111,9 @@ void mate_panel_applet_request_focus(MatePanelApplet* applet, guint32 timestamp)

void mate_panel_applet_setup_menu(MatePanelApplet* applet, const gchar* xml, GtkActionGroup* action_group);
void mate_panel_applet_setup_menu_from_file(MatePanelApplet* applet, const gchar* filename, GtkActionGroup* action_group);
void mate_panel_applet_setup_menu_from_resource (MatePanelApplet *applet,
const gchar *resource_path,
GtkActionGroup *action_group);

int mate_panel_applet_factory_main(const gchar* factory_id,gboolean out_process, GType applet_type, MatePanelAppletFactoryCallback callback, gpointer data);

Expand Down

0 comments on commit b6372ca

Please sign in to comment.