tint2conf: Buttons

This commit is contained in:
o9000 2017-03-25 14:36:40 +01:00
parent d5dfda296f
commit a73c6928c3
3 changed files with 497 additions and 0 deletions

View file

@ -115,6 +115,9 @@ GArray *separators;
// Executors
GArray *executors;
// Buttons
GArray *buttons;
// launcher
GtkListStore *launcher_apps, *all_apps;
@ -155,6 +158,7 @@ void create_task_status(GtkWidget *notebook,
GtkWidget **task_status_background_set);
void create_separator(GtkWidget *parent, int i);
void create_execp(GtkWidget *parent, int i);
void create_button(GtkWidget *parent, int i);
void create_clock(GtkWidget *parent);
void create_systemtray(GtkWidget *parent);
void create_battery(GtkWidget *parent);
@ -227,6 +231,7 @@ GtkWidget *create_properties()
separators = g_array_new(FALSE, TRUE, sizeof(Separator));
executors = g_array_new(FALSE, TRUE, sizeof(Executor));
buttons = g_array_new(FALSE, TRUE, sizeof(Button));
// global layer
view = gtk_dialog_new();
@ -1208,6 +1213,7 @@ void set_panel_items(const char *items)
int separator_index = -1;
int execp_index = -1;
int button_index = -1;
for (; items && *items; items++) {
const char *value = NULL;
@ -1245,6 +1251,12 @@ void set_panel_items(const char *items)
sprintf(buffer, "%s %d", _("Executor"), execp_index + 1);
name = buffer;
value = "E";
} else if (v == 'P') {
button_index++;
buffer[0] = 0;
sprintf(buffer, "%s %d", _("Button"), button_index + 1);
name = buffer;
value = "P";
} else {
continue;
}
@ -1283,11 +1295,14 @@ void panel_add_item(GtkWidget *widget, gpointer data)
separator_create_new();
} else if (g_str_equal(value, "E")) {
execp_create_new();
} else if (g_str_equal(value, "P")) {
button_create_new();
}
}
}
separator_update_indices();
execp_update_indices();
button_update_indices();
}
void panel_remove_item(GtkWidget *widget, gpointer data)
@ -1320,6 +1335,14 @@ void panel_remove_item(GtkWidget *widget, gpointer data)
break;
}
}
} else if (g_str_equal(value, "P")) {
for (int i = 0; i < buttons->len; i++) {
Button *button = &g_array_index(buttons, Button, i);
if (g_str_equal(name, button->name)) {
button_remove(i);
break;
}
}
}
gtk_list_store_remove(panel_items, &iter);
@ -1327,6 +1350,7 @@ void panel_remove_item(GtkWidget *widget, gpointer data)
separator_update_indices();
execp_update_indices();
button_update_indices();
}
void panel_move_item_down(GtkWidget *widget, gpointer data)
@ -1380,6 +1404,21 @@ void panel_move_item_down(GtkWidget *widget, gpointer data)
Executor tmp = *executor1;
*executor1 = *executor2;
*executor2 = tmp;
} else if (g_str_equal(value1, "P") && g_str_equal(value2, "P")) {
Button *button1 = NULL;
Button *button2 = NULL;
for (int i = 0; i < buttons->len; i++) {
Button *button = &g_array_index(buttons, Button, i);
if (g_str_equal(name1, button->name)) {
button1 = button;
}
if (g_str_equal(name2, button->name)) {
button2 = button;
}
}
Button tmp = *button1;
*button1 = *button2;
*button2 = tmp;
}
gtk_list_store_swap(panel_items, &iter, &next);
@ -1387,6 +1426,7 @@ void panel_move_item_down(GtkWidget *widget, gpointer data)
}
separator_update_indices();
execp_update_indices();
button_update_indices();
}
void panel_move_item_up(GtkWidget *widget, gpointer data)
@ -1441,6 +1481,21 @@ void panel_move_item_up(GtkWidget *widget, gpointer data)
Executor tmp = *executor1;
*executor1 = *executor2;
*executor2 = tmp;
} else if (g_str_equal(value1, "P") && g_str_equal(value2, "P")) {
Button *button1 = NULL;
Button *button2 = NULL;
for (int i = 0; i < buttons->len; i++) {
Button *button = &g_array_index(buttons, Button, i);
if (g_str_equal(name1, button->name)) {
button1 = button;
}
if (g_str_equal(name2, button->name)) {
button2 = button;
}
}
Button tmp = *button1;
*button1 = *button2;
*button2 = tmp;
}
gtk_list_store_swap(panel_items, &iter, &prev);
@ -1449,6 +1504,7 @@ void panel_move_item_up(GtkWidget *widget, gpointer data)
}
separator_update_indices();
execp_update_indices();
button_update_indices();
}
enum {
@ -4160,6 +4216,278 @@ void create_execp(GtkWidget *notebook, int i)
change_paragraph(parent);
}
void create_button(GtkWidget *notebook, int i)
{
GtkWidget *label;
GtkWidget *table;
int row, col;
GtkTooltips *tooltips = gtk_tooltips_new();
Button *button = &g_array_index(buttons, Button, i);
button->name[0] = 0;
sprintf(button->name, "%s %d", _("Button"), i + 1);
button->page_label = gtk_label_new(button->name);
gtk_widget_show(button->page_label);
button->page_button = gtk_vbox_new(FALSE, DEFAULT_HOR_SPACING);
button->container = addScrollBarToWidget(button->page_button);
gtk_container_set_border_width(GTK_CONTAINER(button->page_button), 10);
gtk_widget_show(button->page_button);
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), button->container, button->page_label);
GtkWidget *parent = button->page_button;
table = gtk_table_new(1, 2, FALSE);
gtk_widget_show(table);
gtk_box_pack_start(GTK_BOX(parent), table, FALSE, FALSE, 0);
gtk_table_set_row_spacings(GTK_TABLE(table), ROW_SPACING);
gtk_table_set_col_spacings(GTK_TABLE(table), COL_SPACING);
row = 0, col = 2;
label = gtk_label_new(_("<b>Format</b>"));
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
gtk_label_set_use_markup(GTK_LABEL(label), TRUE); gtk_widget_show(label);
gtk_box_pack_start(GTK_BOX(parent), label, FALSE, FALSE, 0);
table = gtk_table_new(3, 10, FALSE);
gtk_widget_show(table);
gtk_box_pack_start(GTK_BOX(parent), table, FALSE, FALSE, 0);
gtk_table_set_row_spacings(GTK_TABLE(table), ROW_SPACING);
gtk_table_set_col_spacings(GTK_TABLE(table), COL_SPACING);
row = 0, col = 2;
label = gtk_label_new(_("Icon"));
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
gtk_widget_show(label);
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
button->button_icon = gtk_entry_new();
gtk_widget_show(button->button_icon);
gtk_entry_set_width_chars(GTK_ENTRY(button->button_icon), 50);
gtk_table_attach(GTK_TABLE(table), button->button_icon, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
row++, col = 2;
label = gtk_label_new(_("Text"));
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
gtk_widget_show(label);
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
button->button_text = gtk_entry_new();
gtk_widget_show(button->button_text);
gtk_entry_set_width_chars(GTK_ENTRY(button->button_text), 50);
gtk_table_attach(GTK_TABLE(table), button->button_text, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
row++, col = 2;
label = gtk_label_new(_("Tooltip"));
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
gtk_widget_show(label);
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
button->button_tooltip = gtk_entry_new();
gtk_widget_show(button->button_tooltip);
gtk_entry_set_width_chars(GTK_ENTRY(button->button_tooltip), 50);
gtk_table_attach(GTK_TABLE(table), button->button_tooltip, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
change_paragraph(parent);
label = gtk_label_new(_("<b>Mouse events</b>"));
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
gtk_widget_show(label);
gtk_box_pack_start(GTK_BOX(parent), label, FALSE, FALSE, 0);
table = gtk_table_new(5, 10, FALSE);
gtk_widget_show(table);
gtk_box_pack_start(GTK_BOX(parent), table, FALSE, FALSE, 0);
gtk_table_set_row_spacings(GTK_TABLE(table), ROW_SPACING);
gtk_table_set_col_spacings(GTK_TABLE(table), COL_SPACING);
row = 0, col = 2;
label = gtk_label_new(_("Left click command"));
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
gtk_widget_show(label);
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
button->button_left_command = gtk_entry_new();
gtk_widget_show(button->button_left_command);
gtk_entry_set_width_chars(GTK_ENTRY(button->button_left_command), 50);
gtk_table_attach(GTK_TABLE(table), button->button_left_command, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips, button->button_left_command,
_("Specifies a command that will be executed when the button receives a left click."), NULL);
row++, col = 2;
label = gtk_label_new(_("Right click command"));
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
gtk_widget_show(label);
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
button->button_right_command = gtk_entry_new();
gtk_widget_show(button->button_right_command);
gtk_entry_set_width_chars(GTK_ENTRY(button->button_right_command), 50);
gtk_table_attach(GTK_TABLE(table), button->button_right_command, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips, button->button_right_command,
_("Specifies a command that will be executed when the button receives a right click."), NULL);
row++, col = 2;
label = gtk_label_new(_("Middle click command"));
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
gtk_widget_show(label);
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
button->button_mclick_command = gtk_entry_new();
gtk_widget_show(button->button_mclick_command);
gtk_entry_set_width_chars(GTK_ENTRY(button->button_mclick_command), 50);
gtk_table_attach(GTK_TABLE(table), button->button_mclick_command, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips, button->button_mclick_command,
_("Specifies a command that will be executed when the button receives a middle click."), NULL);
row++, col = 2;
label = gtk_label_new(_("Wheel scroll up command"));
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
gtk_widget_show(label);
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
button->button_uwheel_command = gtk_entry_new();
gtk_widget_show(button->button_uwheel_command);
gtk_entry_set_width_chars(GTK_ENTRY(button->button_uwheel_command), 50);
gtk_table_attach(GTK_TABLE(table), button->button_uwheel_command, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips, button->button_uwheel_command,
_("Specifies a command that will be executed when the button receives a mouse scroll up."), NULL);
row++, col = 2;
label = gtk_label_new(_("Wheel scroll down command"));
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
gtk_widget_show(label);
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
button->button_dwheel_command = gtk_entry_new();
gtk_widget_show(button->button_dwheel_command);
gtk_entry_set_width_chars(GTK_ENTRY(button->button_dwheel_command), 50);
gtk_table_attach(GTK_TABLE(table), button->button_dwheel_command, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips, button->button_dwheel_command,
_("Specifies a command that will be executed when the button receives a mouse scroll down."), NULL);
change_paragraph(parent);
label = gtk_label_new(_("<b>Appearance</b>"));
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
gtk_widget_show(label);
gtk_box_pack_start(GTK_BOX(parent), label, FALSE, FALSE, 0);
table = gtk_table_new(3, 22, FALSE);
gtk_widget_show(table);
gtk_box_pack_start(GTK_BOX(parent), table, FALSE, FALSE, 0);
gtk_table_set_row_spacings(GTK_TABLE(table), ROW_SPACING);
gtk_table_set_col_spacings(GTK_TABLE(table), COL_SPACING);
row = 0, col = 2;
label = gtk_label_new(_("Background"));
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
gtk_widget_show(label);
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
button->button_background = create_background_combo(_("Button"));
gtk_widget_show(button->button_background);
gtk_table_attach(GTK_TABLE(table), button->button_background, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips, button->button_background, _("Selects the background used to display the button. "
"Backgrounds can be edited in the Backgrounds tab."), NULL);
row++, col = 2;
label = gtk_label_new(_("Horizontal padding"));
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
gtk_widget_show(label);
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
button->button_padding_x = gtk_spin_button_new_with_range(0, 500, 1);
gtk_widget_show(button->button_padding_x);
gtk_table_attach(GTK_TABLE(table), button->button_padding_x, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips, button->button_padding_x, _("Specifies the horizontal padding of the button. "
"This is the space between the border and the content inside."), NULL);
row++, col = 2;
label = gtk_label_new(_("Vertical padding"));
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
gtk_widget_show(label);
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
button->button_padding_y = gtk_spin_button_new_with_range(0, 500, 1);
gtk_widget_show(button->button_padding_y);
gtk_table_attach(GTK_TABLE(table), button->button_padding_y, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips, button->button_padding_y, _("Specifies the vertical padding of the button. "
"This is the space between the border and the content inside."), NULL);
row++, col = 1;
button->button_font_set = gtk_check_button_new();
gtk_widget_show(button->button_font_set);
gtk_table_attach(GTK_TABLE(table), button->button_font_set, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
gtk_tooltips_set_tip(tooltips, button->button_font_set, _("If not checked, the desktop theme font is used. If checked, the custom font specified here is used."), NULL);
col++;
label = gtk_label_new(_("Font"));
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
gtk_widget_show(label);
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
button->button_font = gtk_font_button_new_with_font(get_default_font());
gtk_widget_show(button->button_font);
gtk_table_attach(GTK_TABLE(table), button->button_font, col, col+3, row, row+1, GTK_FILL, 0, 0, 0);
col++;
gtk_font_button_set_show_style(GTK_FONT_BUTTON(button->button_font), TRUE);
gtk_signal_connect(GTK_OBJECT(button->button_font_set), "toggled", GTK_SIGNAL_FUNC(font_set_callback), button->button_font);
font_set_callback(button->button_font_set, button->button_font);
row++, col = 2;
label = gtk_label_new(_("Font color"));
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
gtk_widget_show(label);
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
button->button_font_color = gtk_color_button_new();
gtk_color_button_set_use_alpha(GTK_COLOR_BUTTON(button->button_font_color), TRUE);
gtk_widget_show(button->button_font_color);
gtk_table_attach(GTK_TABLE(table), button->button_font_color, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
row++, col = 2;
label = gtk_label_new(_("Centered"));
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
gtk_widget_show(label);
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
button->button_centered = gtk_check_button_new();
gtk_widget_show(button->button_centered);
gtk_table_attach(GTK_TABLE(table), button->button_centered, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
change_paragraph(parent);
}
void separator_create_new()
{
g_array_set_size(separators, separators->len + 1);
@ -4172,6 +4500,12 @@ void execp_create_new()
create_execp(notebook, executors->len - 1);
}
void button_create_new()
{
g_array_set_size(buttons, buttons->len + 1);
create_button(notebook, buttons->len - 1);
}
Separator *separator_get_last()
{
if (separators->len <= 0)
@ -4186,6 +4520,13 @@ Executor *execp_get_last()
return &g_array_index(executors, Executor, executors->len - 1);
}
Button *button_get_last()
{
if (buttons->len <= 0)
button_create_new();
return &g_array_index(buttons, Button, buttons->len - 1);
}
void separator_remove(int i)
{
Separator *separator = &g_array_index(separators, Separator, i);
@ -4216,6 +4557,21 @@ void execp_remove(int i)
executors = g_array_remove_index(executors, i);
}
void button_remove(int i)
{
Button *button = &g_array_index(buttons, Button, i);
for (int i_page = 0; i_page < gtk_notebook_get_n_pages(GTK_NOTEBOOK(notebook)); i_page++) {
GtkWidget *page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), i_page);
if (page == button->container) {
gtk_widget_hide(page);
gtk_notebook_remove_page(GTK_NOTEBOOK(notebook), i_page);
}
}
buttons = g_array_remove_index(buttons, i);
}
void separator_update_indices()
{
for (int i = 0; i < separators->len; i++) {
@ -4290,6 +4646,43 @@ void execp_update_indices()
}
}
void button_update_indices()
{
for (int i = 0; i < executors->len; i++) {
Button *executor = &g_array_index(executors, Button, i);
sprintf(executor->name, "%s %d", _("Button"), i + 1);
gtk_label_set_text(GTK_LABEL(executor->page_label), executor->name);
}
GtkTreeModel *model = GTK_TREE_MODEL(panel_items);
GtkTreeIter iter;
if (!gtk_tree_model_get_iter_first(model, &iter))
return;
int button_index = -1;
while (1) {
gchar *name;
gchar *value;
gtk_tree_model_get(model, &iter,
itemsColName, &name,
itemsColValue, &value,
-1);
if (g_str_equal(value, "E")) {
button_index++;
char buffer[256];
buffer[0] = 0;
sprintf(buffer, "%s %d", _("Button"), button_index + 1);
gtk_list_store_set(panel_items, &iter,
itemsColName, buffer,
-1);
}
if (!gtk_tree_model_iter_next(model, &iter))
break;
}
}
void create_systemtray(GtkWidget *parent)
{
GtkWidget *table;

View file

@ -151,6 +151,21 @@ typedef struct Executor {
extern GArray *executors;
// Button
typedef struct Button {
char name[256];
GtkWidget *container;
GtkWidget *page_button;
GtkWidget *page_label;
GtkWidget *button_icon, *button_text, *button_tooltip;
GtkWidget *button_left_command, *button_right_command;
GtkWidget *button_mclick_command, *button_rclick_command, *button_uwheel_command, *button_dwheel_command;
GtkWidget *button_font, *button_font_set, *button_font_color, *button_padding_x, *button_padding_y, *button_centered;
GtkWidget *button_background;
} Button;
extern GArray *buttons;
// launcher
enum {
@ -264,6 +279,11 @@ Executor *execp_get_last();
void execp_remove(int i);
void execp_update_indices();
void button_create_new();
Button *button_get_last();
void button_remove(int i);
void button_update_indices();
void create_please_wait(GtkWindow *parent);
void process_events();
void destroy_please_wait();

View file

@ -866,6 +866,46 @@ void config_write_execp(FILE *fp)
}
}
void config_write_button(FILE *fp)
{
for (int i = 0; i < buttons->len; i++) {
fprintf(fp, "#-------------------------------------\n");
fprintf(fp, "# Button %d\n", i + 1);
Button *button = &g_array_index(buttons, Button, i);
fprintf(fp, "button = new\n");
fprintf(fp, "button_icon = %s\n", gtk_entry_get_text(GTK_ENTRY(button->button_icon)));
fprintf(fp, "button_text = %s\n", gtk_entry_get_text(GTK_ENTRY(button->button_text)));
fprintf(fp, "button_tooltip = %s\n", gtk_entry_get_text(GTK_ENTRY(button->button_tooltip)));
fprintf(fp, "button_lclick_command = %s\n", gtk_entry_get_text(GTK_ENTRY(button->button_left_command)));
fprintf(fp, "button_rclick_command = %s\n", gtk_entry_get_text(GTK_ENTRY(button->button_right_command)));
fprintf(fp, "button_mclick_command = %s\n", gtk_entry_get_text(GTK_ENTRY(button->button_mclick_command)));
fprintf(fp, "button_uwheel_command = %s\n", gtk_entry_get_text(GTK_ENTRY(button->button_uwheel_command)));
fprintf(fp, "button_dwheel_command = %s\n", gtk_entry_get_text(GTK_ENTRY(button->button_dwheel_command)));
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button->button_font_set)))
fprintf(fp, "button_font = %s\n", gtk_font_button_get_font_name(GTK_FONT_BUTTON(button->button_font)));
GdkColor color;
gtk_color_button_get_color(GTK_COLOR_BUTTON(button->button_font_color), &color);
config_write_color(fp,
"button_font_color",
color,
gtk_color_button_get_alpha(GTK_COLOR_BUTTON(button->button_font_color)) * 100 / 0xffff);
fprintf(fp,
"button_padding = %d %d\n",
(int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(button->button_padding_x)),
(int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(button->button_padding_y)));
fprintf(fp, "button_background_id = %d\n", gtk_combo_box_get_active(GTK_COMBO_BOX(button->button_background)));
fprintf(fp,
"button_centered = %d\n",
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button->button_centered)) ? 1 : 0);
fprintf(fp, "\n");
}
}
void config_write_tooltip(FILE *fp)
{
fprintf(fp, "#-------------------------------------\n");
@ -939,6 +979,7 @@ void config_save_file(const char *path)
config_write_battery(fp);
config_write_separator(fp);
config_write_execp(fp);
config_write_button(fp);
config_write_tooltip(fp);
checksum = checksum_txt(fp);
@ -1888,6 +1929,49 @@ void add_entry(char *key, char *value)
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(execp_get_last()->execp_centered), atoi(value));
}
/* Button */
else if (strcmp(key, "button") == 0) {
button_create_new();
} else if (strcmp(key, "button_icon") == 0) {
gtk_entry_set_text(GTK_ENTRY(button_get_last()->button_icon), value);
} else if (strcmp(key, "button_text") == 0) {
gtk_entry_set_text(GTK_ENTRY(button_get_last()->button_text), value);
} else if (strcmp(key, "button_tooltip") == 0) {
gtk_entry_set_text(GTK_ENTRY(button_get_last()->button_tooltip), value);
} else if (strcmp(key, "button_lclick_command") == 0) {
gtk_entry_set_text(GTK_ENTRY(button_get_last()->button_left_command), value);
} else if (strcmp(key, "button_rclick_command") == 0) {
gtk_entry_set_text(GTK_ENTRY(button_get_last()->button_right_command), value);
} else if (strcmp(key, "button_mclick_command") == 0) {
gtk_entry_set_text(GTK_ENTRY(button_get_last()->button_mclick_command), value);
} else if (strcmp(key, "button_uwheel_command") == 0) {
gtk_entry_set_text(GTK_ENTRY(button_get_last()->button_uwheel_command), value);
} else if (strcmp(key, "button_dwheel_command") == 0) {
gtk_entry_set_text(GTK_ENTRY(button_get_last()->button_dwheel_command), value);
} else if (strcmp(key, "button_font") == 0) {
gtk_font_button_set_font_name(GTK_FONT_BUTTON(button_get_last()->button_font), value);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button_get_last()->button_font_set), TRUE);
} else if (strcmp(key, "button_font_color") == 0) {
extract_values(value, &value1, &value2, &value3);
GdkColor col;
hex2gdk(value1, &col);
gtk_color_button_set_color(GTK_COLOR_BUTTON(button_get_last()->button_font_color), &col);
if (value2) {
int alpha = atoi(value2);
gtk_color_button_set_alpha(GTK_COLOR_BUTTON(button_get_last()->button_font_color), (alpha * 65535) / 100);
}
} else if (strcmp(key, "button_padding") == 0) {
extract_values(value, &value1, &value2, &value3);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(button_get_last()->button_padding_x), atoi(value1));
if (value2)
gtk_spin_button_set_value(GTK_SPIN_BUTTON(button_get_last()->button_padding_y), atoi(value2));
} else if (strcmp(key, "button_background_id") == 0) {
int id = background_index_safe(atoi(value));
gtk_combo_box_set_active(GTK_COMBO_BOX(button_get_last()->button_background), id);
} else if (strcmp(key, "button_centered") == 0) {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button_get_last()->button_centered), atoi(value));
}
if (value1)
free(value1);
if (value2)