From a9330b424b70b0801fdf6173b375ca593e4954db Mon Sep 17 00:00:00 2001 From: o9000 Date: Sun, 3 May 2015 10:05:31 +0200 Subject: [PATCH] launcher: New option launcher_icon_theme_override to preserve legacy behavior --- src/config.c | 3 +++ src/launcher/launcher.c | 18 +++++++++++++----- src/launcher/launcher.h | 1 + src/tint2conf/properties.c | 7 +++++++ src/tint2conf/properties.h | 1 + src/tint2conf/properties_rw.c | 4 ++++ 6 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/config.c b/src/config.c index 22ebcb8..0a05b2d 100644 --- a/src/config.c +++ b/src/config.c @@ -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); diff --git a/src/launcher/launcher.c b/src/launcher/launcher.c index 4dc1e8f..4637bbc 100644 --- a/src/launcher/launcher.c +++ b/src/launcher/launcher.c @@ -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")); } diff --git a/src/launcher/launcher.h b/src/launcher/launcher.h index 5d5e8ef..47a341d 100644 --- a/src/launcher/launcher.h +++ b/src/launcher/launcher.h @@ -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; diff --git a/src/tint2conf/properties.c b/src/tint2conf/properties.c index 9cf32c2..9a3a74a 100644 --- a/src/tint2conf/properties.c +++ b/src/tint2conf/properties.c @@ -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); diff --git a/src/tint2conf/properties.h b/src/tint2conf/properties.h index c75daf7..16bb553 100644 --- a/src/tint2conf/properties.h +++ b/src/tint2conf/properties.h @@ -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); diff --git a/src/tint2conf/properties_rw.c b/src/tint2conf/properties_rw.c index 26e0db7..0e41f79 100644 --- a/src/tint2conf/properties_rw.c +++ b/src/tint2conf/properties_rw.c @@ -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)); }