[gnome-panel] libpanel-applet: add panel_applet_factory_get_applet_widget
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel] libpanel-applet: add panel_applet_factory_get_applet_widget
- Date: Thu, 6 Nov 2014 22:02:02 +0000 (UTC)
commit 8e1f7ea9f13533ce448cbc485d766fed01029be5
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Thu Nov 6 19:54:36 2014 +0200
libpanel-applet: add panel_applet_factory_get_applet_widget
This function will be used to get applet widget from factory.
libpanel-applet/panel-applet-factory.c | 19 +++++++++++++++++++
libpanel-applet/panel-applet-factory.h | 3 ++-
2 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/libpanel-applet/panel-applet-factory.c b/libpanel-applet/panel-applet-factory.c
index e7e18b4..904fa61 100644
--- a/libpanel-applet/panel-applet-factory.c
+++ b/libpanel-applet/panel-applet-factory.c
@@ -321,4 +321,23 @@ panel_applet_factory_register_service (PanelAppletFactory *factory)
return TRUE;
}
+GtkWidget *
+panel_applet_factory_get_applet_widget (const gchar *id,
+ guint uid)
+{
+ PanelAppletFactory *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/libpanel-applet/panel-applet-factory.h b/libpanel-applet/panel-applet-factory.h
index 6b58f79..6e796ee 100644
--- a/libpanel-applet/panel-applet-factory.h
+++ b/libpanel-applet/panel-applet-factory.h
@@ -40,7 +40,8 @@ PanelAppletFactory *panel_applet_factory_new (const gchar *
GType applet_type,
GClosure *closure);
gboolean panel_applet_factory_register_service (PanelAppletFactory *factory);
-
+GtkWidget *panel_applet_factory_get_applet_widget (const gchar *id,
+ guint uid);
G_END_DECLS
#endif /* PANEL_APPLET_FACTORY_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]