xed-progress-message-area.c: Clean up code style

This commit is contained in:
JosephMcc 2017-01-07 04:13:12 -08:00
parent 01ace1d02f
commit a1671a6227
1 changed files with 118 additions and 128 deletions

View File

@ -40,7 +40,8 @@
#include "xed-progress-message-area.h" #include "xed-progress-message-area.h"
enum { enum
{
PROP_0, PROP_0,
PROP_HAS_CANCEL_BUTTON PROP_HAS_CANCEL_BUTTON
}; };
@ -62,9 +63,9 @@ xed_progress_message_area_set_has_cancel_button (XedProgressMessageArea *area,
gboolean has_button) gboolean has_button)
{ {
if (has_button) if (has_button)
gtk_info_bar_add_button (GTK_INFO_BAR (area), {
GTK_STOCK_CANCEL, gtk_info_bar_add_button (GTK_INFO_BAR (area), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
GTK_RESPONSE_CANCEL); }
g_object_notify (G_OBJECT (area), "has-cancel-button"); g_object_notify (G_OBJECT (area), "has-cancel-button");
} }
@ -82,8 +83,7 @@ xed_progress_message_area_set_property (GObject *object,
switch (prop_id) switch (prop_id)
{ {
case PROP_HAS_CANCEL_BUTTON: case PROP_HAS_CANCEL_BUTTON:
xed_progress_message_area_set_has_cancel_button (area, xed_progress_message_area_set_has_cancel_button (area, g_value_get_boolean (value));
g_value_get_boolean (value));
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -141,8 +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, area->priv->image = gtk_image_new_from_icon_name (GTK_STOCK_MISSING_IMAGE, GTK_ICON_SIZE_SMALL_TOOLBAR);
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);
@ -153,8 +152,7 @@ xed_progress_message_area_init (XedProgressMessageArea *area)
gtk_box_pack_start (GTK_BOX (hbox), area->priv->label, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (hbox), area->priv->label, TRUE, TRUE, 0);
gtk_label_set_use_markup (GTK_LABEL (area->priv->label), TRUE); gtk_label_set_use_markup (GTK_LABEL (area->priv->label), TRUE);
gtk_misc_set_alignment (GTK_MISC (area->priv->label), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (area->priv->label), 0.0, 0.5);
gtk_label_set_ellipsize (GTK_LABEL (area->priv->label), gtk_label_set_ellipsize (GTK_LABEL (area->priv->label), PANGO_ELLIPSIZE_END);
PANGO_ELLIPSIZE_END);
area->priv->progress = gtk_progress_bar_new (); area->priv->progress = gtk_progress_bar_new ();
gtk_widget_show (area->priv->progress); gtk_widget_show (area->priv->progress);
@ -181,11 +179,8 @@ xed_progress_message_area_new (const gchar *stock_id,
"has-cancel-button", has_cancel, "has-cancel-button", has_cancel,
NULL)); NULL));
xed_progress_message_area_set_stock_image (area, xed_progress_message_area_set_stock_image (area, stock_id);
stock_id); xed_progress_message_area_set_markup (area, markup);
xed_progress_message_area_set_markup (area,
markup);
return GTK_WIDGET (area); return GTK_WIDGET (area);
} }
@ -197,9 +192,7 @@ xed_progress_message_area_set_stock_image (XedProgressMessageArea *area,
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 (stock_id != NULL);
gtk_image_set_from_stock (GTK_IMAGE (area->priv->image), gtk_image_set_from_stock (GTK_IMAGE (area->priv->image), stock_id, GTK_ICON_SIZE_SMALL_TOOLBAR);
stock_id,
GTK_ICON_SIZE_SMALL_TOOLBAR);
} }
void void
@ -209,8 +202,7 @@ xed_progress_message_area_set_markup (XedProgressMessageArea *area,
g_return_if_fail (XED_IS_PROGRESS_MESSAGE_AREA (area)); g_return_if_fail (XED_IS_PROGRESS_MESSAGE_AREA (area));
g_return_if_fail (markup != NULL); g_return_if_fail (markup != NULL);
gtk_label_set_markup (GTK_LABEL (area->priv->label), gtk_label_set_markup (GTK_LABEL (area->priv->label), markup);
markup);
} }
void void
@ -220,8 +212,7 @@ xed_progress_message_area_set_text (XedProgressMessageArea *area,
g_return_if_fail (XED_IS_PROGRESS_MESSAGE_AREA (area)); g_return_if_fail (XED_IS_PROGRESS_MESSAGE_AREA (area));
g_return_if_fail (text != NULL); g_return_if_fail (text != NULL);
gtk_label_set_text (GTK_LABEL (area->priv->label), gtk_label_set_text (GTK_LABEL (area->priv->label), text);
text);
} }
void void
@ -230,8 +221,7 @@ xed_progress_message_area_set_fraction (XedProgressMessageArea *area,
{ {
g_return_if_fail (XED_IS_PROGRESS_MESSAGE_AREA (area)); g_return_if_fail (XED_IS_PROGRESS_MESSAGE_AREA (area));
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (area->priv->progress), gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (area->priv->progress), fraction);
fraction);
} }
void void