summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--etc/portato.cfg16
-rw-r--r--portato/gui/templates/PreferenceWindow.glade34
-rw-r--r--portato/gui/windows/main.py17
-rw-r--r--portato/gui/windows/preference.py12
4 files changed, 54 insertions, 25 deletions
diff --git a/etc/portato.cfg b/etc/portato.cfg
index 90cbace..ca20fd9 100644
--- a/etc/portato.cfg
+++ b/etc/portato.cfg
@@ -53,16 +53,16 @@ useperversion = False
#
[GUI]
-; show emerge progress in window title - boolean values
+; show emerge progress in window title - boolean value
updatetitle = on
-; show emerge process in console title - boolean values
+; show emerge process in console title - boolean value
updateconsole = on
-; show the systray icon?- boolean values
+; show the systray icon?- boolean value
showsystray = true
-; control whether to completely hide on minimization - boolean values
+; control whether to completely hide on minimization - boolean value
hideonminimize = true
; the browser to use - string value
@@ -70,17 +70,21 @@ browserCmd = firefox
; search the packages while you are typing
; disable this if you own a slow machine
+; - boolean value
searchontype = true
-; show slots in the version list
+; show slots in the version list - boolean value
showslots = true
-; sets the font of the console - string values
+; sets the font of the console - string value
consolefont = Monospace 11
; controls the maximum length of the console title - integer value
titlelength = 60
+; collapse categories with the same prefix - boolean value
+collapsecats = true
+
; sets the position of the tabs of the two notebooks
; allowed positions:
; - 1 : top
diff --git a/portato/gui/templates/PreferenceWindow.glade b/portato/gui/templates/PreferenceWindow.glade
index fcdc4ec..6dbf17a 100644
--- a/portato/gui/templates/PreferenceWindow.glade
+++ b/portato/gui/templates/PreferenceWindow.glade
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--Generated with glade3 3.4.4 on Sun Jun 8 00:05:22 2008 -->
+<!--Generated with glade3 3.4.4 on Sun Jun 8 01:45:17 2008 -->
<glade-interface>
<widget class="GtkWindow" id="PreferenceWindow">
<property name="border_width">5</property>
@@ -749,13 +749,33 @@
<property name="left_padding">12</property>
<property name="right_padding">5</property>
<child>
- <widget class="GtkCheckButton" id="showSlotsCheck">
+ <widget class="GtkVBox" id="vbox3">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">Show slots in the version list</property>
- <property name="response_id">0</property>
- <property name="draw_indicator">True</property>
+ <child>
+ <widget class="GtkCheckButton" id="showSlotsCheck">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label" translatable="yes">Show slots in the version list</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="collapseCatCheck">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip_markup">Organize the categories in a tree. Thereby collapse categories with the same prefix:
+As an example: &lt;i&gt;app-admin&lt;/i&gt;, &lt;i&gt;app-emacs&lt;/i&gt;, and &lt;i&gt;app-vim&lt;/i&gt; would be collapsed into &lt;i&gt;&lt;b&gt;app&lt;/b&gt;&lt;/i&gt; as root and &lt;i&gt;admin&lt;/i&gt;, &lt;i&gt;emacs&lt;/i&gt;, and &lt;i&gt;vim&lt;/i&gt; as children.</property>
+ <property name="label" translatable="yes">Collapse categories with same prefix</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
</widget>
</child>
</widget>
diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py
index 1cda7bd..8a2f170 100644
--- a/portato/gui/windows/main.py
+++ b/portato/gui/windows/main.py
@@ -775,10 +775,7 @@ class MainWindow (Window):
Builds the category list.
"""
- if False:
- store = gtk.ListStore(str)
- else:
- store = gtk.TreeStore(str)
+ store = gtk.TreeStore(str)
self.fill_cat_store(store)
@@ -804,9 +801,9 @@ class MainWindow (Window):
cats = self.db.get_categories(installed = not self.showAll)
- if False:
+ if not self.cfg.get_boolean("collapseCats", "GUI"):
for p in cats:
- store.append([p])
+ store.append(None, [p])
else:
splitCats = defaultdict(list)
for c in cats:
@@ -1038,7 +1035,9 @@ class MainWindow (Window):
pos = path
break
- if pos == "0" and isinstance(list.get_model(), gtk.TreeStore): # try the new split up
+ if self.cfg.get_boolean("collapseCats", "GUI") and \
+ pos == "0" and isinstance(list.get_model(), gtk.TreeStore): # try the new split up
+
try:
pre, post = name.split("-", 1)
except ValueError: # nothing to split
@@ -1225,7 +1224,7 @@ class MainWindow (Window):
# get the selected category
store, it = selection.get_selected()
if it:
- if False:
+ if not self.cfg.get_boolean("collapseCats", "GUI"):
self.selCatName = store.get_value(it, 0)
else:
parent = store.iter_parent(it)
@@ -1532,7 +1531,7 @@ class MainWindow (Window):
"""
User wants to open preferences.
"""
- PreferenceWindow(self.window, self.cfg, self.console.set_font_from_string, self.set_uri_hook, self.set_notebook_tabpos)
+ PreferenceWindow(self.window, self.cfg, self.console.set_font_from_string, self.set_uri_hook, self.set_notebook_tabpos, self.fill_cat_store)
return True
def cb_about_clicked (self, *args):
diff --git a/portato/gui/windows/preference.py b/portato/gui/windows/preference.py
index 54db879..d35666d 100644
--- a/portato/gui/windows/preference.py
+++ b/portato/gui/windows/preference.py
@@ -24,6 +24,7 @@ class PreferenceWindow (AbstractDialog):
# all checkboxes in the window
# widget name -> option name
checkboxes = {
+ "collapseCatCheck" : ("collapseCats", "GUI"),
"consoleUpdateCheck" : ("updateConsole", "GUI"),
"debugCheck" : "debug",
"deepCheck" : "deep",
@@ -56,7 +57,7 @@ class PreferenceWindow (AbstractDialog):
4 : gtk.POS_RIGHT
}
- def __init__ (self, parent, cfg, console_fn, linkbtn_fn, tabpos_fn):
+ def __init__ (self, parent, cfg, console_fn, linkbtn_fn, tabpos_fn, catmodel_fn):
"""Constructor.
@param parent: parent window
@@ -68,7 +69,9 @@ class PreferenceWindow (AbstractDialog):
@param linkbtn_fn: function to call to set the linkbutton behavior
@type linkbtn_fn: function(string)
@param tabpos_fn: function to call to set the tabposition of the notebooks
- @type tabpos_fn: function(gtk.ComboBox,int)"""
+ @type tabpos_fn: function(gtk.ComboBox,int)
+ @param catmodel_fn: function to call to set the model of the cat list (collapsed/not collapsed)
+ @type catmodel_fn: function()"""
AbstractDialog.__init__(self, parent)
@@ -79,6 +82,7 @@ class PreferenceWindow (AbstractDialog):
self.console_fn = console_fn
self.linkbtn_fn = linkbtn_fn
self.tabpos_fn = tabpos_fn
+ self.catmodel_fn = catmodel_fn
# set the bg-color of the hint
hintEB = self.tree.get_widget("hintEB")
@@ -144,7 +148,7 @@ class PreferenceWindow (AbstractDialog):
self.cfg.set("consolefont", font, section = "GUI")
self.console_fn(font)
- self.cfg.set("titlelength", self.titleLengthSpinBtn.get_value(), section = "GUI")
+ self.cfg.set("titlelength", str(self.titleLengthSpinBtn.get_value_as_int()), section = "GUI")
pkgPos = self.pkgTabCombo.get_active()+1
sysPos = self.systemTabCombo.get_active()+1
@@ -156,6 +160,8 @@ class PreferenceWindow (AbstractDialog):
self.linkbtn_fn(self.cfg.get("browserCmd", section="GUI"))
+ self.catmodel_fn()
+
def cb_ok_clicked(self, button):
"""Saves, writes to config-file and closes the window."""
self._save()
ff-by: Lars Hjemli <hjemli@gmail.com> 2006-12-11Move common output-functions into ui-shared.cLars Hjemli4-82/+99 While at it, replace the cgit_[lib_]error constants with a proper function Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2006-12-11Rename config.c to parsing.c + move cgit_parse_query from cgit.c to parsing.cLars Hjemli4-28/+29 Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2006-12-11Avoid infinite loops in caching layerLars Hjemli3-14/+31 Add a global variable, cgit_max_lock_attemps, to avoid the possibility of infinite loops when failing to acquire a lockfile. This could happen on broken setups or under crazy server load. Incidentally, this also fixes a lurking bug in cache_lock() where an uninitialized returnvalue was used. Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2006-12-11Let 'make install' clear all cachefilesLars Hjemli1-0/+2 Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2006-12-11Fix cache algorithm loopholeLars Hjemli3-11/+16 This closes the door for unneccessary calls to cgit_fill_cache(). Noticed by Linus. Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2006-12-10Add version identifier in generated filesLars Hjemli2-9/+14 Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2006-12-10Add license file and copyright noticesLars Hjemli5-0/+372 Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2006-12-10Add caching infrastructureLars Hjemli9-28/+353 This enables internal caching of page output. Page requests are split into four groups: 1) repo listing (front page) 2) repo summary 3) repo pages w/symbolic references in query string 4) repo pages w/constant sha1's in query string Each group has a TTL specified in minutes. When a page is requested, a cached filename is stat(2)'ed and st_mtime is compared to time(2). If TTL has expired (or the file didn't exist), the cached file is regenerated. When generating a cached file, locking is used to avoid parallell processing of the request. If multiple processes tries to aquire the same lock, the ones who fail to get the lock serves the (expired) cached file. If the cached file don't exist, the process instead calls sched_yield(2) before restarting the request processing. Signed-off-by: Lars Hjemli <hjemli@gmail.com>