[vinagre] Refactored last Jorge's patch.



commit dbd546f4ce4330242b2759b78adb3a4e1ead0375
Author: Jonh Wendell <jwendell gnome org>
Date:   Tue Jul 28 09:36:17 2009 -0300

    Refactored last Jorge's patch.

 vinagre/vinagre-commands.c      |    2 +-
 vinagre/vinagre-plugin-dialog.c |  117 ++++++++++++++++-----------------------
 vinagre/vinagre-plugin-dialog.h |   34 +++---------
 3 files changed, 57 insertions(+), 96 deletions(-)
---
diff --git a/vinagre/vinagre-commands.c b/vinagre/vinagre-commands.c
index 3cca3b7..71fc5e1 100644
--- a/vinagre/vinagre-commands.c
+++ b/vinagre/vinagre-commands.c
@@ -237,7 +237,7 @@ vinagre_cmd_edit_plugins (GtkAction     *action,
 
   vinagre_debug (DEBUG_PLUGINS);
 
-  vinagre_plugin_dialog_show (window);
+  vinagre_plugin_dialog_show (GTK_WINDOW (window));
 }
 
 /* View Menu */
diff --git a/vinagre/vinagre-plugin-dialog.c b/vinagre/vinagre-plugin-dialog.c
index 65c98d3..0744aff 100644
--- a/vinagre/vinagre-plugin-dialog.c
+++ b/vinagre/vinagre-plugin-dialog.c
@@ -3,6 +3,7 @@
  * This file is part of vinagre
  *
  * Copyright (C) 2009 Jorge Pereira <jorge jorgepereira com br>
+ * Copyright (C) 2009 Jonh Wendell <wendell bani com br>
  * 
  * vinagre-plugins-dialog.c is free software: you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the
@@ -18,17 +19,10 @@
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <string.h>
-
 #include <glib/gi18n.h>
-#include <gconf/gconf-client.h>
 
 #include "vinagre-plugin-dialog.h"
+#include "vinagre-plugin-manager.h"
 #include "vinagre-debug.h"
 
 static GtkWidget *plugin_dialog = NULL;
@@ -39,7 +33,7 @@ static GtkWidget *plugin_dialog = NULL;
 
 struct _VinagrePluginDialogPrivate
 {
-	GtkWidget	*plugin_box;
+  gint dummy;
 };
 
 G_DEFINE_TYPE(VinagrePluginDialog, vinagre_plugin_dialog, GTK_TYPE_DIALOG)
@@ -47,88 +41,73 @@ G_DEFINE_TYPE(VinagrePluginDialog, vinagre_plugin_dialog, GTK_TYPE_DIALOG)
 static void 
 vinagre_plugin_dialog_class_init (VinagrePluginDialogClass *klass)
 {
-	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-	g_type_class_add_private (object_class, sizeof (VinagrePluginDialogPrivate));
+  g_type_class_add_private (object_class, sizeof (VinagrePluginDialogPrivate));
 }
 
 static void
-dialog_response_handler (GtkDialog *dlg, 
-	                  		 gint       res_id)
+dialog_response_handler (GtkDialog *dlg, gint res_id)
 {
-	vinagre_debug (DEBUG_PREFS);
-
-	switch (res_id)
-	{
-    case GTK_RESPONSE_CLOSE:
-		default:
-			gtk_widget_destroy (GTK_WIDGET(dlg));
-	}
+  switch (res_id)
+    {
+      case GTK_RESPONSE_CLOSE:
+      default:
+	gtk_widget_destroy (GTK_WIDGET (dlg));
+    }
 }
 
 static void
 setup_plugins_page (VinagrePluginDialog *dlg)
 {
-	GtkWidget *page_content;
-
-  vinagre_debug (DEBUG_PREFS);
+  GtkWidget *page_content;
 
-	page_content = GTK_WIDGET (vinagre_plugin_manager_new ());
-	g_return_if_fail (page_content != NULL);
+  page_content = vinagre_plugin_manager_new ();
+  g_return_if_fail (page_content != NULL);
 
-  gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dlg)->vbox), page_content);
+  gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
+		     page_content);
 
-	gtk_widget_show_all (page_content);
+  gtk_widget_show_all (page_content);
 }
 
 static void
 vinagre_plugin_dialog_init (VinagrePluginDialog *dlg)
 {
-	GtkWidget *error_widget;
-	
-	vinagre_debug (DEBUG_PREFS);
-
-	dlg->priv = VINAGRE_PLUGIN_DIALOG_GET_PRIVATE (dlg);
-	gtk_dialog_add_buttons (GTK_DIALOG (dlg),
-				GTK_STOCK_CLOSE,
-				GTK_RESPONSE_CLOSE,
-				NULL);
-
-	gtk_window_set_title (GTK_WINDOW (dlg), _("Plugin Manager"));
-	gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE);
-	gtk_dialog_set_has_separator (GTK_DIALOG (dlg), TRUE);
-	gtk_window_set_destroy_with_parent (GTK_WINDOW (dlg), TRUE);
-
-	g_signal_connect (dlg,
-			  "response",
-			  G_CALLBACK (dialog_response_handler),
+  dlg->priv = VINAGRE_PLUGIN_DIALOG_GET_PRIVATE (dlg);
+  gtk_dialog_add_buttons (GTK_DIALOG (dlg),
+			  GTK_STOCK_CLOSE,
+			  GTK_RESPONSE_CLOSE,
 			  NULL);
 
-	setup_plugins_page (dlg);
+  gtk_window_set_title (GTK_WINDOW (dlg), _("Plugin Manager"));
+  gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE);
+  gtk_dialog_set_has_separator (GTK_DIALOG (dlg), FALSE);
+  gtk_window_set_destroy_with_parent (GTK_WINDOW (dlg), TRUE);
+
+  g_signal_connect (dlg,
+		    "response",
+		    G_CALLBACK (dialog_response_handler),
+		    NULL);
+
+  setup_plugins_page (dlg);
 }
 
 void
-vinagre_plugin_dialog_show (VinagreWindow *parent)
+vinagre_plugin_dialog_show (GtkWindow *parent)
 {
-	vinagre_debug (DEBUG_PREFS);
-
-	g_return_if_fail (VINAGRE_IS_WINDOW (parent));
-
-	if (plugin_dialog == NULL)
-	{
-		plugin_dialog = GTK_WIDGET (g_object_new (VINAGRE_TYPE_PLUGIN_DIALOG, NULL));
-		g_signal_connect (plugin_dialog,
-				  "destroy",
-				  G_CALLBACK (gtk_widget_destroyed),
-				  &plugin_dialog);
-	}
-
-	if (GTK_WINDOW (parent) != gtk_window_get_transient_for (GTK_WINDOW (plugin_dialog)))
-	{
-		gtk_window_set_transient_for (GTK_WINDOW (plugin_dialog),
-					      GTK_WINDOW (parent));
-	}
-
-	gtk_window_present (GTK_WINDOW (plugin_dialog));
+  if (plugin_dialog == NULL)
+    {
+      plugin_dialog = GTK_WIDGET (g_object_new (VINAGRE_TYPE_PLUGIN_DIALOG, NULL));
+      g_signal_connect (plugin_dialog,
+			"destroy",
+			G_CALLBACK (gtk_widget_destroyed),
+			&plugin_dialog);
+    }
+
+  if (GTK_IS_WINDOW (parent))
+    gtk_window_set_transient_for (GTK_WINDOW (plugin_dialog), parent);
+
+  gtk_window_present (GTK_WINDOW (plugin_dialog));
 }
-
+/* vim: set ts=8: */
diff --git a/vinagre/vinagre-plugin-dialog.h b/vinagre/vinagre-plugin-dialog.h
index a94f7e4..ce8d05d 100644
--- a/vinagre/vinagre-plugin-dialog.h
+++ b/vinagre/vinagre-plugin-dialog.h
@@ -21,13 +21,10 @@
 #ifndef __VINAGRE_PLUGIN_DIALOG_H__
 #define __VINAGRE_PLUGIN_DIALOG_H__
 
-#include "vinagre-window.h"
+#include <gtk/gtk.h>
 
 G_BEGIN_DECLS
 
-/*
- * Type checking and casting macros
- */
 #define VINAGRE_TYPE_PLUGIN_DIALOG              (vinagre_plugin_dialog_get_type())
 #define VINAGRE_PLUGIN_DIALOG(obj)              (G_TYPE_CHECK_INSTANCE_CAST((obj), VINAGRE_TYPE_PLUGIN_DIALOG, VinagrePluginDialog))
 #define VINAGRE_PLUGIN_DIALOG_CONST(obj)        (G_TYPE_CHECK_INSTANCE_CAST((obj), VINAGRE_TYPE_PLUGIN_DIALOG, VinagrePluginDialog const))
@@ -36,41 +33,26 @@ G_BEGIN_DECLS
 #define VINAGRE_IS_PLUGIN_DIALOG_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), VINAGRE_TYPE_PLUGIN_DIALOG))
 #define VINAGRE_PLUGIN_DIALOG_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS((obj),  VINAGRE_TYPE_PLUGIN_DIALOG, VinagrePluginDialogClass))
 
-
-/* Private structure type */
 typedef struct _VinagrePluginDialogPrivate VinagrePluginDialogPrivate;
-
-/*
- * Main object structure
- */
 typedef struct _VinagrePluginDialog VinagrePluginDialog;
+typedef struct _VinagrePluginDialogClass VinagrePluginDialogClass;
 
 struct _VinagrePluginDialog 
 {
-	GtkDialog dialog;
-	
-	/*< private > */
-	VinagrePluginDialogPrivate *priv;
+  GtkDialog dialog;
+  VinagrePluginDialogPrivate *priv;
 };
 
-/*
- * Class definition
- */
-typedef struct _VinagrePluginDialogClass VinagrePluginDialogClass;
-
 struct _VinagrePluginDialogClass 
 {
-	GtkDialogClass parent_class;
+  GtkDialogClass parent_class;
 };
 
-/*
- * Public methods
- */
-GType		 vinagre_plugin_dialog_get_type	(void) G_GNUC_CONST;
+GType	vinagre_plugin_dialog_get_type	(void) G_GNUC_CONST;
 
-void		 vinagre_plugin_dialog_show (VinagreWindow *parent);
+void	vinagre_plugin_dialog_show	(GtkWindow *parent);
 
 G_END_DECLS
 
 #endif /* __VINAGRE_PLUGIN_DIALOG_H__ */
-
+/* vim: set ts=8: */



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