Skip to content
Snippets Groups Projects
Commit e1fd6f4c authored by Yann Leboulanger's avatar Yann Leboulanger
Browse files

iconstyle choice in preference window

parent bc00565d
No related branches found
No related tags found
No related merge requests found
......@@ -2741,6 +2741,72 @@ David Ferlier (david@yazzy.org)</property>
<property name="y">0</property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="frame3">
<property name="width_request">150</property>
<property name="height_request">70</property>
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<child>
<widget class="GtkCombo" id="combo_iconstyle">
<property name="visible">True</property>
<property name="value_in_list">True</property>
<property name="allow_empty">False</property>
<property name="case_sensitive">False</property>
<property name="enable_arrow_keys">True</property>
<property name="enable_arrows_always">False</property>
<child internal-child="entry">
<widget class="GtkEntry" id="combo-entry1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>
</widget>
</child>
<child internal-child="list">
<widget class="GtkList" id="combo-list1">
<property name="visible">True</property>
<property name="selection_mode">GTK_SELECTION_BROWSE</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label45">
<property name="visible">True</property>
<property name="label" translatable="yes">Icon Style</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="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="x">210</property>
<property name="y">0</property>
</packing>
</child>
</widget>
<packing>
<property name="tab_expand">False</property>
......
......@@ -119,6 +119,11 @@ def write_cfg(self):
else:
self.r.cfgParser.set('GtkGui', 'autopopup', '0')
self.r.autopopup = 0
#IconStyle
ist = self.combo_iconstyle.entry.get_text()
self.r.cfgParser.set('GtkGui', 'iconstyle', ist)
self.r.iconstyle = ist
self.r.mkpixbufs()
self.r.cfgParser.writeCfgFile()
self.r.cfgParser.parseCfgFile()
......@@ -135,6 +140,7 @@ def __init__(self, roster):
self.da_out = self.xml.get_widget("drawing_out")
self.da_status = self.xml.get_widget("drawing_status")
self.chk_autopp = self.xml.get_widget("chk_autopopup")
self.combo_iconstyle = self.xml.get_widget("combo_iconstyle")
#Color for incomming messages
colSt = self.r.cfgParser.GtkGui_inmsgcolor
......@@ -166,6 +172,18 @@ def __init__(self, roster):
st = '0'
pp = string.atoi(st)
self.chk_autopp.set_active(pp)
#iconStyle
list_style = os.listdir('plugins/gtkgui/icons/')
l = []
for i in list_style:
if i != 'CVS':
l.append(i)
if l.count == 0:
l.append(" ")
self.combo_iconstyle.set_popdown_strings(l)
if self.r.iconstyle in l:
self.combo_iconstyle.entry.set_text(self.r.iconstyle)
self.xml.signal_connect('gtk_widget_destroy', self.delete_event)
self.xml.signal_connect('on_but_col_clicked', self.on_color_button_clicked)
......@@ -805,6 +823,17 @@ def on_browse(self, widget):
if not Wbrowser:
Wbrowser = browser(self)
def mkpixbufs(self):
self.path = 'plugins/gtkgui/icons/' + self.iconstyle + '/'
self.pixbufs = {}
for state in ('online', 'away', 'xa', 'dnd', 'offline', 'requested', 'message', 'opened', 'closed'):
if not os.path.exists(self.path + state + '.xpm'):
print 'No such file : ' + self.path + state + '.xpm'
self.pixbufs[state] = None
else:
pix = gtk.gdk.pixbuf_new_from_file (self.path + state + '.xpm')
self.pixbufs[state] = pix
def __init__(self, queueOUT, plug):
# FIXME : handle no file ...
self.cfgParser = common.optparser.OptionsParser(CONFPATH)
......@@ -815,18 +844,10 @@ def __init__(self, queueOUT, plug):
self.plug = plug
#(icon, name, jid, editable, background color, show_icon)
self.treestore = gtk.TreeStore(gtk.gdk.Pixbuf, str, str, gobject.TYPE_BOOLEAN, str, gobject.TYPE_BOOLEAN)
iconstyle = self.cfgParser.GtkGui_iconstyle
if not iconstyle:
iconstyle = 'sun'
self.path = 'plugins/gtkgui/icons/' + iconstyle + '/'
self.pixbufs = {}
for state in ('online', 'away', 'xa', 'dnd', 'offline', 'requested', 'message', 'opened', 'closed'):
if not os.path.exists(self.path + state + '.xpm'):
print 'No such file : ' + self.path + state + '.xpm'
self.pixbufs[state] = None
else:
pix = gtk.gdk.pixbuf_new_from_file (self.path + state + '.xpm')
self.pixbufs[state] = pix
self.iconstyle = self.cfgParser.GtkGui_iconstyle
if not self.iconstyle:
self.iconstyle = 'sun'
self.mkpixbufs()
self.tree.set_model(self.treestore)
# map = self.tree.get_colormap()
# colour = map.alloc_color("red") # light red
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment