[Commits] Makefile.am 1.1.2.4 1.1.2.5 python_plugin.c 1.1.2.20 1.1.2.21

holger at claws-mail.org holger at claws-mail.org
Tue Aug 14 00:12:38 CEST 2012


Update of /home/claws-mail/plugins/python/src
In directory srv:/tmp/cvs-serv4255/src

Modified Files:
      Tag: gtk2
	Makefile.am python_plugin.c 
Log Message:
2012-08-13 [holger]	0.10cvs5

	* configure.ac
	* src/Makefile.am
	* src/python_plugin.c
		Modernize launching the scripts dir in a file manager
		Bump required glib/gtk+ versions to 2.16 

Index: python_plugin.c
===================================================================
RCS file: /home/claws-mail/plugins/python/src/Attic/python_plugin.c,v
retrieving revision 1.1.2.20
retrieving revision 1.1.2.21
diff -u -d -r1.1.2.20 -r1.1.2.21
--- python_plugin.c	10 Jul 2012 13:36:54 -0000	1.1.2.20
+++ python_plugin.c	13 Aug 2012 22:12:36 -0000	1.1.2.21
@@ -437,17 +437,28 @@
 
 static void browse_python_scripts_dir(GtkAction *action, gpointer data)
 {
-  gchar *argv[2];
-  gboolean retval;
+  gchar *uri;
+  GdkAppLaunchContext *launch_context;
   GError *error = NULL;
-  argv[0] = "xdg-open";
-  argv[1] = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, PYTHON_SCRIPTS_BASE_DIR, G_DIR_SEPARATOR_S, NULL);
-  retval = gdk_spawn_on_screen(gdk_screen_get_default(), NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &error);
-  g_free(argv[1]);
-  if(!retval) {
-    debug_print("Could not open scripts dir browser: '%s'\n", error->message);
-    g_error_free(error);
+  MainWindow *mainwin;
+
+  mainwin =  mainwindow_get_mainwindow();
+  if(!mainwin) {
+      debug_print("Browse Python scripts: Problems getting the mainwindow\n");
+      return;
+  }
+  launch_context = gdk_app_launch_context_new();
+  gdk_app_launch_context_set_screen(launch_context, gtk_widget_get_screen(mainwin->window));
+  uri = g_strconcat("file://", get_rc_dir(), G_DIR_SEPARATOR_S, PYTHON_SCRIPTS_BASE_DIR, G_DIR_SEPARATOR_S, NULL);
+  g_app_info_launch_default_for_uri(uri, launch_context, &error);
+
+  if(error) {
+      debug_print("Could not open scripts dir browser: '%s'\n", error->message);
+      g_error_free(error);
   }
+
+  g_object_unref(launch_context);
+  g_free(uri);
 }
 
 static void refresh_python_scripts_menus(GtkAction *action, gpointer data)

Index: Makefile.am
===================================================================
RCS file: /home/claws-mail/plugins/python/src/Attic/Makefile.am,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -d -r1.1.2.4 -r1.1.2.5
--- Makefile.am	3 Sep 2009 22:09:23 -0000	1.1.2.4
+++ Makefile.am	13 Aug 2012 22:12:36 -0000	1.1.2.5
@@ -22,6 +22,7 @@
 
 python_plugin_la_LDFLAGS = \
 	-avoid-version -module \
+	$(GLIB_LIBS) \
 	$(GTK_LIBS) \
 	$(PYGTK_LIBS) \
 	$(PYTHON_LIBS)



More information about the Commits mailing list