[Thunar-workers] CVS: design/ui ThunarBookmarksPane.py, NONE, 1.1 ThunarSidePane.py, NONE, 1.1 ChangeLog, 1.7, 1.8 ThunarTreePane.py, 1.1, 1.2 ThunarWindow.py, 1.3, 1.4 thunar.ui, 1.2, 1.3
Benedikt Meurer
benny at xfce.org
Mon Feb 28 23:04:15 CET 2005
Update of /var/cvs/thunar/design/ui
In directory espresso.foo-projects.org:/tmp/cvs-serv30211
Modified Files:
ChangeLog ThunarTreePane.py ThunarWindow.py thunar.ui
Added Files:
ThunarBookmarksPane.py ThunarSidePane.py
Log Message:
2005-02-28 Benedikt Meurer <benny at xfce.org>
* ThunarBookmarksPane.py, ThunarSidePane.py, ThunarTreePane.py,
ThunarWindow.py, thunar.ui: Add the 'Bookmarks' tab to the
side pane, based on the GtkFileChooser shortcuts.
--- NEW FILE: ThunarBookmarksPane.py ---
#!/usr/bin/env python
# vi:set ts=4 sw=4 et ai nocindent:
#
# $Id: ThunarBookmarksPane.py,v 1.1 2005/02/28 22:04:12 benny Exp $
#
# Copyright (c) 2005 Benedikt Meurer <benny at xfce.org>
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
#
import os
import pygtk
pygtk.require('2.0')
import gobject
import gtk
from ThunarFileInfo import ThunarFileInfo
signals_registered = False
class ThunarBookmarksPane(gtk.TreeView):
COLUMN_NAME = 0
COLUMN_ICON = 1
COLUMN_INFO = 2
ICON_SIZE = 22
def __init__(self):
gtk.TreeView.__init__(self, self._create_model())
# register signals
global signals_registered
if not signals_registered:
gobject.signal_new('directory-changed1', self, gobject.SIGNAL_RUN_LAST, \
gobject.TYPE_NONE, [ThunarFileInfo])
signals_registered = True
column = gtk.TreeViewColumn('Name')
renderer = gtk.CellRendererPixbuf()
column.pack_start(renderer, False)
column.add_attribute(renderer, 'pixbuf', self.COLUMN_ICON)
renderer = gtk.CellRendererText()
column.pack_start(renderer, True)
column.add_attribute(renderer, 'text', self.COLUMN_NAME)
self.append_column(column)
self.set_expander_column(column)
self.get_selection().set_mode(gtk.SELECTION_BROWSE)
self.get_selection().unselect_all()
self.get_selection().connect('changed', lambda selection: self._selection_changed())
self._selection_changed_called = False
self.set_headers_visible(False)
self.set_rules_hint(False)
def _create_model(self):
self.model = gtk.ListStore(gobject.TYPE_STRING, gtk.gdk.Pixbuf, ThunarFileInfo)
home = os.getenv('HOME')
for path in [home, os.path.join(home, 'Desktop'), '/']:
try:
info = ThunarFileInfo(path)
self.model.append([info.get_visible_name(), info.render_icon(self.ICON_SIZE), info])
except:
pass
try:
fp = file(os.path.join(home, '.gtk-bookmarks'))
for line in fp.readlines():
line = line[:-1]
if not line.startswith('file://'):
continue
path = line[7:]
try:
info = ThunarFileInfo(path)
self.model.append([info.get_visible_name(), info.render_icon(self.ICON_SIZE), info])
except:
pass
except IOError:
pass
return self.model
def _selection_changed(self):
selection = self.get_selection()
model, iter = selection.get_selected()
if not self._selection_changed_called:
self._selection_changed_called = True
self.get_selection().unselect_all()
return
if iter:
info = model.get(iter, self.COLUMN_INFO)[0]
self.emit('directory-changed1', info)
def select_by_info(self, info):
self.get_selection().unselect_all()
iter = self.model.iter_children(None)
while iter:
bm_info = self.model.get(iter, self.COLUMN_INFO)[0]
if bm_info.get_path() == info.get_path():
path = self.model.get_path(iter)
self.get_selection().select_path(path)
return
iter = self.model.iter_next(iter)
--- NEW FILE: ThunarSidePane.py ---
#!/usr/bin/env python
# vi:set ts=4 sw=4 et ai nocindent:
#
# $Id: ThunarSidePane.py,v 1.1 2005/02/28 22:04:12 benny Exp $
#
# Copyright (c) 2005 Benedikt Meurer <benny at xfce.org>
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
#
import dircache, os
import pygtk
pygtk.require('2.0')
import gobject
import gtk
from ThunarFileInfo import ThunarFileInfo
from ThunarTreePane import ThunarTreePane
from ThunarBookmarksPane import ThunarBookmarksPane
signals_registered = False
class ThunarSidePane(gtk.Notebook):
def __init__(self):
gtk.Notebook.__init__(self)
# register signals
global signals_registered
if not signals_registered:
gobject.signal_new('directory-changed', self, gobject.SIGNAL_RUN_LAST, \
gobject.TYPE_NONE, [ThunarFileInfo])
signals_registered = True
swin = gtk.ScrolledWindow(None, None)
swin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
label = gtk.Label('Tree')
self.append_page(swin, label)
label.show()
swin.show()
self.tree = ThunarTreePane()
self.tree_handler_id = self.tree.connect('directory-changed0', lambda tree, info: self._directory_changed(info))
swin.add(self.tree)
self.tree.show()
swin = gtk.ScrolledWindow(None, None)
swin.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
swin.set_shadow_type(gtk.SHADOW_IN)
label = gtk.Label('Bookmarks')
self.append_page(swin, label)
label.show()
swin.show()
self.bm = ThunarBookmarksPane()
self.bm_handler_id = self.bm.connect('directory-changed1', lambda bm, info: self._directory_changed(info))
swin.add(self.bm)
self.bm.show()
def _directory_changed(self, info):
self.emit('directory-changed', info)
def select_by_info(self, info):
self.tree.handler_block(self.tree_handler_id)
self.tree.select_by_info(info)
self.tree.handler_unblock(self.tree_handler_id)
self.bm.handler_block(self.bm_handler_id)
self.bm.select_by_info(info)
self.bm.handler_unblock(self.bm_handler_id)
Index: ChangeLog
===================================================================
RCS file: /var/cvs/thunar/design/ui/ChangeLog,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- ChangeLog 27 Feb 2005 21:37:05 -0000 1.7
+++ ChangeLog 28 Feb 2005 22:04:12 -0000 1.8
@@ -1,3 +1,9 @@
+2005-02-28 Benedikt Meurer <benny at xfce.org>
+
+ * ThunarBookmarksPane.py, ThunarSidePane.py, ThunarTreePane.py,
+ ThunarWindow.py, thunar.ui: Add the 'Bookmarks' tab to the
+ side pane, based on the GtkFileChooser shortcuts.
+
2005-02-27 Benedikt Meurer <benny at xfce.org>
* ThunarWindow.py: Implement the `Forward' and `Back' browser
Index: ThunarTreePane.py
===================================================================
RCS file: /var/cvs/thunar/design/ui/ThunarTreePane.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ThunarTreePane.py 27 Feb 2005 18:13:49 -0000 1.1
+++ ThunarTreePane.py 28 Feb 2005 22:04:12 -0000 1.2
@@ -47,7 +47,7 @@
# register signals
global signals_registered
if not signals_registered:
- gobject.signal_new('directory-changed', self, gobject.SIGNAL_RUN_LAST, \
+ gobject.signal_new('directory-changed0', self, gobject.SIGNAL_RUN_LAST, \
gobject.TYPE_NONE, [ThunarFileInfo])
signals_registered = True
@@ -122,7 +122,7 @@
model, iter = self.get_selection().get_selected()
if iter:
info = self.model.get(iter, self.COLUMN_INFO)[0]
- self.emit('directory-changed', info)
+ self.emit('directory-changed0', info)
def select_by_info(self, info):
Index: ThunarWindow.py
===================================================================
RCS file: /var/cvs/thunar/design/ui/ThunarWindow.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ThunarWindow.py 27 Feb 2005 21:37:05 -0000 1.3
+++ ThunarWindow.py 28 Feb 2005 22:04:12 -0000 1.4
@@ -31,7 +31,7 @@
from ThunarModel import ThunarModel
from ThunarFileInfo import ThunarFileInfo
from ThunarListView import ThunarListView
-from ThunarTreePane import ThunarTreePane
+from ThunarSidePane import ThunarSidePane
from ThunarPropertiesDialog import ThunarPropertiesDialog
# the icon view requires libexo-0.3
@@ -131,22 +131,13 @@
self.main_vbox.pack_start(self.main_hbox, True, True, 0)
self.main_hbox.show()
- self.sidepane = gtk.VBox(False, 0)
+ self.sidepane = ThunarSidePane()
+ self.main_hbox.set_position(self.sidepane.size_request()[0])
+ self.sidepane.select_by_info(self.info)
+ self.sidepane_selection_id = self.sidepane.connect('directory-changed', lambda ign, info: self._action_open_dir(info))
self.main_hbox.add1(self.sidepane)
self.sidepane.show()
- swin = gtk.ScrolledWindow(None, None)
- swin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
- self.sidepane.pack_start(swin, True, True, 0)
- swin.show()
-
- self.treepane = ThunarTreePane()
- self.main_hbox.set_position(self.treepane.size_request()[0])
- self.treepane.select_by_info(self.info)
- self.treepane_selection_id = self.treepane.connect('directory-changed', lambda ign, info: self._action_open_dir(info))
- swin.add(self.treepane)
- self.treepane.show()
-
self.swin = gtk.ScrolledWindow(None, None)
self.swin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
self.main_hbox.add2(self.swin)
@@ -164,6 +155,7 @@
self.view.connect('activated', lambda widget, info: self._action_open_dir(info))
self.view.connect('selection-changed', lambda widget: self._selection_changed())
self.swin.add(self.view)
+ self.view.grab_focus()
self.view.show()
self.status_bar = gtk.Statusbar()
@@ -247,9 +239,9 @@
self.set_title('Thunar: ' + info.get_visible_name())
self.set_icon(info.render_icon(48))
- self.treepane.handler_block(self.treepane_selection_id)
- self.treepane.select_by_info(info)
- self.treepane.handler_unblock(self.treepane_selection_id)
+ self.sidepane.handler_block(self.sidepane_selection_id)
+ self.sidepane.select_by_info(info)
+ self.sidepane.handler_unblock(self.sidepane_selection_id)
# scroll to (0,0)
self.swin.get_hadjustment().set_value(0)
Index: thunar.ui
===================================================================
RCS file: /var/cvs/thunar/design/ui/thunar.ui,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- thunar.ui 27 Feb 2005 18:13:49 -0000 1.2
+++ thunar.ui 28 Feb 2005 22:04:12 -0000 1.3
@@ -70,9 +70,11 @@
<menuitem action="go-location" />
</menu>
+ <!--
<menu action="bookmarks-menu">
<menuitem action="add-bookmark" />
</menu>
+ -->
<menu action="help-menu">
<menuitem action="contents" />
More information about the Thunar-workers
mailing list