From 7f3b895cdccf368d34a99347667ed9fbbaa8a432 Mon Sep 17 00:00:00 2001
From: bigpod <bigpod@no-mail.com>
Date: Sun, 6 Mar 2005 19:30:32 +0000
Subject: [PATCH] code added forreset color button

---
 plugins/gtkgui/config.py    | 43 ++++++++++++++++++++++++++++++++++++-
 plugins/gtkgui/gtkgui.glade |  1 +
 plugins/gtkgui/gtkgui.py    |  5 +++--
 3 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/plugins/gtkgui/config.py b/plugins/gtkgui/config.py
index ac421ea21f..bee7bf13a0 100644
--- a/plugins/gtkgui/config.py
+++ b/plugins/gtkgui/config.py
@@ -178,7 +178,48 @@ class preferences_window:
 			self.plugin.hide_systray()
 		self.plugin.send('CONFIG', None, ('GtkGui', self.plugin.config, 'GtkGui'))
 		self.plugin.roster.draw_roster()
-
+	
+	def on_reset_colors_button_clicked(self, widget):
+		defaults = self.plugin.default_config
+		self.plugin.config['inmsgcolor'] = defaults['inmsgcolor']
+		self.plugin.config['outmsgcolor'] = defaults['outmsgcolor']
+		self.plugin.config['statusmsgcolor'] = defaults['statusmsgcolor']
+		self.plugin.config['accounttextcolor'] = defaults['accounttextcolor']
+		self.plugin.config['grouptextcolor'] = defaults['grouptextcolor']
+		self.plugin.config['usertextcolor'] = defaults['usertextcolor']
+		self.plugin.config['accountbgcolor'] = defaults['accountbgcolor']
+		self.plugin.config['groupbgcolor'] = defaults['groupbgcolor']
+		self.plugin.config['userbgcolor'] = defaults['userbgcolor']
+		self.plugin.config['accountfont'] = defaults['accountfont']
+		self.plugin.config['groupfont'] = defaults['groupfont']
+		self.plugin.config['userfont'] = defaults['userfont']
+		self.xml.get_widget('incoming_msg_colorbutton').set_color(\
+			gtk.gdk.color_parse(defaults['inmsgcolor']))		
+		self.xml.get_widget('outgoing_msg_colorbutton').set_color(\
+			gtk.gdk.color_parse(defaults['outmsgcolor']))		
+		self.xml.get_widget('status_msg_colorbutton').set_color(\
+			gtk.gdk.color_parse(defaults['statusmsgcolor']))		
+		self.xml.get_widget('account_text_colorbutton').set_color(\
+			gtk.gdk.color_parse(defaults['accounttextcolor']))		
+		self.xml.get_widget('group_text_colorbutton').set_color(\
+			gtk.gdk.color_parse(defaults['grouptextcolor']))		
+		self.xml.get_widget('user_text_colorbutton').set_color(\
+			gtk.gdk.color_parse(defaults['usertextcolor']))	
+		self.xml.get_widget('account_text_bg_colorbutton').set_color(\
+			gtk.gdk.color_parse(defaults['accountbgcolor']))		
+		self.xml.get_widget('group_text_bg_colorbutton').set_color(\
+			gtk.gdk.color_parse(defaults['groupbgcolor']))		
+		self.xml.get_widget('user_text_bg_colorbutton').set_color(\
+			gtk.gdk.color_parse(defaults['userbgcolor']))
+		self.xml.get_widget('account_text_fontbutton').set_font_name(\
+			defaults['accountfont'])		
+		self.xml.get_widget('group_text_fontbutton').set_font_name(\
+			defaults['groupfont'])
+		self.xml.get_widget('user_text_fontbutton').set_font_name(\
+			defaults['userfont'])
+		self.update_text_tags()
+		self.plugin.roster.draw_roster()
+	
 	def write_cfg(self): #FIXME: (nk) instant apply
 		"""Save preferences in config File and apply them"""
 		
diff --git a/plugins/gtkgui/gtkgui.glade b/plugins/gtkgui/gtkgui.glade
index 6cf68254a3..7ce51efdab 100644
--- a/plugins/gtkgui/gtkgui.glade
+++ b/plugins/gtkgui/gtkgui.glade
@@ -3754,6 +3754,7 @@ on the server as a vCard</property>
 		  <property name="visible">True</property>
 		  <property name="relief">GTK_RELIEF_NONE</property>
 		  <property name="focus_on_click">False</property>
+		  <signal name="clicked" handler="on_reset_colors_button_clicked" last_modification_time="Sun, 06 Mar 2005 18:40:18 GMT"/>
 
 		  <child>
 		    <widget class="GtkAlignment" id="alignment50">
diff --git a/plugins/gtkgui/gtkgui.py b/plugins/gtkgui/gtkgui.py
index 2dd9610a75..02600f4206 100644
--- a/plugins/gtkgui/gtkgui.py
+++ b/plugins/gtkgui/gtkgui.py
@@ -3246,7 +3246,7 @@ class plugin:
 			'ACC_OK', 'CONFIG', 'MYVCARD', 'VCARD', 'LOG_NB_LINE', 'LOG_LINE', \
 			'VISUAL', 'GC_MSG', 'GC_SUBJECT', 'BAD_PASSPHRASE', \
 			'GPG_SECRETE_KEYS', 'ROSTER_INFO', 'MSGSENT'])
-		self.send('ASK_CONFIG', None, ('GtkGui', 'GtkGui', {'autopopup':1,\
+		self.default_config = {'autopopup':1,\
 			'autopopupaway':1,\
 			'showoffline':0,\
 			'autoaway':1,\
@@ -3297,7 +3297,8 @@ class plugin:
 			'x-position': 0,\
 			'y-position': 0,\
 			'width': 150,\
-			'height': 400}))
+			'height': 400}
+		self.send('ASK_CONFIG', None, ('GtkGui', 'GtkGui', self.default_config))
 		self.config = self.wait('CONFIG')
 		self.send('ASK_CONFIG', None, ('GtkGui', 'accounts'))
 		self.accounts = self.wait('CONFIG')
-- 
GitLab