make roster theme UI better

This commit is contained in:
Nikos Kouremenos 2005-04-29 15:01:44 +00:00
parent 3cb963554d
commit 94537da614
2 changed files with 70 additions and 46 deletions

View File

@ -61,6 +61,18 @@ class Preferences_window:
self.xml.get_widget('soundplayer_hbox').set_property('visible', False) self.xml.get_widget('soundplayer_hbox').set_property('visible', False)
self.trayicon_checkbutton.set_property('visible', False) self.trayicon_checkbutton.set_property('visible', False)
theme_combobox = self.xml.get_widget('theme_combobox')
model = theme_combobox.get_model()
active = theme_combobox.get_active()
theme = model[active][0]
fonts_colors_table = self.xml.get_widget('fonts_colors_table')
if theme == 'Custom':
#fonts_colors_table.set_sensitive(True)
fonts_colors_table.set_property('visible', True)
else:
#fonts_colors_table.set_sensitive(False)
fonts_colors_table.set_property('visible', False)
def on_preferences_window_key_press_event(self, widget, event): def on_preferences_window_key_press_event(self, widget, event):
if event.keyval == gtk.keysyms.Escape: # ESCAPE if event.keyval == gtk.keysyms.Escape: # ESCAPE
self.window.hide() self.window.hide()
@ -165,31 +177,35 @@ class Preferences_window:
'group_text_fontbutton': 'groupfont', 'group_text_fontbutton': 'groupfont',
'user_text_fontbutton': 'userfont' 'user_text_fontbutton': 'userfont'
} }
model = widget.get_model() model = widget.get_model()
active = widget.get_active() active = widget.get_active()
theme = model[active][0] theme = model[active][0]
fonts_colors_table = self.xml.get_widget('fonts_colors_table')
if theme == 'Custom':
#fonts_colors_table.set_sensitive(True)
fonts_colors_table.set_property('visible', True)
else:
#fonts_colors_table.set_sensitive(False)
fonts_colors_table.set_property('visible', False)
for w in color_widgets: for w in color_widgets:
widg = self.xml.get_widget(w) widg = self.xml.get_widget(w)
if theme == 'Custom': if theme == 'Custom':
widg.set_color(gtk.gdk.color_parse(gajim.config.get( widg.set_color(gtk.gdk.color_parse(gajim.config.get(
color_widgets[w]))) color_widgets[w])))
widg.set_sensitive(True)
else: else:
widg.set_color(gtk.gdk.color_parse(self.theme_default[theme]\ widg.set_color(gtk.gdk.color_parse(self.theme_default[theme]\
[color_widgets[w]])) [color_widgets[w]]))
widg.set_sensitive(False)
for w in font_widgets: for w in font_widgets:
widg = self.xml.get_widget(w) widg = self.xml.get_widget(w)
if theme == 'Custom': if theme == 'Custom':
widg.set_font_name(gajim.config.get(font_widgets[w])) widg.set_font_name(gajim.config.get(font_widgets[w]))
widg.set_sensitive(True)
else: else:
widg.set_font_name(self.theme_default[theme][font_widgets[w]]) widg.set_font_name(self.theme_default[theme][font_widgets[w]])
widg.set_sensitive(False)
gajim.config.set('roster_theme', theme) gajim.config.set('roster_theme', theme)
self.plugin.roster.draw_roster()
self.plugin.save_config() self.plugin.save_config()
self.plugin.roster.draw_roster()
def merge_windows(self, kind): def merge_windows(self, kind):
for acct in gajim.connections: for acct in gajim.connections:

View File

@ -2928,9 +2928,55 @@
</child> </child>
<child> <child>
<widget class="GtkTable" id="table17"> <widget class="GtkHBox" id="hbox2956">
<property name="visible">True</property> <property name="visible">True</property>
<property name="n_rows">5</property> <property name="homogeneous">False</property>
<property name="spacing">10</property>
<child>
<widget class="GtkLabel" id="label249">
<property name="visible">True</property>
<property name="label" translatable="yes">Roster theme:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="theme_combobox">
<property name="visible">True</property>
<signal name="changed" handler="on_theme_combobox_changed" last_modification_time="Fri, 29 Apr 2005 11:44:52 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkTable" id="fonts_colors_table">
<property name="visible">True</property>
<property name="n_rows">4</property>
<property name="n_columns">4</property> <property name="n_columns">4</property>
<property name="homogeneous">False</property> <property name="homogeneous">False</property>
<property name="row_spacing">5</property> <property name="row_spacing">5</property>
@ -3143,30 +3189,6 @@
</packing> </packing>
</child> </child>
<child>
<widget class="GtkLabel" id="label173">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child> <child>
<widget class="GtkColorButton" id="account_text_bg_colorbutton"> <widget class="GtkColorButton" id="account_text_bg_colorbutton">
<property name="visible">True</property> <property name="visible">True</property>
@ -3274,24 +3296,10 @@
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
</child> </child>
<child>
<widget class="GtkComboBox" id="theme_combobox">
<property name="visible">True</property>
<signal name="changed" handler="on_theme_combobox_changed" last_modification_time="Fri, 29 Apr 2005 11:44:52 GMT"/>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">fill</property>
</packing>
</child>
</widget> </widget>
<packing> <packing>
<property name="padding">0</property> <property name="padding">0</property>
<property name="expand">False</property> <property name="expand">True</property>
<property name="fill">True</property> <property name="fill">True</property>
</packing> </packing>
</child> </child>