X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2Ftint2conf%2Fmain.c;h=cf27bb9c79a1729c6909c500e83678a4b387f0df;hb=fa81324a2418b1288c0fc4822014fb55abefd10a;hp=6e283539e75bea85b01be2f24b3e8da55ab0aff0;hpb=3fe84f48719226f0b23390df15c62eafbf7ed15c;p=chaz%2Ftint2 diff --git a/src/tint2conf/main.c b/src/tint2conf/main.c index 6e28353..cf27bb9 100644 --- a/src/tint2conf/main.c +++ b/src/tint2conf/main.c @@ -32,12 +32,14 @@ #include "common.h" #include "theme_view.h" +#define SNAPSHOT_TICK 190 // default config file and directory char *g_path_config = NULL; char *g_path_dir = NULL; char *g_default_theme = NULL; +char *g_cmd_property = NULL; int g_width, g_height; GtkWidget *g_window; @@ -261,7 +263,7 @@ static void menuAdd() selectTheme(name_first); g_free(name_first); - g_timeout_add(100, (GSourceFunc)update_snapshot, NULL); + g_timeout_add(SNAPSHOT_TICK, (GSourceFunc)update_snapshot, NULL); } @@ -336,7 +338,8 @@ static void menuProperties() if (gtk_tree_selection_get_selected(GTK_TREE_SELECTION(sel), &model, &iter)) { gtk_tree_model_get(model, &iter, COL_THEME_FILE, &file, -1); - cmd = g_strdup_printf("gedit \'%s\' &", file); + cmd = g_strdup_printf("%s \'%s\' &", g_cmd_property, file); + printf("cmd %s\n", cmd); system(cmd); g_free(cmd); @@ -355,6 +358,8 @@ static void menuQuit() g_free(g_path_dir); if (g_default_theme) g_free(g_default_theme); + if (g_cmd_property) + g_free(g_cmd_property); gtk_main_quit (); } @@ -371,7 +376,7 @@ static void menuRefresh() gtk_list_store_set(g_store, &iter, COL_SNAPSHOT, NULL, -1); } - g_timeout_add(100, (GSourceFunc)update_snapshot, NULL); + g_timeout_add(SNAPSHOT_TICK, (GSourceFunc)update_snapshot, NULL); } @@ -388,7 +393,7 @@ static void menuRefreshAll() have_iter = gtk_tree_model_iter_next(model, &iter); } - g_timeout_add(100, (GSourceFunc)update_snapshot, NULL); + g_timeout_add(SNAPSHOT_TICK, (GSourceFunc)update_snapshot, NULL); } @@ -502,7 +507,7 @@ static void load_theme(GtkWidget *list) selectTheme(g_default_theme); - g_timeout_add(100, (GSourceFunc)update_snapshot, NULL); + g_timeout_add(SNAPSHOT_TICK, (GSourceFunc)update_snapshot, NULL); } @@ -565,13 +570,16 @@ void read_config() { char *path; + // default values if (g_default_theme != NULL) { g_free(g_default_theme); g_default_theme = NULL; } - g_width = 500; g_height = 350; + g_cmd_property = g_strdup("python /usr/bin/tintwizard.py"); + + // load config path = g_build_filename (g_get_user_config_dir(), "tint2", "tint2confrc", NULL); if (g_file_test (path, G_FILE_TEST_EXISTS)) { FILE *fp; @@ -581,7 +589,11 @@ void read_config() while (fgets(line, sizeof(line), fp) != NULL) { if (parse_line(line, &key, &value)) { if (strcmp (key, "default_theme") == 0) - g_default_theme = strdup (value); + g_default_theme = strdup(value); + else if (strcmp (key, "cmd_property") == 0) { + g_free(g_cmd_property); + g_cmd_property = strdup(value); + } else if (strcmp (key, "width") == 0) g_width = atoi(value); else if (strcmp (key, "height") == 0) @@ -609,7 +621,9 @@ void write_config() fputs("# TINT2CONF CONFIG FILE\n", fp); if (g_default_theme != NULL) { fprintf(fp, "default_theme = %s\n", g_default_theme); - printf("default_theme %s\n", g_default_theme); + } + if (g_cmd_property != NULL) { + fprintf(fp, "cmd_property = %s\n", g_cmd_property); } fprintf(fp, "width = %d\n", g_width); fprintf(fp, "height = %d\n", g_height);