Skip to content
Permalink
Browse files

fr-window: little improvements in the look of pause/resume button

  • Loading branch information...
sc0w committed Dec 3, 2018
1 parent 5eea3e1 commit d5560ec81eb35bbf70e06988f60d53ec26a0c30b
Showing with 34 additions and 6 deletions.
  1. +34 −6 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);

0 comments on commit d5560ec

Please sign in to comment.
You can’t perform that action at this time.