Skip to content

Commit d5560ec

Browse files
committed
fr-window: little improvements in the look of pause/resume button
1 parent 5eea3e1 commit d5560ec

File tree

1 file changed

+34
-6
lines changed

1 file changed

+34
-6
lines changed

‎src/fr-window.c‎

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2292,17 +2292,24 @@ fr_window_view_extraction_destination_folder (FrWindow *window)
22922292
open_folder (GTK_WINDOW (window), fr_archive_get_last_extraction_destination (window->archive));
22932293
}
22942294

2295-
static void change_button_label(GtkWidget *button)
2295+
static void change_button_label (GtkWidget *button)
22962296
{
22972297
const gchar *state;
2298-
state = gtk_button_get_label(GTK_BUTTON(button));
2299-
if(g_strrstr("suspend",state) != NULL)
2298+
state = gtk_button_get_label (GTK_BUTTON (button));
2299+
2300+
if (g_strrstr ("_Pause", state) != NULL)
23002301
{
2301-
gtk_button_set_label(GTK_BUTTON(button),_("start"));
2302+
gtk_button_set_label (GTK_BUTTON (button), _("_Resume"));
2303+
gtk_button_set_image (GTK_BUTTON (button),
2304+
gtk_image_new_from_icon_name ("media-playback-start",
2305+
GTK_ICON_SIZE_BUTTON));
23022306
}
23032307
else
23042308
{
2305-
gtk_button_set_label(GTK_BUTTON(button),_("suspend"));
2309+
gtk_button_set_label (GTK_BUTTON(button), _("_Pause"));
2310+
gtk_button_set_image (GTK_BUTTON (button),
2311+
gtk_image_new_from_icon_name ("media-playback-pause",
2312+
GTK_ICON_SIZE_BUTTON));
23062313
}
23072314
}
23082315
static void fr_state_switch(FrWindow *window)
@@ -2531,6 +2538,27 @@ fr_window_message_cb (FrCommand *command,
25312538
}
25322539

25332540

2541+
static GtkWidget*
2542+
dialog_add_button_with_icon_name (GtkDialog *dialog,
2543+
const gchar *button_text,
2544+
const gchar *icon_name,
2545+
gint response_id)
2546+
{
2547+
GtkWidget *button;
2548+
2549+
button = gtk_button_new_with_mnemonic (button_text);
2550+
gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON));
2551+
2552+
gtk_button_set_use_underline (GTK_BUTTON (button), TRUE);
2553+
gtk_style_context_add_class (gtk_widget_get_style_context (button), "text-button");
2554+
gtk_widget_set_can_default (button, TRUE);
2555+
gtk_widget_show (button);
2556+
gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, response_id);
2557+
2558+
return button;
2559+
}
2560+
2561+
25342562
static void
25352563
create_the_progress_dialog (FrWindow *window)
25362564
{
@@ -2569,7 +2597,7 @@ create_the_progress_dialog (FrWindow *window)
25692597
window->priv->pd_close_button = gtk_dialog_add_button (GTK_DIALOG (window->priv->progress_dialog), "gtk-close", GTK_RESPONSE_CLOSE);
25702598
window->priv->pd_cancel_button = gtk_dialog_add_button (GTK_DIALOG (window->priv->progress_dialog), "gtk-cancel", GTK_RESPONSE_CANCEL);
25712599
/*add start button default suspend*/
2572-
window->priv->pd_state_button = gtk_dialog_add_button (GTK_DIALOG (window->priv->progress_dialog), _("suspend"), GTK_RESPONSE_ACCEPT);
2600+
window->priv->pd_state_button = dialog_add_button_with_icon_name (GTK_DIALOG (window->priv->progress_dialog), _("_Pause"), "media-playback-pause", GTK_RESPONSE_ACCEPT);
25732601
d = GTK_DIALOG (window->priv->progress_dialog);
25742602
gtk_window_set_resizable (GTK_WINDOW (d), TRUE);
25752603
gtk_dialog_set_default_response (GTK_DIALOG (d), GTK_RESPONSE_OK);

0 commit comments

Comments
 (0)