From 5706c595970bc76e11feb56ed56c190452c076d6 Mon Sep 17 00:00:00 2001 From: Monsta Date: Sat, 10 Jan 2015 13:20:30 +0300 Subject: use mate_gdk_spawn_command_line_on_screen like other MATE apps do Closes https://github.com/mate-desktop/caja/pull/370 --- eel/eel-mate-extensions.c | 20 ++------------------ src/caja-window-menus.c | 34 ++++++++-------------------------- src/file-manager/fm-directory-view.c | 22 +++++----------------- 3 files changed, 15 insertions(+), 61 deletions(-) diff --git a/eel/eel-mate-extensions.c b/eel/eel-mate-extensions.c index f1974397..4d4e9beb 100644 --- a/eel/eel-mate-extensions.c +++ b/eel/eel-mate-extensions.c @@ -194,24 +194,8 @@ eel_mate_open_terminal_on_screen (const char *command, g_message ("Could not start a terminal"); return; } -#if GTK_CHECK_VERSION (3, 0, 0) - GdkAppLaunchContext *launch_context; - GAppInfo *app_info = NULL; - app_info = g_app_info_create_from_commandline (command_line, - NULL, - G_APP_INFO_CREATE_NONE, - NULL); - if (app_info != NULL) - { - launch_context = gdk_app_launch_context_new (); - gdk_app_launch_context_set_screen (launch_context, screen); - g_app_info_launch (app_info, NULL, G_APP_LAUNCH_CONTEXT (launch_context), NULL); - g_object_unref (launch_context); - g_object_unref (app_info); - } -#else - gdk_spawn_command_line_on_screen (screen, command_line, NULL); -#endif + + mate_gdk_spawn_command_line_on_screen(screen, command_line, NULL); g_free (command_line); } diff --git a/src/caja-window-menus.c b/src/caja-window-menus.c index 2fc0d640..368fd508 100644 --- a/src/caja-window-menus.c +++ b/src/caja-window-menus.c @@ -43,7 +43,6 @@ #include #include #include -#include #include #include #include @@ -55,6 +54,11 @@ #include #include #include + +#define MATE_DESKTOP_USE_UNSTABLE_API +#include +#include + #include #define MENU_PATH_EXTENSION_ACTIONS "/MenuBar/File/Extension Actions" @@ -576,31 +580,9 @@ action_caja_manual_callback (GtkAction *action, if (CAJA_IS_DESKTOP_WINDOW (window)) { -#if GTK_CHECK_VERSION (3, 0, 0) - GdkScreen *screen; - GdkAppLaunchContext *launch_context; - GAppInfo *app_info = NULL; - app_info = g_app_info_create_from_commandline ("mate-help", - NULL, - G_APP_INFO_CREATE_NONE, - &error); - if (error == NULL) - { - screen = gtk_window_get_screen(GTK_WINDOW(window)); - launch_context = gdk_app_launch_context_new (); - gdk_app_launch_context_set_screen (launch_context, screen); - g_app_info_launch (app_info, NULL, G_APP_LAUNCH_CONTEXT (launch_context), &error); - g_object_unref (launch_context); - } - if (app_info != NULL) - g_object_unref (app_info); -#else -#if GTK_CHECK_VERSION (2, 24, 0) - gdk_spawn_command_line_on_screen(gtk_window_get_screen(GTK_WINDOW(window)), "mate-help", &error); -#else - g_spawn_command_line_async("mate-help", &error); -#endif -#endif + mate_gdk_spawn_command_line_on_screen(gtk_window_get_screen(GTK_WINDOW(window)), + "mate-help", + &error); } else { diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c index 74fb6067..7efa3494 100644 --- a/src/file-manager/fm-directory-view.c +++ b/src/file-manager/fm-directory-view.c @@ -83,6 +83,9 @@ #include #include +#define MATE_DESKTOP_USE_UNSTABLE_API +#include + #include /* for g_list_free_full */ /* Minimum starting update inverval */ @@ -10195,23 +10198,8 @@ fm_directory_view_move_copy_items (const GList *item_uris, if (screen == NULL) { screen = gdk_screen_get_default (); } -#if GTK_CHECK_VERSION (3, 0, 0) - GdkAppLaunchContext *launch_context; - GAppInfo *app_info = NULL; - app_info = g_app_info_create_from_commandline (command, - NULL, - G_APP_INFO_CREATE_NONE, - NULL); - if (app_info != NULL) { - launch_context = gdk_app_launch_context_new (); - gdk_app_launch_context_set_screen (launch_context, screen); - g_app_info_launch (app_info, NULL, G_APP_LAUNCH_CONTEXT (launch_context), NULL); - g_object_unref (launch_context); - g_object_unref (app_info); - } -#else - gdk_spawn_command_line_on_screen (screen, command, NULL); -#endif + + mate_gdk_spawn_command_line_on_screen(screen, command, NULL); g_free (command); return; -- cgit v1.2.1