From a823c728f14e2600fbbcd6ad14e6305331e80bf2 Mon Sep 17 00:00:00 2001 From: Stefano Karapetsas Date: Thu, 25 Jul 2013 15:13:25 +0200 Subject: src: Add GTK3/GDK3 support --- src/caja-window-menus.c | 26 +++++++++++++++++++++----- src/caja-window.c | 6 +++--- src/file-manager/fm-directory-view.c | 16 ++++++++++++++++ 3 files changed, 40 insertions(+), 8 deletions(-) diff --git a/src/caja-window-menus.c b/src/caja-window-menus.c index 82d4c4d6..5d1bd371 100644 --- a/src/caja-window-menus.c +++ b/src/caja-window-menus.c @@ -574,15 +574,31 @@ action_caja_manual_callback (GtkAction *action, if (CAJA_IS_DESKTOP_WINDOW (window)) { -#if GTK_CHECK_VERSION(2, 24, 0) +#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 } else { diff --git a/src/caja-window.c b/src/caja-window.c index 782e2607..365c3696 100644 --- a/src/caja-window.c +++ b/src/caja-window.c @@ -189,10 +189,10 @@ caja_window_init (CajaWindow *window) g_signal_connect_object (caja_signaller_get_current (), "popup_menu_changed", G_CALLBACK (caja_window_load_extension_menus), window, G_CONNECT_SWAPPED); +/* Keep the main event loop alive as long as the window exists */ #if GTK_CHECK_VERSION(3, 0, 0) - gtk_quit_add_destroy (1, GTK_WIDGET (window)); - - /* Keep the main event loop alive as long as the window exists */ + /* FIXME: port to GtkApplication with GTK3 */ + //gtk_quit_add_destroy (1, GTK_WIDGET (window)); caja_main_event_loop_register (GTK_WIDGET (window)); #else gtk_quit_add_destroy (1, GTK_OBJECT (window)); diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c index 8b1afaaf..0309f86b 100644 --- a/src/file-manager/fm-directory-view.c +++ b/src/file-manager/fm-directory-view.c @@ -10098,7 +10098,23 @@ 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 g_free (command); return; -- cgit v1.2.1