Add support for battery tooltip option in tint2conf
This commit is contained in:
@@ -92,6 +92,7 @@ GtkWidget *clock_background;
|
|||||||
GtkWidget *battery_hide_if_higher, *battery_alert_if_lower, *battery_alert_cmd;
|
GtkWidget *battery_hide_if_higher, *battery_alert_if_lower, *battery_alert_cmd;
|
||||||
GtkWidget *battery_padding_x, *battery_padding_y, *battery_font_line1, *battery_font_line2, *battery_font_color;
|
GtkWidget *battery_padding_x, *battery_padding_y, *battery_font_line1, *battery_font_line2, *battery_font_color;
|
||||||
GtkWidget *battery_background;
|
GtkWidget *battery_background;
|
||||||
|
GtkWidget *battery_tooltip;
|
||||||
GtkWidget *battery_left_command, *battery_mclick_command, *battery_right_command, *battery_uwheel_command, *battery_dwheel_command;
|
GtkWidget *battery_left_command, *battery_mclick_command, *battery_right_command, *battery_uwheel_command, *battery_dwheel_command;
|
||||||
|
|
||||||
// systray
|
// systray
|
||||||
@@ -3829,6 +3830,20 @@ void create_battery(GtkWidget *parent)
|
|||||||
gtk_table_set_col_spacings(GTK_TABLE(table), COL_SPACING);
|
gtk_table_set_col_spacings(GTK_TABLE(table), COL_SPACING);
|
||||||
row = 0, col = 2;
|
row = 0, col = 2;
|
||||||
|
|
||||||
|
label = gtk_label_new(_("Tooltips"));
|
||||||
|
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++;
|
||||||
|
|
||||||
|
battery_tooltip = gtk_check_button_new();
|
||||||
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(battery_tooltip), 1);
|
||||||
|
gtk_widget_show(battery_tooltip);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), battery_tooltip, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
gtk_tooltips_set_tip(tooltips, battery_tooltip, _("If enabled, shows a tooltip with detailed battery information when the mouse is moved over the battery widget."), NULL);
|
||||||
|
|
||||||
|
row++, col = 2;
|
||||||
label = gtk_label_new(_("Left click command"));
|
label = gtk_label_new(_("Left click command"));
|
||||||
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
gtk_widget_show(label);
|
gtk_widget_show(label);
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ extern GtkWidget *clock_background;
|
|||||||
extern GtkWidget *battery_hide_if_higher, *battery_alert_if_lower, *battery_alert_cmd;
|
extern GtkWidget *battery_hide_if_higher, *battery_alert_if_lower, *battery_alert_cmd;
|
||||||
extern GtkWidget *battery_padding_x, *battery_padding_y, *battery_font_line1, *battery_font_line2, *battery_font_color;
|
extern GtkWidget *battery_padding_x, *battery_padding_y, *battery_font_line1, *battery_font_line2, *battery_font_color;
|
||||||
extern GtkWidget *battery_background;
|
extern GtkWidget *battery_background;
|
||||||
|
extern GtkWidget *battery_tooltip;
|
||||||
extern GtkWidget *battery_left_command, *battery_mclick_command, *battery_right_command, *battery_uwheel_command, *battery_dwheel_command;
|
extern GtkWidget *battery_left_command, *battery_mclick_command, *battery_right_command, *battery_uwheel_command, *battery_dwheel_command;
|
||||||
|
|
||||||
// systray
|
// systray
|
||||||
|
|||||||
@@ -560,6 +560,7 @@ void config_write_battery(FILE *fp)
|
|||||||
fprintf(fp, "#-------------------------------------\n");
|
fprintf(fp, "#-------------------------------------\n");
|
||||||
fprintf(fp, "# Battery\n");
|
fprintf(fp, "# Battery\n");
|
||||||
|
|
||||||
|
fprintf(fp, "battery_tooltip = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(battery_tooltip)) ? 1 : 0);
|
||||||
fprintf(fp, "battery_low_status = %g\n", gtk_spin_button_get_value(GTK_SPIN_BUTTON(battery_alert_if_lower)));
|
fprintf(fp, "battery_low_status = %g\n", gtk_spin_button_get_value(GTK_SPIN_BUTTON(battery_alert_if_lower)));
|
||||||
fprintf(fp, "battery_low_cmd = %s\n", gtk_entry_get_text(GTK_ENTRY(battery_alert_cmd)));
|
fprintf(fp, "battery_low_cmd = %s\n", gtk_entry_get_text(GTK_ENTRY(battery_alert_cmd)));
|
||||||
fprintf(fp, "bat1_font = %s\n", gtk_font_button_get_font_name(GTK_FONT_BUTTON(battery_font_line1)));
|
fprintf(fp, "bat1_font = %s\n", gtk_font_button_get_font_name(GTK_FONT_BUTTON(battery_font_line1)));
|
||||||
@@ -904,8 +905,9 @@ void add_entry(char *key, char *value)
|
|||||||
// Obsolete option
|
// Obsolete option
|
||||||
config_has_battery = 1;
|
config_has_battery = 1;
|
||||||
config_battery_enabled = atoi(value);
|
config_battery_enabled = atoi(value);
|
||||||
}
|
} else if (strcmp(key, "battery_tooltip") == 0) {
|
||||||
else if (strcmp(key, "battery_low_status") == 0) {
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(battery_tooltip), atoi(value));
|
||||||
|
} else if (strcmp(key, "battery_low_status") == 0) {
|
||||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(battery_alert_if_lower), atof(value));
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(battery_alert_if_lower), atof(value));
|
||||||
}
|
}
|
||||||
else if (strcmp(key, "battery_low_cmd") == 0) {
|
else if (strcmp(key, "battery_low_cmd") == 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user