From 55a13efc27289717061f31770c0b9a8fb834561b Mon Sep 17 00:00:00 2001 From: Thierry Lorthiois Date: Sat, 24 Oct 2009 23:23:01 +0000 Subject: [PATCH] some tint2conf code --- black_white.tint2rc | 97 ++++++++++++++++ tintrc02 => default.tint2rc | 98 ++++++++-------- tintrc04 => hanna.tint2rc | 82 +++++++------ illumin8.tint2rc | 78 +++++++++++++ tintrc03 => serious_lee.tint2rc | 66 ++++++----- src/tint2conf/main.c | 197 +++++++++++++++++++++++++------- tintrc01 => thil77.tint2rc | 97 ++++++++-------- tintrc05 | 99 ---------------- tintrc06 | 103 ----------------- 9 files changed, 513 insertions(+), 404 deletions(-) create mode 100644 black_white.tint2rc rename tintrc02 => default.tint2rc (61%) rename tintrc04 => hanna.tint2rc (62%) create mode 100644 illumin8.tint2rc rename tintrc03 => serious_lee.tint2rc (65%) rename tintrc01 => thil77.tint2rc (67%) delete mode 100644 tintrc05 delete mode 100644 tintrc06 diff --git a/black_white.tint2rc b/black_white.tint2rc new file mode 100644 index 0000000..63957c8 --- /dev/null +++ b/black_white.tint2rc @@ -0,0 +1,97 @@ +#--------------------------------------------- +# TINT2 CONFIG FILE +#--------------------------------------------- + +#--------------------------------------------- +# BACKGROUND AND BORDER +#--------------------------------------------- +rounded = 0 +border_width = 0 +background_color = #000000 66 +border_color = #000000 0 + +rounded = 1 +border_width = 1 +background_color = #000000 75 +border_color = #000000 50 + +rounded = 1 +border_width = 1 +background_color = #c8c8c8 100 +border_color = #7b7b7b 90 + +rounded = 7 +border_width = 1 +background_color = #000000 60 +border_color = #ffffff 18 + +rounded = 5 +border_width = 0 +background_color = #ffffff 30 +border_color = #ffffff 18 + +rounded = 5 +border_width = 0 +background_color = #ffffff 50 +border_color = #ffffff 70 + +#--------------------------------------------- +# PANEL +#--------------------------------------------- +panel_monitor = 1 +panel_position = bottom center horizontal +panel_size = 100% 30 +panel_margin = 0 0 +panel_padding = 0 0 2 +font_shadow = 0 +panel_background_id = 1 +wm_menu = 1 + +#--------------------------------------------- +# TASKBAR +#--------------------------------------------- +taskbar_mode = single_desktop +taskbar_padding = 0 5 2 +taskbar_background_id = 0 + +#--------------------------------------------- +# TASK +#--------------------------------------------- +task_icon = 0 +task_text = 1 +task_maximum_size = 180 22 +task_centered = 1 +task_padding = 16 4 +task_font = Helvetica 8 +task_font_color = #aaaaaa 100 +task_active_font_color = #444444 100 +task_background_id = 2 +task_active_background_id = 3 + +#--------------------------------------------- +# SYSTRAYBAR +#--------------------------------------------- +systray_padding = 7 8 5 +systray_background_id = 1 +systray_sort = left2right + +#--------------------------------------------- +# TOOLTIP +#--------------------------------------------- +tooltip = 1 +tooltip_padding = 2 2 +tooltip_show_timeout = 0.7 +tooltip_hide_timeout = 0.3 +tooltip_background_id = 3 +tooltip_font_color = #OOOOOO 80 +tooltip_font = Helvetica 8 + +#--------------------------------------------- +# MOUSE ACTION ON TASK +#--------------------------------------------- +mouse_middle = none +mouse_right = close +mouse_scroll_up = toggle +mouse_scroll_down = iconify + + diff --git a/tintrc02 b/default.tint2rc similarity index 61% rename from tintrc02 rename to default.tint2rc index 7bd59cc..df3fd74 100644 --- a/tintrc02 +++ b/default.tint2rc @@ -5,39 +5,41 @@ #--------------------------------------------- # BACKGROUND AND BORDER #--------------------------------------------- -rounded = 1 -border_width = 0 -background_color = #282828 60 -border_color = #000000 0 +rounded = 0 +border_width = 1 +#background_color = #5E5E5E 25 +#background_color = #ffffff 20 +background_color = #000000 50 +border_color = #9b9b9b 35 rounded = 1 border_width = 1 -background_color = #cccccc 0 -border_color = #cccccc 55 +background_color = #000000 70 +border_color = #9b9b9b 75 rounded = 1 border_width = 0 -background_color = #cccccc 20 -border_color = #cccccc 40 +background_color = #OOOOOO 70 +border_color = #ffffff 20 # tooltip rounded = 0 -border_width = 2 -background_color = #030905 -border_color = #ffffff 30 +border_width = 0 +background_color = #bbbbbb +border_color = #bbbbbb 30 #--------------------------------------------- # PANEL #--------------------------------------------- panel_monitor = all -panel_position = bottom center -panel_size = 95% 30 +#panel_position = center left vertical +panel_position = bottom center horizontal +panel_size = 100% 32 panel_margin = 0 0 -panel_padding = 7 3 7 +panel_padding = 7 2 7 font_shadow = 0 -panel_background_id = 1 -wm_menu = 0 -panel_dock = 0 +panel_background_id = 0 +wm_menu = 1 #--------------------------------------------- # TASKBAR @@ -45,65 +47,69 @@ panel_dock = 0 taskbar_mode = multi_desktop #taskbar_mode = single_desktop taskbar_padding = 0 0 0 -taskbar_background_id = 2 +taskbar_background_id = 1 +taskbar_active_background_id = 2 #--------------------------------------------- -# TASKS +# TASK #--------------------------------------------- task_icon = 1 task_text = 0 -task_maximum_size = 34 34 +task_maximum_size = 50 35 task_centered = 1 -task_padding = 2 3 -task_font = sans 8 -task_font_color = #ffffff 60 -task_active_font_color = #ffffff 100 +task_padding = 4 2 +task_font = kiloji 8 +task_font_color = #a0a0a0 100 +task_active_font_color = #d4d4d4 100 +#task_icon_asb = 0 -45 -10 +task_icon_asb = 90 -70 -20 +task_active_icon_asb = 100 -50 -15 task_background_id = 0 task_active_background_id = 3 #--------------------------------------------- # SYSTRAYBAR #--------------------------------------------- -systray_padding = 0 4 3 -systray_background_id = 0 +systray_padding = 8 4 5 +systray_background_id = 1 +systray_sort = left2right + +#--------------------------------------------- +# BATTERY +#--------------------------------------------- +battery = 1 +battery_low_status = 7 +battery_low_cmd = notify-send "battery low" +bat1_font = sans 8 +bat2_font = sans 6 +battery_font_color = #ffffff 76 +battery_padding = 1 0 +battery_background_id = 2 #--------------------------------------------- # CLOCK #--------------------------------------------- time1_format = %H:%M -time1_font = sans 7 +time1_font = sans 8 time2_format = %A %d %B -time2_font = sans 7 -clock_font_color = #ffffff 100 +time2_font = sans 6 +clock_font_color = #ffffff 76 clock_padding = 1 0 -clock_background_id = 0 +clock_background_id = 1 #clock_lclick_command = xclock clock_rclick_command = orage -#--------------------------------------------- -# BATTERY -#--------------------------------------------- -battery = 1 -battery_low_status = 10 -battery_low_cmd = notify-send "battery low" -bat1_font = sans 7 -bat2_font = sans 7 -battery_font_color = #ffffff 100 -battery_padding = 1 0 -battery_background_id = 0 - #--------------------------------------------- # TOOLTIP #--------------------------------------------- tooltip = 1 tooltip_padding = 2 2 -tooltip_show_timeout = 1.5 -tooltip_hide_timeout = 0.5 +tooltip_show_timeout = 0.7 +tooltip_hide_timeout = 0.3 tooltip_background_id = 4 -tooltip_font_color = #ffffff 80 +tooltip_font_color = #OOOOOO 80 tooltip_font = sans 10 - #--------------------------------------------- # MOUSE ACTION ON TASK #--------------------------------------------- diff --git a/tintrc04 b/hanna.tint2rc similarity index 62% rename from tintrc04 rename to hanna.tint2rc index 349470c..4acd25f 100644 --- a/tintrc04 +++ b/hanna.tint2rc @@ -5,79 +5,90 @@ #--------------------------------------------- # BACKGROUND AND BORDER #--------------------------------------------- -rounded = 1 + +rounded = 0 border_width = 0 -background_color = #282828 100 -border_color = #000000 0 +background_color = #ffffff 0 +border_color = #ffffff 60 + +rounded = 0 +border_width = 1 +background_color = #333333 50 +#background_color = #719B69 50 +border_color = #ffffff 40 + -rounded = 1 +rounded = 0 border_width = 0 -background_color = #f6b655 90 -border_color = #cccccc 40 +#background_color = #A6B384 20 +background_color = #eeeeec 70 +border_color = #ffffff + #--------------------------------------------- # PANEL #--------------------------------------------- panel_monitor = all -panel_position = bottom center -panel_size = 100% 22 +#panel_mode = single_monitor +panel_position = bottom center horizontal +panel_size = 99% 27 panel_margin = 0 0 -panel_padding = 0 0 0 +panel_padding = 3 3 3 3 font_shadow = 0 -panel_background_id = 1 -wm_menu = 0 -panel_dock = 0 +panel_background_id = 3 -#--------------------------------------------- -# TASKBAR -#--------------------------------------------- -#taskbar_mode = multi_desktop -taskbar_mode = single_desktop -taskbar_padding = 0 0 0 -taskbar_background_id = 0 #--------------------------------------------- # TASKS #--------------------------------------------- task_icon = 0 task_text = 1 -task_maximum_size = 160 30 +task_width = 100 task_centered = 1 -task_padding = 5 0 -task_font = sans 7.5 -task_font_color = #ffffff 60 -task_active_font_color = #000000 100 -task_background_id = 0 +task_margin = 4 +task_padding = 5 +#task_icon_size = 13 +task_font = AvantGardeLTMedium 9 +task_font_color = #151515 60 +task_active_font_color = #ffffff 70 +task_background_id = 1 task_active_background_id = 2 + +#--------------------------------------------- +# TASKBAR +#--------------------------------------------- +taskbar_mode = multi_desktop +taskbar_padding = 0 0 0 +taskbar_background_id = 0 +taskbar_active_background_id = 0 + #--------------------------------------------- # SYSTRAYBAR #--------------------------------------------- -systray_padding = 4 3 4 +systray_padding = 4 2 3 systray_background_id = 0 #--------------------------------------------- # CLOCK #--------------------------------------------- -time1_format = %H:%M -time1_font = sans 13 +time1_format = %H:%M / %a %d %b +#time1_font = Museo 8 +time1_font = AvantGardeLTMedium 8 #time2_format = %A %d %B -time2_font = sans 7 -clock_font_color = #ffffff 90 +#time2_font = Monospace 6 +clock_font_color = #151515 60 clock_padding = 4 0 -clock_background_id = 0 -#clock_lclick_command = xclock -clock_rclick_command = orage #--------------------------------------------- # BATTERY #--------------------------------------------- battery = 0 -battery_low_status = 10 +battery_low_status = 7 battery_low_cmd = notify-send "battery low" bat1_font = sans 8 bat2_font = sans 6 -battery_font_color = #ffffff 100 +battery_font_color = #151515 60 battery_padding = 1 0 battery_background_id = 0 @@ -88,4 +99,3 @@ mouse_middle = none mouse_right = close mouse_scroll_up = toggle mouse_scroll_down = iconify - diff --git a/illumin8.tint2rc b/illumin8.tint2rc new file mode 100644 index 0000000..c77e52c --- /dev/null +++ b/illumin8.tint2rc @@ -0,0 +1,78 @@ +#--------------------------------------------- +# TINT2 CONFIG FILE +#--------------------------------------------- + +#--------------------------------------------- +# BACKGROUND AND BORDER +#--------------------------------------------- +rounded = 5 +border_width = 1 +background_color = #44475D 45 +border_color = #44475D 100 + +rounded = 5 +border_width = 1 +background_color = #ffffff 20 +border_color = #444444 70 + +rounded = 0 +border_width = 1 +background_color = #ffffff 20 +border_color = #444444 20 + +rounded = 5 +border_width = 1 +background_color = #ffffff 20 +border_color = #ffffff 50 + +#--------------------------------------------- +# PANEL +#--------------------------------------------- +panel_monitor = all +panel_position = bottom center horizontal +panel_size = 99% 35 +panel_margin = 0 0 +panel_padding = 10 3 10 +font_shadow = 0 +panel_background_id = 1 +wm_menu = 1 + +#--------------------------------------------- +# TASKBAR +#--------------------------------------------- +taskbar_mode = multi_desktop +taskbar_padding = 2 0 0 +taskbar_background_id = 2 +taskbar_active_background_id = 4 + +#--------------------------------------------- +# TASK +#--------------------------------------------- +task_icon = 10 +task_text = 0 +task_maximum_size = 40 20 +task_centered = 1 +task_padding = 0 2 +task_font = kiloji 10 +task_font_color = #333333 80 +task_active_font_color = #333333 100 +task_icon_asb = 100 -50 -20 +task_active_icon_asb = 100 -20 10 +task_background_id = 0 +#task_active_background_id = 3 +task_active_background_id = 0 + +#--------------------------------------------- +# SYSTRAYBAR +#--------------------------------------------- +systray_padding = 6 5 5 +systray_background_id =2 + + +#--------------------------------------------- +# MOUSE ACTION ON TASK +#--------------------------------------------- +mouse_middle = none +mouse_right = close +mouse_scroll_up = toggle +mouse_scroll_down = iconify diff --git a/tintrc03 b/serious_lee.tint2rc similarity index 65% rename from tintrc03 rename to serious_lee.tint2rc index d969f58..8523e21 100644 --- a/tintrc03 +++ b/serious_lee.tint2rc @@ -7,67 +7,71 @@ #--------------------------------------------- rounded = 3 border_width = 1 -background_color = #000000 40 -border_color = #d1d1d1 34 +background_color = #000000 60 +border_color = #ffffff 30 rounded = 3 border_width = 1 -background_color = #000000 55 -border_color = #d1d1d1 40 +background_color = #ffffff 0 +border_color = #ffffff 20 + +rounded = 3 +border_width = 1 +background_color = #000000 18 +border_color = #ffffff 35 #--------------------------------------------- # PANEL #--------------------------------------------- panel_monitor = all -panel_position = bottom center -panel_size = 97% 26 +panel_position = center left vertical +panel_size = 100% 45 panel_margin = 0 0 -panel_padding = 0 2 5 +panel_padding = 2 0 font_shadow = 0 panel_background_id = 0 wm_menu = 0 -panel_dock = 0 #--------------------------------------------- # TASKBAR #--------------------------------------------- #taskbar_mode = multi_desktop taskbar_mode = single_desktop -taskbar_padding = 0 0 5 -taskbar_background_id = 0 +taskbar_padding = 0 0 2 +taskbar_background_id = 3 #--------------------------------------------- # TASKS #--------------------------------------------- -task_icon = 0 -task_text = 1 -task_maximum_size = 160 30 +task_icon = 1 +task_text = 0 +task_width = 50 task_centered = 1 -task_padding = 3 1 -task_font = sans bold 7.5 -task_font_color = #ffffff 60 -task_active_font_color = #ffffff 90 -task_background_id = 1 -task_active_background_id = 2 +task_padding = 0 2 +task_font = Aller 9 +task_font_color = #ffffff 70 +task_active_font_color = #ffffff 85 +task_background_id = 2 +task_active_background_id = 1 #--------------------------------------------- # SYSTRAYBAR #--------------------------------------------- -systray_padding = 6 2 6 +systray_padding = 2 8 0 systray_background_id = 1 #--------------------------------------------- # CLOCK #--------------------------------------------- -#time1_format = %a %d %H:%M -time1_font = sans bold 7.5 -#time2_format = %A %d %B -time2_font = sans bold 7.5 -clock_font_color = #ffffff 60 -clock_padding = 5 0 +time1_format = %a %d +time1_font = Aller 7 +time2_format = %I:%M +time2_font = Aller 10 +clock_font_color = #ffffff 100 +clock_padding = 6 4 clock_background_id = 1 #clock_lclick_command = xclock -clock_rclick_command = orage +#clock_rclick_command = orage #--------------------------------------------- # BATTERY @@ -75,12 +79,13 @@ clock_rclick_command = orage battery = 0 battery_low_status = 10 battery_low_cmd = notify-send "battery low" -bat1_font = sans 7 -bat2_font = sans 7 -battery_font_color = #ffffff 100 +bat1_font = sans 8 +bat2_font = sans 6 +battery_font_color = #ffffff 76 battery_padding = 1 0 battery_background_id = 0 + #--------------------------------------------- # MOUSE ACTION ON TASK #--------------------------------------------- @@ -88,4 +93,3 @@ mouse_middle = none mouse_right = close mouse_scroll_up = toggle mouse_scroll_down = iconify - diff --git a/src/tint2conf/main.c b/src/tint2conf/main.c index c7eb6c7..a2d1e53 100644 --- a/src/tint2conf/main.c +++ b/src/tint2conf/main.c @@ -25,7 +25,6 @@ #include -// gcc -Wall -g main1.c -o tint2conf `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0 --libs gthread-2.0` // TODO // ** add, saveas // - liste de fichiers tint2rc* @@ -38,12 +37,18 @@ // - sauvegarde et lecture taille de fenetre // - activation des menus sur sélection dans la liste // - dialogue propriétés ... -// tint2 -d directory, plutot que -c config ?? -// tint2 preview, comment gérer les barres verticales... #define LONG_VERSION_STRING "0.7" +enum { LIST_ITEM = 0, N_COLUMNS }; + +// default config file and directory +char *pathConfig = 0; +char *pathDir = 0; + +GtkWidget *themeView; + static GtkUIManager *myUIManager = NULL; static void menuAddWidget (GtkUIManager *, GtkWidget *, GtkContainer *); @@ -51,10 +56,10 @@ static void viewPopup(GtkWidget *wid,GdkEventButton *event,GtkWidget *menu); // action on menus static void menuAdd (GtkWindow * parent); -static void menuSaveAs (GtkWindow *parent); +//static void menuSaveAs (GtkWindow *parent); +static void menuDelete (void); static void menuProperties (void); static void menuRename (void); -static void menuDelete (void); static void menuQuit (void); static void menuRefresh (void); static void menuRefreshAll (void); @@ -64,7 +69,12 @@ static void menuAbout(GtkWindow * parent); static void onPopupMenu(GtkWidget *self, GdkEventButton *event); static void viewRowActivated( GtkTreeView *tree_view, GtkTreePath *path, GtkTreeViewColumn *column, gpointer user_data); -static void loadDir(); +// TreeView +static void loadTheme(); +static void init_list(GtkWidget *list); +static void add_to_list(GtkWidget *list, const gchar *str); +void on_changed(GtkWidget *widget, gpointer label); + // define menubar and toolbar @@ -73,13 +83,13 @@ static const char *fallback_ui_file = " " " " " " - " " +// " " + " " + " " " " " " " " " " - " " - " " " " " " " " @@ -102,10 +112,10 @@ static const char *fallback_ui_file = static GtkActionEntry entries[] = { {"ThemeMenu", NULL, "Theme", NULL, NULL, NULL}, {"ThemeAdd", GTK_STOCK_ADD, "_Add...", "N", "Add theme", G_CALLBACK (menuAdd)}, - {"ThemeSaveAs", GTK_STOCK_SAVE_AS, "_Save as...", NULL, "Save theme as", G_CALLBACK (menuSaveAs)}, +// {"ThemeSaveAs", GTK_STOCK_SAVE_AS, "_Save as...", NULL, "Save theme as", G_CALLBACK (menuSaveAs)}, + {"ThemeDelete", GTK_STOCK_DELETE, "_Delete", NULL, "Delete theme", G_CALLBACK (menuDelete)}, {"ThemeProperties", GTK_STOCK_PROPERTIES, "_Properties...", NULL, "Show properties", G_CALLBACK (menuProperties)}, {"ThemeRename", NULL, "_Rename...", NULL, "Rename theme", G_CALLBACK (menuRename)}, - {"ThemeDelete", GTK_STOCK_DELETE, "_Delete", NULL, "Delete theme", G_CALLBACK (menuDelete)}, {"ThemeQuit", GTK_STOCK_QUIT, "_Quit", "Q", "Quit", G_CALLBACK (menuQuit)}, {"ViewMenu", NULL, "View", NULL, NULL, NULL}, {"ViewRefresh", GTK_STOCK_REFRESH, "Refresh", NULL, "Refresh", G_CALLBACK (menuRefresh)}, @@ -118,7 +128,7 @@ static GtkActionEntry entries[] = { int main (int argc, char ** argv) { - GtkWidget *window, *themeView, *popup, *item; + GtkWidget *window, *popup, *item; GtkWidget *vBox = NULL; GtkActionGroup *actionGroup; GtkTreeViewColumn *col; @@ -126,8 +136,9 @@ int main (int argc, char ** argv) gtk_init (&argc, &argv); g_thread_init( NULL ); + checkConfig(); - // define main layout : container, menubar, toolbar, themeView + // define main layout : container, menubar, toolbar window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window), _("Panel theming")); gtk_window_set_default_size(GTK_WINDOW(window), 600, 350); @@ -143,19 +154,31 @@ int main (int argc, char ** argv) g_signal_connect(myUIManager, "add_widget", G_CALLBACK (menuAddWidget), vBox); gtk_ui_manager_ensure_update(myUIManager); + // define tree view themeView = gtk_tree_view_new(); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(themeView), FALSE); - gtk_tree_view_set_fixed_height_mode(GTK_TREE_VIEW(themeView), TRUE); - col = GTK_TREE_VIEW_COLUMN (g_object_new (GTK_TYPE_TREE_VIEW_COLUMN, "title", _("Theme"), "resizable", TRUE, "sizing", GTK_TREE_VIEW_COLUMN_FIXED, NULL)); + //gtk_tree_view_set_fixed_height_mode(GTK_TREE_VIEW(themeView), TRUE); + //col = GTK_TREE_VIEW_COLUMN (g_object_new (GTK_TYPE_TREE_VIEW_COLUMN, "title", _("Theme"), "resizable", TRUE, "sizing", GTK_TREE_VIEW_COLUMN_FIXED, NULL)); sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(themeView)); gtk_tree_selection_set_mode(GTK_TREE_SELECTION(sel), GTK_SELECTION_SINGLE); gtk_box_pack_start(GTK_BOX(vBox), themeView, TRUE, TRUE, 0); gtk_widget_show(themeView); g_signal_connect(themeView, "popup-menu", G_CALLBACK(onPopupMenu), NULL); g_signal_connect(themeView, "row-activated", G_CALLBACK(viewRowActivated), NULL); + g_signal_connect(sel, "changed", G_CALLBACK(on_changed), NULL); //g_signal_connect(themeView, "button-press-event", G_CALLBACK(onViewButtonPressed), (void *)onViewButtonPressed); //g_signal_connect(themeView, "button-release-event", G_CALLBACK(onViewButtonReleased), NULL); + GtkCellRenderer *renderer; + GtkTreeViewColumn *column; + GtkListStore *store; + renderer = gtk_cell_renderer_text_new(); + column = gtk_tree_view_column_new_with_attributes("List Items", renderer, "text", LIST_ITEM, NULL); + gtk_tree_view_append_column(GTK_TREE_VIEW(themeView), column); + store = gtk_list_store_new(N_COLUMNS, G_TYPE_STRING); + gtk_tree_view_set_model(GTK_TREE_VIEW(themeView), GTK_TREE_MODEL(store)); + g_object_unref(store); + // popup menu // all you need to do is add the GDK_BUTTON_PRESS_MASK to the window's events gtk_widget_add_events(window, GDK_BUTTON_PRESS_MASK); @@ -167,7 +190,7 @@ int main (int argc, char ** argv) g_signal_connect(G_OBJECT(window),"button-press-event", G_CALLBACK(viewPopup), (gpointer)popup); // load themes - loadDir(); + loadTheme(themeView); // rig up idle/thread routines //Glib::Thread::create(sigc::mem_fun(window.view, &Thumbview::load_cache_images), true); @@ -202,8 +225,7 @@ static void menuAbout(GtkWindow * parent) "comments", _("Theming tool for tint2 panel"), "version", LONG_VERSION_STRING, "copyright", _("Copyright 2009 tint2 team\nLicense GNU GPL version 2"), - "logo-icon-name", NULL, - "authors", authors, + "logo-icon-name", NULL, "authors", authors, /* Translators: translate "translator-credits" as your name to have it appear in the credits in the "About" dialog */ @@ -221,7 +243,6 @@ static void menuAdd (GtkWindow *parent) dialog = gtk_file_chooser_dialog_new(_("Add a theme"), parent, GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT, NULL); chooser = GTK_FILE_CHOOSER(dialog); - //gtk_dialog_set_alternative_button_order(GTK_DIALOG(w), GTK_RESPONSE_ACCEPT, GTK_RESPONSE_CANCEL, -1); gtk_file_chooser_set_current_folder(chooser, g_get_home_dir()); gtk_file_chooser_set_select_multiple(chooser, TRUE); @@ -233,14 +254,26 @@ static void menuAdd (GtkWindow *parent) if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) { GSList *l, *list = gtk_file_chooser_get_filenames(chooser); - // TODO: remember this folder the next time we use this dialog - //char *folder = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(dialog)); - //pref_string_set( PREF_KEY_OPEN_DIALOG_FOLDER, folder ); - //g_free( folder ); - + gchar *file, *pt1, *name, *path; for (l = list; l ; l = l->next) { - printf("fichier %s\n", (char *)l->data); - //add_filename(core, l->data, FALSE); + file = (char *)l->data; + pt1 = strrchr (file, '/'); + if (pt1) { + pt1++; + if (*pt1) { + name = strndup(pt1, 65000); + path = g_build_filename (g_get_user_config_dir(), "tint2", name, NULL); + copy_file(file, path); + g_free(path); + pt1 = strstr(name, ".tint2rc"); + if (pt1) { + file = strndup(name, pt1-name); + add_to_list(themeView, file); + g_free(file); + } + g_free(name); + } + } //tr_core_torrents_added( core ); } @@ -250,7 +283,7 @@ static void menuAdd (GtkWindow *parent) gtk_widget_destroy (dialog); } - +/* static void menuSaveAs (GtkWindow *parent) { GtkWidget *dialog; @@ -271,6 +304,12 @@ static void menuSaveAs (GtkWindow *parent) } gtk_widget_destroy (dialog); } +*/ + +static void menuDelete (void) +{ + printf("menuDelete\n"); +} static void menuProperties (void) @@ -285,12 +324,6 @@ static void menuRename (void) } -static void menuDelete (void) -{ - printf("menuDelete\n"); -} - - static void menuQuit (void) { gtk_main_quit (); @@ -311,7 +344,24 @@ static void menuRefreshAll (void) static void menuApply (void) { - printf("menuApply\n"); + GtkTreeSelection *sel; + GtkTreeIter iter; + GtkTreeModel *model; + char *value, *name1, *name2; + + sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(themeView)); + if (gtk_tree_selection_get_selected(GTK_TREE_SELECTION(sel), &model, &iter)) { + gtk_tree_model_get(model, &iter, LIST_ITEM, &value, -1); + name1 = g_build_filename (g_get_user_config_dir(), "tint2", value, NULL); + name2 = g_strdup_printf("%s.tint2rc", name1); + copy_file(name2, pathConfig); + g_free(value); + g_free(name1); + g_free(name2); + + // restart panel + system("killall -SIGUSR1 tint2"); + } } @@ -329,17 +379,80 @@ static void viewRowActivated(GtkTreeView *tree_view, GtkTreePath *path, GtkTreeV } -static void loadDir() +static void loadTheme(GtkWidget *list) { - char *path = g_build_filename (g_get_user_config_dir(), "tint2", NULL); - if (!g_file_test (path, G_FILE_TEST_IS_DIR)) { - g_mkdir(path, 0777); + GDir *dir; + gchar *file, *pt1, *name; + + dir = g_dir_open(pathDir, 0, NULL); + while ((file = g_dir_read_name(dir))) { + pt1 = strstr(file, ".tint2rc"); + if (pt1) { + name = strndup(file, pt1-file); + add_to_list(list, name); + g_free(name); + } } - g_free(path); + g_dir_close(dir); +} - GDir *dir; - dir = g_dir_open(path, 0, NULL); - g_dir_close(dir); +// config file management + +void checkConfig() +{ + pathDir = g_build_filename (g_get_user_config_dir(), "tint2", NULL); + if (!g_file_test (pathDir, G_FILE_TEST_IS_DIR)) + g_mkdir(pathDir, 0777); + + pathConfig = g_build_filename (g_get_user_config_dir(), "tint2", "tint2rc", NULL); + +} + + +void copy_file(const char *pathSrc, const char *pathDest) +{ + FILE *fileSrc, *fileDest; + char line[100]; + int nb; + + fileSrc = fopen(pathSrc, "rb"); + if (fileSrc == NULL) return; + + fileDest = fopen(pathDest, "wb"); + if (fileDest == NULL) return; + + while ((nb = fread(line, 1, 100, fileSrc)) > 0) fwrite(line, 1, nb, fileDest); + + fclose (fileDest); + fclose (fileSrc); +} + + +static void add_to_list(GtkWidget *list, const gchar *str) +{ + GtkListStore *store; + GtkTreeIter iter; + + store = GTK_LIST_STORE(gtk_tree_view_get_model (GTK_TREE_VIEW(list))); + + gtk_list_store_append(store, &iter); + gtk_list_store_set(store, &iter, LIST_ITEM, str, -1); } + +void on_changed(GtkWidget *widget, gpointer label) +{ + GtkTreeIter iter; + GtkTreeModel *model; + char *value; + + if (gtk_tree_selection_get_selected(GTK_TREE_SELECTION(widget), &model, &iter)) { + gtk_tree_model_get(model, &iter, LIST_ITEM, &value, -1); + //gtk_label_set_text(GTK_LABEL(label), value); + g_free(value); + } + +} + + diff --git a/tintrc01 b/thil77.tint2rc similarity index 67% rename from tintrc01 rename to thil77.tint2rc index 17c7d9e..ca231aa 100644 --- a/tintrc01 +++ b/thil77.tint2rc @@ -5,68 +5,84 @@ #--------------------------------------------- # BACKGROUND AND BORDER #--------------------------------------------- -rounded = 7 -border_width = 2 -background_color = #000000 60 -border_color = #ffffff 18 - -rounded = 5 +rounded = 0 border_width = 0 -background_color = #ffffff 40 -border_color = #ffffff 50 +background_color = #000000 55 +border_color = #9b9b9b 35 -rounded = 5 +rounded = 1 +border_width = 1 +background_color = #000000 70 +border_color = #9b9b9b 75 + +rounded = 1 border_width = 0 -background_color = #ffffff 18 -border_color = #ffffff 70 +background_color = #OOOOOO 70 +border_color = #ffffff 20 # tooltip rounded = 0 -border_width = 2 -background_color = #030905 -border_color = #ffffff 30 +border_width = 0 +background_color = #bbbbbb +border_color = #bbbbbb 30 #--------------------------------------------- # PANEL #--------------------------------------------- panel_monitor = all -panel_position = bottom center horizontal #panel_position = center left vertical -panel_size = 94% 30 +panel_position = bottom center horizontal +panel_size = 100% 32 panel_margin = 0 0 -panel_padding = 7 0 +panel_padding = 5 2 0 font_shadow = 0 panel_background_id = 1 -wm_menu = 0 -panel_dock = 0 +wm_menu = 1 #--------------------------------------------- # TASKBAR #--------------------------------------------- -#taskbar_mode = multi_desktop -taskbar_mode = single_desktop -taskbar_padding = 2 3 2 +taskbar_mode = multi_desktop +#taskbar_mode = single_desktop +taskbar_padding = 1 1 0 taskbar_background_id = 0 +taskbar_active_background_id = 2 #--------------------------------------------- -# TASKS +# TASK #--------------------------------------------- task_icon = 1 -task_text = 1 -task_maximum_size = 140 30 +task_text = 0 +task_maximum_size = 50 35 task_centered = 1 -task_padding = 6 3 -task_font = sans 7 -task_font_color = #ffffff 70 -task_active_font_color = #ffffff 85 -task_background_id = 3 -task_active_background_id = 2 +task_padding = 4 2 +task_font = kiloji 8 +task_font_color = #a0a0a0 100 +task_active_font_color = #d4d4d4 100 +#task_icon_asb = 0 -45 -10 +task_icon_asb = 90 -70 -20 +task_active_icon_asb = 100 -50 -15 +task_background_id = 0 +task_active_background_id = 3 #--------------------------------------------- # SYSTRAYBAR #--------------------------------------------- -#systray_padding = 0 4 5 +systray_padding = 8 6 5 systray_background_id = 0 +systray_sort = left2right + +#--------------------------------------------- +# BATTERY +#--------------------------------------------- +battery = 1 +battery_low_status = 7 +battery_low_cmd = notify-send "battery low" +bat1_font = sans 8 +bat2_font = sans 6 +battery_font_color = #ffffff 76 +battery_padding = 1 0 +battery_background_id = 2 #--------------------------------------------- # CLOCK @@ -76,23 +92,11 @@ time1_font = sans 8 time2_format = %A %d %B time2_font = sans 6 clock_font_color = #ffffff 76 -clock_padding = 1 0 +clock_padding = 2 0 clock_background_id = 0 #clock_lclick_command = xclock clock_rclick_command = orage -#--------------------------------------------- -# BATTERY -#--------------------------------------------- -battery = 0 -battery_low_status = 10 -battery_low_cmd = notify-send "battery low" -bat1_font = sans 8 -bat2_font = sans 6 -battery_font_color = #ffffff 76 -battery_padding = 1 0 -battery_background_id = 0 - #--------------------------------------------- # TOOLTIP #--------------------------------------------- @@ -101,10 +105,9 @@ tooltip_padding = 2 2 tooltip_show_timeout = 0.7 tooltip_hide_timeout = 0.3 tooltip_background_id = 4 -tooltip_font_color = #ffffff 80 +tooltip_font_color = #OOOOOO 80 tooltip_font = sans 10 - #--------------------------------------------- # MOUSE ACTION ON TASK #--------------------------------------------- diff --git a/tintrc05 b/tintrc05 deleted file mode 100644 index ccb155c..0000000 --- a/tintrc05 +++ /dev/null @@ -1,99 +0,0 @@ -#--------------------------------------------- -# TINT2 CONFIG FILE -#--------------------------------------------- - -#--------------------------------------------- -# BACKGROUND AND BORDER -#--------------------------------------------- -rounded = 0 -border_width = 0 -background_color = #000000 60 -border_color = #d1d1d1 34 - -rounded = 3 -border_width = 1 -background_color = #96b3a9 60 -border_color = #d1d1d1 70 - -rounded = 2 -border_width = 0 -background_color = #707070 40 -border_color = #d1d1d1 40 - -#--------------------------------------------- -# PANEL -#--------------------------------------------- -panel_monitor = all -panel_position = center left vertical -#panel_position = bottom center horizontal -panel_size = 90% 85 -panel_margin = 0 0 -panel_padding = 10 3 10 -font_shadow = 0 -panel_background_id = 0 -wm_menu = 1 -panel_dock = 0 - -#--------------------------------------------- -# TASKBAR -#--------------------------------------------- -taskbar_mode = multi_desktop -#taskbar_mode = single_desktop -taskbar_padding = 0 0 0 -taskbar_background_id = 2 - -#--------------------------------------------- -# TASKS -#--------------------------------------------- -task_icon = 0 -task_text = 1 -task_maximum_size = 120 26 -task_centered = 1 -task_padding = 1 5 -task_font = sans 7.5 -task_font_color = #ffffff 80 -task_active_font_color = #ffffff 100 -task_background_id = 0 -task_active_background_id = 3 - -#--------------------------------------------- -# SYSTRAYBAR -#--------------------------------------------- -systray_padding = 0 28 2 -systray_background_id = 0 - -#--------------------------------------------- -# CLOCK -#--------------------------------------------- -time1_format = %H:%M -time1_font = sans bold 8 -#time2_format = %A %d %B -time2_format = %A %d -time2_font = sans 7 -clock_font_color = #ffffff 90 -clock_padding = 4 2 -clock_background_id = 2 -clock_lclick_command = xclock -clock_rclick_command = orage - -#--------------------------------------------- -# BATTERY -#--------------------------------------------- -battery = 0 -battery_low_status = 10 -battery_low_cmd = notify-send "battery low" -bat1_font = sans bold 7 -bat2_font = sans 7 -battery_font_color = #ffffff 90 -battery_padding = 0 0 -battery_background_id = 2 - -#--------------------------------------------- -# MOUSE ACTION ON TASK -#--------------------------------------------- -mouse_middle = none -mouse_right = close -mouse_scroll_up = toggle -mouse_scroll_down = iconify - - diff --git a/tintrc06 b/tintrc06 deleted file mode 100644 index 562d10b..0000000 --- a/tintrc06 +++ /dev/null @@ -1,103 +0,0 @@ -#--------------------------------------------- -# TINT2 CONFIG FILE -#--------------------------------------------- - -#--------------------------------------------- -# BACKGROUND AND BORDER -#--------------------------------------------- -rounded = 1 -border_width = 0 -background_color = #cae2dd 40 -border_color = #d1d1d1 34 - -rounded = 1 -border_width = 1 -background_color = #000000 0 -border_color = #ffffff 60 - -rounded = 1 -border_width = 0 -background_color = #000000 15 -border_color = #ffffff 0 - -rounded = 1 -border_width = 0 -background_color = #cae2dd 50 -border_color = #d1d1d1 34 - - -#--------------------------------------------- -# PANEL -#--------------------------------------------- -panel_monitor = all -panel_position = center left vertical -#panel_position = bottom center -panel_size = 90% 50 -panel_margin = 0 0 -panel_padding = 7 3 5 -font_shadow = 0 -panel_background_id = 1 -wm_menu = 1 -panel_dock = 0 - -#--------------------------------------------- -# TASKBAR -#--------------------------------------------- -taskbar_mode = multi_desktop -#taskbar_mode = single_desktop -taskbar_padding = 0 0 0 -taskbar_background_id = 2 - -#--------------------------------------------- -# TASKS -#--------------------------------------------- -task_icon = 1 -task_text = 0 -task_maximum_size = 120 30 -task_centered = 1 -task_padding = 4 6 -task_font = sans bold 7.5 -task_font_color = #ffffff 70 -task_active_font_color = #ffffff 100 -task_background_id = 0 -task_active_background_id = 3 - -#--------------------------------------------- -# SYSTRAYBAR -#--------------------------------------------- -systray_padding = 4 10 2 -systray_background_id = 0 - -#--------------------------------------------- -# CLOCK -#--------------------------------------------- -time1_format = %H:%M -time1_font = sans 8 -time2_format = %d %b -time2_font = sans 7 -clock_font_color = #000000 90 -clock_padding = 4 2 -clock_background_id = 4 -clock_lclick_command = xclock -clock_rclick_command = orage - -#--------------------------------------------- -# BATTERY -#--------------------------------------------- -battery = 0 -battery_low_status = 10 -battery_low_cmd = notify-send "battery low" -bat1_font = sans bold 7 -bat2_font = sans 7 -battery_font_color = #ffffff 60 -battery_padding = 0 0 -battery_background_id = 0 - -#--------------------------------------------- -# MOUSE ACTION ON TASK -#--------------------------------------------- -mouse_middle = none -mouse_right = close -mouse_scroll_up = toggle -mouse_scroll_down = iconify - -- 2.44.0