diff options
Diffstat (limited to 'shell')
-rw-r--r-- | shell/eggfindbar.c | 3 | ||||
-rw-r--r-- | shell/ev-annotation-properties-dialog.c | 30 | ||||
-rw-r--r-- | shell/ev-application.c | 71 | ||||
-rw-r--r-- | shell/ev-convert-metadata.c | 4 | ||||
-rw-r--r-- | shell/ev-navigation-action-widget.c | 4 | ||||
-rw-r--r-- | shell/ev-password-view.c | 2 | ||||
-rw-r--r-- | shell/ev-properties-dialog.c | 2 | ||||
-rw-r--r-- | shell/ev-sidebar-attachments.c | 16 | ||||
-rw-r--r-- | shell/ev-sidebar-thumbnails.c | 2 | ||||
-rw-r--r-- | shell/ev-sidebar.c | 28 | ||||
-rw-r--r-- | shell/ev-utils.c | 8 | ||||
-rw-r--r-- | shell/ev-window.c | 13 | ||||
-rw-r--r-- | shell/main.c | 22 |
13 files changed, 140 insertions, 65 deletions
diff --git a/shell/eggfindbar.c b/shell/eggfindbar.c index b557b44b..f4932160 100644 --- a/shell/eggfindbar.c +++ b/shell/eggfindbar.c @@ -23,6 +23,9 @@ #include <glib/gi18n.h> #include <gtk/gtk.h> #include <gdk/gdkkeysyms.h> +#if GTK_CHECK_VERSION (3, 0, 0) +#include <gdk/gdkkeysyms-compat.h> +#endif #include "eggfindbar.h" diff --git a/shell/ev-annotation-properties-dialog.c b/shell/ev-annotation-properties-dialog.c index 837d6164..40f8a972 100644 --- a/shell/ev-annotation-properties-dialog.c +++ b/shell/ev-annotation-properties-dialog.c @@ -100,17 +100,17 @@ ev_annotation_properties_dialog_constructed (GObject *object) GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (label); - dialog->icon = gtk_combo_box_new_text (); - gtk_combo_box_append_text (GTK_COMBO_BOX (dialog->icon), _("Note")); - gtk_combo_box_append_text (GTK_COMBO_BOX (dialog->icon), _("Comment")); - gtk_combo_box_append_text (GTK_COMBO_BOX (dialog->icon), _("Key")); - gtk_combo_box_append_text (GTK_COMBO_BOX (dialog->icon), _("Help")); - gtk_combo_box_append_text (GTK_COMBO_BOX (dialog->icon), _("New Paragraph")); - gtk_combo_box_append_text (GTK_COMBO_BOX (dialog->icon), _("Paragraph")); - gtk_combo_box_append_text (GTK_COMBO_BOX (dialog->icon), _("Insert")); - gtk_combo_box_append_text (GTK_COMBO_BOX (dialog->icon), _("Cross")); - gtk_combo_box_append_text (GTK_COMBO_BOX (dialog->icon), _("Circle")); - gtk_combo_box_append_text (GTK_COMBO_BOX (dialog->icon), _("Unknown")); + dialog->icon = gtk_combo_box_text_new (); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dialog->icon), _("Note")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dialog->icon), _("Comment")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dialog->icon), _("Key")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dialog->icon), _("Help")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dialog->icon), _("New Paragraph")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dialog->icon), _("Paragraph")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dialog->icon), _("Insert")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dialog->icon), _("Cross")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dialog->icon), _("Circle")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dialog->icon), _("Unknown")); gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->icon), 0); gtk_table_attach (GTK_TABLE (table), dialog->icon, 1, 2, 5, 6, @@ -139,7 +139,9 @@ ev_annotation_properties_dialog_init (EvAnnotationPropertiesDialog *annot_dialog gtk_window_set_title (GTK_WINDOW (annot_dialog), _("Annotation Properties")); gtk_window_set_destroy_with_parent (GTK_WINDOW (annot_dialog), TRUE); gtk_container_set_border_width (GTK_CONTAINER (annot_dialog), 5); +#if !GTK_CHECK_VERSION (3, 0, 0) gtk_dialog_set_has_separator (dialog, FALSE); +#endif gtk_dialog_add_buttons (dialog, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, GTK_STOCK_APPLY, GTK_RESPONSE_APPLY, @@ -222,9 +224,9 @@ ev_annotation_properties_dialog_init (EvAnnotationPropertiesDialog *annot_dialog GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (label); - annot_dialog->popup_state = gtk_combo_box_new_text (); - gtk_combo_box_append_text (GTK_COMBO_BOX (annot_dialog->popup_state), _("Open")); - gtk_combo_box_append_text (GTK_COMBO_BOX (annot_dialog->popup_state), _("Close")); + annot_dialog->popup_state = gtk_combo_box_text_new (); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (annot_dialog->popup_state), _("Open")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (annot_dialog->popup_state), _("Close")); gtk_combo_box_set_active (GTK_COMBO_BOX (annot_dialog->popup_state), 1); gtk_table_attach (GTK_TABLE (table), annot_dialog->popup_state, 1, 2, 4, 5, diff --git a/shell/ev-application.c b/shell/ev-application.c index 1e762b6f..96d9691b 100644 --- a/shell/ev-application.c +++ b/shell/ev-application.c @@ -224,17 +224,6 @@ ev_display_open_if_needed (const gchar *name) } static void -child_setup (gpointer user_data) -{ - gchar *startup_id; - - startup_id = g_strdup_printf ("_TIME%lu", - (unsigned long)GPOINTER_TO_INT (user_data)); - g_setenv ("DESKTOP_STARTUP_ID", startup_id, TRUE); - g_free (startup_id); -} - -static void ev_spawn (const char *uri, GdkScreen *screen, EvLinkDest *dest, @@ -242,69 +231,83 @@ ev_spawn (const char *uri, const gchar *search_string, guint timestamp) { - gchar *argv[6]; - guint arg = 0; - gint i; - gboolean res; + GString *cmd; + gchar *path, *cmdline; + GAppInfo *app; + GdkAppLaunchContext *ctx; GError *error = NULL; + cmd = g_string_new (NULL); + #ifdef G_OS_WIN32 { gchar *dir; dir = g_win32_get_package_installation_directory_of_module (NULL); - argv[arg++] = g_build_filename (dir, "bin", "atril", NULL); + path = g_build_filename (dir, "bin", "atril", NULL); g_free (dir); } #else - argv[arg++] = g_build_filename (BINDIR, "atril", NULL); + path = g_build_filename (BINDIR, "atril", NULL); #endif + g_string_append_printf (cmd, " %s", path); + g_free (path); + /* Page label */ if (dest) { const gchar *page_label; page_label = ev_link_dest_get_page_label (dest); if (page_label) - argv[arg++] = g_strdup_printf ("--page-label=%s", page_label); + g_string_append_printf (cmd, " --page-label=%s", page_label); else - argv[arg++] = g_strdup_printf ("--page-label=%d", - ev_link_dest_get_page (dest)); + g_string_append_printf (cmd, " --page-label=%d", ev_link_dest_get_page (dest)); } /* Find string */ if (search_string) { - argv[arg++] = g_strdup_printf ("--find=%s", search_string); + g_string_append_printf (cmd, " --find=%s", search_string); } /* Mode */ switch (mode) { case EV_WINDOW_MODE_FULLSCREEN: - argv[arg++] = g_strdup ("-f"); + g_string_append (cmd, " -f"); break; case EV_WINDOW_MODE_PRESENTATION: - argv[arg++] = g_strdup ("-s"); + g_string_append (cmd, " -s"); break; default: break; } - argv[arg++] = (gchar *)uri; - argv[arg] = NULL; + g_string_append_printf (cmd, " %s", uri); - res = gdk_spawn_on_screen (screen, NULL /* wd */, argv, NULL /* env */, - 0, - child_setup, - GINT_TO_POINTER(timestamp), - NULL, &error); - if (!res) { + cmdline = g_string_free (cmd, FALSE); + app = g_app_info_create_from_commandline (cmdline, NULL, 0, &error); + + if (app != NULL) { +#if GTK_CHECK_VERSION (3, 0, 0) + ctx = gdk_display_get_app_launch_context (gdk_screen_get_display (screen)); +#else + ctx = gdk_app_launch_context_new (); + gdk_app_launch_context_set_display (ctx, gdk_screen_get_display (screen)); +#endif + gdk_app_launch_context_set_screen (ctx, screen); + gdk_app_launch_context_set_timestamp (ctx, timestamp); + + g_app_info_launch (app, NULL, G_APP_LAUNCH_CONTEXT (ctx), &error); + + g_object_unref (app); + g_object_unref (ctx); + } + if (error != NULL) { g_warning ("Error launching atril %s: %s\n", uri, error->message); g_error_free (error); } - for (i = 0; i < arg - 1; i++) { - g_free (argv[i]); - } + g_free (cmdline); } static GList * diff --git a/shell/ev-convert-metadata.c b/shell/ev-convert-metadata.c index 270206b1..5664253b 100644 --- a/shell/ev-convert-metadata.c +++ b/shell/ev-convert-metadata.c @@ -164,7 +164,11 @@ show_progress_dialog (ConvertData *data) dialog = gtk_dialog_new_with_buttons (_("Converting metadata"), NULL, +#if GTK_CHECK_VERSION (3, 0, 0) + GTK_DIALOG_MODAL, +#else GTK_DIALOG_NO_SEPARATOR, +#endif GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL); action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog)); diff --git a/shell/ev-navigation-action-widget.c b/shell/ev-navigation-action-widget.c index 95c7fdff..57a490ea 100644 --- a/shell/ev-navigation-action-widget.c +++ b/shell/ev-navigation-action-widget.c @@ -134,7 +134,11 @@ menu_position_func (GtkMenu *menu, gint monitor_num; GdkScreen *screen; +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_get_preferred_size (GTK_WIDGET (button->menu), &menu_req, NULL); +#else gtk_widget_size_request (GTK_WIDGET (button->menu), &menu_req); +#endif direction = gtk_widget_get_direction (widget); screen = gtk_widget_get_screen (GTK_WIDGET (menu)); diff --git a/shell/ev-password-view.c b/shell/ev-password-view.c index 73ebbdef..b6ead823 100644 --- a/shell/ev-password-view.c +++ b/shell/ev-password-view.c @@ -255,7 +255,9 @@ ev_password_view_ask_password (EvPasswordView *password_view) action_area = gtk_dialog_get_action_area (dialog); /* Set the dialog up with HIG properties */ +#if !GTK_CHECK_VERSION (3, 0, 0) gtk_dialog_set_has_separator (dialog, FALSE); +#endif gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); gtk_box_set_spacing (GTK_BOX (content_area), 2); /* 2 * 5 + 2 = 12 */ gtk_container_set_border_width (GTK_CONTAINER (action_area), 5); diff --git a/shell/ev-properties-dialog.c b/shell/ev-properties-dialog.c index f520a733..cefedbd6 100644 --- a/shell/ev-properties-dialog.c +++ b/shell/ev-properties-dialog.c @@ -61,7 +61,9 @@ ev_properties_dialog_init (EvPropertiesDialog *properties) gtk_window_set_title (GTK_WINDOW (properties), _("Properties")); gtk_window_set_destroy_with_parent (GTK_WINDOW (properties), TRUE); +#if !GTK_CHECK_VERSION (3, 0, 0) gtk_dialog_set_has_separator (GTK_DIALOG (properties), FALSE); +#endif gtk_container_set_border_width (GTK_CONTAINER (properties), 5); gtk_box_set_spacing (content_area, 2); diff --git a/shell/ev-sidebar-attachments.c b/shell/ev-sidebar-attachments.c index b26711cb..989c60d5 100644 --- a/shell/ev-sidebar-attachments.c +++ b/shell/ev-sidebar-attachments.c @@ -472,7 +472,11 @@ ev_sidebar_attachments_get_property (GObject *object, } static void +#if GTK_CHECK_VERSION (3, 0, 0) +ev_sidebar_attachments_dispose (GObject *object) +#else ev_sidebar_attachments_destroy (GtkObject *object) +#endif { EvSidebarAttachments *ev_attachbar = EV_SIDEBAR_ATTACHMENTS (object); @@ -494,22 +498,34 @@ ev_sidebar_attachments_destroy (GtkObject *object) ev_attachbar->priv->icon_cache = NULL; } +#if GTK_CHECK_VERSION (3, 0, 0) + (* G_OBJECT_CLASS (ev_sidebar_attachments_parent_class)->dispose) (object); +#else (* GTK_OBJECT_CLASS (ev_sidebar_attachments_parent_class)->destroy) (object); +#endif } static void ev_sidebar_attachments_class_init (EvSidebarAttachmentsClass *ev_attachbar_class) { GObjectClass *g_object_class; +#if !GTK_CHECK_VERSION (3, 0, 0) GtkObjectClass *gtk_object_class; +#endif GtkWidgetClass *gtk_widget_class; g_object_class = G_OBJECT_CLASS (ev_attachbar_class); +#if !GTK_CHECK_VERSION (3, 0, 0) gtk_object_class = GTK_OBJECT_CLASS (ev_attachbar_class); +#endif gtk_widget_class = GTK_WIDGET_CLASS (ev_attachbar_class); g_object_class->get_property = ev_sidebar_attachments_get_property; +#if GTK_CHECK_VERSION (3, 0, 0) + g_object_class->dispose = ev_sidebar_attachments_dispose; +#else gtk_object_class->destroy = ev_sidebar_attachments_destroy; +#endif gtk_widget_class->popup_menu = ev_sidebar_attachments_popup_menu; gtk_widget_class->screen_changed = ev_sidebar_attachments_screen_changed; diff --git a/shell/ev-sidebar-thumbnails.c b/shell/ev-sidebar-thumbnails.c index 901bdade..913d8504 100644 --- a/shell/ev-sidebar-thumbnails.c +++ b/shell/ev-sidebar-thumbnails.c @@ -299,11 +299,9 @@ static void ev_sidebar_thumbnails_class_init (EvSidebarThumbnailsClass *ev_sidebar_thumbnails_class) { GObjectClass *g_object_class; - GtkObjectClass *gtk_object_class; GtkWidgetClass *widget_class; g_object_class = G_OBJECT_CLASS (ev_sidebar_thumbnails_class); - gtk_object_class = GTK_OBJECT_CLASS (ev_sidebar_thumbnails_class); widget_class = GTK_WIDGET_CLASS (ev_sidebar_thumbnails_class); g_object_class->dispose = ev_sidebar_thumbnails_dispose; diff --git a/shell/ev-sidebar.c b/shell/ev-sidebar.c index e9d0f75a..4d8a1de0 100644 --- a/shell/ev-sidebar.c +++ b/shell/ev-sidebar.c @@ -28,6 +28,9 @@ #include <gtk/gtk.h> #include <gdk/gdkkeysyms.h> +#if GTK_CHECK_VERSION (3, 0, 0) +#include <gdk/gdkkeysyms-compat.h> +#endif #include "ev-sidebar.h" #include "ev-sidebar-page.h" @@ -64,7 +67,11 @@ G_DEFINE_TYPE (EvSidebar, ev_sidebar, GTK_TYPE_VBOX) (G_TYPE_INSTANCE_GET_PRIVATE ((object), EV_TYPE_SIDEBAR, EvSidebarPrivate)) static void +#if GTK_CHECK_VERSION (3, 0, 0) +ev_sidebar_dispose (GObject *object) +#else ev_sidebar_destroy (GtkObject *object) +#endif { EvSidebar *ev_sidebar = EV_SIDEBAR (object); @@ -78,8 +85,11 @@ ev_sidebar_destroy (GtkObject *object) ev_sidebar->priv->page_model = NULL; } - +#if GTK_CHECK_VERSION (3, 0, 0) + (* G_OBJECT_CLASS (ev_sidebar_parent_class)->dispose) (object); +#else (* GTK_OBJECT_CLASS (ev_sidebar_parent_class)->destroy) (object); +#endif } static void @@ -176,16 +186,22 @@ static void ev_sidebar_class_init (EvSidebarClass *ev_sidebar_class) { GObjectClass *g_object_class; - GtkWidgetClass *widget_class; +#if !GTK_CHECK_VERSION (3, 0, 0) GtkObjectClass *gtk_object_klass; - +#endif + g_object_class = G_OBJECT_CLASS (ev_sidebar_class); - widget_class = GTK_WIDGET_CLASS (ev_sidebar_class); +#if !GTK_CHECK_VERSION (3, 0, 0) gtk_object_klass = GTK_OBJECT_CLASS (ev_sidebar_class); +#endif g_type_class_add_private (g_object_class, sizeof (EvSidebarPrivate)); +#if GTK_CHECK_VERSION (3, 0, 0) + g_object_class->dispose = ev_sidebar_dispose; +#else gtk_object_klass->destroy = ev_sidebar_destroy; +#endif g_object_class->get_property = ev_sidebar_get_property; g_object_class->set_property = ev_sidebar_set_property; @@ -237,7 +253,11 @@ ev_sidebar_select_button_press_cb (GtkWidget *widget, gtk_widget_get_allocation (widget, &allocation); width = allocation.width; gtk_widget_set_size_request (ev_sidebar->priv->menu, -1, -1); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_get_preferred_size (ev_sidebar->priv->menu, &requisition, NULL); +#else gtk_widget_size_request (ev_sidebar->priv->menu, &requisition); +#endif gtk_widget_set_size_request (ev_sidebar->priv->menu, MAX (width, requisition.width), -1); diff --git a/shell/ev-utils.c b/shell/ev-utils.c index 83cfcdbc..1363cace 100644 --- a/shell/ev-utils.c +++ b/shell/ev-utils.c @@ -225,7 +225,11 @@ ev_gui_sanitise_popup_position (GtkMenu *menu, g_return_if_fail (widget != NULL); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_get_preferred_size (GTK_WIDGET (menu), &req, NULL); +#else gtk_widget_size_request (GTK_WIDGET (menu), &req); +#endif monitor_num = gdk_screen_get_monitor_at_point (screen, *x, *y); gtk_menu_set_monitor (menu, monitor_num); @@ -251,7 +255,11 @@ ev_gui_menu_position_tree_selection (GtkMenu *menu, GtkAllocation allocation; GdkRectangle visible; +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_get_preferred_size (GTK_WIDGET (menu), &req, NULL); +#else gtk_widget_size_request (GTK_WIDGET (menu), &req); +#endif gdk_window_get_origin (gtk_widget_get_window (widget), x, y); gtk_widget_get_allocation (widget, &allocation); diff --git a/shell/ev-window.c b/shell/ev-window.c index 7705a9ec..1f989f85 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -4157,7 +4157,9 @@ ev_window_cmd_edit_toolbar (GtkAction *action, EvWindow *ev_window) gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE); gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)), 5); gtk_box_set_spacing (GTK_BOX (content_area), 2); +#if !GTK_CHECK_VERSION (3, 0, 0) gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE); +#endif gtk_window_set_default_size (GTK_WINDOW (dialog), 500, 400); toolbar = EGG_EDITABLE_TOOLBAR (ev_window->priv->toolbar); @@ -4167,7 +4169,11 @@ 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); @@ -4592,7 +4598,7 @@ ev_window_cmd_help_about (GtkAction *action, EvWindow *ev_window) "name", _("Atril"), "version", VERSION, "copyright", - _("© 1996–2009 The Atril authors"), + _("© 1996–2009 The Evince authors\n© 2012–2014 The MATE developers"), "license", license_trans, "website", "http://www.mate-desktop.org/", "comments", comments, @@ -6816,6 +6822,11 @@ 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"); gtk_box_pack_start (GTK_BOX (ev_window->priv->main_box), diff --git a/shell/main.c b/shell/main.c index 7f00c6f9..3164d3da 100644 --- a/shell/main.c +++ b/shell/main.c @@ -92,8 +92,6 @@ launch_previewer (void) { GString *cmd_str; gchar *cmd; - gint argc; - gchar **argv; gboolean retval = FALSE; GError *error = NULL; @@ -123,16 +121,16 @@ launch_previewer (void) } cmd = g_string_free (cmd_str, FALSE); - g_shell_parse_argv (cmd, &argc, &argv, &error); - g_free (cmd); if (!error) { - retval = gdk_spawn_on_screen (gdk_screen_get_default (), - NULL, argv, NULL, - G_SPAWN_SEARCH_PATH, - NULL, NULL, NULL, - &error); - g_strfreev (argv); + GAppInfo *app; + + app = g_app_info_create_from_commandline (cmd, NULL, 0, &error); + + if (app != NULL) { + retval = g_app_info_launch (app, NULL, NULL, &error); + g_object_unref (app); + } } if (error) { @@ -140,6 +138,8 @@ launch_previewer (void) g_error_free (error); } + g_free (cmd); + return retval; } @@ -260,9 +260,11 @@ main (int argc, char *argv[]) } #endif +#if !GLIB_CHECK_VERSION (2, 32, 0) /* Init glib threads asap */ if (!g_thread_supported ()) g_thread_init (NULL); +#endif #ifdef ENABLE_NLS /* Initialize the i18n stuff */ |