launcher: New option launcher_icon_theme_override to preserve legacy behavior

This commit is contained in:
o9000 2015-05-03 10:05:31 +02:00
parent 5486c93f4c
commit a9330b424b
6 changed files with 29 additions and 5 deletions

View file

@ -664,6 +664,9 @@ void add_entry (char *key, char *value)
free(icon_theme_name_config);
icon_theme_name_config = strdup(value);
}
else if (strcmp(key, "launcher_icon_theme_override") == 0) {
launcher_icon_theme_override = atoi(value);
}
else if (strcmp(key, "launcher_icon_asb") == 0) {
extract_values(value, &value1, &value2, &value3);
launcher_alpha = atoi(value1);

View file

@ -53,6 +53,7 @@ int launcher_saturation;
int launcher_brightness;
char *icon_theme_name_config;
char *icon_theme_name_xsettings;
int launcher_icon_theme_override;
XSettingsClient *xsettings_client;
int startup_notifications;
@ -69,6 +70,7 @@ void default_launcher()
launcher_brightness = 0;
icon_theme_name_config = NULL;
icon_theme_name_xsettings = NULL;
launcher_icon_theme_override = 0;
xsettings_client = NULL;
startup_notifications = 0;
}
@ -486,9 +488,15 @@ void launcher_load_icons(Launcher *launcher)
// Populates the list_themes list
void launcher_load_themes(Launcher *launcher)
{
launcher->list_themes = load_themes(icon_theme_name_config
? icon_theme_name_config
: icon_theme_name_xsettings
? icon_theme_name_xsettings
: "hicolor");
launcher->list_themes = load_themes(launcher_icon_theme_override
? (icon_theme_name_config
? icon_theme_name_config
: icon_theme_name_xsettings
? icon_theme_name_xsettings
: "hicolor")
: (icon_theme_name_xsettings
? icon_theme_name_xsettings
: icon_theme_name_config
? icon_theme_name_config
: "hicolor"));
}

View file

@ -42,6 +42,7 @@ extern int launcher_saturation;
extern int launcher_brightness;
extern char *icon_theme_name_xsettings; // theme name
extern char *icon_theme_name_config;
extern int launcher_icon_theme_override;
extern XSettingsClient *xsettings_client;
extern int startup_notifications;

View file

@ -115,6 +115,7 @@ GtkWidget *launcher_background;
GtkWidget *startup_notifications;
IconThemeWrapper *icon_theme;
GtkWidget *launcher_tooltip;
GtkWidget *launcher_icon_theme_override;
GtkListStore *backgrounds;
GtkWidget *current_background,
@ -2153,6 +2154,12 @@ void create_launcher(GtkWidget *parent)
"tint2 will detect and use the icon theme of your desktop as long as you have "
"an XSETTINGS manager running (most desktop environments do).", NULL);
launcher_icon_theme_override = gtk_check_button_new_with_label("Overrides XSETTINGS");
gtk_widget_show(launcher_icon_theme_override);
gtk_table_attach(GTK_TABLE(table), launcher_icon_theme_override, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips, launcher_icon_theme_override, "If enabled, the icon theme selected here will override the one provided by XSETTINGS.", NULL);
row++, col = 2;
label = gtk_label_new(_("Startup notifications"));
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);

View file

@ -127,6 +127,7 @@ extern GtkWidget *launcher_background;
extern GtkWidget *startup_notifications;
extern IconThemeWrapper *icon_theme;
extern GtkWidget *launcher_tooltip;
extern GtkWidget *launcher_icon_theme_override;
void load_desktop_file(const char *file, gboolean selected);
void set_current_icon_theme(const char *theme);

View file

@ -469,6 +469,7 @@ void config_write_launcher(FILE *fp)
g_free(icon_theme);
icon_theme = NULL;
}
fprintf(fp, "launcher_icon_theme_override = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(launcher_icon_theme_override)) ? 1 : 0);
fprintf(fp, "startup_notifications = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(startup_notifications)) ? 1 : 0);
fprintf(fp, "launcher_tooltip = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(launcher_tooltip)) ? 1 : 0);
@ -1283,6 +1284,9 @@ void add_entry(char *key, char *value)
else if (strcmp(key, "launcher_icon_theme") == 0) {
set_current_icon_theme(value);
}
else if (strcmp(key, "launcher_icon_theme_override") == 0) {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(launcher_icon_theme_override), atoi(value));
}
else if (strcmp(key, "launcher_tooltip") == 0) {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(launcher_tooltip), atoi(value));
}