[gnome-panel] libpanel-applet: Remove out_process from panel_applet_factory_main()



commit 6ef943dd473ac662dea01645e0ab1f6564361253
Author: Vincent Untz <vuntz gnome org>
Date:   Thu Feb 24 13:41:17 2011 +0100

    libpanel-applet: Remove out_process from panel_applet_factory_main()
    
    This argument makes no sense when introspection is used since, in that
    case, the applet will be out-of-process anyway.
    
    Instead, create a panel_applet_factory_setup_in_process() API that is
    marked as "skip" for introspection, that is used to setup the factory
    for in-process applets.

 libpanel-applet/panel-applet.c |   60 +++++++++++++++++++++++++++++----------
 libpanel-applet/panel-applet.h |   11 +++++--
 2 files changed, 52 insertions(+), 19 deletions(-)
---
diff --git a/libpanel-applet/panel-applet.c b/libpanel-applet/panel-applet.c
index da7aa97..d06bd6c 100644
--- a/libpanel-applet/panel-applet.c
+++ b/libpanel-applet/panel-applet.c
@@ -2303,22 +2303,12 @@ _panel_applet_setup_x_error_handler (void)
 	_x_error_func = XSetErrorHandler (_x_error_handler);
 }
 
-/**
- * panel_applet_factory_main:
- * @factory_id: Factory ID.
- * @out_process: If the factory is on a separate process or not.
- * @applet_type: GType of the applet this factory creates.
- * @callback: (scope call): Callback to be called when a new applet is to be created.
- * @data: (closure): Callback data.
- *
- * Returns: 0 on success, 1 if there is an error.
- */
-int
-panel_applet_factory_main (const gchar               *factory_id,
-			   gboolean                   out_process,
-			   GType                      applet_type,
-			   PanelAppletFactoryCallback callback,
-			   gpointer                   user_data)
+static int
+_panel_applet_factory_main_internal (const gchar               *factory_id,
+				     gboolean                   out_process,
+				     GType                      applet_type,
+				     PanelAppletFactoryCallback callback,
+				     gpointer                   user_data)
 {
 	PanelAppletFactory *factory;
 	GClosure           *closure;
@@ -2350,6 +2340,44 @@ panel_applet_factory_main (const gchar               *factory_id,
 	return 1;
 }
 
+/**
+ * panel_applet_factory_main:
+ * @factory_id: Factory ID.
+ * @applet_type: GType of the applet this factory creates.
+ * @callback: (scope call): Callback to be called when a new applet is to be created.
+ * @data: (closure): Callback data.
+ *
+ * Returns: 0 on success, 1 if there is an error.
+ */
+int
+panel_applet_factory_main (const gchar               *factory_id,
+			   GType                      applet_type,
+			   PanelAppletFactoryCallback callback,
+			   gpointer                   user_data)
+{
+	return _panel_applet_factory_main_internal (factory_id, TRUE, applet_type,
+						    callback, user_data);
+}
+
+/**
+ * panel_applet_factory_setup_in_process: (skip)
+ * @factory_id: Factory ID.
+ * @applet_type: GType of the applet this factory creates.
+ * @callback: (scope call): Callback to be called when a new applet is to be created.
+ * @data: (closure): Callback data.
+ *
+ * Returns: 0 on success, 1 if there is an error.
+ */
+int
+panel_applet_factory_setup_in_process (const gchar               *factory_id,
+				       GType                      applet_type,
+				       PanelAppletFactoryCallback callback,
+				       gpointer                   user_data)
+{
+	return _panel_applet_factory_main_internal (factory_id, FALSE, applet_type,
+						    callback, user_data);
+}
+
 void
 panel_applet_set_background_widget (PanelApplet *applet,
 				    GtkWidget   *widget)
diff --git a/libpanel-applet/panel-applet.h b/libpanel-applet/panel-applet.h
index 7d42258..e2accaa 100644
--- a/libpanel-applet/panel-applet.h
+++ b/libpanel-applet/panel-applet.h
@@ -118,11 +118,15 @@ void               panel_applet_setup_menu_from_file (PanelApplet        *applet
 						      GtkActionGroup     *action_group);
 
 int                panel_applet_factory_main          (const gchar		  *factory_id,
-						       gboolean                    out_process,
 						       GType                       applet_type,
 						       PanelAppletFactoryCallback  callback,
 						       gpointer			   data);
 
+int                panel_applet_factory_setup_in_process (const gchar               *factory_id,
+							  GType                      applet_type,
+							  PanelAppletFactoryCallback callback,
+							  gpointer                   data);
+
 
 /*
  * These macros are getting a bit unwieldy.
@@ -172,7 +176,7 @@ int main (int argc, char *argv [])						\
 										\
 	gtk_init (&argc, &argv);						\
                                                                                 \
-        retval = panel_applet_factory_main (id, TRUE, type, callback, data);    \
+        retval = panel_applet_factory_main (id, type, callback, data);          \
 	g_option_context_free (context);					\
 										\
 	return retval;								\
@@ -184,7 +188,8 @@ G_MODULE_EXPORT gint
 _panel_applet_shlib_factory (void)					        \
 {										\
 	_PANEL_APPLET_SETUP_GETTEXT (FALSE);					\
-        return panel_applet_factory_main (id, FALSE, type, callback, data);     \
+        return panel_applet_factory_setup_in_process (id, type,                 \
+                                                      callback, data);          \
 }
 
 G_END_DECLS



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]