tint2conf: Display themes consistently

This commit is contained in:
o9000 2016-03-24 23:20:00 +01:00
parent 9150a180fa
commit 3e03e81dbf
4 changed files with 19 additions and 13 deletions

View file

@ -5,7 +5,11 @@
- Tint2conf GUI improvements
- Config options with changed behavior:
- The launcher now also allows launcher_item_app entries without a full path.
In this case the .desktop file is searched in the standard application directories.
In this case the .desktop file is searched in the standard application directories (issue #565).
- If the panel size is given as a percentage and a non-zero margin is also specified,
the size is now computed as a fraction of the available size (i.e. monitor size - margin).
Before it was computed as a fraction of the monitor size first, then the margin was subtracted from the value, which
was not intuitive (issue #559).
- Fixes:
- Taskbar icons are now resized correctly for certain geometries (issue #560)
- Fix get_version.sh so that it returns the correct version when .git is missing

View file

@ -117,7 +117,7 @@ gchar *import_no_overwrite(const char *filepath)
gchar *newpath = g_build_filename(g_get_user_config_dir(), "tint2", filename, NULL);
if (!g_file_test(newpath, G_FILE_TEST_EXISTS)) {
copy_file(filepath, newpath);
theme_list_append(newpath, NULL);
theme_list_append(newpath);
g_timeout_add(SNAPSHOT_TICK, (GSourceFunc)update_snapshot, NULL);
}
@ -136,7 +136,7 @@ void import_with_overwrite(const char *filepath, const char *newpath)
if (theme_is_editable(newpath)) {
if (!theme_existed) {
theme_list_append(newpath, NULL);
theme_list_append(newpath);
g_timeout_add(SNAPSHOT_TICK, (GSourceFunc)update_snapshot, NULL);
} else {
int unused = system("killall -SIGUSR1 tint2 || pkill -SIGUSR1 -x tint2");
@ -708,7 +708,7 @@ static gboolean load_user_themes()
!strstr(file_name, "~") && (endswith(file_name, "tint2rc") || endswith(file_name, ".conf"))) {
found_theme = TRUE;
gchar *path = g_build_filename(tint2_config_dir, file_name, NULL);
theme_list_append(path, NULL);
theme_list_append(path);
g_free(path);
}
}
@ -732,7 +732,7 @@ static gboolean load_themes_from_dirs(const gchar *const *dirs)
(endswith(file_name, "tint2rc") || endswith(file_name, ".conf"))) {
found_theme = TRUE;
gchar *path = g_build_filename(path_tint2, file_name, NULL);
theme_list_append(path, dirs[i]);
theme_list_append(path);
g_free(path);
}
}

View file

@ -20,6 +20,7 @@
#include "main.h"
#include "strnatcmp.h"
#include "theme_view.h"
#include "common.h"
// The data columns that we export via the tree model interface
GtkWidget *g_theme_view;
@ -136,7 +137,7 @@ gboolean theme_list_contains(const char *given_path)
return FALSE;
}
void theme_list_append(const gchar *path, const gchar *suffix)
void theme_list_append(const gchar *path)
{
if (theme_list_contains(path))
return;
@ -146,14 +147,15 @@ void theme_list_append(const gchar *path, const gchar *suffix)
gchar *name = strrchr(path, '/') + 1;
gchar *display_name;
if (suffix) {
display_name = g_strdup_printf("%s\n(%s)", name, suffix);
} else {
display_name = g_strdup(name);
}
gchar *dir = g_strdup(path);
strrchr(dir, '/')[0] = 0;
char *suffix = contract_tilde(dir);
g_free(dir);
gchar *display_name = g_strdup_printf("%s\n(%s)", name, suffix);
gtk_list_store_set(theme_list_store, &iter, COL_THEME_FILE, path, COL_THEME_NAME, display_name, -1);
g_free(display_name);
g_free(suffix);
}

View file

@ -9,6 +9,6 @@ enum { COL_THEME_FILE = 0, COL_THEME_NAME, COL_SNAPSHOT, NB_COL, };
GtkWidget *create_view();
void theme_list_append(const gchar *path, const gchar *suffix);
void theme_list_append(const gchar *path);
#endif