summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/gtkui/deadbeef.glade48
-rw-r--r--plugins/gtkui/interface.c20
-rw-r--r--plugins/gtkui/widgets.c32
3 files changed, 97 insertions, 3 deletions
diff --git a/plugins/gtkui/deadbeef.glade b/plugins/gtkui/deadbeef.glade
index 35f1e244..12c81dc6 100644
--- a/plugins/gtkui/deadbeef.glade
+++ b/plugins/gtkui/deadbeef.glade
@@ -8204,7 +8204,7 @@ Descending</property>
</widget>
<widget class="GtkDialog" id="button_properties">
- <property name="height_request">210</property>
+ <property name="height_request">250</property>
<property name="visible">True</property>
<property name="title" translatable="yes">Button properties</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
@@ -8333,6 +8333,52 @@ Descending</property>
</child>
<child>
+ <widget class="GtkHBox" id="hbox118">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">8</property>
+
+ <child>
+ <widget class="GtkCheckButton" id="use_textcolor">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Text color</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkColorButton" id="textcolor">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="use_alpha">False</property>
+ <property name="focus_on_click">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
<widget class="GtkHBox" id="hbox115">
<property name="visible">True</property>
<property name="homogeneous">False</property>
diff --git a/plugins/gtkui/interface.c b/plugins/gtkui/interface.c
index 600d7082..87bf48c9 100644
--- a/plugins/gtkui/interface.c
+++ b/plugins/gtkui/interface.c
@@ -4237,6 +4237,9 @@ create_button_properties (void)
GtkWidget *hbox114;
GtkWidget *use_color;
GtkWidget *color;
+ GtkWidget *hbox118;
+ GtkWidget *use_textcolor;
+ GtkWidget *textcolor;
GtkWidget *hbox115;
GtkWidget *label141;
GtkWidget *icon;
@@ -4252,7 +4255,7 @@ create_button_properties (void)
GtkWidget *okbutton9;
button_properties = gtk_dialog_new ();
- gtk_widget_set_size_request (button_properties, -1, 210);
+ gtk_widget_set_size_request (button_properties, -1, 250);
gtk_window_set_title (GTK_WINDOW (button_properties), _("Button properties"));
gtk_window_set_type_hint (GTK_WINDOW (button_properties), GDK_WINDOW_TYPE_HINT_DIALOG);
@@ -4276,6 +4279,18 @@ create_button_properties (void)
gtk_widget_show (color);
gtk_box_pack_start (GTK_BOX (hbox114), color, FALSE, FALSE, 0);
+ hbox118 = gtk_hbox_new (FALSE, 8);
+ gtk_widget_show (hbox118);
+ gtk_box_pack_start (GTK_BOX (vbox42), hbox118, FALSE, FALSE, 0);
+
+ use_textcolor = gtk_check_button_new_with_mnemonic (_("Text color"));
+ gtk_widget_show (use_textcolor);
+ gtk_box_pack_start (GTK_BOX (hbox118), use_textcolor, FALSE, FALSE, 0);
+
+ textcolor = gtk_color_button_new ();
+ gtk_widget_show (textcolor);
+ gtk_box_pack_start (GTK_BOX (hbox118), textcolor, FALSE, FALSE, 0);
+
hbox115 = gtk_hbox_new (FALSE, 8);
gtk_widget_show (hbox115);
gtk_box_pack_start (GTK_BOX (vbox42), hbox115, FALSE, TRUE, 0);
@@ -4339,6 +4354,9 @@ create_button_properties (void)
GLADE_HOOKUP_OBJECT (button_properties, hbox114, "hbox114");
GLADE_HOOKUP_OBJECT (button_properties, use_color, "use_color");
GLADE_HOOKUP_OBJECT (button_properties, color, "color");
+ GLADE_HOOKUP_OBJECT (button_properties, hbox118, "hbox118");
+ GLADE_HOOKUP_OBJECT (button_properties, use_textcolor, "use_textcolor");
+ GLADE_HOOKUP_OBJECT (button_properties, textcolor, "textcolor");
GLADE_HOOKUP_OBJECT (button_properties, hbox115, "hbox115");
GLADE_HOOKUP_OBJECT (button_properties, label141, "label141");
GLADE_HOOKUP_OBJECT (button_properties, icon, "icon");
diff --git a/plugins/gtkui/widgets.c b/plugins/gtkui/widgets.c
index 98c8eb1d..9576ac65 100644
--- a/plugins/gtkui/widgets.c
+++ b/plugins/gtkui/widgets.c
@@ -144,11 +144,13 @@ typedef struct {
GtkWidget *button;
GtkWidget *alignment;
GdkColor color;
+ GdkColor textcolor;
char *icon;
char *label;
char *action;
int action_ctx;
unsigned use_color : 1;
+ unsigned use_textcolor : 1;
} w_button_t;
static int design_mode;
@@ -2764,7 +2766,15 @@ w_button_load (struct ddb_gtkui_widget_s *w, const char *type, const char *s) {
b->color.blue = blue << 8;
}
}
- if (!strcmp (key, "icon")) {
+ else if (!strcmp (key, "textcolor")) {
+ int red, green, blue;
+ if (3 == sscanf (val, "#%02x%02x%02x", &red, &green, &blue)) {
+ b->textcolor.red = red << 8;
+ b->textcolor.green = green << 8;
+ b->textcolor.blue = blue << 8;
+ }
+ }
+ else if (!strcmp (key, "icon")) {
b->icon = val[0] ? strdup (val) : NULL;
}
else if (!strcmp (key, "label")) {
@@ -2779,6 +2789,9 @@ w_button_load (struct ddb_gtkui_widget_s *w, const char *type, const char *s) {
else if (!strcmp (key, "use_color")) {
b->use_color = atoi (val);
}
+ else if (!strcmp (key, "use_textcolor")) {
+ b->use_textcolor = atoi (val);
+ }
}
return s;
@@ -2795,6 +2808,9 @@ w_button_save (struct ddb_gtkui_widget_s *w, char *s, int sz) {
n = snprintf (pp, ss, " color=\"#%02x%02x%02x\"", b->color.red>>8, b->color.green>>8, b->color.blue>>8);
ss -= n;
pp += n;
+ n = snprintf (pp, ss, " textcolor=\"#%02x%02x%02x\"", b->textcolor.red>>8, b->textcolor.green>>8, b->textcolor.blue>>8);
+ ss -= n;
+ pp += n;
if (b->icon) {
n = snprintf (pp, ss, " icon=\"%s\"", b->icon);
ss -= n;
@@ -2820,6 +2836,10 @@ w_button_save (struct ddb_gtkui_widget_s *w, char *s, int sz) {
ss -= n;
pp += n;
+ n = snprintf (pp, ss, " use_textcolor=%d", (int)b->use_textcolor);
+ ss -= n;
+ pp += n;
+
strncat (s, save, sz);
}
@@ -2882,6 +2902,10 @@ w_button_init (ddb_gtkui_widget_t *ww) {
gtk_widget_modify_bg (w->button, GTK_STATE_NORMAL, &w->color);
}
+ if (w->use_textcolor) {
+ gtk_widget_modify_fg (label, GTK_STATE_NORMAL, &w->textcolor);
+ }
+
if (w->action) {
g_signal_connect ((gpointer) w->button, "clicked",
G_CALLBACK (on_button_clicked),
@@ -2976,11 +3000,15 @@ on_button_config (GtkMenuItem *menuitem, gpointer user_data) {
GtkWidget *dlg = create_button_properties ();
GtkWidget *color = lookup_widget (dlg, "color");
GtkWidget *use_color = lookup_widget (dlg, "use_color");
+ GtkWidget *textcolor = lookup_widget (dlg, "textcolor");
+ GtkWidget *use_textcolor = lookup_widget (dlg, "use_textcolor");
GtkWidget *label = lookup_widget (dlg, "label");
GtkWidget *action = lookup_widget (dlg, "action");
GtkWidget *icon = lookup_widget (dlg, "icon");
gtk_color_button_set_color (GTK_COLOR_BUTTON (color), &b->color);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (use_color), b->use_color);
+ gtk_color_button_set_color (GTK_COLOR_BUTTON (textcolor), &b->textcolor);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (use_textcolor), b->use_textcolor);
gtk_entry_set_text (GTK_ENTRY (label), b->label ? b->label : "");
set_button_action_label (b, action);
g_signal_connect ((gpointer) action, "clicked",
@@ -3036,6 +3064,8 @@ on_button_config (GtkMenuItem *menuitem, gpointer user_data) {
if (response == GTK_RESPONSE_OK || response == GTK_RESPONSE_APPLY) {
gtk_color_button_get_color (GTK_COLOR_BUTTON (color), &b->color);
b->use_color = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (use_color));
+ gtk_color_button_get_color (GTK_COLOR_BUTTON (textcolor), &b->textcolor);
+ b->use_textcolor = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (use_textcolor));
const char *l = gtk_entry_get_text (GTK_ENTRY (label));
if (b->label) {
free (b->label);