Executor: tint2conf support

This commit is contained in:
o9000
2015-12-23 23:17:39 +01:00
parent 8c3017634f
commit 6a285a628d
3 changed files with 367 additions and 178 deletions

View File

@@ -46,6 +46,8 @@ GtkWidget *screen_position[12];
GSList *screen_position_group;
GtkWidget *panel_background;
GtkWidget *notebook;
// taskbar
GtkWidget *taskbar_show_desktop, *taskbar_show_name, *taskbar_padding_x, *taskbar_padding_y, *taskbar_spacing;
GtkWidget *taskbar_hide_inactive_tasks, *taskbar_hide_diff_monitor;
@@ -111,13 +113,8 @@ GtkWidget *tooltip_task_show, *tooltip_show_after, *tooltip_hide_after;
GtkWidget *clock_format_tooltip, *clock_tmz_tooltip;
GtkWidget *tooltip_background;
// Executor
GtkWidget *execp_command, *execp_has_icon, *execp_cache_icon, *execp_interval, *execp_show_tooltip;
GtkWidget *execp_continuous, *execp_markup, *execp_tooltip;
GtkWidget *execp_left_command, *execp_right_command;
GtkWidget *execp_mclick_command, *execp_rclick_command, *execp_uwheel_command, *execp_dwheel_command;
GtkWidget *execp_font, *execp_font_color, *execp_padding_x, *execp_padding_y, *execp_centered, *execp_background;
GtkWidget *execp_icon_w, *execp_icon_h;
// Executors
GArray *executors;
// launcher
@@ -177,7 +174,7 @@ void create_task_status(GtkWidget *notebook,
GtkWidget **task_status_icon_brightness,
GtkWidget **task_status_background,
GtkWidget **task_status_background_set);
void create_execp(GtkWidget *parent);
void create_execp(GtkWidget *parent, int i);
void create_clock(GtkWidget *parent);
void create_systemtray(GtkWidget *parent);
void create_battery(GtkWidget *parent);
@@ -224,15 +221,17 @@ void okClicked(GtkWidget *widget, gpointer data)
GtkWidget *create_properties()
{
GtkWidget *view, *dialog_vbox3, *button, *notebook;
GtkWidget *view, *dialog_vbox3, *button;
GtkTooltips *tooltips;
GtkWidget *page_panel, *page_panel_items, *page_launcher, *page_taskbar, *page_battery, *page_clock, *page_execp,
GtkWidget *page_panel, *page_panel_items, *page_launcher, *page_taskbar, *page_battery, *page_clock,
*page_tooltip, *page_systemtray, *page_task, *page_background;
GtkWidget *label;
tooltips = gtk_tooltips_new();
(void) tooltips;
executors = g_array_new(FALSE, TRUE, sizeof(Executor));
// global layer
view = gtk_dialog_new();
gtk_window_set_title(GTK_WINDOW(view), _("Properties"));
@@ -341,14 +340,6 @@ GtkWidget *create_properties()
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), addScrollBarToWidget(page_battery), label);
create_battery(page_battery);
label = gtk_label_new(_("Executors"));
gtk_widget_show(label);
page_execp = gtk_vbox_new(FALSE, DEFAULT_HOR_SPACING);
gtk_container_set_border_width(GTK_CONTAINER(page_execp), 10);
gtk_widget_show(page_execp);
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), addScrollBarToWidget(page_execp), label);
create_execp(page_execp);
label = gtk_label_new(_("Tooltip"));
gtk_widget_show(label);
page_tooltip = gtk_vbox_new(FALSE, DEFAULT_HOR_SPACING);
@@ -1682,6 +1673,11 @@ void create_panel_items(GtkWidget *parent)
itemsColName, _("Free space"),
itemsColValue, "F",
-1);
gtk_list_store_append(all_items, &iter);
gtk_list_store_set(all_items, &iter,
itemsColName, _("Executor"),
itemsColValue, "E",
-1);
panel_items_view = gtk_tree_view_new();
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(panel_items_view),
@@ -1840,9 +1836,11 @@ void set_panel_items(const char *items)
{
gtk_list_store_clear(panel_items);
int execp_index = -1;
for (; items && *items; items++) {
const char *value = NULL;
const char *name = NULL;
char buffer[256];
char v = *items;
if (v == 'B') {
@@ -1864,8 +1862,11 @@ void set_panel_items(const char *items)
value = "F";
name = _("Free space");
} else if (v == 'E') {
execp_index++;
buffer[0] = 0;
sprintf(buffer, "%s %d", _("Executor"), execp_index + 1);
name = buffer;
value = "E";
name = _("Executor");
} else {
continue;
}
@@ -1893,15 +1894,19 @@ void panel_add_item(GtkWidget *widget, gpointer data)
itemsColValue, &value,
-1);
if (!panel_contains(value)) {
if (!panel_contains(value) || g_str_equal(value, "E")) {
GtkTreeIter iter;
gtk_list_store_append(panel_items, &iter);
gtk_list_store_set(panel_items, &iter,
itemsColName, g_strdup(name),
itemsColValue, g_strdup(value),
-1);
if (g_str_equal(value, "E")) {
execp_create_new();
}
}
}
execp_update_indices();
}
void panel_remove_item(GtkWidget *widget, gpointer data)
@@ -1910,8 +1915,28 @@ void panel_remove_item(GtkWidget *widget, gpointer data)
GtkTreeModel *model;
if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(panel_items_view)), &model, &iter)) {
gchar *name;
gchar *value;
gtk_tree_model_get(model, &iter,
itemsColName, &name,
itemsColValue, &value,
-1);
if (g_str_equal(value, "E")) {
for (int i = 0; i < executors->len; i++) {
Executor *executor = &g_array_index(executors, Executor, i);
if (g_str_equal(name, executor->name)) {
execp_remove(i);
break;
}
}
}
gtk_list_store_remove(panel_items, &iter);
}
execp_update_indices();
}
void panel_move_item_down(GtkWidget *widget, gpointer data)
@@ -1922,9 +1947,40 @@ void panel_move_item_down(GtkWidget *widget, gpointer data)
if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(panel_items_view)), &model, &iter)) {
GtkTreeIter next = iter;
if (gtk_tree_model_iter_next(model, &next)) {
gchar *name1;
gchar *value1;
gtk_tree_model_get(model, &iter,
itemsColName, &name1,
itemsColValue, &value1,
-1);
gchar *name2;
gchar *value2;
gtk_tree_model_get(model, &next,
itemsColName, &name2,
itemsColValue, &value2,
-1);
if (g_str_equal(value1, "E") && g_str_equal(value2, "E")) {
Executor *executor1 = NULL;
Executor *executor2 = NULL;
for (int i = 0; i < executors->len; i++) {
Executor *executor = &g_array_index(executors, Executor, i);
if (g_str_equal(name1, executor->name)) {
executor1 = executor;
}
if (g_str_equal(name2, executor->name)) {
executor2 = executor;
}
}
Executor tmp = *executor1;
*executor1 = *executor2;
*executor2 = tmp;
}
gtk_list_store_swap(panel_items, &iter, &next);
}
}
execp_update_indices();
}
void panel_move_item_up(GtkWidget *widget, gpointer data)
@@ -1936,10 +1992,41 @@ void panel_move_item_up(GtkWidget *widget, gpointer data)
if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(panel_items_view)), &model, &iter)) {
GtkTreeIter prev = iter;
if (gtk_tree_model_iter_prev_tint2(model, &prev)) {
gchar *name1;
gchar *value1;
gtk_tree_model_get(model, &iter,
itemsColName, &name1,
itemsColValue, &value1,
-1);
gchar *name2;
gchar *value2;
gtk_tree_model_get(model, &prev,
itemsColName, &name2,
itemsColValue, &value2,
-1);
if (g_str_equal(value1, "E") && g_str_equal(value2, "E")) {
Executor *executor1 = NULL;
Executor *executor2 = NULL;
for (int i = 0; i < executors->len; i++) {
Executor *executor = &g_array_index(executors, Executor, i);
if (g_str_equal(name1, executor->name)) {
executor1 = executor;
}
if (g_str_equal(name2, executor->name)) {
executor2 = executor;
}
}
Executor tmp = *executor1;
*executor1 = *executor2;
*executor2 = tmp;
}
gtk_list_store_swap(panel_items, &iter, &prev);
}
}
}
execp_update_indices();
}
enum {
@@ -3981,13 +4068,27 @@ void create_clock(GtkWidget *parent)
change_paragraph(parent);
}
void create_execp(GtkWidget *parent)
void create_execp(GtkWidget *notebook, int i)
{
GtkWidget *table;
GtkWidget *label;
GtkWidget *table;
int row, col;
GtkTooltips *tooltips = gtk_tooltips_new();
Executor *executor = &g_array_index(executors, Executor, i);
executor->name[0] = 0;
sprintf(executor->name, "%s %d", _("Executor"), i + 1);
executor->page_label = gtk_label_new(executor->name);
gtk_widget_show(executor->page_label);
executor->page_execp = gtk_vbox_new(FALSE, DEFAULT_HOR_SPACING);
executor->container = addScrollBarToWidget(executor->page_execp);
gtk_container_set_border_width(GTK_CONTAINER(executor->page_execp), 10);
gtk_widget_show(executor->page_execp);
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), executor->container, executor->page_label);
GtkWidget *parent = executor->page_execp;
table = gtk_table_new(1, 2, FALSE);
gtk_widget_show(table);
gtk_box_pack_start(GTK_BOX(parent), table, FALSE, FALSE, 0);
@@ -4013,12 +4114,12 @@ void create_execp(GtkWidget *parent)
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
execp_command = gtk_entry_new();
gtk_widget_show(execp_command);
gtk_entry_set_width_chars(GTK_ENTRY(execp_command), 50);
gtk_table_attach(GTK_TABLE(table), execp_command, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
executor->execp_command = gtk_entry_new();
gtk_widget_show(executor->execp_command);
gtk_entry_set_width_chars(GTK_ENTRY(executor->execp_command), 50);
gtk_table_attach(GTK_TABLE(table), executor->execp_command, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips, execp_command,
gtk_tooltips_set_tip(tooltips, executor->execp_command,
_("Specifies the command to execute."), NULL);
row++, col = 2;
@@ -4028,11 +4129,11 @@ void create_execp(GtkWidget *parent)
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
execp_interval = gtk_spin_button_new_with_range(0, 1000000, 1);
gtk_widget_show(execp_interval);
gtk_table_attach(GTK_TABLE(table), execp_interval, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
executor->execp_interval = gtk_spin_button_new_with_range(0, 1000000, 1);
gtk_widget_show(executor->execp_interval);
gtk_table_attach(GTK_TABLE(table), executor->execp_interval, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips, execp_interval, _("Specifies the interval at which the command is executed, in seconds. "
gtk_tooltips_set_tip(tooltips, executor->execp_interval, _("Specifies the interval at which the command is executed, in seconds. "
"If zero, the command is executed only once."), NULL);
row++, col = 2;
@@ -4042,11 +4143,11 @@ void create_execp(GtkWidget *parent)
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
execp_has_icon = gtk_check_button_new();
gtk_widget_show(execp_has_icon);
gtk_table_attach(GTK_TABLE(table), execp_has_icon, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
executor->execp_has_icon = gtk_check_button_new();
gtk_widget_show(executor->execp_has_icon);
gtk_table_attach(GTK_TABLE(table), executor->execp_has_icon, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips, execp_has_icon, _("If enabled, the first line printed by the command is interpreted "
gtk_tooltips_set_tip(tooltips, executor->execp_has_icon, _("If enabled, the first line printed by the command is interpreted "
"as a path to an image file."), NULL);
row++, col = 2;
@@ -4056,12 +4157,12 @@ void create_execp(GtkWidget *parent)
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
execp_cache_icon = gtk_check_button_new();
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(execp_cache_icon), 1);
gtk_widget_show(execp_cache_icon);
gtk_table_attach(GTK_TABLE(table), execp_cache_icon, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
executor->execp_cache_icon = gtk_check_button_new();
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(executor->execp_cache_icon), 1);
gtk_widget_show(executor->execp_cache_icon);
gtk_table_attach(GTK_TABLE(table), executor->execp_cache_icon, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips, execp_cache_icon, _("If enabled, the image is not reloaded from disk every time the command is executed if the path remains unchanged. Enabling this is recommended."), NULL);
gtk_tooltips_set_tip(tooltips, executor->execp_cache_icon, _("If enabled, the image is not reloaded from disk every time the command is executed if the path remains unchanged. Enabling this is recommended."), NULL);
row++, col = 2;
label = gtk_label_new(_("Continuous output"));
@@ -4070,11 +4171,11 @@ void create_execp(GtkWidget *parent)
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
execp_continuous = gtk_spin_button_new_with_range(0, 1000000, 1);
gtk_widget_show(execp_continuous);
gtk_table_attach(GTK_TABLE(table), execp_continuous, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
executor->execp_continuous = gtk_spin_button_new_with_range(0, 1000000, 1);
gtk_widget_show(executor->execp_continuous);
gtk_table_attach(GTK_TABLE(table), executor->execp_continuous, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips, execp_continuous, _("If non-zero, the last execp_continuous lines from the output of "
gtk_tooltips_set_tip(tooltips, executor->execp_continuous, _("If non-zero, the last execp_continuous lines from the output of "
"the command are displayed, every execp_continuous lines; this is "
"useful for showing the output of commands that run indefinitely, "
"such as 'ping 127.0.0.1'. If zero, the output of the command is "
@@ -4086,12 +4187,12 @@ void create_execp(GtkWidget *parent)
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
execp_markup = gtk_check_button_new();
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(execp_markup), 1);
gtk_widget_show(execp_markup);
gtk_table_attach(GTK_TABLE(table), execp_markup, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
executor->execp_markup = gtk_check_button_new();
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(executor->execp_markup), 1);
gtk_widget_show(executor->execp_markup);
gtk_table_attach(GTK_TABLE(table), executor->execp_markup, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips, execp_markup, _("If enabled, the output of the command is treated as Pango markup, "
gtk_tooltips_set_tip(tooltips, executor->execp_markup, _("If enabled, the output of the command is treated as Pango markup, "
"which allows rich text formatting. Note that using this with commands "
"that print data downloaded from the Internet is a potential security risk."), NULL);
@@ -4116,12 +4217,12 @@ void create_execp(GtkWidget *parent)
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
execp_left_command = gtk_entry_new();
gtk_widget_show(execp_left_command);
gtk_entry_set_width_chars(GTK_ENTRY(execp_left_command), 50);
gtk_table_attach(GTK_TABLE(table), execp_left_command, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
executor->execp_left_command = gtk_entry_new();
gtk_widget_show(executor->execp_left_command);
gtk_entry_set_width_chars(GTK_ENTRY(executor->execp_left_command), 50);
gtk_table_attach(GTK_TABLE(table), executor->execp_left_command, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips, execp_left_command,
gtk_tooltips_set_tip(tooltips, executor->execp_left_command,
_("Specifies a command that will be executed when the executor receives a left click."), NULL);
row++, col = 2;
@@ -4131,12 +4232,12 @@ void create_execp(GtkWidget *parent)
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
execp_right_command = gtk_entry_new();
gtk_widget_show(execp_right_command);
gtk_entry_set_width_chars(GTK_ENTRY(execp_right_command), 50);
gtk_table_attach(GTK_TABLE(table), execp_right_command, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
executor->execp_right_command = gtk_entry_new();
gtk_widget_show(executor->execp_right_command);
gtk_entry_set_width_chars(GTK_ENTRY(executor->execp_right_command), 50);
gtk_table_attach(GTK_TABLE(table), executor->execp_right_command, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips, execp_right_command,
gtk_tooltips_set_tip(tooltips, executor->execp_right_command,
_("Specifies a command that will be executed when the executor receives a right click."), NULL);
row++, col = 2;
@@ -4146,12 +4247,12 @@ void create_execp(GtkWidget *parent)
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
execp_mclick_command = gtk_entry_new();
gtk_widget_show(execp_mclick_command);
gtk_entry_set_width_chars(GTK_ENTRY(execp_mclick_command), 50);
gtk_table_attach(GTK_TABLE(table), execp_mclick_command, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
executor->execp_mclick_command = gtk_entry_new();
gtk_widget_show(executor->execp_mclick_command);
gtk_entry_set_width_chars(GTK_ENTRY(executor->execp_mclick_command), 50);
gtk_table_attach(GTK_TABLE(table), executor->execp_mclick_command, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips, execp_mclick_command,
gtk_tooltips_set_tip(tooltips, executor->execp_mclick_command,
_("Specifies a command that will be executed when the executor receives a middle click."), NULL);
row++, col = 2;
@@ -4161,12 +4262,12 @@ void create_execp(GtkWidget *parent)
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
execp_uwheel_command = gtk_entry_new();
gtk_widget_show(execp_uwheel_command);
gtk_entry_set_width_chars(GTK_ENTRY(execp_uwheel_command), 50);
gtk_table_attach(GTK_TABLE(table), execp_uwheel_command, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
executor->execp_uwheel_command = gtk_entry_new();
gtk_widget_show(executor->execp_uwheel_command);
gtk_entry_set_width_chars(GTK_ENTRY(executor->execp_uwheel_command), 50);
gtk_table_attach(GTK_TABLE(table), executor->execp_uwheel_command, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips, execp_uwheel_command,
gtk_tooltips_set_tip(tooltips, executor->execp_uwheel_command,
_("Specifies a command that will be executed when the executor receives a mouse scroll up."), NULL);
row++, col = 2;
@@ -4176,12 +4277,12 @@ void create_execp(GtkWidget *parent)
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
execp_dwheel_command = gtk_entry_new();
gtk_widget_show(execp_dwheel_command);
gtk_entry_set_width_chars(GTK_ENTRY(execp_dwheel_command), 50);
gtk_table_attach(GTK_TABLE(table), execp_dwheel_command, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
executor->execp_dwheel_command = gtk_entry_new();
gtk_widget_show(executor->execp_dwheel_command);
gtk_entry_set_width_chars(GTK_ENTRY(executor->execp_dwheel_command), 50);
gtk_table_attach(GTK_TABLE(table), executor->execp_dwheel_command, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips, execp_dwheel_command,
gtk_tooltips_set_tip(tooltips, executor->execp_dwheel_command,
_("Specifies a command that will be executed when the executor receives a mouse scroll down."), NULL);
change_paragraph(parent);
@@ -4205,11 +4306,11 @@ void create_execp(GtkWidget *parent)
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
execp_background = create_background_combo(_("execp"));
gtk_widget_show(execp_background);
gtk_table_attach(GTK_TABLE(table), execp_background, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
executor->execp_background = create_background_combo(_("Executor"));
gtk_widget_show(executor->execp_background);
gtk_table_attach(GTK_TABLE(table), executor->execp_background, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips, execp_background, _("Selects the background used to display the executor. "
gtk_tooltips_set_tip(tooltips, executor->execp_background, _("Selects the background used to display the executor. "
"Backgrounds can be edited in the Backgrounds tab."), NULL);
row++, col = 2;
@@ -4219,11 +4320,11 @@ void create_execp(GtkWidget *parent)
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
execp_padding_x = gtk_spin_button_new_with_range(0, 500, 1);
gtk_widget_show(execp_padding_x);
gtk_table_attach(GTK_TABLE(table), execp_padding_x, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
executor->execp_padding_x = gtk_spin_button_new_with_range(0, 500, 1);
gtk_widget_show(executor->execp_padding_x);
gtk_table_attach(GTK_TABLE(table), executor->execp_padding_x, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips, execp_padding_x, _("Specifies the horizontal padding of the executor. "
gtk_tooltips_set_tip(tooltips, executor->execp_padding_x, _("Specifies the horizontal padding of the executor. "
"This is the space between the border and the content inside."), NULL);
row++, col = 2;
@@ -4233,11 +4334,11 @@ void create_execp(GtkWidget *parent)
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
execp_padding_y = gtk_spin_button_new_with_range(0, 500, 1);
gtk_widget_show(execp_padding_y);
gtk_table_attach(GTK_TABLE(table), execp_padding_y, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
executor->execp_padding_y = gtk_spin_button_new_with_range(0, 500, 1);
gtk_widget_show(executor->execp_padding_y);
gtk_table_attach(GTK_TABLE(table), executor->execp_padding_y, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips, execp_padding_y, _("Specifies the vertical padding of the executor. "
gtk_tooltips_set_tip(tooltips, executor->execp_padding_y, _("Specifies the vertical padding of the executor. "
"This is the space between the border and the content inside."), NULL);
row++, col = 2;
@@ -4247,11 +4348,11 @@ void create_execp(GtkWidget *parent)
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
execp_font = gtk_font_button_new();
gtk_widget_show(execp_font);
gtk_table_attach(GTK_TABLE(table), execp_font, col, col+3, row, row+1, GTK_FILL, 0, 0, 0);
executor->execp_font = gtk_font_button_new();
gtk_widget_show(executor->execp_font);
gtk_table_attach(GTK_TABLE(table), executor->execp_font, col, col+3, row, row+1, GTK_FILL, 0, 0, 0);
col++;
gtk_font_button_set_show_style(GTK_FONT_BUTTON(execp_font), TRUE);
gtk_font_button_set_show_style(GTK_FONT_BUTTON(executor->execp_font), TRUE);
row++, col = 2;
label = gtk_label_new(_("Font color"));
@@ -4260,10 +4361,10 @@ void create_execp(GtkWidget *parent)
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
execp_font_color = gtk_color_button_new();
gtk_color_button_set_use_alpha(GTK_COLOR_BUTTON(execp_font_color), TRUE);
gtk_widget_show(execp_font_color);
gtk_table_attach(GTK_TABLE(table), execp_font_color, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
executor->execp_font_color = gtk_color_button_new();
gtk_color_button_set_use_alpha(GTK_COLOR_BUTTON(executor->execp_font_color), TRUE);
gtk_widget_show(executor->execp_font_color);
gtk_table_attach(GTK_TABLE(table), executor->execp_font_color, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
row++, col = 2;
@@ -4273,9 +4374,9 @@ void create_execp(GtkWidget *parent)
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
execp_centered = gtk_check_button_new();
gtk_widget_show(execp_centered);
gtk_table_attach(GTK_TABLE(table), execp_centered, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
executor->execp_centered = gtk_check_button_new();
gtk_widget_show(executor->execp_centered);
gtk_table_attach(GTK_TABLE(table), executor->execp_centered, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
row++, col = 2;
@@ -4285,11 +4386,11 @@ void create_execp(GtkWidget *parent)
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
execp_icon_w = gtk_spin_button_new_with_range(0, 1000000, 1);
gtk_widget_show(execp_icon_w);
gtk_table_attach(GTK_TABLE(table), execp_icon_w, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
executor->execp_icon_w = gtk_spin_button_new_with_range(0, 1000000, 1);
gtk_widget_show(executor->execp_icon_w);
gtk_table_attach(GTK_TABLE(table), executor->execp_icon_w, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips, execp_icon_w, _("If non-zero, the image is resized to this width."), NULL);
gtk_tooltips_set_tip(tooltips, executor->execp_icon_w, _("If non-zero, the image is resized to this width."), NULL);
row++, col = 2;
label = gtk_label_new(_("Icon height"));
@@ -4298,11 +4399,11 @@ void create_execp(GtkWidget *parent)
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
execp_icon_h = gtk_spin_button_new_with_range(0, 1000000, 1);
gtk_widget_show(execp_icon_h);
gtk_table_attach(GTK_TABLE(table), execp_icon_h, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
executor->execp_icon_h = gtk_spin_button_new_with_range(0, 1000000, 1);
gtk_widget_show(executor->execp_icon_h);
gtk_table_attach(GTK_TABLE(table), executor->execp_icon_h, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips, execp_icon_h, _("If non-zero, the image is resized to this height."), NULL);
gtk_tooltips_set_tip(tooltips, executor->execp_icon_h, _("If non-zero, the image is resized to this height."), NULL);
row++, col = 2;
label = gtk_label_new(_("Tooltip"));
@@ -4311,10 +4412,10 @@ void create_execp(GtkWidget *parent)
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
execp_show_tooltip = gtk_check_button_new();
gtk_widget_show(execp_show_tooltip);
gtk_table_attach(GTK_TABLE(table), execp_show_tooltip, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(execp_show_tooltip), 1);
executor->execp_show_tooltip = gtk_check_button_new();
gtk_widget_show(executor->execp_show_tooltip);
gtk_table_attach(GTK_TABLE(table), executor->execp_show_tooltip, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(executor->execp_show_tooltip), 1);
col++;
row++, col = 2;
@@ -4324,17 +4425,82 @@ void create_execp(GtkWidget *parent)
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
execp_tooltip = gtk_entry_new();
gtk_widget_show(execp_tooltip);
gtk_entry_set_width_chars(GTK_ENTRY(execp_tooltip), 50);
gtk_table_attach(GTK_TABLE(table), execp_tooltip, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
executor->execp_tooltip = gtk_entry_new();
gtk_widget_show(executor->execp_tooltip);
gtk_entry_set_width_chars(GTK_ENTRY(executor->execp_tooltip), 50);
gtk_table_attach(GTK_TABLE(table), executor->execp_tooltip, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips, execp_tooltip,
gtk_tooltips_set_tip(tooltips, executor->execp_tooltip,
_("The tooltip text to display. Leave this empty to display an automatically generated tooltip with information about when the command was last executed."), NULL);
change_paragraph(parent);
}
void execp_create_new()
{
g_array_set_size(executors, executors->len + 1);
create_execp(notebook, executors->len - 1);
}
Executor *execp_get_last()
{
if (executors->len <= 0)
execp_create_new();
return &g_array_index(executors, Executor, executors->len - 1);
}
void execp_remove(int i)
{
Executor *executor = &g_array_index(executors, Executor, 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 == executor->container) {
gtk_widget_hide(page);
gtk_notebook_remove_page(GTK_NOTEBOOK(notebook), i_page);
}
}
executors = g_array_remove_index(executors, i);
}
void execp_update_indices()
{
for (int i = 0; i < executors->len; i++) {
Executor *executor = &g_array_index(executors, Executor, i);
sprintf(executor->name, "%s %d", _("Executor"), 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 execp_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")) {
execp_index++;
char buffer[256];
buffer[0] = 0;
sprintf(buffer, "%s %d", _("Executor"), execp_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;