xed-progress-message-area: Clean up more uses of GtkStock

This commit is contained in:
JosephMcc 2017-01-07 12:58:32 -08:00
parent a1671a6227
commit 32fd96e327
4 changed files with 41 additions and 41 deletions

View File

@ -275,7 +275,7 @@ XedProgressMessageAreaPrivate
<TITLE>XedProgressMessageArea</TITLE> <TITLE>XedProgressMessageArea</TITLE>
XedProgressMessageArea XedProgressMessageArea
xed_progress_message_area_new xed_progress_message_area_new
xed_progress_message_area_set_stock_image xed_progress_message_area_set_image
xed_progress_message_area_set_markup xed_progress_message_area_set_markup
xed_progress_message_area_set_text xed_progress_message_area_set_text
xed_progress_message_area_set_fraction xed_progress_message_area_set_fraction

View File

@ -64,7 +64,7 @@ xed_progress_message_area_set_has_cancel_button (XedProgressMessageArea *area,
{ {
if (has_button) if (has_button)
{ {
gtk_info_bar_add_button (GTK_INFO_BAR (area), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); gtk_info_bar_add_button (GTK_INFO_BAR (area), _("Cancel"), GTK_RESPONSE_CANCEL);
} }
g_object_notify (G_OBJECT (area), "has-cancel-button"); g_object_notify (G_OBJECT (area), "has-cancel-button");
@ -141,7 +141,7 @@ xed_progress_message_area_init (XedProgressMessageArea *area)
gtk_widget_show (hbox); gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
area->priv->image = gtk_image_new_from_icon_name (GTK_STOCK_MISSING_IMAGE, GTK_ICON_SIZE_SMALL_TOOLBAR); area->priv->image = gtk_image_new_from_icon_name ("image-missing", GTK_ICON_SIZE_SMALL_TOOLBAR);
gtk_widget_show (area->priv->image); gtk_widget_show (area->priv->image);
gtk_widget_set_halign (area->priv->image, GTK_ALIGN_CENTER); gtk_widget_set_halign (area->priv->image, GTK_ALIGN_CENTER);
gtk_widget_set_valign (area->priv->image, GTK_ALIGN_CENTER); gtk_widget_set_valign (area->priv->image, GTK_ALIGN_CENTER);
@ -166,33 +166,33 @@ xed_progress_message_area_init (XedProgressMessageArea *area)
} }
GtkWidget * GtkWidget *
xed_progress_message_area_new (const gchar *stock_id, xed_progress_message_area_new (const gchar *icon_name,
const gchar *markup, const gchar *markup,
gboolean has_cancel) gboolean has_cancel)
{ {
XedProgressMessageArea *area; XedProgressMessageArea *area;
g_return_val_if_fail (stock_id != NULL, NULL); g_return_val_if_fail (icon_name != NULL, NULL);
g_return_val_if_fail (markup != NULL, NULL); g_return_val_if_fail (markup != NULL, NULL);
area = XED_PROGRESS_MESSAGE_AREA (g_object_new (XED_TYPE_PROGRESS_MESSAGE_AREA, area = XED_PROGRESS_MESSAGE_AREA (g_object_new (XED_TYPE_PROGRESS_MESSAGE_AREA,
"has-cancel-button", has_cancel, "has-cancel-button", has_cancel,
NULL)); NULL));
xed_progress_message_area_set_stock_image (area, stock_id); xed_progress_message_area_set_image (area, icon_name);
xed_progress_message_area_set_markup (area, markup); xed_progress_message_area_set_markup (area, markup);
return GTK_WIDGET (area); return GTK_WIDGET (area);
} }
void void
xed_progress_message_area_set_stock_image (XedProgressMessageArea *area, xed_progress_message_area_set_image (XedProgressMessageArea *area,
const gchar *stock_id) const gchar *icon_name)
{ {
g_return_if_fail (XED_IS_PROGRESS_MESSAGE_AREA (area)); g_return_if_fail (XED_IS_PROGRESS_MESSAGE_AREA (area));
g_return_if_fail (stock_id != NULL); g_return_if_fail (icon_name != NULL);
gtk_image_set_from_stock (GTK_IMAGE (area->priv->image), stock_id, GTK_ICON_SIZE_SMALL_TOOLBAR); gtk_image_set_from_icon_name (GTK_IMAGE (area->priv->image), icon_name, GTK_ICON_SIZE_SMALL_TOOLBAR);
} }
void void

View File

@ -55,10 +55,10 @@ typedef struct _XedProgressMessageArea XedProgressMessageArea;
struct _XedProgressMessageArea struct _XedProgressMessageArea
{ {
GtkInfoBar parent; GtkInfoBar parent;
/*< private > */ /*< private > */
XedProgressMessageAreaPrivate *priv; XedProgressMessageAreaPrivate *priv;
}; };
/* /*
@ -68,31 +68,31 @@ typedef struct _XedProgressMessageAreaClass XedProgressMessageAreaClass;
struct _XedProgressMessageAreaClass struct _XedProgressMessageAreaClass
{ {
GtkInfoBarClass parent_class; GtkInfoBarClass parent_class;
}; };
/* /*
* Public methods * Public methods
*/ */
GType xed_progress_message_area_get_type (void) G_GNUC_CONST; GType xed_progress_message_area_get_type (void) G_GNUC_CONST;
GtkWidget *xed_progress_message_area_new (const gchar *stock_id, GtkWidget *xed_progress_message_area_new (const gchar *icon_name,
const gchar *markup, const gchar *markup,
gboolean has_cancel); gboolean has_cancel);
void xed_progress_message_area_set_stock_image (XedProgressMessageArea *area, void xed_progress_message_area_set_image (XedProgressMessageArea *area,
const gchar *stock_id); const gchar *icon_name);
void xed_progress_message_area_set_markup (XedProgressMessageArea *area, void xed_progress_message_area_set_markup (XedProgressMessageArea *area,
const gchar *markup); const gchar *markup);
void xed_progress_message_area_set_text (XedProgressMessageArea *area, void xed_progress_message_area_set_text (XedProgressMessageArea *area,
const gchar *text); const gchar *text);
void xed_progress_message_area_set_fraction (XedProgressMessageArea *area, void xed_progress_message_area_set_fraction (XedProgressMessageArea *area,
gdouble fraction); gdouble fraction);
void xed_progress_message_area_pulse (XedProgressMessageArea *area); void xed_progress_message_area_pulse (XedProgressMessageArea *area);
G_END_DECLS G_END_DECLS

View File

@ -657,7 +657,7 @@ show_loading_message_area (XedTab *tab)
msg = g_strdup_printf (_("Reverting %s"), name_markup); msg = g_strdup_printf (_("Reverting %s"), name_markup);
} }
area = xed_progress_message_area_new (GTK_STOCK_REVERT_TO_SAVED, msg, TRUE); area = xed_progress_message_area_new ("document-revert-symbolic", msg, TRUE);
} }
else else
{ {
@ -675,7 +675,7 @@ show_loading_message_area (XedTab *tab)
msg = g_strdup_printf (_("Loading %s"), name_markup); msg = g_strdup_printf (_("Loading %s"), name_markup);
} }
area = xed_progress_message_area_new (GTK_STOCK_OPEN, msg, TRUE); area = xed_progress_message_area_new ("document-open-symbolic", msg, TRUE);
} }
g_signal_connect (area, "response", g_signal_connect (area, "response",
@ -758,7 +758,7 @@ show_saving_message_area (XedTab *tab)
msg = g_strdup_printf (_("Saving %s"), from_markup); msg = g_strdup_printf (_("Saving %s"), from_markup);
} }
area = xed_progress_message_area_new (GTK_STOCK_SAVE, msg, FALSE); area = xed_progress_message_area_new ("document-save-symbolic", msg, FALSE);
gtk_widget_show (area); gtk_widget_show (area);
@ -2316,11 +2316,11 @@ show_printing_message_area (XedTab *tab,
if (preview) if (preview)
{ {
area = xed_progress_message_area_new (GTK_STOCK_PRINT_PREVIEW, "", TRUE); area = xed_progress_message_area_new ("document-print-preview-symbolic", "", TRUE);
} }
else else
{ {
area = xed_progress_message_area_new (GTK_STOCK_PRINT, "", TRUE); area = xed_progress_message_area_new ("document-print-symbolic", "", TRUE);
} }
g_signal_connect (area, "response", g_signal_connect (area, "response",