From: Thierry Lorthiois Date: Thu, 5 Nov 2009 19:48:26 +0000 (+0000) Subject: update tintwizard : added button Apply and Close X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Ftint2;a=commitdiff_plain;h=a3eabee391c4c2b575ec021bde4e66bd84191f75 update tintwizard : added button Apply and Close --- diff --git a/AUTHORS b/AUTHORS index 19134a6..c8f91f4 100644 --- a/AUTHORS +++ b/AUTHORS @@ -3,13 +3,13 @@ tint2 is developped by : - Thierry Lorthiois - Andreas Fink - Euan Freeman (tintwizard) +- Christian Ruppert (autotools build system) tint2 is based on ttm source code (http://code.google.com/p/ttm/) - 2007-2008 PÃ¥l Staurland Contributors: - Christian Ruppert : autotools build system Kwaku Yeboah : wiki page Daniel Moerner : man page and debian package Doug Barton : freebsd package diff --git a/src/tint2conf/main.c b/src/tint2conf/main.c index a4d0d92..a714029 100644 --- a/src/tint2conf/main.c +++ b/src/tint2conf/main.c @@ -219,7 +219,7 @@ static void menuAddWidget (GtkUIManager * p_uiManager, GtkWidget * p_widget, Gtk static void menuAbout(GtkWindow * parent) { - const char *authors[] = { "Thierry Lorthiois", "Christian Ruppert (Build system)", "Euan Freeman (tintwizard)\nSee http://code.google.com/p/tintwizard/", NULL }; + const char *authors[] = { "Thierry Lorthiois ", "Andreas Fink ", "Christian Ruppert (Build system)", "Euan Freeman (tintwizard)\n See http://code.google.com/p/tintwizard/", NULL }; gtk_show_about_dialog( parent, "name", g_get_application_name( ), "comments", _("Theming tool for tint2 panel"), diff --git a/src/tint2conf/tintwizard.py b/src/tint2conf/tintwizard.py index da6c2aa..aa086b7 100755 --- a/src/tint2conf/tintwizard.py +++ b/src/tint2conf/tintwizard.py @@ -1237,11 +1237,24 @@ class TintWizardGUI(gtk.Window): # Add notebook to window and show self.table.attach(self.notebook, 0, 4, 2, 3, xpadding=5, ypadding=5) + if self.oneConfigFile: + # Add button Apply and Close + self.box1 = gtk.HBox(False, 20) + self.table.attach(self.box1, 0, 4, 3, 4, xpadding=5, ypadding=5) + temp = gtk.Button("Apply", gtk.STOCK_APPLY) + temp.set_name("applyBg") + temp.connect("clicked", self.apply) + self.box1.pack_start(temp, True, True, 0) + temp = gtk.Button("Close", gtk.STOCK_CLOSE) + temp.set_name("closeBg") + temp.connect("clicked", self.quit) + self.box1.pack_start(temp, True, True, 0) + # Create and add the status bar to the bottom of the main window self.statusBar = gtk.Statusbar() self.statusBar.set_has_resize_grip(True) self.updateStatusBar("New Config File [*]") - self.table.attach(self.statusBar, 0, 4, 3, 4) + self.table.attach(self.statusBar, 0, 4, 4, 5) self.add(self.table) @@ -1415,39 +1428,52 @@ class TintWizardGUI(gtk.Window): def apply(self, widget, event=None, confirmChange=True): """Applies the current config to tint2.""" - if confirmDialog(self, "This will terminate all currently running instances of tint2 before applying config. Continue?") == gtk.RESPONSE_YES: - if not self.save(): - return - - #shutil.copyfile(self.filename, self.filename+".backup") # Create backup + # Check if tint2 is running + procs = os.popen('pidof "tint2"') # Check list of active processes for tint2 + pids = [] # List of process ids for tint2 - # Check if tint2 is running - procs = os.popen('pidof "tint2"') # Check list of active processes for tint2 - pids = [] # List of process ids for tint2 + for proc in procs.readlines(): + pids += [int(proc.strip().split(" ")[0])] - for proc in procs.readlines(): - pids += [int(proc.strip().split(" ")[0])] + procs.close() - procs.close() - - # If it is - kill it + if self.oneConfigFile: + # Save and copy as default + self.save() + tmpSrc = self.filename + tmpDest = os.path.expandvars("${HOME}") + "/.config/tint2/tint2rc" + try: + shutil.copyfile(tmpSrc, tmpDest) + except shutil.Error: + pass + # Ask tint2 to reload config for pid in pids: - os.kill(pid, signal.SIGTERM) - - # Lastly, start it - os.spawnv(os.P_NOWAIT, self.tint2Bin, [self.tint2Bin, "-c" + self.filename]) - - if confirmChange and self.filename != (os.path.expandvars("${HOME}") + "/.config/tint2/tint2rc") and confirmDialog(self, "Use this as default tint2 config?") == gtk.RESPONSE_YES: - tmp = self.filename - self.filename = os.path.expandvars("${HOME}") + "/.config/tint2/tint2rc" - try: - shutil.copyfile(tmp, self.filename) - except shutil.Error: - pass - - #if confirmChange and confirmDialog(self, "Keep this config?") == gtk.RESPONSE_NO: - # shutil.copyfile(self.filename+".backup", self.filename) # Create backup - # self.apply(widget, event, False) + os.kill(pid, signal.SIGUSR1) + else: + if confirmDialog(self, "This will terminate all currently running instances of tint2 before applying config. Continue?") == gtk.RESPONSE_YES: + if not self.save(): + return + + #shutil.copyfile(self.filename, self.filename+".backup") # Create backup + + # If it is - kill it + for pid in pids: + os.kill(pid, signal.SIGTERM) + + # Lastly, start it + os.spawnv(os.P_NOWAIT, self.tint2Bin, [self.tint2Bin, "-c" + self.filename]) + + if confirmChange and self.filename != (os.path.expandvars("${HOME}") + "/.config/tint2/tint2rc") and confirmDialog(self, "Use this as default tint2 config?") == gtk.RESPONSE_YES: + tmp = self.filename + self.filename = os.path.expandvars("${HOME}") + "/.config/tint2/tint2rc" + try: + shutil.copyfile(tmp, self.filename) + except shutil.Error: + pass + + #if confirmChange and confirmDialog(self, "Keep this config?") == gtk.RESPONSE_NO: + # shutil.copyfile(self.filename+".backup", self.filename) # Create backup + # self.apply(widget, event, False) def changeAllFonts(self, widget): """Changes all fonts at once."""