[libpeas] [PeasUIConfigurable] Make the dialog the return value.



commit 3892bd5827f706fa1f7a7a58e68260d8cfbbb92c
Author: Steve Frécinaux <code istique net>
Date:   Wed Jun 30 20:54:01 2010 +0200

    [PeasUIConfigurable] Make the dialog the return value.
    
    It was previously an out parameter, but we recently gained the ability
    to use return values of extension interface methods.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=623173

 libpeasui/peas-ui-configurable.c                   |   12 ++++------
 libpeasui/peas-ui-configurable.h                   |    6 +---
 .../helloworld/peasdemo-hello-world-plugin.c       |   21 ++++++++++---------
 3 files changed, 18 insertions(+), 21 deletions(-)
---
diff --git a/libpeasui/peas-ui-configurable.c b/libpeasui/peas-ui-configurable.c
index f781219..6b5b662 100644
--- a/libpeasui/peas-ui-configurable.c
+++ b/libpeasui/peas-ui-configurable.c
@@ -80,17 +80,15 @@ peas_ui_configurable_is_configurable (PeasUIConfigurable *configurable)
 /**
  * peas_ui_configurable_create_configure_dialog:
  * @configurable: A #PeasUIConfigurable
- * @conf_dlg: (out): A #GtkWindow used for configuration
  *
  * Creates the configure dialog widget for the plugin.
  *
  * The default implementation returns %NULL.
  *
- * Returns: %TRUE on success.
+ * Returns: A #GtkWindow used for configuration.
  */
-gboolean
-peas_ui_configurable_create_configure_dialog (PeasUIConfigurable  *configurable,
-                                              GtkWidget          **conf_dlg)
+GtkWidget *
+peas_ui_configurable_create_configure_dialog (PeasUIConfigurable  *configurable)
 {
   PeasUIConfigurableInterface *iface;
 
@@ -99,8 +97,8 @@ peas_ui_configurable_create_configure_dialog (PeasUIConfigurable  *configurable,
   iface = PEAS_UI_CONFIGURABLE_GET_IFACE (configurable);
 
   if (G_LIKELY (iface->create_configure_dialog != NULL))
-    return iface->create_configure_dialog (configurable, conf_dlg);
+    return iface->create_configure_dialog (configurable);
 
   /* Default implementation */
-  return FALSE;
+  return NULL;
 }
diff --git a/libpeasui/peas-ui-configurable.h b/libpeasui/peas-ui-configurable.h
index 40cb7ad..f40d920 100644
--- a/libpeasui/peas-ui-configurable.h
+++ b/libpeasui/peas-ui-configurable.h
@@ -42,8 +42,7 @@ struct _PeasUIConfigurableInterface
 {
   GTypeInterface g_iface;
 
-  gboolean    (*create_configure_dialog)  (PeasUIConfigurable  *configurable,
-                                           GtkWidget          **conf_dlg);
+  GtkWidget  *(*create_configure_dialog)  (PeasUIConfigurable  *configurable);
 
   /* Plugins should usually not override this, it's handled automatically
    * by the PeasPluginClass */
@@ -52,8 +51,7 @@ struct _PeasUIConfigurableInterface
 
 GType       peas_ui_configurable_get_type                (void);
 gboolean    peas_ui_configurable_is_configurable         (PeasUIConfigurable  *configurable);
-gboolean    peas_ui_configurable_create_configure_dialog (PeasUIConfigurable  *configurable,
-                                                          GtkWidget          **conf_dlg);
+GtkWidget  *peas_ui_configurable_create_configure_dialog (PeasUIConfigurable  *configurable);
 
 G_END_DECLS
 
diff --git a/peas-demo/plugins/helloworld/peasdemo-hello-world-plugin.c b/peas-demo/plugins/helloworld/peasdemo-hello-world-plugin.c
index fdacad5..c3d9076 100644
--- a/peas-demo/plugins/helloworld/peasdemo-hello-world-plugin.c
+++ b/peas-demo/plugins/helloworld/peasdemo-hello-world-plugin.c
@@ -113,21 +113,22 @@ on_configure_dialog_response (GtkDialog *dialog,
   gtk_widget_destroy (GTK_WIDGET (dialog));
 }
 
-static gboolean
-peasdemo_hello_world_plugin_create_configure_dialog (PeasUIConfigurable  *configurable,
-                                                     GtkWidget          **dialog)
+static GtkWidget *
+peasdemo_hello_world_plugin_create_configure_dialog (PeasUIConfigurable  *configurable)
 {
+  GtkWidget *dialog;
+
   g_debug (G_STRFUNC);
 
-  *dialog = gtk_message_dialog_new (NULL,
-                                    0,
-                                    GTK_MESSAGE_INFO,
-                                    GTK_BUTTONS_OK,
-                                    "This is a configuration dialog for the HelloWorld plugin.");
-  g_signal_connect (*dialog, "response",
+  dialog = gtk_message_dialog_new (NULL,
+                                   0,
+                                   GTK_MESSAGE_INFO,
+                                   GTK_BUTTONS_OK,
+                                   "This is a configuration dialog for the HelloWorld plugin.");
+  g_signal_connect (dialog, "response",
                     G_CALLBACK (on_configure_dialog_response), NULL);
 
-  return TRUE;
+  return dialog;
 }
 
 static void



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