diff options
author | Pablo Barciela <[email protected]> | 2018-12-03 21:17:53 +0100 |
---|---|---|
committer | Pablo Barciela <[email protected]> | 2018-12-03 21:17:53 +0100 |
commit | d5560ec81eb35bbf70e06988f60d53ec26a0c30b (patch) | |
tree | 2192427316c6e070b5133272a0b94a316065a00d | |
parent | 5eea3e1c074787c4082993e977af30644cec9775 (diff) | |
download | engrampa-d5560ec81eb35bbf70e06988f60d53ec26a0c30b.tar.bz2 engrampa-d5560ec81eb35bbf70e06988f60d53ec26a0c30b.tar.xz |
fr-window: little improvements in the look of pause/resume button
-rw-r--r-- | src/fr-window.c | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/src/fr-window.c b/src/fr-window.c index cb08c55..90c4af0 100644 --- a/src/fr-window.c +++ b/src/fr-window.c @@ -2292,17 +2292,24 @@ fr_window_view_extraction_destination_folder (FrWindow *window) open_folder (GTK_WINDOW (window), fr_archive_get_last_extraction_destination (window->archive)); } -static void change_button_label(GtkWidget *button) +static void change_button_label (GtkWidget *button) { const gchar *state; - state = gtk_button_get_label(GTK_BUTTON(button)); - if(g_strrstr("suspend",state) != NULL) + state = gtk_button_get_label (GTK_BUTTON (button)); + + if (g_strrstr ("_Pause", state) != NULL) { - gtk_button_set_label(GTK_BUTTON(button),_("start")); + gtk_button_set_label (GTK_BUTTON (button), _("_Resume")); + gtk_button_set_image (GTK_BUTTON (button), + gtk_image_new_from_icon_name ("media-playback-start", + GTK_ICON_SIZE_BUTTON)); } else { - gtk_button_set_label(GTK_BUTTON(button),_("suspend")); + gtk_button_set_label (GTK_BUTTON(button), _("_Pause")); + gtk_button_set_image (GTK_BUTTON (button), + gtk_image_new_from_icon_name ("media-playback-pause", + GTK_ICON_SIZE_BUTTON)); } } static void fr_state_switch(FrWindow *window) @@ -2531,6 +2538,27 @@ fr_window_message_cb (FrCommand *command, } +static GtkWidget* +dialog_add_button_with_icon_name (GtkDialog *dialog, + const gchar *button_text, + const gchar *icon_name, + gint response_id) +{ + GtkWidget *button; + + button = gtk_button_new_with_mnemonic (button_text); + gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON)); + + gtk_button_set_use_underline (GTK_BUTTON (button), TRUE); + gtk_style_context_add_class (gtk_widget_get_style_context (button), "text-button"); + gtk_widget_set_can_default (button, TRUE); + gtk_widget_show (button); + gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, response_id); + + return button; +} + + static void create_the_progress_dialog (FrWindow *window) { @@ -2569,7 +2597,7 @@ create_the_progress_dialog (FrWindow *window) window->priv->pd_close_button = gtk_dialog_add_button (GTK_DIALOG (window->priv->progress_dialog), "gtk-close", GTK_RESPONSE_CLOSE); window->priv->pd_cancel_button = gtk_dialog_add_button (GTK_DIALOG (window->priv->progress_dialog), "gtk-cancel", GTK_RESPONSE_CANCEL); /*add start button default suspend*/ - window->priv->pd_state_button = gtk_dialog_add_button (GTK_DIALOG (window->priv->progress_dialog), _("suspend"), GTK_RESPONSE_ACCEPT); + window->priv->pd_state_button = dialog_add_button_with_icon_name (GTK_DIALOG (window->priv->progress_dialog), _("_Pause"), "media-playback-pause", GTK_RESPONSE_ACCEPT); d = GTK_DIALOG (window->priv->progress_dialog); gtk_window_set_resizable (GTK_WINDOW (d), TRUE); gtk_dialog_set_default_response (GTK_DIALOG (d), GTK_RESPONSE_OK); |