[PATCH] Ported GnomeProgram, GnomeColor and hopefully others as well.



---
 src/Makefile.am                                |    1 +
 src/nautilus-autorun-software.c                |    7 +---
 src/nautilus-connect-server-dialog-main.c      |   24 +++++++------
 src/nautilus-file-management-properties-main.c |    9 +----
 src/nautilus-property-browser.c                |   44 +++++++++---------------
 src/nautilus-window-menus.c                    |    7 ++--
 test/test-nautilus-mime-actions-set.c          |    7 ++--
 test/test-nautilus-mime-actions.c              |    5 +--
 8 files changed, 42 insertions(+), 62 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 92ffed9..985b5cc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -19,6 +19,7 @@ INCLUDES =							\
 	-DDATADIR=\""$(datadir)"\" 				\
 	-DLIBDIR=\""$(libdir)"\" 				\
 	-DNAUTILUS_DATADIR=\""$(datadir)/nautilus"\" 		\
+	-DGNOMELOCALEDIR=\""$(datadir)/locale"\"		\
 	-DGLADEDIR=\""$(datadir)/nautilus/glade"\" 		\
 	-DNAUTILUS_PIXMAPDIR=\""$(datadir)/pixmaps/nautilus"\" 	\
 	-DPREFIX=\""$(prefix)"\" 				\
diff --git a/src/nautilus-autorun-software.c b/src/nautilus-autorun-software.c
index 103efa8..0687def 100644
--- a/src/nautilus-autorun-software.c
+++ b/src/nautilus-autorun-software.c
@@ -28,13 +28,12 @@
 #include <unistd.h>
 #include <string.h>
 #include <time.h>
+#include <errno.h>
 #include <gtk/gtk.h>
 #include <gio/gio.h>
 
 #include <glib/gi18n.h>
 
-#include <libgnome/gnome-program.h>
-#include <libgnomeui/gnome-ui-init.h>
 #include <libnautilus-private/nautilus-module.h>
 #include <libnautilus-private/nautilus-icon-info.h>
 
@@ -253,9 +252,7 @@ main (int argc, char *argv[])
 	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 	textdomain (GETTEXT_PACKAGE);
 
-	gnome_program_init ("nautilus-autorun-software", VERSION,
-			    LIBGNOMEUI_MODULE, argc, argv,
-			    NULL, NULL);
+	gtk_init (&argc, &argv);
 
         if (argc != 2) {
                 goto out;
diff --git a/src/nautilus-connect-server-dialog-main.c b/src/nautilus-connect-server-dialog-main.c
index 575b91a..0704d98 100644
--- a/src/nautilus-connect-server-dialog-main.c
+++ b/src/nautilus-connect-server-dialog-main.c
@@ -31,9 +31,7 @@
 #include <gtk/gtk.h>
 #include <gdk/gdk.h>
 
-#include <libgnome/gnome-program.h>
-#include <libgnomeui/gnome-ui-init.h>
-#include <libgnomeui/gnome-authentication-manager.h>
+#include <stdlib.h>
 
 #include <eel/eel-preferences.h>
 #include <eel/eel-stock-dialogs.h>
@@ -163,11 +161,11 @@ nautilus_connect_server_dialog_present_uri (NautilusApplication *application,
 int
 main (int argc, char *argv[])
 {
-	GnomeProgram *program;
 	GtkWidget *dialog;
 	GOptionContext *context;
 	const char **args;
 	GFile *location;
+	GError *error;
 	const GOptionEntry options[] = {
 		{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &args, NULL,  N_("[URI]") },
 		{ NULL }
@@ -178,19 +176,23 @@ main (int argc, char *argv[])
 	textdomain (GETTEXT_PACKAGE);
 
 	args = NULL;
-	/* Translators: This is the --help description gor the connect to server app,
+	error = NULL;
+	/* Translators: This is the --help description for the connect to server app,
 	   the initial newlines are between the command line arg and the description */
 	context = g_option_context_new (N_("\n\nAdd connect to server mount"));
 	g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
 
-	g_option_context_set_translation_domain(context, GETTEXT_PACKAGE);
+	g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+	g_option_context_add_group (context, gtk_get_option_group (TRUE));
 
-	program = gnome_program_init ("nautilus-connect-server", VERSION,
-				      LIBGNOMEUI_MODULE, argc, argv,
-				      GNOME_PARAM_GOPTION_CONTEXT, context,
-				      NULL);
+	if (!g_option_context_parse (context, &argc, &argv, &error)) {
+		g_critical ("Failed to parse arguments: %s", error->message);
+		g_error_free (error);
+		g_option_context_free (context);
+		exit (1);
+	}
 
-	gnome_authentication_manager_init ();
+	g_option_context_free (context);
 
 	eel_preferences_init ("/apps/nautilus");
 
diff --git a/src/nautilus-file-management-properties-main.c b/src/nautilus-file-management-properties-main.c
index 2e3731e..44943a6 100644
--- a/src/nautilus-file-management-properties-main.c
+++ b/src/nautilus-file-management-properties-main.c
@@ -25,13 +25,10 @@
 #include <config.h>
 
 #include <gtk/gtk.h>
+#include <glib/gi18n.h>
 
-#include <libgnome/gnome-program.h>
-#include <libgnomeui/gnome-ui-init.h>
 #include <libnautilus-private/nautilus-module.h>
 
-#include <libintl.h>
-
 #include <eel/eel-preferences.h>
 
 #include "nautilus-file-management-properties.h"
@@ -52,9 +49,7 @@ main (int argc, char *argv[])
 	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 	textdomain (GETTEXT_PACKAGE);
 
-	gnome_program_init ("file-managment-properties", VERSION,
-			    LIBGNOMEUI_MODULE, argc, argv,
-			    NULL, NULL);
+	gtk_init (&argc, &argv);
 
 	eel_preferences_init ("/apps/nautilus");
 
diff --git a/src/nautilus-property-browser.c b/src/nautilus-property-browser.c
index 0bdd41f..8392d41 100644
--- a/src/nautilus-property-browser.c
+++ b/src/nautilus-property-browser.c
@@ -50,13 +50,8 @@
 #include <glib/gi18n.h>
 #include <glib/gstdio.h>
 #include <gio/gio.h>
-#include <libgnome/gnome-util.h>
-#include <libgnome/gnome-help.h>
 #include <libgnomeui/gnome-color-picker.h>
 #include <libgnomeui/gnome-icon-entry.h>
-#include <libgnomeui/gnome-help.h>
-#include <libgnomeui/gnome-stock-icons.h>
-#include <libgnomeui/gnome-uidefs.h>
 #include <libnautilus-private/nautilus-customization-data.h>
 #include <libnautilus-private/nautilus-directory.h>
 #include <libnautilus-private/nautilus-emblem-utils.h>
@@ -791,11 +786,8 @@ make_color_drag_image (NautilusPropertyBrowser *property_browser, const char *co
 
 	color_square = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, COLOR_SQUARE_SIZE, COLOR_SQUARE_SIZE);
 	
-	eel_gdk_color_parse (color_spec, &color);
-	color.red >>= 8;
-	color.green >>= 8;
-	color.blue >>= 8;
-	
+	gdk_color_parse (color_spec, &color);
+
 	pixels = gdk_pixbuf_get_pixels (color_square);
 	stride = gdk_pixbuf_get_rowstride (color_square);
 	
@@ -1121,9 +1113,8 @@ nautilus_color_selection_dialog_new (NautilusPropertyBrowser *property_browser)
 	widget = gtk_label_new_with_mnemonic(_("Color _value:"));
 	gtk_widget_show(widget);
 	gtk_table_attach(GTK_TABLE(table), widget, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
- 
-	/* set up a gnome file entry to pick the image file */
-	property_browser->details->color_picker = gnome_color_picker_new ();
+
+	property_browser->details->color_picker = gtk_color_button_new ();
 	gtk_widget_show (property_browser->details->color_picker);
 	gtk_label_set_mnemonic_widget (GTK_LABEL (widget), property_browser->details->color_picker);
 
@@ -1284,20 +1275,17 @@ add_color_to_file (NautilusPropertyBrowser *property_browser, const char *color_
 static void
 add_color_to_browser (GtkWidget *widget, gint which_button, gpointer *data)
 {
-	char color_spec[8];
+	char * color_spec;
 	const char *color_name;
 	char *stripped_color_name;
 
-	gdouble color[4];
 	NautilusPropertyBrowser *property_browser = NAUTILUS_PROPERTY_BROWSER (data);
 
 	if (which_button == GTK_RESPONSE_OK) {
-		gnome_color_picker_get_d (GNOME_COLOR_PICKER (property_browser->details->color_picker), &color[0], &color[1], &color[2], &color[3]);		
-		g_snprintf (color_spec, sizeof (color_spec),
-			 "#%02X%02X%02X",
-			 (guint) (color[0] * 255.0 + 0.5),
-			 (guint) (color[1] * 255.0 + 0.5),
-			 (guint) (color[2] * 255.0 + 0.5));
+		GdkColor color;
+
+		gtk_color_button_get_color (GTK_COLOR_BUTTON (property_browser->details->color_picker), &color);
+		color_spec = gdk_color_to_string (&color);
 
 		color_name = gtk_entry_get_text (GTK_ENTRY (property_browser->details->color_name));
 		stripped_color_name = g_strstrip (g_strdup (color_name));
@@ -1311,6 +1299,7 @@ add_color_to_browser (GtkWidget *widget, gint which_button, gpointer *data)
 			nautilus_property_browser_update_contents(property_browser);
 		}
 		g_free (stripped_color_name);
+		g_free (color_spec);
 	}
 	
 	gtk_widget_destroy(property_browser->details->colors_dialog);
@@ -1331,17 +1320,16 @@ show_color_selection_window (GtkWidget *widget, gpointer *data)
 	property_browser->details->colors_dialog = nautilus_color_selection_dialog_new (property_browser);		
 
 	/* set the color to the one picked by the selector */
-	gnome_color_picker_set_i16 (GNOME_COLOR_PICKER (property_browser->details->color_picker), color.red, color.green, color.blue, 1.0);
-	
+	gtk_color_button_set_color (GTK_COLOR_BUTTON (property_browser->details->color_picker), &color);
+
 	/* connect the signals to the new dialog */
-	
+
 	eel_add_weak_pointer (&property_browser->details->colors_dialog);
 
 	g_signal_connect_object (property_browser->details->colors_dialog, "response",
 				 G_CALLBACK (add_color_to_browser), property_browser, 0);
 	gtk_window_set_position (GTK_WINDOW (property_browser->details->colors_dialog), GTK_WIN_POS_MOUSE);
 	gtk_widget_show (GTK_WIDGET(property_browser->details->colors_dialog));
-
 }
 
 
@@ -1515,9 +1503,9 @@ help_button_callback (GtkWidget *widget, GtkWidget *property_browser)
 	GError *error = NULL;
 	GtkWidget *dialog;
 
-	gnome_help_display_desktop_on_screen (
-		NULL, "user-guide", "user-guide.xml", "gosnautilus-50",
-		gtk_window_get_screen (GTK_WINDOW (property_browser)), &error);
+	gtk_show_uri (gtk_widget_get_screen (property_browser),
+		      "ghelp:user-guide#gosnautilus-50",
+		      gtk_get_current_event_time (), &error);
 
 	if (error) {
 		dialog = gtk_message_dialog_new (GTK_WINDOW (property_browser),
diff --git a/src/nautilus-window-menus.c b/src/nautilus-window-menus.c
index cca53ae..78998e4 100644
--- a/src/nautilus-window-menus.c
+++ b/src/nautilus-window-menus.c
@@ -43,7 +43,6 @@
 #include <gio/gio.h>
 #include <glib/gi18n.h>
 #include <eel/eel-preferences.h>
-#include <libgnomeui/gnome-help.h>
 #include <libnautilus-extension/nautilus-menu-provider.h>
 #include <libnautilus-private/nautilus-file-utilities.h>
 #include <libnautilus-private/nautilus-global-preferences.h>
@@ -606,9 +605,9 @@ action_nautilus_manual_callback (GtkAction *action,
 			gtk_window_get_screen (GTK_WINDOW (window)),
 			"gnome-help", &error);
 	} else {
-		gnome_help_display_desktop_on_screen (
-			NULL, "user-guide", "user-guide.xml", "gosnautilus-1",
-			gtk_window_get_screen (GTK_WINDOW (window)), &error);
+		gtk_show_uri (gtk_window_get_screen (GTK_WINDOW (window)),
+			      "ghelp:user-guide#gosnautilus-1",
+			      gtk_get_current_event_time (), &error);
 	}
 
 	if (error) {
diff --git a/test/test-nautilus-mime-actions-set.c b/test/test-nautilus-mime-actions-set.c
index 7bf6ec4..b615d91 100644
--- a/test/test-nautilus-mime-actions-set.c
+++ b/test/test-nautilus-mime-actions-set.c
@@ -24,7 +24,7 @@
 
 #include <config.h>
 
-#include <gnome.h>
+#include <gtk/gtk.h>
 #include <libnautilus-private/nautilus-mime-actions.h>
 #include <stdio.h>
 
@@ -107,9 +107,8 @@ main (int argc, char **argv)
 	const char *value;
 	NautilusFile *file;
 	NautilusFileAttributes attributes;
-	
-	gnome_program_init ("test-nautilus-mime-actions-set", "0.0",
-			    LIBGNOMEUI_MODULE, argc, argv, NULL);
+
+	gtk_init (&argc, &argv);	
 
 	if (argc < 3) {
 		usage (argv[0]);
diff --git a/test/test-nautilus-mime-actions.c b/test/test-nautilus-mime-actions.c
index 4e92e08..e77fff1 100644
--- a/test/test-nautilus-mime-actions.c
+++ b/test/test-nautilus-mime-actions.c
@@ -24,7 +24,7 @@
 
 #include <config.h>
 
-#include <gnome.h>
+#include <gtk/gtk.h>
 #include <libnautilus-private/nautilus-mime-actions.h>
 #include <stdio.h>
 
@@ -103,8 +103,7 @@ main (int argc, char **argv)
 	NautilusFile *file;
 	NautilusFileAttributes attributes;
 
-	gnome_program_init ("test-nautilus-mime-actions", "0.0",
-			    LIBGNOMEUI_MODULE, argc, argv, NULL);
+	gtk_init (&argc, &argv);
 
 	if (argc != 2) {
 		fprintf (stderr, "Usage: %s uri\n", *argv);
-- 
1.5.6.3


--=-M9WetJk+GBqnJK8uPecM
Content-Disposition: attachment; filename="0002-Port-the-gnome_config-to-GKeyFile.patch"
Content-Type: text/x-patch; name="0002-Port-the-gnome_config-to-GKeyFile.patch"; charset="UTF-8"
Content-Transfer-Encoding: 7bit



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