summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlukefromdc <[email protected]>2017-07-14 14:44:34 -0400
committerlukefromdc <[email protected]>2017-08-13 14:37:24 -0400
commit788cde808151c8b4f06ee343f1e7006341c2d0ee (patch)
tree75f24a8b4a1ef7acd643cd3f732345d03d0eaa6b
parent72d3549c4dbbe6e7373d74550a2f6d2b2f0690a9 (diff)
downloadmate-panel-788cde808151c8b4f06ee343f1e7006341c2d0ee.tar.bz2
mate-panel-788cde808151c8b4f06ee343f1e7006341c2d0ee.tar.xz
libpanel-applet: add panel_applet_factory_get_applet_widget
This function will be used to get applet widget from factory. Based on https://github.com/GNOME/gnome-panel/commit/8e1f7ea9f13533ce448cbc485d766fed01029be5
-rw-r--r--libmate-panel-applet/mate-panel-applet-factory.c19
-rw-r--r--libmate-panel-applet/mate-panel-applet-factory.h2
2 files changed, 21 insertions, 0 deletions
diff --git a/libmate-panel-applet/mate-panel-applet-factory.c b/libmate-panel-applet/mate-panel-applet-factory.c
index b7e237c1..cf38d64c 100644
--- a/libmate-panel-applet/mate-panel-applet-factory.c
+++ b/libmate-panel-applet/mate-panel-applet-factory.c
@@ -306,4 +306,23 @@ mate_panel_applet_factory_register_service (MatePanelAppletFactory *factory)
return TRUE;
}
+GtkWidget *
+mate_panel_applet_factory_get_applet_widget (const gchar *id,
+ guint uid)
+{
+ MatePanelAppletFactory *factory;
+ GObject *object;
+
+ if (!factories)
+ return NULL;
+ factory = g_hash_table_lookup (factories, id);
+ if (!factory)
+ return NULL;
+
+ object = g_hash_table_lookup (factory->applets, GUINT_TO_POINTER (uid));
+ if (!object || !GTK_IS_WIDGET (object))
+ return NULL;
+
+ return GTK_WIDGET (object);
+}
diff --git a/libmate-panel-applet/mate-panel-applet-factory.h b/libmate-panel-applet/mate-panel-applet-factory.h
index 4bffc444..9726dd47 100644
--- a/libmate-panel-applet/mate-panel-applet-factory.h
+++ b/libmate-panel-applet/mate-panel-applet-factory.h
@@ -44,6 +44,8 @@ MatePanelAppletFactory *mate_panel_applet_factory_new (const gchar
GType applet_type,
GClosure *closure);
gboolean mate_panel_applet_factory_register_service (MatePanelAppletFactory *factory);
+GtkWidget *mate_panel_applet_factory_get_applet_widget (const gchar *id,
+ guint uid);
/* This technically belongs to mate-panel-applet.h, but it's not something that
* should be public API. */