file-roller r2244 - in trunk: . src



Author: paobac
Date: Mon Apr 14 18:31:24 2008
New Revision: 2244
URL: http://svn.gnome.org/viewvc/file-roller?rev=2244&view=rev

Log:
2008-04-14  Paolo Bacchilega  <paobac svn gnome org>
	
	* src/gtk-utils.c: use g_app_info_launch_default_for_uri to show
	the help dialog.
	
	* configure.in: requires at least gtk+ 2.13.0 for GdkAppLaunchContext
	
	* src/fr-window.c (open_folder): use a GdkAppLaunchContext instead of a
	GAppLaunchContext

	* src/main.c: re-arranged includes.

Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/src/fr-window.c
   trunk/src/gtk-utils.c
   trunk/src/main.c

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Mon Apr 14 18:31:24 2008
@@ -20,7 +20,7 @@
 
 GLIB_REQUIRED=2.16.0
 GIO_REQUIRED=2.16.0
-GTK_REQUIRED=2.10.0
+GTK_REQUIRED=2.13.0
 LIBGNOME_REQUIRED=2.6.0
 LIBGNOMEUI_REQUIRED=2.6.0
 LIBGLADE_REQUIRED=2.4.0

Modified: trunk/src/fr-window.c
==============================================================================
--- trunk/src/fr-window.c	(original)
+++ trunk/src/fr-window.c	Mon Apr 14 18:31:24 2008
@@ -2489,14 +2489,14 @@
 open_folder (GtkWindow  *parent,
 	     const char *folder)
 {
-	GAppLaunchContext *app_context;
-	GError            *error = NULL;
+	GdkAppLaunchContext *app_context;
+	GError              *error = NULL;
 	
 	if (folder == NULL)
 		return;
 
-	app_context = g_app_launch_context_new ();
-	if (! g_app_info_launch_default_for_uri (folder, app_context, &error)) {
+	app_context = gdk_app_launch_context_new ();
+	if (! g_app_info_launch_default_for_uri (folder, G_APP_LAUNCH_CONTEXT (app_context), &error)) {
 		GtkWidget *d;
 		char      *utf8_name;
 		char      *message;
@@ -2516,6 +2516,7 @@
 		g_free (message);
 		g_clear_error (&error);
 	}
+	g_object_unref (app_context);
 }
 
 

Modified: trunk/src/gtk-utils.c
==============================================================================
--- trunk/src/gtk-utils.c	(original)
+++ trunk/src/gtk-utils.c	Mon Apr 14 18:31:24 2008
@@ -862,51 +862,23 @@
 
 void
 show_help_dialog (GtkWindow  *parent,
-		  const char *link_id)
+		  const char *section)
 {
-	GError *err = NULL;
-	char *command;
-	const char *lang;
-	char *uri = NULL;
-	int i;
-	GdkScreen *gscreen;
-
-	const char * const * langs = g_get_language_names ();
-
-	for (i = 0; langs[i]; i++) {
-		lang = langs[i];
-		if (strchr (lang, '.')) {
-			continue;
-		}
-
-		uri = g_build_filename(FR_DATADIR,
-				       "/gnome/help/file-roller/",
-					lang,
-				       "/file-roller.xml",
-					NULL);
-					
-		if (g_file_test (uri, G_FILE_TEST_EXISTS)) {
-                    break;
-		}
-	}
 	
-	if (link_id) {
-		command = g_strconcat ("gnome-open ghelp://", uri, "?", link_id, NULL);
-	} else {
-		command = g_strconcat ("gnome-open ghelp://", uri,  NULL);
-	}
-
-	gscreen = gdk_screen_get_default();
-	gdk_spawn_command_line_on_screen (gscreen, command, &err);
-
-	if (err != NULL) {
-		GtkWidget *dialog;
+	GdkAppLaunchContext *app_context;
+	char                *uri;
+	GError              *error = NULL;
+	
+	uri = g_strconcat ("ghelp:file-roller", section ? "?" : NULL, section, NULL);	
+	app_context = gdk_app_launch_context_new ();
+	if (! g_app_info_launch_default_for_uri (uri, G_APP_LAUNCH_CONTEXT (app_context), &error)) {
+  		GtkWidget *dialog;
 
 		dialog = _gtk_message_dialog_new (parent,
 						  GTK_DIALOG_DESTROY_WITH_PARENT, 
 						  GTK_STOCK_DIALOG_ERROR,
 						  _("Could not display help"),
-						  err->message,
+						  error->message,
 						  GTK_STOCK_OK, GTK_RESPONSE_OK,
 						  NULL);
 		gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
@@ -919,6 +891,8 @@
 
 		gtk_widget_show (dialog);
 
-		g_error_free (err);
+		g_clear_error (&error);
 	}
+	g_object_unref (app_context);
+	g_free (uri);
 }

Modified: trunk/src/main.c
==============================================================================
--- trunk/src/main.c	(original)
+++ trunk/src/main.c	Mon Apr 14 18:31:24 2008
@@ -23,10 +23,10 @@
 #include <config.h>
 #include <string.h>
 
-#include <libgnome/gnome-config.h>
-#include <libgnomeui/libgnomeui.h>
 #include <gio/gio.h>
 #include <glade/glade.h>
+#include <libgnome/gnome-config.h>
+#include <libgnomeui/libgnomeui.h>
 #include "file-utils.h"
 #include "glib-utils.h"
 #include "fr-process.h"



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