Codebase list conky-manager / debian/2.4_136_ubuntu15.10.1
Imported Debian version 2.4~136~ubuntu15.10.1 Tony George authored 8 years ago Raphaƫl Hertzog committed 8 years ago
19 changed file(s) with 347 addition(s) and 347 deletion(s). Raw diff Collapse all Expand all
33 DIR="$( cd "$( dirname "$0" )" && pwd )"
44 cd "$DIR"
55
6 sh push.sh
7
8 #check for errors
9 if [ $? -ne 0 ]; then
10 cd "$backup"
11 echo "Failed"
12 exit 1
13 fi
14
156 sh build-installer.sh
16
177 #check for errors
188 if [ $? -ne 0 ]; then
199 cd "$backup"
2717 cp -p --no-preserve=ownership -t /home/teejee/Dropbox/Public/linux ./conky-manager-latest-${arch}.run
2818 cp -p --no-preserve=ownership -t /home/teejee/Dropbox/Public/linux ./conky-manager-latest-${arch}.deb
2919 done
20 cd ..
21
22 sh push.sh
23 #check for errors
24 if [ $? -ne 0 ]; then
25 cd "$backup"
26 echo "Failed"
27 exit 1
28 fi
3029
3130 cd "$backup"
2222 long_line_column=72
2323
2424 [files]
25 current_page=6
26 FILE_NAME_0=4539;Vala;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fconky-manager%2Fsrc%2FGeneratePreviewWindow.vala;0;4
27 FILE_NAME_1=831;Vala;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fconky-manager%2Fsrc%2FAboutWindow.vala;0;4
28 FILE_NAME_2=4379;Vala;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fconky-manager%2Fsrc%2FMainWindow.vala;0;4
29 FILE_NAME_3=1846;Vala;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fconky-manager%2Fsrc%2FDonationWindow.vala;0;4
30 FILE_NAME_4=3390;Vala;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fconky-manager%2Fsrc%2FEditThemeWindow.vala;0;4
31 FILE_NAME_5=0;Vala;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fconky-manager%2Fsrc%2FEditWidgetWindow.vala;0;4
32 FILE_NAME_6=1175;Vala;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fconky-manager%2Fsrc%2FMain.vala;0;4
33 FILE_NAME_7=1588;Make;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fconky-manager%2Fsrc%2Fmakefile;0;4
34 FILE_NAME_8=0;Vala;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fconky-manager%2Fsrc%2FSettingsWindow.vala;0;4
35 FILE_NAME_9=9115;Vala;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fconky-manager%2Fsrc%2FUtility.vala;0;4
36 FILE_NAME_10=343;Sh;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fconky-manager%2Finstaller%2Finstall.sh;0;4
37 FILE_NAME_11=701;None;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fconky-manager%2Fdebian%2Fchangelog;0;4
38 FILE_NAME_12=656;Conf;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fconky-manager%2Fdebian%2Fcontrol;0;4
39 FILE_NAME_13=805;Sh;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fconky-manager%2Fbuild-installer.sh;0;4
25 current_page=4
26 FILE_NAME_0=30;Vala;0;EUTF-8;1;1;1;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fconky-manager%2Fsrc%2FAboutWindow.vala;0;4
27 FILE_NAME_1=33;Vala;0;EUTF-8;1;1;1;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fconky-manager%2Fsrc%2FDonationWindow.vala;0;4
28 FILE_NAME_2=34;Vala;0;EUTF-8;1;1;1;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fconky-manager%2Fsrc%2FEditThemeWindow.vala;0;4
29 FILE_NAME_3=35;Vala;0;EUTF-8;1;1;1;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fconky-manager%2Fsrc%2FEditWidgetWindow.vala;0;4
30 FILE_NAME_4=2069;Vala;0;EUTF-8;1;1;1;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fconky-manager%2Fsrc%2FGeneratePreviewWindow.vala;0;4
31 FILE_NAME_5=1286;Vala;0;EUTF-8;1;1;1;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fconky-manager%2Fsrc%2FMain.vala;0;4
32 FILE_NAME_6=29;Vala;0;EUTF-8;1;1;1;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fconky-manager%2Fsrc%2FMainWindow.vala;0;4
33 FILE_NAME_7=29;Vala;0;EUTF-8;1;1;1;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fconky-manager%2Fsrc%2FSettingsWindow.vala;0;4
34 FILE_NAME_8=26;Vala;0;EUTF-8;1;1;1;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fconky-manager%2Fsrc%2FUtility.vala;0;4
35 FILE_NAME_9=1744;Make;0;EUTF-8;1;1;1;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fconky-manager%2Fsrc%2Fmakefile;0;4
36 FILE_NAME_10=167;Conf;0;EUTF-8;1;1;1;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fconky-manager%2Fdebian%2Fcontrol;0;4
37 FILE_NAME_11=206;None;0;EUTF-8;1;1;1;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fconky-manager%2Fdebian%2Fchangelog;0;4
4038
4139 [VTE]
4240 last_dir=/home/teejee
77 msgstr ""
88 "Project-Id-Version: conky-manager 2.0\n"
99 "Report-Msgid-Bugs-To: [email protected]\n"
10 "POT-Creation-Date: 2014-11-01 22:11+0530\n"
10 "POT-Creation-Date: 2015-10-21 18:29+0530\n"
1111 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1212 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1313 "Language-Team: LANGUAGE <[email protected]>\n"
139139 msgid "Custom Wallpaper"
140140 msgstr ""
141141
142 #: DonationWindow.vala:53
142 #: DonationWindow.vala:54
143143 msgid ""
144144 "Did you find this software useful?\n"
145145 "\n"
146146 "You can buy me a coffee or make a donation via PayPal to show your support. "
147 "Or just drop me an email and say Hi.\n"
147 "Or just drop me an email and say Hi. This application is completely free and "
148 "will continue to remain that way. Your contributions will help in keeping "
149 "this project alive and improving it further.\n"
148150 "\n"
149 "This application is completely free and will continue to remain that way. "
150 "Your contributions will help in keeping this project alive and to develop it "
151 "further.\n"
151 "Feel free to send me an email if you find any issues in this application or "
152 "if you need any changes. Suggestions and feedback are always welcome.\n"
152153 "\n"
153 "Feel free to drop me an email if you find any issues or if you have "
154 "suggestions for improvement.\n"
155 "\n"
156 "Regards,\n"
154 "Thanks,\n"
157155 "Tony George\n"
158 "[email protected]"
156 "([email protected])"
159157 msgstr ""
160158
161159 #: Main.vala:266 Main.vala:272 Main.vala:278
175173 msgid "Donate"
176174 msgstr ""
177175
178 #: DonationWindow.vala:66
179 msgid "Donate via PayPal"
176 #: DonationWindow.vala:74
177 msgid "Donate with Google Wallet"
178 msgstr ""
179
180 #: DonationWindow.vala:67
181 msgid "Donate with PayPal"
180182 msgstr ""
181183
182184 #: AboutWindow.vala:354
402404 msgid "None"
403405 msgstr ""
404406
405 #: EditThemeWindow.vala:205 GeneratePreviewWindow.vala:125
406 #: SettingsWindow.vala:215
407 #: DonationWindow.vala:95 EditThemeWindow.vala:205
408 #: GeneratePreviewWindow.vala:125 SettingsWindow.vala:215
407409 msgid "OK"
408410 msgstr ""
409411
520522 msgid "Semi-Transparent"
521523 msgstr ""
522524
523 #: DonationWindow.vala:73
525 #: DonationWindow.vala:81
524526 msgid "Send Email"
525527 msgstr ""
526528
690692 msgid "Vertical Gap"
691693 msgstr ""
692694
693 #: DonationWindow.vala:80
695 #: DonationWindow.vala:88
694696 msgid "Visit Website"
695697 msgstr ""
696698
0 # bzr-builder format 0.3 deb-version {debupstream}~132
1 lp:conky-manager revid:[email protected]
0 # bzr-builder format 0.3 deb-version {debupstream}~136
1 lp:conky-manager revid:[email protected]
0 conky-manager (2.3.3~132~ubuntu15.04.1) vivid; urgency=low
0 conky-manager (2.4~136~ubuntu15.10.1) wily; urgency=low
11
22 * Auto build.
33
4 -- Tony George <[email protected]> Fri, 07 Nov 2014 14:46:53 +0000
4 -- Tony George <[email protected]> Wed, 21 Oct 2015 13:17:29 +0000
55
6 conky-manager (2.3.3) trusty; urgency=low
6 conky-manager (2.4) trusty; urgency=low
77
8 * Added appdata.xml file
8 * Minor changes
99
10 * Fixed: Applying wallpaper to Cinnamon desktop with scaling option 'none' can result in an empty/black background
11
12 * Fixed: Create empty startup script if widgets are not enabled
13
14 * While generating previews for all 'missing' cases, generate previews for those widgets also which have common 'preview.xxx' file
15
16 * Combo for switching between Widget List and Theme List is replaced by toggle buttons for single-click switching
17
18 * Fixed: After generating preview, selected list item will remain selected instead of reloading the list
19
20 -- Tony George <[email protected]> Fri, 6 Nov 2014 10:00:00 +0530
10 -- Tony George <[email protected]> Wed, 21 Oct 2015 10:00:00 +0530
11 Section: utils
22 Priority: extra
33 Maintainer: Tony George <[email protected]>
4 Build-Depends: debhelper (>= 8.0.0), autotools-dev, valac, libgtk-3-dev, libgee-dev, libjson-glib-dev
4 Build-Depends: debhelper (>= 8.0.0), autotools-dev, valac-0.26, libgtk-3-dev, libgee-0.8-dev, libjson-glib-dev
55 Standards-Version: 3.9.3
66 Homepage: http://teejeetech.blogspot.in/
77 #Vcs-Git: git://git.debian.org/collab-maint/hello.git
0 doc/changelog
1
+0
-1
doc/changelog less more
0 /home/teejee/projects/selene/debian/changelogāŽ
169169 echo ""
170170 for i in "${debian_depends[@]}"; do
171171 MSG_INFO "Installing: $i"
172 apt-get -y install $i
172 apt-get install $i
173173 echo ""
174174 done
175175 fi
192192 echo ""
193193 for i in "${redhat_depends[@]}"; do
194194 MSG_INFO "Installing: $i"
195 yum -y install $i
195 yum install $i
196196 echo ""
197197 done
198198 fi
215215 echo ""
216216 for i in "${arch_depends[@]}"; do
217217 MSG_INFO "Installing: $i"
218 pacman -S --noconfirm $i
218 pacman -S $i
219219 echo ""
220220 done
221221 fi
00 /*
11 * AboutWindow.vala
22 *
3 * Copyright 2012 Tony George <[email protected]>
3 * Copyright 2015 Tony George <[email protected]>
44 *
55 * This program is free software; you can redistribute it and/or modify
66 * it under the terms of the GNU General Public License as published by
00 /*
11 * DonationWindow.vala
2 *
2 *
33 * Copyright 2012 Tony George <[email protected]>
4 *
4 *
55 * This program is free software; you can redistribute it and/or modify
66 * it under the terms of the GNU General Public License as published by
77 * the Free Software Foundation; either version 2 of the License, or
88 * (at your option) any later version.
9 *
9 *
1010 * This program is distributed in the hope that it will be useful,
1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1313 * GNU General Public License for more details.
14 *
14 *
1515 * You should have received a copy of the GNU General Public License
1616 * along with this program; if not, write to the Free Software
1717 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
1818 * MA 02110-1301, USA.
19 *
20 *
19 *
20 *
2121 */
22
22
2323 using Gtk;
2424
2525 using TeeJee.Logging;
3232
3333 public class DonationWindow : Dialog {
3434 public DonationWindow() {
35 title = _("Donate");
36 window_position = WindowPosition.CENTER_ON_PARENT;
35 set_title(_("Donate"));
36 window_position = WindowPosition.CENTER_ON_PARENT;
3737 set_destroy_with_parent (true);
3838 set_modal (true);
39 skip_taskbar_hint = false;
40 set_default_size (400, 20);
39 set_deletable(true);
40 set_skip_taskbar_hint(false);
41 set_default_size (400, 20);
4142 icon = get_app_icon(16);
42
43
4344 //vbox_main
44 Box vbox_main = get_content_area();
45 Box vbox_main = get_content_area();
4546 vbox_main.margin = 6;
4647 vbox_main.homogeneous = false;
47
48
4849 get_action_area().visible = false;
49
50
5051 //lbl_message
5152 Label lbl_message = new Gtk.Label("");
52 string msg = _("Did you find this software useful?\n\nYou can buy me a coffee or make a donation via PayPal to show your support. Or just drop me an email and say Hi.\n\nThis application is completely free and will continue to remain that way. Your contributions will help in keeping this project alive and to develop it further.\n\nFeel free to drop me an email if you find any issues or if you have suggestions for improvement.\n\nRegards,\nTony George\[email protected]");
53 string msg = _("Did you find this software useful?\n\nYou can buy me a coffee or make a donation via PayPal to show your support. Or just drop me an email and say Hi. This application is completely free and will continue to remain that way. Your contributions will help in keeping this project alive and improving it further.\n\nFeel free to send me an email if you find any issues in this application or if you need any changes. Suggestions and feedback are always welcome.\n\nThanks,\nTony George\n([email protected])");
5354 lbl_message.label = msg;
5455 lbl_message.wrap = true;
5556 vbox_main.pack_start(lbl_message,true,true,0);
56
57
5758 //vbox_actions
58 Box vbox_actions = new Box (Orientation.VERTICAL, 6);
59 Box vbox_actions = new Box (Orientation.VERTICAL, 6);
5960 vbox_actions.margin_left = 50;
6061 vbox_actions.margin_right = 50;
6162 vbox_actions.margin_top = 20;
6263 vbox_main.pack_start(vbox_actions,false,false,0);
6364
64 //btn_donate
65 Button btn_donate = new Button.with_label(" " + _("Donate via PayPal") + " ");
66 vbox_actions.add(btn_donate);
67 btn_donate.clicked.connect(()=>{
68 xdg_open("https://www.paypal.com/cgi-bin/[email protected]&cmd=_xclick&currency_code=USD&amount=10&item_name=Conky%20Manager%20Donation");
65 //btn_donate_paypal
66 Button btn_donate_paypal = new Button.with_label(" " + _("Donate with PayPal") + " ");
67 vbox_actions.add(btn_donate_paypal);
68 btn_donate_paypal.clicked.connect(()=>{
69 xdg_open("https://www.paypal.com/cgi-bin/[email protected]&cmd=_xclick&currency_code=USD&amount=10&item_name=ConkyManager%20Donation");
6970 });
7071
72 //btn_donate_wallet
73 Button btn_donate_wallet = new Button.with_label(" " + _("Donate with Google Wallet") + " ");
74 vbox_actions.add(btn_donate_wallet);
75 btn_donate_wallet.clicked.connect(()=>{
76 xdg_open("https://support.google.com/mail/answer/3141103?hl=en");
77 });
78
7179 //btn_send_email
7280 Button btn_send_email = new Button.with_label(" " + _("Send Email") + " ");
7381 vbox_actions.add(btn_send_email);
7482 btn_send_email.clicked.connect(()=>{
7583 xdg_open("mailto:[email protected]");
7684 });
77
85
7886 //btn_visit
7987 Button btn_visit = new Button.with_label(" " + _("Visit Website") + " ");
8088 vbox_actions.add(btn_visit);
8189 btn_visit.clicked.connect(()=>{
8290 xdg_open("http://www.teejeetech.in");
8391 });
92
93 //btn_exit
94 Button btn_exit = new Button.with_label(" " + _("OK") + " ");
95 vbox_actions.add(btn_exit);
96 btn_exit.clicked.connect(() => {
97 this.destroy();
98 });
8499 }
85
86100 }
00 /*
11 * EditThemeWindow.vala
22 *
3 * Copyright 2012 Tony George <[email protected]>
3 * Copyright 2015 Tony George <[email protected]>
44 *
55 * This program is free software; you can redistribute it and/or modify
66 * it under the terms of the GNU General Public License as published by
106106 (cell as Gtk.CellRendererText).text = type;
107107 });
108108
109 ListStore store = new ListStore(1, typeof(string));
109 var store = new Gtk.ListStore(1, typeof(string));
110110 TreeIter iter;
111111 store.append(out iter);
112112 store.set (iter, 0, _("None"));
165165 (cell as Gtk.CellRendererText).text = type;
166166 });
167167
168 store = new ListStore(1, typeof(string));
168 store = new Gtk.ListStore(1, typeof(string));
169169 foreach(string option in App.bg_scaling){
170170 store.append(out iter);
171171 store.set (iter, 0, option);
265265
266266 private void cell_widget_enable_toggled (string path){
267267 TreeIter iter;
268 ListStore model = (ListStore)tv_widget.model;
268 var model = (Gtk.ListStore)tv_widget.model;
269269 bool enabled;
270270
271271 model.get_iter_from_string (out iter, path);
275275 }
276276
277277 private void tv_widget_refresh(){
278 ListStore model = new ListStore(2, typeof(bool), typeof(ConkyRC));
278 var model = new Gtk.ListStore(2, typeof(bool), typeof(ConkyRC));
279279
280280 var list = new Gee.ArrayList<string>();
281281
356356
357357 string txt = "";
358358
359 ListStore model = (ListStore)tv_widget.model;
359 var model = (Gtk.ListStore)tv_widget.model;
360360 TreeIter iter;
361361 bool enabled;
362362 ConkyRC rc;
00 /*
11 * EditWidgetWindow.vala
22 *
3 * Copyright 2012 Tony George <[email protected]>
3 * Copyright 2015 Tony George <[email protected]>
44 *
55 * This program is free software; you can redistribute it and/or modify
66 * it under the terms of the GNU General Public License as published by
113113
114114 //populate
115115 TreeIter iter;
116 ListStore model = new Gtk.ListStore (2, typeof (string), typeof (string));
116 var model = new Gtk.ListStore (2, typeof (string), typeof (string));
117117 model.append (out iter);
118118 model.set (iter,0,_("Top Left"),1,"top_left");
119119 model.append (out iter);
00 /*
11 * GeneratePreviewWindow.vala
22 *
3 * Copyright 2012 Tony George <[email protected]>
3 * Copyright 2015 Tony George <[email protected]>
44 *
55 * This program is free software; you can redistribute it and/or modify
66 * it under the terms of the GNU General Public License as published by
00 /*
11 * Main.vala
2 *
2 *
33 * Copyright 2013 Tony George <teejee@teejee-pc>
4 *
4 *
55 * This program is free software; you can redistribute it and/or modify
66 * it under the terms of the GNU General Public License as published by
77 * the Free Software Foundation; either version 2 of the License, or
88 * (at your option) any later version.
9 *
9 *
1010 * This program is distributed in the hope that it will be useful,
1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1212 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1313 * GNU General Public License for more details.
14 *
14 *
1515 * You should have received a copy of the GNU General Public License
1616 * along with this program; if not, write to the Free Software
1717 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
1818 * MA 02110-1301, USA.
19 *
20 *
19 *
20 *
2121 */
22
22
2323 using GLib;
2424 using Gtk;
2525 using Gee;
3636 public Main App;
3737 public const string AppName = "Conky Manager";
3838 public const string AppShortName = "conky-manager";
39 public const string AppVersion = "2.3.3";
39 public const string AppVersion = "2.4";
4040 public const string AppAuthor = "Tony George";
4141 public const string AppAuthorEmail = "[email protected]";
4242
4646 extern void exit(int exit_code);
4747
4848 public class Main : GLib.Object {
49
49
5050 public string app_path = "";
5151 public string share_folder = "";
5252 public string data_dir = "";
5353 public string app_conf_path = "";
5454 public string desktop = "gnome";
55
55
5656 public Gee.ArrayList<string> search_folders;
5757 public Gee.ArrayList<ConkyRC> conkyrc_list;
5858 public Gee.ArrayList<ConkyTheme> conkytheme_list;
59
59
6060 public bool is_aborted;
6161 public string last_cmd;
6262
7676 public string[] bg_scaling_gnome = {"stretched","centered","tiled","stretched","scaled","zoomed"};
7777 public string[] bg_scaling_xfce = {"0","1","2","3","4","5"};
7878 public string[] bg_scaling_lxde = {"","center","tile","stretch","fit","crop"};
79
79
8080 public static int main(string[] args) {
81
81
8282 //set locale
8383 Intl.setlocale(GLib.LocaleCategory.MESSAGES, "");
8484 Intl.textdomain(GETTEXT_PACKAGE);
8787
8888 //init GTK
8989 Gtk.init (ref args);
90
90
9191 //init TMP
9292 init_tmp();
93
93
9494 //init app
9595 App = new Main(args);
96
96
9797 //show window
9898 var window = new MainWindow();
9999 //quit app when window is closed
107107 return false;
108108 });
109109 window.show_all();
110
110
111111 //run main loop
112112 Gtk.main();
113113
126126 conkytheme_list = new Gee.ArrayList<ConkyTheme>();
127127
128128 //check dependencies ---------------------
129
129
130130 string message;
131131 if (!check_dependencies(out message)){
132132 string title = _("Missing Dependencies");
133133 gtk_messagebox(title, message, null, true);
134134 exit(0);
135135 }
136
136
137137 //get desktop ---------------
138138 desktop = get_desktop_name().down();
139139 log_msg("Desktop: %s".printf(desktop));
140
140
141141 //install new theme packs and fonts ---------------
142
142
143143 init_directories();
144144 init_theme_packs();
145145
148148
149149 public bool check_dependencies(out string msg){
150150 msg = "";
151
151
152152 string[] dependencies = { "conky", "rsync","killall","cp","rm","touch","7za","import" };
153153
154154 string path;
158158 msg += " * " + cmd_tool + "\n";
159159 }
160160 }
161
161
162162 if (msg.length > 0){
163163 msg = _("Commands listed below are not available") + ":\n\n" + msg + "\n";
164164 msg += _("Please install required packages and try running it again");
169169 return true;
170170 }
171171 }
172
172
173173 public void save_app_config(){
174174 var config = new Json.Object();
175175
176176 string home = Environment.get_home_dir();
177
177
178178 config.set_string_member("capture_background", capture_background.to_string());
179179 config.set_string_member("generate_png", generate_png.to_string());
180180 config.set_string_member("show_preview", show_preview.to_string());
198198 var node = new Json.Node(NodeType.OBJECT);
199199 node.set_object(config);
200200 json.set_root(node);
201
201
202202 try{
203203 json.to_file(this.app_conf_path);
204204 } catch (Error e) {
205205 log_error (e.message);
206206 }
207
207
208208 log_msg(_("App config saved") + ": '%s'".printf(app_conf_path));
209209 }
210
210
211211 public void load_app_config(){
212212 var f = File.new_for_path(app_conf_path);
213213 if (!f.query_exists()) { return; }
214
214
215215 var parser = new Json.Parser();
216216 try{
217217 parser.load_from_file(this.app_conf_path);
231231 startup_delay = json_get_int(config,"startup_delay",startup_delay);
232232
233233 // search folders -------------------
234
234
235235 search_folders.clear();
236
236
237237 string home = Environment.get_home_dir();
238
238
239239 //default locations: look for other folders in addition to "~/.conky"
240240 foreach(string path in new string[]{ home + "/.Conky", home + "/.config/conky", home + "/.config/Conky"}){
241241 if (!search_folders.contains(path) && dir_exists(path)){
255255
256256 log_msg(_("App config loaded") + ": '%s'".printf(this.app_conf_path));
257257 }
258
258
259259 public void init_directories(){
260260 string path = data_dir;
261261 string home = Environment.get_home_dir ();
262
262
263263 if (dir_exists(path) == false){
264264 create_dir(path);
265265 log_debug(_("Directory Created") + ": " + path);
270270 create_dir(path);
271271 log_debug(_("Directory Created") + ": " + path);
272272 }
273
273
274274 path = home + "/.config/autostart";
275275 if (dir_exists(path) == false){
276276 create_dir(path);
277277 log_debug(_("Directory Created") + ": " + path);
278278 }
279279 }
280
280
281281 public void init_theme_packs(){
282282 string sharePath = "/usr/share/conky-manager/themepacks";
283283 string config_file = data_dir + "/.themepacks";
284
284
285285 //create empty config file if missing
286 if (file_exists(config_file) == false) {
287 Posix.system("touch \"" + config_file + "\"");
286 if (file_exists(config_file) == false) {
287 Posix.system("touch \"" + config_file + "\"");
288288 }
289289
290290 //read config file
293293 foreach(string item in txt.split("\n")){
294294 filenames.add(item);
295295 }
296
296
297297 //skip import of theme packs installed by previous versions of conky manager
298298 filenames.add("default-themes-1.1.cmtp.7z");
299299 filenames.add("default-themes-1.2.cmtp.7z");
300
300
301301 try{
302302 FileEnumerator enumerator;
303303 FileInfo file;
304304 File fShare = File.parse_name (sharePath);
305
305
306306 if (dir_exists(sharePath)){
307307 enumerator = fShare.enumerate_children ("standard::*", 0);
308
308
309309 while ((file = enumerator.next_file ()) != null) {
310
310
311311 string filePath = sharePath + "/" + file.get_name();
312312 if (file_exists(filePath) == false) { continue; }
313313 if (filePath.has_suffix(".cmtp.7z") == false) { continue; }
320320 break;
321321 }
322322 }
323
323
324324 if (!is_installed){
325325 log_msg("-----------------------------------------------------");
326326 log_msg(_("Found theme pack [new]") + ": " + filePath);
327327 install_theme_pack(filePath);
328328 filenames.add(file.get_name());
329329 log_msg("-----------------------------------------------------");
330
330
331331 string list = "";
332332 foreach(string filename in filenames){
333333 list += filename + "\n";
335335 list += file.get_name() + "\n";
336336 write_file(config_file,list);
337337 }
338 }
338 }
339339 }
340340 }
341341 catch(Error e){
348348 string std_out;
349349 string std_err;
350350 int ret_val;
351
351
352352 //create temp dir
353353 string temp_dir = TEMP_DIR;
354354 temp_dir = temp_dir + "/" + timestamp2();
355355 create_dir(temp_dir);
356
356
357357 //check and create ~/.conky
358358 if (dir_exists(data_dir) == false){
359359 create_dir(data_dir);
360360 }
361
361
362362 log_msg(_("Importing") + ": " + pkgPath);
363
363
364364 //unzip
365365 cmd = "cd \"" + temp_dir + "\"\n";
366366 cmd += "7za x \"" + pkgPath + "\">nul\n";
367
367
368368 ret_val = execute_command_script_sync(cmd, out std_out, out std_err);
369369 if (ret_val != 0){
370370 log_error(_("Failed to unzip files from theme pack"));
371371 log_error (std_err);
372372 return false;
373373 }
374
374
375375 //install
376376 foreach(string dirname in new string[]{".conky",".Conky",".fonts",".config/conky",".config/Conky"}){
377377 string src_path = temp_dir + "/" + dirname;
378378 string dst_path = Environment.get_home_dir() + "/" + dirname;
379
379
380380 if (dir_exists(src_path)){
381
381
382382 //create destination
383383 if (!dir_exists(dst_path)){
384384 create_dir(dst_path);
385385 }
386
386
387387 //rsync folder
388388 execute_command_sync("rsync -ai --numeric-ids '%s/' '%s'".printf(src_path,dst_path));
389389 }
391391
392392 //delete temp files
393393 Posix.system("rm -rf \"" + temp_dir + "\"");
394
394
395395 return true;
396396 }
397
397
398398 public void load_themes_and_widgets() {
399399 is_aborted = false;
400
400
401401 find_conkyrc_files();
402402 find_conkytheme_files();
403403 find_and_install_fonts();
404404 refresh_conkyrc_status();
405
405
406406 log_msg(_("Searching for conkyrc files... %d found").printf(conkyrc_list.size));
407407 }
408408
410410 is_aborted = true;
411411 command_kill("grep",last_cmd);
412412 }
413
413
414414 public void find_conkyrc_files(){
415415 conkyrc_list = new Gee.ArrayList<ConkyRC>();
416416
420420 find_conkyrc_files_in_path(path);
421421 }
422422 }
423 CompareFunc<ConkyConfigItem> func = (a, b) => {
423 CompareDataFunc<ConkyConfigItem> func = (a, b) => {
424424 return strcmp(a.name,b.name);
425425 };
426 conkyrc_list.sort(func);
427 }
428
426 conkyrc_list.sort((owned) func);
427 }
428
429429 public void find_conkyrc_files_in_path(string path){
430430 string std_out = "";
431431 string std_err = "";
432432 string cmd = "grep -r \"^[[:blank:]]*TEXT[[:blank:]]*$\" \"%s\"".printf(path);
433433 last_cmd = cmd;
434434 int exit_code = execute_command_script_sync(cmd, out std_out, out std_err);
435
436 if (exit_code != 0){
435
436 if (exit_code != 0){
437437 //no files found
438438 return;
439439 }
440
440
441441 string file_path;
442442 foreach(string line in std_out.split("\n")){
443443 if (line.index_of(":") > -1){
444444 file_path = line.split(":")[0].strip();
445445 if (file_path.strip().has_suffix("~")){ continue; }
446
446
447447 bool found = false;
448448 foreach(ConkyConfigItem item in conkyrc_list){
449449 if (item.path == file_path){
458458 }
459459 }
460460 }
461
461
462462 public void find_conkytheme_files(){
463463 conkytheme_list = new Gee.ArrayList<ConkyTheme>();
464464
469469 }
470470 }
471471
472 CompareFunc<ConkyConfigItem> func = (a, b) => {
472 CompareDataFunc<ConkyConfigItem> func = (a, b) => {
473473 return strcmp(a.name,b.name);
474474 };
475 conkytheme_list.sort(func);
475 conkytheme_list.sort((owned) func);
476476 }
477477
478478 public void find_conkytheme_files_in_path(string path){
490490 foreach(string line in std_out.split("\n")){
491491 if (line == null){ continue; }
492492 if (line.length == 0){ continue; }
493
493
494494 file_path = line.strip();
495495 if (file_path.has_suffix("~")){ continue; }
496496 if (!file_path.has_suffix(".cmtheme")){ continue; }
497497 if (file_path.split(" ").length < 2){ continue; }
498498 file_path = path + "/" + file_path[file_path.index_of(" ") + 1:file_path.length].strip();
499
499
500500 bool found = false;
501501 foreach(ConkyConfigItem item in conkytheme_list){
502502 if (item.path == file_path){
510510 }
511511 }
512512 }
513
513
514514 public void find_and_install_fonts(){
515515 find_and_install_fonts_in_path(data_dir);
516516 foreach(string path in search_folders){
519519 }
520520 }
521521 }
522
522
523523 public void find_and_install_fonts_in_path(string path){
524524 string std_out = "";
525525 string std_err = "";
539539 file_path = line.strip();
540540 if (file_path.has_suffix("~")){ continue; }
541541 if (file_path.split(" ").length < 2){ continue; }
542
542
543543 if (file_path.has_suffix(".ttf")||file_path.has_suffix(".TTF")||file_path.has_suffix(".otf")||file_path.has_suffix(".OTF")){
544544 //ok
545545 }
548548 }
549549
550550 file_path = path + "/" + file_path[file_path.index_of(" ") + 1:file_path.length].strip();
551
551
552552 File font_file = File.new_for_path (file_path);
553553 string file_name = font_file.get_basename();
554554 string home = Environment.get_home_dir ();
555555 string target_file = home + "/.fonts/" + file_name;
556
556
557557 if (file_exists(target_file) == false){
558558 copy_file(file_path, target_file);
559559 log_msg(_("Font Copied: ") + target_file);
565565 Gee.ArrayList<string> active_list = new Gee.ArrayList<string>();
566566
567567 string cmd = "conky -c "; //without double-quotes
568 string txt = execute_command_sync_get_output ("ps w -C conky");
568 string txt = execute_command_sync_get_output ("ps w -C conky");
569569 //use 'ps ew -C conky' for all users
570
570
571571 foreach(string line in txt.split("\n")){
572572 if (line.index_of(cmd) != -1){
573573 string conf = line.substring(line.index_of(cmd) + 8).strip();
574574 active_list.add(conf);
575575 }
576576 }
577
577
578578 foreach(ConkyRC rc in conkyrc_list){
579579 bool active = false;
580580 foreach(string path in active_list){
585585 rc.enabled = active;
586586 }
587587 }
588
588
589589 private void exit_app(){
590590 update_startup_script();
591
591
592592 save_app_config();
593
593
594594 if (check_startup()){
595595 autostart(true); //overwrite the startup entry
596596 }
597597 }
598
598
599599 public void run_startup_script(){
600600 execute_command_sync("sh \"" + data_dir + "/conky-startup.sh\"");
601601 Posix.usleep(500000);//microseconds
602602 //refresh_status();
603603 }
604
604
605605 public void update_startup_script(){
606606 string startupScript = data_dir + "/conky-startup.sh";
607
607
608608 bool atleast_one_widget_enabled = false;
609
609
610610 string txt = "";
611611 txt += "sleep %ds\n".printf(startup_delay);
612612 txt += "killall conky\n";
617617 atleast_one_widget_enabled = true;
618618 }
619619 }
620
620
621621 if (file_exists(startupScript)){
622622 file_delete(startupScript);
623623 }
624
624
625625 if (atleast_one_widget_enabled){
626626 write_file(startupScript, txt);
627627 }
629629 write_file(startupScript, "# No widgets enabled!\n\nexit 0"); //write empty script
630630 }
631631 }
632
632
633633 public bool check_startup(){
634634 string home = Environment.get_home_dir ();
635635 string startupFile = home + "/.config/autostart/conky.desktop";
636 return file_exists(startupFile);
637 }
638
636 return file_exists(startupFile);
637 }
638
639639 public void autostart(bool autostart){
640640 string home = Environment.get_home_dir ();
641641 string startupFile = home + "/.config/autostart/conky.desktop";
642
642
643643 if (autostart){
644 string txt =
644 string txt =
645645 """[Desktop Entry]
646646 Type=Application
647647 Exec={command}
654654 Comment=
655655 """;
656656 txt = txt.replace("{command}", "sh \"" + data_dir + "/conky-startup.sh\"");
657
657
658658 write_file(startupFile, txt);
659659 }
660660 else{
661 file_delete(startupFile);
662 }
663 }
664
661 file_delete(startupFile);
662 }
663 }
664
665665 public void kill_all_conky(){
666666 Posix.system("killall conky");
667667 foreach(ConkyRC rc in conkyrc_list){
680680 private bool _enabled = false;
681681 private string _url = "";
682682 private string _credits = "";
683
683
684684 public abstract void start();
685685 public abstract void stop();
686
686
687687 public void init_path(string theme_file_path){
688688 path = theme_file_path;
689689 var f = File.new_for_path (theme_file_path);
691691 base_name = f.get_basename();
692692 dir = f.get_parent().get_path();
693693 }
694
694
695695 public void init_image_path(){
696
696
697697 string[] ext_list = {".png",".jpg",".jpeg"};
698
698
699699 //search using base name
700700 foreach(string ext in ext_list){
701701 image_path = dir + "/" + base_name + ext;
702702 if (file_exists(image_path)){ return; }
703703 }
704
704
705705 //search without basename extension
706706 if (base_name.split(".").length == 2){
707707 foreach(string ext in ext_list){
709709 if (file_exists(image_path)){ return; }
710710 }
711711 }
712
712
713713 //search using fixed names
714714 foreach(string ext in ext_list){
715715 image_path = dir + "/preview" + ext;
716716 if (file_exists(image_path)){ return; }
717717 }
718
718
719719 image_path = ""; //clear if not found
720720 }
721721
730730 credits = TeeJee.FileSystem.read_file(credits_file).replace("\n","");
731731 }
732732 }
733
733
734734 public string name{
735735 get{
736736 return _name;
739739 _name = value;
740740 }
741741 }
742
742
743743 public string path{
744744 get{
745745 return _path;
757757 _dir = value;
758758 }
759759 }
760
760
761761 public string image_path{
762762 get{
763763 return _image_path;
766766 _image_path = value;
767767 }
768768 }
769
769
770770 public bool enabled{
771771 get{
772772 return _enabled;
793793 _url = value;
794794 }
795795 }
796
796
797797 public string credits{
798798 get{
799799 return _credits;
802802 _credits = value;
803803 }
804804 }
805
805
806806 }
807807
808808 public class ConkyRC : ConkyConfigItem {
809809 public string text = "";
810
810
811811 private Regex rex_conky_win;
812812 private MatchInfo match;
813
813
814814 private string err_line;
815815 private string out_line;
816816 private DataInputStream dis_out;
818818 private bool thread_is_running = false;
819819 private int wait_interval = 1;
820820 private uint timer_stop;
821
821
822822 public ConkyRC(string rc_file_path) {
823823 init_path(rc_file_path);
824824 init_image_path();
831831 log_error (e.message);
832832 }
833833 }
834
834
835835 public bool is_running(){
836836 string cmd = "conky -c " + path; //without double-quotes
837 string txt = execute_command_sync_get_output ("ps w -C conky");
837 string txt = execute_command_sync_get_output ("ps w -C conky");
838838 //use 'ps ew -C conky' for all users
839
839
840840 bool active = false;
841841 foreach(string line in txt.split("\n")){
842842 if (line.index_of(cmd) != -1){
846846 }
847847 return active;
848848 }
849
849
850850 public override void start(){
851851 string cmd;
852852
853853 if (is_running()){
854854 stop();
855855 }
856
856
857857 //Theme.install();
858
858
859859 cmd = "cd \"" + dir + "\"\n";
860860 cmd += "conky -c \"" + path + "\"\n";
861861
863863
864864 Thread.usleep((ulong)1000000);
865865 log_debug(_("Started") + ": " + path);
866
866
867867 //set the flag for immediate effect
868868 //will be updated by the refresh_status() timer
869 enabled = true;
869 enabled = true;
870870 }
871871
872872 public bool stop_handler(){
873873 stop();
874874 return true;
875875 }
876
876
877877 public override void stop(){
878
878
879879 //Note: There may be more than one running instance of the same config
880880 //We need to kill all instances
881
881
882882 string cmd = "conky -c " + path; //without double-quotes
883883 string txt = execute_command_sync_get_output ("ps w -C conky");
884884 //use 'ps ew -C conky' for all users
885
885
886886 string pid = "";
887887 foreach(string line in txt.split("\n")){
888888 if (line.index_of(cmd) != -1){
891891 log_debug(_("Stopped") + ": [PID=" + pid + "] " + path);
892892 }
893893 }
894
894
895895 //set the flag for immediate effect
896896 //will be updated by the refresh_status() timer
897 enabled = false;
898 }
899
897 enabled = false;
898 }
899
900900 public void read_file(){
901901 log_debug("Read config file from disk");
902902 this.text = TeeJee.FileSystem.read_file(this.path);
903903 }
904
904
905905 public void save_file(){
906906 log_debug("Saved config file changes to disk");
907907 write_file(this.path, text);
910910 public void save_file_temp(){
911911 write_file(this.path + "~temp~", text);
912912 }
913
913
914914 public void delete_file_temp(){
915915 file_delete(this.path + "~temp~");
916916 }
917
917
918918 public bool generate_preview(){
919919 stop();
920920 read_file();
926926 }
927927 delete_file_temp();
928928 save_file_temp();
929
929
930930 read_file();
931931 wait_interval = 3;
932932 foreach(string line in text.split("\n")){
935935 break;
936936 }
937937 }
938
938
939939 try {
940940 thread_is_running = true;
941941 Thread.create<void> (generate_preview_thread, true);
959959 return false;
960960 }
961961 }
962
962
963963 public void generate_preview_thread (){
964964 string cmd = "cd \"" + dir + "\"\n";
965965 cmd += "conky -c \"" + path + "~temp~\" 2>&1 \n";
966966
967967 string[] argv = new string[1];
968968 argv[0] = create_temp_bash_script(cmd);
969
969
970970 Pid child_pid;
971971 int input_fd;
972972 int output_fd;
984984 out input_fd,
985985 out output_fd,
986986 out error_fd);
987
987
988988 thread_is_running = true;
989
989
990990 timer_stop = Timeout.add (10 * 1000, stop_handler);
991
991
992992 //create stream readers
993993 UnixInputStream uis_out = new UnixInputStream(output_fd, false);
994994 UnixInputStream uis_err = new UnixInputStream(error_fd, false);
996996 dis_err = new DataInputStream(uis_err);
997997 dis_out.newline_type = DataStreamNewlineType.ANY;
998998 dis_err.newline_type = DataStreamNewlineType.ANY;
999
999
10001000 try {
10011001 //start thread for reading output stream
10021002 Thread.create<void> (conky_read_output_line, true);
10031003 } catch (Error e) {
10041004 log_error (e.message);
10051005 }
1006
1006
10071007 try {
10081008 //start thread for reading error stream
10091009 Thread.create<void> (conky_read_error_line, true);
10261026 }
10271027 catch (Error e) {
10281028 log_error (e.message);
1029 }
1030 }
1031
1029 }
1030 }
1031
10321032 private void conky_read_output_line(){
10331033 try{
10341034 out_line = dis_out.read_line (null);
10351035 while (out_line != null) {
10361036 if (rex_conky_win.match (out_line, 0, out match)){
1037
1037
10381038 //wait for one second till window is displayed on screen
10391039 Thread.usleep ((ulong) wait_interval * 1000000);
1040
1040
10411041 string win_id = match.fetch(1).strip();
10421042 string cmd = "";
1043
1043
10441044 if (App.generate_png){
10451045 image_path = dir + "/" + base_name + ".png";
10461046 cmd = "import -window 0x%s '%s'".printf(win_id,image_path);
10491049 image_path = dir + "/" + base_name + ".jpg";
10501050 cmd = "import -window 0x%s -quality 90 '%s'".printf(win_id,image_path);
10511051 }
1052
1052
10531053 execute_command_sync(cmd);
1054
1054
10551055 Thread.usleep ((ulong) 100000); //wait 100ms before killing conky
1056
1056
10571057 if (timer_stop > 0){
10581058 Source.remove(timer_stop);
10591059 timer_stop = 0;
10681068 }
10691069 catch (Error e) {
10701070 log_error (e.message);
1071 }
1071 }
10721072 }
10731073
10741074 public string alignment{
10751075 owned get{
10761076 string s = get_value("alignment");
1077
1077
10781078 switch(s){
10791079 case "tl":
10801080 s = "top_left";
11191119 log_debug("Set: alignment " + value);
11201120 }
11211121 }
1122
1122
11231123 public string gap_x{
11241124 owned get{
11251125 string s = get_value("gap_x");
11341134 log_debug("Set: gap_x " + value);
11351135 }
11361136 }
1137
1137
11381138 public string gap_y{
11391139 owned get{
11401140 string s = get_value("gap_y");
11491149 log_debug("Set: gap_y " + value);
11501150 }
11511151 }
1152
1152
11531153 public string own_window_transparent{
11541154 owned get{
11551155 string s = get_value("own_window_transparent");
11641164 log_debug("Set: own_window_transparent " + value);
11651165 }
11661166 }
1167
1167
11681168 public string own_window_argb_visual{
11691169 owned get{
11701170 string s = get_value("own_window_argb_visual");
11791179 log_debug("Set: own_window_argb_visual " + value);
11801180 }
11811181 }
1182
1182
11831183 public string own_window_argb_value{
11841184 owned get{
11851185 string s = get_value("own_window_argb_value");
11941194 log_debug("Set: own_window_argb_value " + value);
11951195 }
11961196 }
1197
1197
11981198 public string own_window_colour{
11991199 owned get{
12001200 string s = get_value("own_window_colour");
12081208 log_debug("Set: own_window_colour " + value.up());
12091209 }
12101210 }
1211
1211
12121212 public string transparency{
12131213 owned get{
12141214 string s = "trans";
12471247 else{
12481248 s = "opaque";
12491249 }
1250
1250
12511251 log_debug("Get: transparency " + s);
1252
1252
12531253 return s;
12541254 }
12551255 set{
12731273 own_window_argb_visual = "yes";
12741274 break;
12751275 }
1276
1276
12771277 log_debug("Set: transparency " + value.down());
12781278 }
12791279 }
1280
1280
12811281 public string minimum_size{
12821282 owned get{
12831283 string s = get_value("minimum_size");
12921292 log_debug("Set: minimum_size " + value);
12931293 }
12941294 }
1295
1295
12961296 public int height_padding{
12971297 get{
12981298 string[] arr = this.text.split("\n");
12991299 int count = 0;
1300
1300
13011301 //count empty lines at end of the file
13021302 for(int k = arr.length - 1; k >= 0; k--){
13031303 if (arr[k].strip() == ""){
13071307 break;
13081308 }
13091309 }
1310
1310
13111311 count--;
1312
1312
13131313 log_debug("Get: height_padding " + count.to_string());
1314
1314
13151315 return count;
13161316 }
13171317 set
13191319 string newText = "";
13201320 string[] arr = this.text.split("\n");
13211321 int count = 0;
1322
1322
13231323 //count empty lines at end of the file
13241324 for(int k = arr.length - 1; k >= 0; k--){
13251325 if (arr[k].strip() == ""){
13291329 break;
13301330 }
13311331 }
1332
1332
13331333 int lastLineNumber = arr.length - count;
1334
1334
13351335 //remove all empty lines from end of text
13361336 for(int k = 0; k < lastLineNumber; k++){
13371337 newText += arr[k] + "\n";
13381338 }
13391339 //remove extra newline from end of text
13401340 //newText = newText[0:newText.length-1];
1341
1341
13421342 //add empty lines at end of text
13431343 for(int k = 1; k <= value; k++){
13441344 newText += "\n";
13451345 }
1346
1346
13471347 log_debug("Set: height_padding " + value.to_string());
1348
1348
13491349 this.text = newText;
13501350 }
13511351 }
1352
1352
13531353 public string time_format{
13541354 owned get{
13551355 string val = "";
1356
1356
13571357 if (search("""\${(time|TIME) [^}]*H[^}]*}""") != ""){
13581358 val = "24";
13591359 log_debug("Get: time format = 24-hour");
13681368 set
13691369 {
13701370 if (value == "") { return; }
1371
1371
13721372 switch(value){
13731373 case "12":
13741374 if (replace("""\${(time|TIME) [^}]*(H)[^}]*}""", 2, "I")){
13791379 if (replace("""\${(time|TIME) [^}]*(I)[^}]*}""", 2, "H")){
13801380 log_debug("Set: time format = 24-hour");
13811381 }
1382 break;
1383 }
1384 }
1385 }
1386
1382 break;
1383 }
1384 }
1385 }
1386
13871387 public string network_device{
13881388 owned get{
13891389 string var1 = "totaldown|totalup|upspeed|upspeedf|downspeed|downspeedf|wireless_ap|wireless_bitrate|wireless_essid|wireless_link_qual|wireless_link_qual_max|wireless_link_qual_perc|wireless_mode";
13901390 var1 = """\${(""" + var1 + "|" + var1.up() + """)[ \t]*([A-Za-z0-9]+)[ \t]*}""";
1391
1391
13921392 string var2 = "upspeedgraph|downspeedgraph";
13931393 var2 = """\${(""" + var2 + "|" + var2.up() + """)[ \t]*([A-Za-z0-9]+)[ \t]*.*}""";
1394
1394
13951395 string var3 = "wireless_link_bar";
13961396 var3 = """\${(""" + var3 + "|" + var3.up() + """)[ \t]*[0-9]+[ \t]*,[0-9+][ \t]*([A-Za-z0-9]+)[ \t]*}""";
13971397
13981398 string net = search(var1, 2);
1399
1399
14001400 if (net != ""){
14011401 log_debug("Get: network interface = " + net);
14021402 return net;
14031403 }
1404
1404
14051405 net = search(var2, 2);
1406
1406
14071407 if (net != ""){
14081408 log_debug("Get: network interface = " + net);
14091409 return net;
14101410 }
1411
1411
14121412 net = search(var3, 2);
1413
1413
14141414 if (net != ""){
14151415 log_debug("Get: network interface = " + net);
14161416 return net;
14171417 }
1418
1418
14191419 return "";
14201420 }
14211421 set
14221422 {
14231423 if (value == "") { return; }
1424
1424
14251425 string var1 = "totaldown|totalup|upspeed|upspeedf|downspeed|downspeedf|wireless_ap|wireless_bitrate|wireless_essid|wireless_link_qual|wireless_link_qual_max|wireless_link_qual_perc|wireless_mode";
14261426 var1 = """\${(""" + var1 + "|" + var1.up() + """)[ \t]*([A-Za-z0-9]+)[ \t]*}""";
1427
1427
14281428 string var2 = "upspeedgraph|downspeedgraph";
14291429 var2 = """\${(""" + var2 + "|" + var2.up() + """)[ \t]*([A-Za-z0-9]+)[ \t]*.*}""";
1430
1430
14311431 string var3 = "wireless_link_bar";
14321432 var3 = """\${(""" + var3 + "|" + var3.up() + """)[ \t]*[0-9]+[ \t]*,[0-9+][ \t]*([A-Za-z0-9]+)[ \t]*}""";
14331433
14341434 string net = search(var1, 2);
1435
1435
14361436 if (net != ""){
14371437 if (replace(var1, 2, value)){
14381438 log_debug("Set: network interface = " + value);
14391439 }
14401440 }
1441
1441
14421442 net = search(var2, 2);
1443
1443
14441444 if (net != ""){
14451445 if (replace(var2, 2, value)){
14461446 log_debug("Set: network interface = " + value);
14471447 }
14481448 }
1449
1449
14501450 net = search(var3, 2);
1451
1451
14521452 if (net != ""){
14531453 if (replace(var3, 2, value)){
14541454 log_debug("Set: network interface = " + value);
14561456 }
14571457 }
14581458 }
1459
1459
14601460 public string get_value(string param){
14611461 foreach(string line in this.text.split("\n")){
14621462 string s = line.down().strip();
14691469 }
14701470 }
14711471 }
1472
1472
14731473 return "";
14741474 }
1475
1475
14761476 public void set_value(string param, string newLine){
14771477 string newText = "";
14781478 bool found = false;
14791479 bool remove = (newLine.strip() == param);
1480
1480
14811481 foreach(string line in this.text.split("\n")){
14821482 string s = line.down().strip();
14831483 if (s.has_prefix(param)){
14991499 newText += line + "\n";
15001500 }
15011501 }
1502
1502
15031503 //remove extra newline from end of text
15041504 newText = newText[0:newText.length-1];
1505
1505
15061506 this.text = newText;
15071507 }
1508
1508
15091509 public string search(string search_string, int bracket_num = 0){
15101510 foreach(string line in this.text.split("\n")){
15111511 string s = line.strip();
15201520 log_error (e.message);
15211521 }
15221522 }
1523
1523
15241524 return "";
15251525 }
1526
1526
15271527 public bool replace(string search_string, int bracket_num, string replace_string){
15281528 bool found = false;
15291529 string new_text = "";
15301530 string old_match = "";
15311531 string new_match = "";
15321532 string new_line = "";
1533
1533
15341534 foreach(string line in this.text.split("\n")){
15351535 try{
15361536 Regex regx = new Regex(search_string);
15371537 MatchInfo match;
15381538 if (regx.match(line, 0, out match)){
1539
1539
15401540 bool matchExists = true;
15411541 new_line = line;
1542
1542
15431543 while (matchExists){
15441544 old_match = match.fetch(0);
15451545 new_match = old_match.replace(match.fetch(bracket_num),replace_string);
15471547 new_line = new_line.replace(old_match, new_match);
15481548 matchExists = match.next();
15491549 }
1550
1550
15511551 new_text += new_line + "\n";
15521552 found = true;
15531553 }
15591559 return false;
15601560 }
15611561 }
1562
1562
15631563 //remove extra newline from end of text
15641564 new_text = new_text[0:new_text.length-1];
1565
1565
15661566 this.text = new_text;
1567
1567
15681568 return found;
15691569 }
15701570 }
15731573 public string wallpaper_path = "";
15741574 public string text = "";
15751575 public string wallpaper_scaling = "";
1576
1576
15771577 public Gee.ArrayList<ConkyRC> conkyrc_list;
15781578 private Main main_app;
1579
1579
15801580 public ConkyTheme.empty(string theme_file_path){
15811581 init_path(theme_file_path);
15821582 conkyrc_list = new Gee.ArrayList<ConkyRC>();
15831583 }
1584
1584
15851585 public ConkyTheme.from_file(string theme_file_path, Main _main_app){
15861586 main_app = _main_app;
15871587 init_path(theme_file_path);
15881588 init_image_path();
15891589 init_credits();
1590
1590
15911591 conkyrc_list = new Gee.ArrayList<ConkyRC>();
15921592 foreach(string line in read_file(theme_file_path).split("\n")){
15931593 //remove quotes
15971597 if (line.has_suffix("\"")){
15981598 line = line[0:line.length-1];
15991599 }
1600
1600
16011601 //read options
16021602 if (line.contains("wallpaper-scaling") && (line.split(":").length == 2)){
16031603 string val = line.split(":")[1].strip().down();
1604
1604
16051605 //check if option is valid
16061606 bool valid = false;
16071607 foreach(string option in App.bg_scaling){
16101610 break;
16111611 }
16121612 }
1613
1613
16141614 if (valid){
16151615 wallpaper_scaling = val;
16161616 continue;
16191619 continue;
16201620 }
16211621 }
1622
1622
16231623 //read wallpaper path
16241624 if (line.has_suffix(".png")||line.has_suffix(".jpg")||line.has_suffix(".jpeg")){
16251625 wallpaper_path = line.replace("~", Environment.get_home_dir());
16391639
16401640 public void init_wallpaper_path(){
16411641 string[] ext_list = {".png",".jpg",".jpeg"};
1642
1642
16431643 foreach(string ext in ext_list){
16441644 wallpaper_path = dir + "/wallpaper" + ext;
16451645 if (file_exists(wallpaper_path)){ return; }
16471647
16481648 wallpaper_path = "";
16491649 }
1650
1650
16511651 public void set_wallpaper(){
16521652 if ((wallpaper_path.length > 0)&&(file_exists(wallpaper_path))){
16531653 switch (App.desktop){
16791679 cmd += "xfconf-query -c xfce4-desktop -p '%s' -s '%s'".printf(property.strip(), wallpaper_path);
16801680 string std_out2, std_err2;
16811681 execute_command_script_sync(cmd, out std_out2, out std_err2);
1682 }
1682 }
16831683 break;
16841684 case "lxde": //limited support - wallpaper changes after logout and login
16851685 execute_command_sync("pcmanfm --set-wallpaper '%s'".printf(wallpaper_path));
16871687 execute_command_sync("pcmanfm --wallpaper-mode '%s'".printf(get_scaling_value_for_desktop()));
16881688 }
16891689 break;
1690 case "gnome":
1690 case "gnome":
16911691 case "unity":
16921692 if (execute_command_sync("gsettings get org.gnome.desktop.background picture-uri") == 0){
16931693 execute_command_sync("gsettings set org.gnome.desktop.background picture-uri 'file://%s'".printf(wallpaper_path));
16941694 }
1695
1695
16961696 if (execute_command_sync("gsettings get org.gnome.desktop.background picture-options") == 0){
16971697 execute_command_sync("gsettings set org.gnome.desktop.background picture-options '%s'".printf(get_scaling_value_for_desktop()));
16981698 }
1699
1699
17001700 if (execute_command_sync("gsettings get com.canonical.unity-greeter background") == 0){
17011701 execute_command_sync("gsettings set com.canonical.unity-greeter background '%s'".printf(wallpaper_path));
17021702 }
17031703 break;
17041704 }
1705
1706
1705
1706
17071707 /*if (wallpaper_scaling.length > 0){
17081708 Posix.system("feh --bg-%s '%s'".printf(wallpaper_scaling,wallpaper_path));
17091709 }
17121712 }*/
17131713 }
17141714 }
1715
1715
17161716 public string get_scaling_value_for_desktop(){
17171717 //get index
17181718 int index = 0;
17371737 default:
17381738 return "";
17391739 }
1740
1741 }
1742
1740
1741 }
1742
17431743 public string get_current_wallpaper(){
17441744 switch (App.desktop){
17451745 case "gnome":
17881788 rc.start();
17891789 }
17901790 }
1791
1791
17921792 public override void stop(){
17931793 main_app.kill_all_conky();
17941794 }
00 /*
11 * MainWindow.vala
22 *
3 * Copyright 2012 Tony George <[email protected]>
3 * Copyright 2015 Tony George <[email protected]>
44 *
55 * This program is free software; you can redistribute it and/or modify
66 * it under the terms of the GNU General Public License as published by
00 /*
11 * EditWindow.vala
22 *
3 * Copyright 2012 Tony George <[email protected]>
3 * Copyright 2015 Tony George <[email protected]>
44 *
55 * This program is free software; you can redistribute it and/or modify
66 * it under the terms of the GNU General Public License as published by
226226 }
227227
228228 private void tv_folders_refresh(){
229 ListStore model = new ListStore(1, typeof(string));
229 var model = new Gtk.ListStore(1, typeof(string));
230230 TreeIter iter;
231231 foreach (string path in folder_list_user){
232232 model.append(out iter);
00 /*
11 * Utility.vala
22 *
3 * Copyright 2012 Tony George <[email protected]>
3 * Copyright 2015 Tony George <[email protected]>
44 *
55 * This program is free software; you can redistribute it and/or modify
66 * it under the terms of the GNU General Public License as published by
1010
1111 all:
1212 #build binaries
13 valac -X -D'GETTEXT_PACKAGE="${app_name}"' --Xcc="-lm" -X -Wl,-rpath,/usr/share/${app_name}/libs "Main.vala" "MainWindow.vala" "EditWidgetWindow.vala" "EditThemeWindow.vala" "SettingsWindow.vala" "DonationWindow.vala" "GeneratePreviewWindow.vala" "AboutWindow.vala" "Utility.vala" -o ${app_name} --pkg glib-2.0 --pkg gio-unix-2.0 --pkg posix --pkg gtk+-3.0 --pkg gee-1.0 --pkg json-glib-1.0
13 valac -X -D'GETTEXT_PACKAGE="${app_name}"' --Xcc="-lm" -X -Wl,-rpath,/usr/share/${app_name}/libs "Main.vala" "MainWindow.vala" "EditWidgetWindow.vala" "EditThemeWindow.vala" "SettingsWindow.vala" "DonationWindow.vala" "GeneratePreviewWindow.vala" "AboutWindow.vala" "Utility.vala" -o ${app_name} --pkg glib-2.0 --pkg gio-unix-2.0 --pkg posix --pkg gtk+-3.0 --pkg gee-0.8 --pkg json-glib-1.0
1414
1515 #update translation template
1616 xgettext --language=C --keyword=_ --copyright-holder='Tony George ([email protected])' --package-name='${app_name}' --package-version='2.0' --msgid-bugs-address='[email protected]' --escape --sort-output -o ../${app_name}.pot *.vala