Commit 182cefdf authored by Vincent Untz's avatar Vincent Untz
Browse files

libpanel-applet: Add panel_applet_setup_menu_from_resource() API

Add API to be able to use the new GResource framework.
parent 2fd32f37
......@@ -31,6 +31,7 @@ AC_PROG_CC
AM_PATH_PYTHON
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources)
AC_PATH_PROG(GCONFTOOL, gconftool-2)
GNOME_COMPILE_WARNINGS([maximum])
......@@ -60,7 +61,7 @@ AC_CHECK_FUNCS(_NSGetEnviron)
LIBGNOME_DESKTOP_REQUIRED=2.91.0
GDK_PIXBUF_REQUIRED=2.7.1
PANGO_REQUIRED=1.15.4
GLIB_REQUIRED=2.25.12
GLIB_REQUIRED=2.31.14
GTK_REQUIRED=3.0
LIBWNCK_REQUIRED=2.91.0
GCONF_REQUIRED=2.6.1
......
......@@ -980,6 +980,46 @@ panel_applet_setup_menu_from_file (PanelApplet *applet,
g_free (xml);
}
/**
* panel_applet_setup_menu_from_resource:
* @applet: a #PanelApplet.
* @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: 3.4
**/
void
panel_applet_setup_menu_from_resource (PanelApplet *applet,
const gchar *resource_path,
GtkActionGroup *action_group)
{
GBytes *bytes;
GError *error = NULL;
bytes = g_resources_lookup_data (resource_path,
G_RESOURCE_LOOKUP_FLAGS_NONE,
&error);
if (bytes) {
panel_applet_setup_menu (applet,
g_bytes_get_data (bytes, NULL),
action_group);
} else {
g_warning ("%s", error->message);
g_error_free (error);
}
g_bytes_unref (bytes);
}
static void
panel_applet_finalize (GObject *object)
{
......
......@@ -170,6 +170,9 @@ void panel_applet_setup_menu (PanelApplet *applet
void panel_applet_setup_menu_from_file (PanelApplet *applet,
const gchar *filename,
GtkActionGroup *action_group);
void panel_applet_setup_menu_from_resource (PanelApplet *applet,
const gchar *resource_path,
GtkActionGroup *action_group);
int panel_applet_factory_main (const gchar *factory_id,
GType applet_type,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment