Commit 09b70ca9 authored by Germán Poo-Caamaño's avatar Germán Poo-Caamaño

shell: Fix Gtk Stock deprecated symbols on message area

parent 3f00f441
/* ev-message-area.c
* this file is part of evince, a gnome document viewer
*
* Copyright (C) 2007 Carlos Garcia Campos
*
* Author:
* Carlos Garcia Campos <carlosgc@gnome.org>
* Copyright (C) 2007 Carlos Garcia Campos <carlosgc@gnome.org>
* Copyright (C) 2018 Germán Poo-Caamaño <gpoo@gnome.org>
*
* Evince is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
......@@ -121,7 +119,7 @@ ev_message_area_init (EvMessageArea *area)
gtk_widget_set_can_focus (area->priv->secondary_label, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), area->priv->secondary_label, TRUE, TRUE, 0);
area->priv->image = gtk_image_new_from_stock (NULL, GTK_ICON_SIZE_DIALOG);
area->priv->image = gtk_image_new_from_icon_name (NULL, GTK_ICON_SIZE_DIALOG);
gtk_misc_set_alignment (GTK_MISC (area->priv->image), 0.5, 0.0);
gtk_box_pack_start (GTK_BOX (hbox), area->priv->image, FALSE, FALSE, 0);
gtk_widget_show (area->priv->image);
......@@ -141,21 +139,21 @@ static void
ev_message_area_set_image_for_type (EvMessageArea *area,
GtkMessageType type)
{
const gchar *stock_id = NULL;
const gchar *icon_name = NULL;
AtkObject *atk_obj;
switch (type) {
case GTK_MESSAGE_INFO:
stock_id = GTK_STOCK_DIALOG_INFO;
icon_name = "dialog-information-symbolic";
break;
case GTK_MESSAGE_QUESTION:
stock_id = GTK_STOCK_DIALOG_QUESTION;
icon_name = "dialog-question-symbolic";
break;
case GTK_MESSAGE_WARNING:
stock_id = GTK_STOCK_DIALOG_WARNING;
icon_name = "dialog-warning-symbolic";
break;
case GTK_MESSAGE_ERROR:
stock_id = GTK_STOCK_DIALOG_ERROR;
icon_name = "dialog-error-symbolic";
break;
case GTK_MESSAGE_OTHER:
break;
......@@ -164,18 +162,16 @@ ev_message_area_set_image_for_type (EvMessageArea *area,
break;
}
if (stock_id)
gtk_image_set_from_stock (GTK_IMAGE (area->priv->image), stock_id,
GTK_ICON_SIZE_DIALOG);
if (icon_name)
gtk_image_set_from_icon_name (GTK_IMAGE (area->priv->image),
icon_name,
GTK_ICON_SIZE_DIALOG);
atk_obj = gtk_widget_get_accessible (GTK_WIDGET (area));
if (GTK_IS_ACCESSIBLE (atk_obj)) {
atk_object_set_role (atk_obj, ATK_ROLE_ALERT);
if (stock_id) {
GtkStockItem item;
gtk_stock_lookup (stock_id, &item);
atk_object_set_name (atk_obj, item.label);
if (icon_name) {
atk_object_set_name (atk_obj, icon_name);
}
}
}
......@@ -305,15 +301,15 @@ ev_message_area_set_image (EvMessageArea *area,
}
void
ev_message_area_set_image_from_stock (EvMessageArea *area,
const gchar *stock_id)
ev_message_area_set_image_from_icon_name (EvMessageArea *area,
const gchar *icon_name)
{
g_return_if_fail (EV_IS_MESSAGE_AREA (area));
g_return_if_fail (stock_id != NULL);
gtk_image_set_from_stock (GTK_IMAGE (area->priv->image),
stock_id,
GTK_ICON_SIZE_DIALOG);
g_return_if_fail (icon_name != NULL);
gtk_image_set_from_icon_name (GTK_IMAGE (area->priv->image),
icon_name,
GTK_ICON_SIZE_DIALOG);
}
void
......
/* ev-message-area.h
* this file is part of evince, a gnome document viewer
*
* Copyright (C) 2007 Carlos Garcia Campos
*
* Author:
* Carlos Garcia Campos <carlosgc@gnome.org>
* Copyright (C) 2007 Carlos Garcia Campos <carlosgc@gnome.org>
* Copyright (C) 2018 Germán Poo-Caamaño <gpoo@gnome.org>
*
* Evince is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
......@@ -50,24 +48,24 @@ struct _EvMessageAreaClass {
GtkInfoBarClass parent_class;
};
GType ev_message_area_get_type (void) G_GNUC_CONST;
GtkWidget *ev_message_area_new (GtkMessageType type,
const gchar *text,
const gchar *first_button_text,
...);
void ev_message_area_set_image (EvMessageArea *area,
GtkWidget *image);
void ev_message_area_set_image_from_stock (EvMessageArea *area,
const gchar *stock_id);
void ev_message_area_set_text (EvMessageArea *area,
const gchar *str);
void ev_message_area_set_secondary_text (EvMessageArea *area,
const gchar *str);
GType ev_message_area_get_type (void) G_GNUC_CONST;
GtkWidget *ev_message_area_new (GtkMessageType type,
const gchar *text,
const gchar *first_button_text,
...);
void ev_message_area_set_image (EvMessageArea *area,
GtkWidget *image);
void ev_message_area_set_image_from_icon_name (EvMessageArea *area,
const gchar *icon_name);
void ev_message_area_set_text (EvMessageArea *area,
const gchar *str);
void ev_message_area_set_secondary_text (EvMessageArea *area,
const gchar *str);
void _ev_message_area_add_buttons_valist (EvMessageArea *area,
const gchar *first_button_text,
va_list args);
GtkWidget *_ev_message_area_get_main_box (EvMessageArea *area);
void _ev_message_area_add_buttons_valist (EvMessageArea *area,
const gchar *first_button_text,
va_list args);
GtkWidget *_ev_message_area_get_main_box (EvMessageArea *area);
G_END_DECLS
......
......@@ -2,6 +2,7 @@
* this file is part of evince, a gnome document viewer
*
* Copyright (C) 2008 Carlos Garcia Campos <carlosgc@gnome.org>
* Copyright (C) 2018 Germán Poo-Caamaño <gpoo@gnome.org>
*
* Evince is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
......@@ -151,7 +152,7 @@ ev_progress_message_area_get_property (GObject *object,
}
GtkWidget *
ev_progress_message_area_new (const gchar *stock_id,
ev_progress_message_area_new (const gchar *icon_name,
const gchar *text,
const gchar *first_button_text,
...)
......@@ -172,7 +173,8 @@ ev_progress_message_area_new (const gchar *stock_id,
va_end (args);
}
ev_message_area_set_image_from_stock (EV_MESSAGE_AREA (widget), stock_id);
ev_message_area_set_image_from_icon_name (EV_MESSAGE_AREA (widget),
icon_name);
return widget;
}
......
......@@ -2,6 +2,7 @@
* this file is part of evince, a gnome document viewer
*
* Copyright (C) 2008 Carlos Garcia Campos <carlosgc@gnome.org>
* Copyright (C) 2018 Germán Poo-Caamaño <gpoo@gnome.org>
*
* Evince is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
......@@ -50,7 +51,7 @@ struct _EvProgressMessageAreaClass {
};
GType ev_progress_message_area_get_type (void) G_GNUC_CONST;
GtkWidget *ev_progress_message_area_new (const gchar *stock_id,
GtkWidget *ev_progress_message_area_new (const gchar *icon_name,
const gchar *text,
const gchar *first_button_text,
...);
......
......@@ -773,7 +773,7 @@ ev_window_error_message (EvWindow *window,
area = ev_message_area_new (GTK_MESSAGE_ERROR,
msg,
GTK_STOCK_CLOSE,
_("_Close"),
GTK_RESPONSE_CLOSE,
NULL);
g_free (msg);
......@@ -805,7 +805,7 @@ ev_window_warning_message (EvWindow *window,
area = ev_message_area_new (GTK_MESSAGE_WARNING,
msg,
GTK_STOCK_CLOSE,
_("_Close"),
GTK_RESPONSE_CLOSE,
NULL);
g_free (msg);
......@@ -1934,11 +1934,11 @@ show_loading_progress (EvWindow *ev_window)
text = g_strdup_printf (_("Loading document from “%s”"),
display_name);
area = ev_progress_message_area_new (GTK_STOCK_OPEN,
area = ev_progress_message_area_new ("document-open-symbolic",
text,
GTK_STOCK_CLOSE,
_("_Close"),
GTK_RESPONSE_CLOSE,
GTK_STOCK_CANCEL,
_("C_ancel"),
GTK_RESPONSE_CANCEL,
NULL);
g_signal_connect (area, "response",
......@@ -2387,11 +2387,11 @@ show_reloading_progress (EvWindow *ev_window)
text = g_strdup_printf (_("Reloading document from %s"),
ev_window->priv->uri);
area = ev_progress_message_area_new (GTK_STOCK_REFRESH,
area = ev_progress_message_area_new ("view-refresh-symbolic",
text,
GTK_STOCK_CLOSE,
_("_Close"),
GTK_RESPONSE_CLOSE,
GTK_STOCK_CANCEL,
_("C_ancel"),
GTK_RESPONSE_CANCEL,
NULL);
g_signal_connect (area, "response",
......@@ -2736,11 +2736,11 @@ show_saving_progress (GFile *dst)
g_assert_not_reached ();
}
g_free (uri);
area = ev_progress_message_area_new (GTK_STOCK_SAVE,
area = ev_progress_message_area_new ("document-save-symbolic",
text,
GTK_STOCK_CLOSE,
_("_Close"),
GTK_RESPONSE_CLOSE,
GTK_STOCK_CANCEL,
_("C_ancel"),
GTK_RESPONSE_CANCEL,
NULL);
g_signal_connect (area, "response",
......@@ -3440,11 +3440,11 @@ ev_window_print_operation_status_changed (EvPrintOperation *op,
job_name = ev_print_operation_get_job_name (op);
text = g_strdup_printf (_("Printing job “%s”"), job_name);
area = ev_progress_message_area_new (GTK_STOCK_PRINT,
area = ev_progress_message_area_new ("document-print-symbolic",
text,
GTK_STOCK_CLOSE,
_("_Close"),
GTK_RESPONSE_CLOSE,
GTK_STOCK_CANCEL,
_("C_ancel"),
GTK_RESPONSE_CANCEL,
NULL);
ev_window_print_update_pending_jobs_message (ev_window, 1);
......@@ -5678,7 +5678,7 @@ ev_window_cmd_view_toggle_caret_navigation (GSimpleAction *action,
message_area = ev_message_area_new (GTK_MESSAGE_QUESTION,
_("Enable caret navigation?"),
GTK_STOCK_NO, GTK_RESPONSE_NO,
_("_No"), GTK_RESPONSE_NO,
_("_Enable"), GTK_RESPONSE_YES,
NULL);
ev_message_area_set_secondary_text (EV_MESSAGE_AREA (message_area),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment