diff options
author | monsta <[email protected]> | 2016-11-23 18:15:54 +0300 |
---|---|---|
committer | monsta <[email protected]> | 2016-11-23 18:15:54 +0300 |
commit | ae5f4711a21508a70d7123dbc0efb610af1289a2 (patch) | |
tree | 54d4a9de3b092aa772ed8799fcf30e11e19ff93f /shell/ev-window.c | |
parent | 7884bbe50fe8b8c26e68b8077c18047861c2dd0c (diff) | |
download | atril-ae5f4711a21508a70d7123dbc0efb610af1289a2.tar.bz2 atril-ae5f4711a21508a70d7123dbc0efb610af1289a2.tar.xz |
move to GTK+3 (>= 3.14), drop GTK+2 code and --with-gtk build option
and require caja >= 1.17.1
Diffstat (limited to 'shell/ev-window.c')
-rw-r--r-- | shell/ev-window.c | 136 |
1 files changed, 2 insertions, 134 deletions
diff --git a/shell/ev-window.c b/shell/ev-window.c index 20effead..f2e07e5d 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -101,10 +101,6 @@ #include "ev-media-player-keys.h" #endif /* ENABLE_DBUS */ -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#endif - typedef enum { PAGE_MODE_DOCUMENT, PAGE_MODE_PASSWORD @@ -533,7 +529,6 @@ ev_window_update_actions (EvWindow *ev_window) ev_view_get_has_selection (view)); } #if ENABLE_EPUB -#if GTK_CHECK_VERSION (3, 0, 0) else if (webview) { /* * The webkit2 function for this is an asynchronous call, @@ -543,13 +538,6 @@ ev_window_update_actions (EvWindow *ev_window) ev_window_set_action_sensitive (ev_window,"EditCopy", has_pages); } -#else - else if(webview) { - ev_window_set_action_sensitive (ev_window, "EditCopy", - has_pages && - ev_web_view_get_has_selection (webview)); - } -#endif #endif ev_window_set_action_sensitive (ev_window, "EditFindNext", has_pages && can_find_in_page); @@ -983,17 +971,6 @@ view_selection_changed_cb (EvView *view, ev_window_set_action_sensitive (window, "EditCopy", ev_view_get_has_selection (view)); } -#if ENABLE_EPUB -#if !GTK_CHECK_VERSION (3, 0, 0) -static void -web_view_selection_changed_cb(EvWebView *webview, - EvWindow *window) -{ - ev_window_set_action_sensitive (window,"EditCopy", - ev_web_view_get_has_selection(webview)); -} -#endif -#endif static void view_layers_changed_cb (EvView *view, @@ -3098,12 +3075,6 @@ ev_window_cmd_save_as (GtkAction *action, EvWindow *ev_window) ev_document_factory_add_filters (fc, ev_window->priv->document); gtk_dialog_set_default_response (GTK_DIALOG (fc), GTK_RESPONSE_OK); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_dialog_set_alternative_button_order (GTK_DIALOG (fc), - GTK_RESPONSE_OK, - GTK_RESPONSE_CANCEL, - -1); -#endif gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (fc), FALSE); gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (fc), TRUE); @@ -3145,12 +3116,7 @@ ev_window_cmd_send_to (GtkAction *action, GdkScreen *screen; screen = gtk_window_get_screen (GTK_WINDOW (ev_window)); -#if GTK_CHECK_VERSION (3, 0, 0) context = gdk_display_get_app_launch_context (gdk_screen_get_display (screen)); -#else - context = gdk_app_launch_context_new (); - gdk_app_launch_context_set_display (context, gdk_screen_get_display (screen)); -#endif gdk_app_launch_context_set_screen (context, screen); gdk_app_launch_context_set_timestamp (context, gtk_get_current_event_time ()); g_app_info_launch (app_info, NULL, G_APP_LAUNCH_CONTEXT (context), &error); @@ -3740,13 +3706,6 @@ ev_window_check_document_modified (EvWindow *ev_window) GTK_RESPONSE_YES, NULL); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_YES); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), - GTK_RESPONSE_YES, - GTK_RESPONSE_NO, - GTK_RESPONSE_CANCEL, - -1); -#endif g_signal_connect (dialog, "response", G_CALLBACK (document_modified_confirmation_dialog_response), @@ -3845,13 +3804,6 @@ ev_window_check_print_queue (EvWindow *ev_window) GTK_RESPONSE_YES, NULL); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_YES); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), - GTK_RESPONSE_YES, - GTK_RESPONSE_NO, - GTK_RESPONSE_CANCEL, - -1); -#endif g_signal_connect (dialog, "response", G_CALLBACK (print_jobs_confirmation_dialog_response), @@ -4116,7 +4068,6 @@ fullscreen_toolbar_setup_item_properties (GtkUIManager *ui_manager) static void fullscreen_toolbar_remove_shadow (GtkWidget *toolbar) { -#if GTK_CHECK_VERSION (3, 0, 0) GtkCssProvider *provider; gtk_widget_set_name (toolbar, "ev-fullscreen-toolbar"); @@ -4131,25 +4082,6 @@ fullscreen_toolbar_remove_shadow (GtkWidget *toolbar) GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); g_object_unref (provider); } -#else - static gboolean done = FALSE; - - if (!done) { - gtk_rc_parse_string ( - "\n" - " style \"fullscreen-toolbar-style\"\n" - " {\n" - " GtkToolbar::shadow-type=GTK_SHADOW_NONE\n" - " }\n" - "\n" - " widget \"*.fullscreen-toolbar\" style \"fullscreen-toolbar-style\"\n" - "\n"); - done = TRUE; - } - - gtk_widget_set_name (toolbar, "fullscreen-toolbar"); -} -#endif static void ev_window_run_fullscreen (EvWindow *window) @@ -4625,11 +4557,7 @@ ev_window_cmd_edit_toolbar (GtkAction *action, EvWindow *ev_window) gtk_container_set_border_width (GTK_CONTAINER (editor), 5); gtk_box_set_spacing (GTK_BOX (EGG_TOOLBAR_EDITOR (editor)), 5); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_box_pack_start (GTK_BOX (content_area), editor, TRUE, TRUE, 0); -#else - gtk_container_add (GTK_CONTAINER (content_area), editor); -#endif egg_editable_toolbar_set_edit_mode (toolbar, TRUE); @@ -5688,9 +5616,6 @@ find_bar_visibility_changed_cb (EggFindBar *find_bar, } #if ENABLE_EPUB else { -#if !GTK_CHECK_VERSION(3, 0, 0) - ev_web_view_find_set_highlight_search(EV_WEB_VIEW(ev_window->priv->webview),visible); -#endif ev_web_view_find_search_changed(EV_WEB_VIEW(ev_window->priv->webview)); ev_web_view_set_handler(EV_WEB_VIEW(ev_window->priv->webview),visible); } @@ -6684,12 +6609,8 @@ launch_action (EvWindow *window, EvLinkAction *action) GAppInfo *app_info; GFile *file; GList file_list = {NULL}; -#if GTK_CHECK_VERSION (3, 0, 0) GdkAppLaunchContext *context; GdkScreen *screen; -#else - GAppLaunchContext *context; -#endif GError *error = NULL; if (filename == NULL) @@ -6720,7 +6641,6 @@ launch_action (EvWindow *window, EvLinkAction *action) return; } -#if GTK_CHECK_VERSION (3, 0, 0) screen = gtk_window_get_screen (GTK_WINDOW (window)); context = gdk_display_get_app_launch_context (gdk_screen_get_display (screen)); gdk_app_launch_context_set_screen (context, screen); @@ -6728,16 +6648,6 @@ launch_action (EvWindow *window, EvLinkAction *action) file_list.data = file; if (!g_app_info_launch (app_info, &file_list, G_APP_LAUNCH_CONTEXT (context), &error)) { -#else - context = G_APP_LAUNCH_CONTEXT (gdk_app_launch_context_new ()); - gdk_app_launch_context_set_screen (GDK_APP_LAUNCH_CONTEXT (context), - gtk_window_get_screen (GTK_WINDOW (window))); - gdk_app_launch_context_set_timestamp (GDK_APP_LAUNCH_CONTEXT (context), - gtk_get_current_event_time ()); - - file_list.data = file; - if (!g_app_info_launch (app_info, &file_list, context, &error)) { -#endif ev_window_error_message (window, error, "%s", _("Unable to launch external application.")); @@ -6758,7 +6668,6 @@ launch_external_uri (EvWindow *window, EvLinkAction *action) const gchar *uri = ev_link_action_get_uri (action); GError *error = NULL; gboolean ret; -#if GTK_CHECK_VERSION (3, 0, 0) GdkAppLaunchContext *context; GdkScreen *screen; @@ -6766,15 +6675,6 @@ launch_external_uri (EvWindow *window, EvLinkAction *action) context = gdk_display_get_app_launch_context (gdk_screen_get_display (screen)); gdk_app_launch_context_set_screen (context, screen); gdk_app_launch_context_set_timestamp (context, gtk_get_current_event_time ()); -#else - GAppLaunchContext *context; - - context = G_APP_LAUNCH_CONTEXT (gdk_app_launch_context_new ()); - gdk_app_launch_context_set_screen (GDK_APP_LAUNCH_CONTEXT (context), - gtk_window_get_screen (GTK_WINDOW (window))); - gdk_app_launch_context_set_timestamp (GDK_APP_LAUNCH_CONTEXT (context), - gtk_get_current_event_time ()); -#endif if (!g_strstr_len (uri, strlen (uri), "://") && !g_str_has_prefix (uri, "mailto:")) { @@ -6799,17 +6699,10 @@ launch_external_uri (EvWindow *window, EvLinkAction *action) new_uri = g_strdup_printf ("file:///%s", uri); } } -#if GTK_CHECK_VERSION (3, 0, 0) ret = g_app_info_launch_default_for_uri (new_uri, G_APP_LAUNCH_CONTEXT (context), &error); g_free (new_uri); } else { ret = g_app_info_launch_default_for_uri (uri, G_APP_LAUNCH_CONTEXT (context), &error); -#else - ret = g_app_info_launch_default_for_uri (new_uri, context, &error); - g_free (new_uri); - } else { - ret = g_app_info_launch_default_for_uri (uri, context, &error); -#endif } if (ret == FALSE) { @@ -7081,12 +6974,6 @@ ev_view_popup_cmd_save_image_as (GtkAction *action, EvWindow *window) NULL); gtk_dialog_set_default_response (GTK_DIALOG (fc), GTK_RESPONSE_OK); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_dialog_set_alternative_button_order (GTK_DIALOG (fc), - GTK_RESPONSE_OK, - GTK_RESPONSE_CANCEL, - -1); -#endif gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (fc), FALSE); gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (fc), TRUE); @@ -7318,12 +7205,6 @@ ev_attachment_popup_cmd_save_attachment_as (GtkAction *action, EvWindow *window) NULL); gtk_dialog_set_default_response (GTK_DIALOG (fc), GTK_RESPONSE_OK); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_dialog_set_alternative_button_order (GTK_DIALOG (fc), - GTK_RESPONSE_OK, - GTK_RESPONSE_CANCEL, - -1); -#endif gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (fc), TRUE); gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (fc), FALSE); @@ -7663,14 +7544,12 @@ ev_window_init (EvWindow *ev_window) ev_window->priv->chrome = EV_CHROME_NORMAL; ev_window->priv->title = ev_window_title_new (ev_window); -#if GTK_CHECK_VERSION(3, 0, 0) GtkStyleContext *context; context = gtk_widget_get_style_context (GTK_WIDGET (ev_window)); gtk_style_context_add_class (context, "atril-window"); -#endif - ev_window->priv->main_box = gtk_vbox_new (FALSE, 0); + ev_window->priv->main_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_container_add (GTK_CONTAINER (ev_window), ev_window->priv->main_box); gtk_widget_show (ev_window->priv->main_box); @@ -7753,10 +7632,8 @@ ev_window_init (EvWindow *ev_window) NULL)); g_object_unref (toolbars_model); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (ev_window->priv->toolbar)), GTK_STYLE_CLASS_PRIMARY_TOOLBAR); -#endif egg_editable_toolbar_show (EGG_EDITABLE_TOOLBAR (ev_window->priv->toolbar), "DefaultToolBar"); @@ -7766,11 +7643,7 @@ ev_window_init (EvWindow *ev_window) gtk_widget_show (ev_window->priv->toolbar); /* Add the main area */ -#if GTK_CHECK_VERSION (3, 0, 0) ev_window->priv->hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); -#else - ev_window->priv->hpaned = gtk_hpaned_new (); -#endif g_signal_connect (ev_window->priv->hpaned, "notify::position", G_CALLBACK (ev_window_sidebar_position_change_cb), @@ -7864,7 +7737,7 @@ ev_window_init (EvWindow *ev_window) ev_sidebar_add_page (EV_SIDEBAR (ev_window->priv->sidebar), sidebar_widget); - ev_window->priv->view_box = gtk_vbox_new (FALSE, 0); + ev_window->priv->view_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); ev_window->priv->scrolled_window = GTK_WIDGET (g_object_new (GTK_TYPE_SCROLLED_WINDOW, "shadow-type", GTK_SHADOW_IN, @@ -7883,11 +7756,6 @@ ev_window_init (EvWindow *ev_window) #if ENABLE_EPUB /*The webview, we won't add it now but it will replace the atril-view if a web(epub) document is encountered.*/ ev_window->priv->webview = ev_web_view_new(); ev_web_view_set_model(EV_WEB_VIEW(ev_window->priv->webview),ev_window->priv->model); -#if !GTK_CHECK_VERSION (3, 0, 0) - g_signal_connect_object (ev_window->priv->webview,"selection-changed", - G_CALLBACK(web_view_selection_changed_cb), - ev_window, 0); -#endif #endif page_cache_mb = g_settings_get_uint (ev_window_ensure_settings (ev_window), GS_PAGE_CACHE_SIZE); |