ocarina: Change disable playlist button image

I do this whenever the playlist disabled flag changes.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
Bryan Schumaker 2012-05-18 12:05:03 -04:00
parent 706f07b6f7
commit d74d008223
4 changed files with 15 additions and 5 deletions

View File

@ -7,6 +7,7 @@ using namespace std;
#include <ocarina/ocarina.h>
GtkWidget *get_image(const gchar *stockid, GtkIconSize size);
void change_button_image(GtkWidget *button, const char *stockid);
GtkWidget *make_button_data(const gchar *stockid,
void (* func)(GtkWidget *, gpointer),
@ -35,7 +36,6 @@ GtkWidget *make_toggle_button(const gchar *stockid,
void (* func)(GtkWidget *, gpointer),
bool show);
GtkWidget *make_random_button();
GtkWidget *make_volume_button();

View File

@ -23,6 +23,12 @@ GtkWidget *get_image(const gchar *stockid, GtkIconSize size)
return img;
}
void change_button_image(GtkWidget *button, const gchar *stockid)
{
GtkWidget *image = get_image(stockid, GTK_ICON_SIZE_MENU);
gtk_button_set_image(GTK_BUTTON(button), image);
}
static GtkWidget *get_label(string text)
{
GtkWidget *label = gtk_label_new(text.c_str());
@ -37,8 +43,7 @@ GtkWidget *make_button_data(const gchar *stockid,
{
GtkWidget *button = get_button(func, data, show);
GtkWidget *image = get_image(stockid, GTK_ICON_SIZE_MENU);
container_add(button, image);
gtk_button_set_image(GTK_BUTTON(button), image);
return button;
}

View File

@ -18,7 +18,7 @@ GtkWidget *make_toggle_button_data(const gchar *stockid,
{
GtkWidget *button = get_toggle_button(func, data, show);
GtkWidget *image = get_image(stockid, GTK_ICON_SIZE_MENU);
container_add(button, image);
gtk_button_set_image(GTK_BUTTON(button), image);
return button;
}

View File

@ -184,7 +184,7 @@ namespace ocarina
if (!p->is_static()) {
/* Make disable button for playlists */
disable_button = make_toggle_button_data(GTK_STOCK_MEDIA_PAUSE,
disable_button = make_toggle_button_data(GTK_STOCK_YES,
disable_playlist,
p, true);
gtk_box_pack_start(GTK_BOX(entry_box), disable_button, FALSE, FALSE, 0);
@ -229,6 +229,11 @@ namespace ocarina
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(disable_button), disabled);
gtk_widget_set_sensitive(entry, !disabled);
gtk_widget_set_sensitive(treeview, !disabled);
if (disabled)
change_button_image(disable_button, GTK_STOCK_NO);
else
change_button_image(disable_button, GTK_STOCK_YES);
}
}; /* Namespace: ocarina */