[Thunar-workers] CVS: design/ui ChangeLog, 1.21, 1.22 ThunarBookmarksPane.py, 1.5, 1.6 ThunarImageLoader.py, 1.1, 1.2 ThunarMimeDatabase.py, 1.3, 1.4 ThunarTreePane.py, 1.3, 1.4 ThunarView.py, 1.3, 1.4 ThunarWindow.py, 1.12, 1.13

Benedikt Meurer benny at xfce.org
Tue Mar 15 23:33:04 CET 2005


Update of /var/cvs/thunar/design/ui
In directory espresso.foo-projects.org:/tmp/cvs-serv20288

Modified Files:
	ChangeLog ThunarBookmarksPane.py ThunarImageLoader.py 
	ThunarMimeDatabase.py ThunarTreePane.py ThunarView.py 
	ThunarWindow.py 
Log Message:
2005-03-15	Benedikt Meurer <benny at xfce.org>

	* ThunarImageLoader.py, ThunarMimeDatabase.py: Use gnome-fs-directory as
	  fallback for inode/directory types.
	* ThunarBookmarksPane.py: Add a separator between the predefined and
	  the userdefined bookmark items. Only available with Gtk 2.6.
	* ThunarView.py: Don't inherit from GInterface.
	* ThunarWindow.py: Add a location bar to the classic view. Make the
	  classic view the default for now. Play around with spacings.




Index: ChangeLog
===================================================================
RCS file: /var/cvs/thunar/design/ui/ChangeLog,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- ChangeLog	6 Mar 2005 18:12:50 -0000	1.21
+++ ChangeLog	15 Mar 2005 22:33:01 -0000	1.22
@@ -1,3 +1,13 @@
+2005-03-15	Benedikt Meurer <benny at xfce.org>
+
+	* ThunarImageLoader.py, ThunarMimeDatabase.py: Use gnome-fs-directory as
+	  fallback for inode/directory types.
+	* ThunarBookmarksPane.py: Add a separator between the predefined and
+	  the userdefined bookmark items. Only available with Gtk 2.6.
+	* ThunarView.py: Don't inherit from GInterface.
+	* ThunarWindow.py: Add a location bar to the classic view. Make the
+	  classic view the default for now. Play around with spacings.
+
 2005-03-06	Benedikt Meurer <benny at xfce.org>
 
 	* ThunarColumnsView.py, thunar.ui, ThunarWindow.py: Remove the Columns

Index: ThunarBookmarksPane.py
===================================================================
RCS file: /var/cvs/thunar/design/ui/ThunarBookmarksPane.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- ThunarBookmarksPane.py	6 Mar 2005 15:25:56 -0000	1.5
+++ ThunarBookmarksPane.py	15 Mar 2005 22:33:01 -0000	1.6
@@ -40,7 +40,9 @@
 
 
     def __init__(self):
-        gtk.TreeView.__init__(self, self._create_model())
+        gtk.TreeView.__init__(self)
+        
+        self.set_model(self._create_model())
 
         column = gtk.TreeViewColumn('Name')
         renderer = gtk.CellRendererPixbuf()
@@ -71,6 +73,12 @@
                 self.model.append([info.get_visible_name(), info.render_icon(self.ICON_SIZE), info])
             except:
                 pass
+
+        try:
+            self.set_row_separator_func(lambda model, iter: model.get(iter, self.COLUMN_INFO)[0] == None)
+            self.model.append([None, None, None])
+        except:
+            pass
         
         try:
             fp = file(os.path.join(home, '.gtk-bookmarks'))
@@ -102,7 +110,7 @@
         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():
+            if bm_info and bm_info.get_path() == info.get_path():
                 path = self.model.get_path(iter)
                 self.get_selection().select_path(path)
                 return

Index: ThunarImageLoader.py
===================================================================
RCS file: /var/cvs/thunar/design/ui/ThunarImageLoader.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ThunarImageLoader.py	6 Mar 2005 15:25:56 -0000	1.1
+++ ThunarImageLoader.py	15 Mar 2005 22:33:01 -0000	1.2
@@ -52,3 +52,7 @@
             icon = self.__theme.load_icon(name, size, 0)
             self.__cache[key] = icon
         return icon
+
+
+    def has_icon(self, name):
+        return self.__theme.has_icon(name)

Index: ThunarMimeDatabase.py
===================================================================
RCS file: /var/cvs/thunar/design/ui/ThunarMimeDatabase.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ThunarMimeDatabase.py	6 Mar 2005 15:25:56 -0000	1.3
+++ ThunarMimeDatabase.py	15 Mar 2005 22:33:01 -0000	1.4
@@ -89,13 +89,20 @@
                         name = 'gnome-mime-' + type.split('/')[0]
                         icon = self.__loader.load_icon(name, size)
                     except gobject.GError:
-                        try:
-                            name = 'mime-application:octet-stream'
-                            icon = self.__loader.load_icon(name, size)
-                        except gobject.GError:
+                        if type == 'inode/directory':
                             try:
-                                name = 'gnome-mime-application-octet-stream'
+                                name = 'gnome-fs-directory'
                                 icon = self.__loader.load_icon(name, size)
                             except gobject.GError:
                                 icon = gtk.gdk.pixbuf_new_from_file_at_size('fallback.svg', size, size)
+                        else:
+                            try:
+                                name = 'mime-application:octet-stream'
+                                icon = self.__loader.load_icon(name, size)
+                            except gobject.GError:
+                                try:
+                                    name = 'gnome-mime-application-octet-stream'
+                                    icon = self.__loader.load_icon(name, size)
+                                except gobject.GError:
+                                    icon = gtk.gdk.pixbuf_new_from_file_at_size('fallback.svg', size, size)
         return icon

Index: ThunarTreePane.py
===================================================================
RCS file: /var/cvs/thunar/design/ui/ThunarTreePane.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ThunarTreePane.py	6 Mar 2005 15:46:06 -0000	1.3
+++ ThunarTreePane.py	15 Mar 2005 22:33:01 -0000	1.4
@@ -31,8 +31,6 @@
 
 from ThunarFileInfo import ThunarFileInfo
 
-signals_registered = False
-
 class ThunarTreePane(gtk.TreeView):
     COLUMN_NAME = 0
     COLUMN_ICON = 1
@@ -44,13 +42,6 @@
     def __init__(self):
         gtk.TreeView.__init__(self)
 
-        # register signals
-        global signals_registered
-        if not signals_registered:
-            gobject.signal_new('directory-changed0', self, gobject.SIGNAL_RUN_LAST, \
-                               gobject.TYPE_NONE, [ThunarFileInfo])
-            signals_registered = True
-
         self.model = gtk.TreeStore(gobject.TYPE_STRING, gtk.gdk.Pixbuf, gobject.TYPE_INT, ThunarFileInfo)
 
         info = ThunarFileInfo(os.getenv('HOME'))
@@ -157,3 +148,9 @@
 
         self.get_selection().select_path(tpath)
         self.scroll_to_cell(tpath)
+
+
+gobject.type_register(ThunarTreePane)
+gobject.signal_new('directory-changed0', ThunarTreePane, gobject.SIGNAL_RUN_LAST, \
+                   gobject.TYPE_NONE, [ThunarFileInfo])
+

Index: ThunarView.py
===================================================================
RCS file: /var/cvs/thunar/design/ui/ThunarView.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ThunarView.py	5 Mar 2005 18:43:15 -0000	1.3
+++ ThunarView.py	15 Mar 2005 22:33:01 -0000	1.4
@@ -30,7 +30,7 @@
 from ThunarFileInfo import ThunarFileInfo
 from ThunarModel import ThunarModel
 
-class ThunarView(gobject.GInterface):
+class ThunarView:
     def __init__(self):
         return
 

Index: ThunarWindow.py
===================================================================
RCS file: /var/cvs/thunar/design/ui/ThunarWindow.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- ThunarWindow.py	6 Mar 2005 18:12:50 -0000	1.12
+++ ThunarWindow.py	15 Mar 2005 22:33:01 -0000	1.13
@@ -86,8 +86,8 @@
             ('sidebar-disabled', None, 'Hidden', None, 'Hide the sidebar', 3),
         ], 2, lambda action, whatever, self: self._action_sidebar_toggled(), self)
         self.action_group.add_toggle_actions([
-            ('view-gtkfilechooser', None, 'GtkFileChooser-like', None, None, lambda ign, self: self._action_gtkfilechooser_like(), True),
-            ('view-toolbars', None, 'Show Toolbars', None, None, lambda ign, self: self._action_show_toolbars(), False),
+            ('view-gtkfilechooser', None, 'GtkFileChooser-like', None, None, lambda ign, self: self._action_gtkfilechooser_like(), False),
+            ('view-toolbars', None, 'Show Toolbars', None, None, lambda ign, self: self._action_show_toolbars(), True),
         ], self)
         self.action_group.add_radio_actions([
             ('view-as-icons', None, 'View as _Icons', None, None, 1),
@@ -140,20 +140,68 @@
         self.main_vbox.pack_start(menu_bar, False, False, 0)
         menu_bar.show()
 
-        tool_bar = self.ui_manager.get_widget('/main-toolbar')
-        tool_bar.set_style(gtk.TOOLBAR_BOTH_HORIZ)
-        self.main_vbox.pack_start(tool_bar, False, False, 0)
-        tool_bar.hide()
+        self.tool_bar = self.ui_manager.get_widget('/main-toolbar')
+        self.tool_bar.set_style(gtk.TOOLBAR_BOTH_HORIZ)
+        self.main_vbox.pack_start(self.tool_bar, False, False, 0)
+        self.tool_bar.show()
+
+        self.location_bar = gtk.Toolbar()
+        self.main_vbox.pack_start(self.location_bar, False, False, 0)
+        self.location_bar.show()
+
+        item = gtk.SeparatorToolItem()
+        item.set_draw(False)
+        self.location_bar.insert(item, -1)
+        item.show()
+
+        item = gtk.ToolItem()
+        self.location_bar.insert(item, -1)
+        item.show()
+
+        label = gtk.Label('Location:')
+        item.add(label)
+        label.show()
+
+        item = gtk.SeparatorToolItem()
+        item.set_draw(False)
+        self.location_bar.insert(item, -1)
+        item.show()
+
+        item = gtk.ToolItem()
+        item.set_border_width(6)
+        item.set_expand(True)
+        self.location_bar.insert(item, -1)
+        item.show()
+
+        self.location_entry = gtk.Entry()
+        self.location_entry.set_text(info.get_path())
+        self.location_entry.connect('activate', lambda entry: self._action_open_dir(ThunarFileInfo(entry.get_text())))
+        item.add(self.location_entry)
+        self.location_entry.show()
+
+        item = gtk.ToolItem()
+        item.set_border_width(4)
+        self.location_bar.insert(item, -1)
+        item.show()
+
+        self.view_combo = gtk.combo_box_new_text()
+        self.view_combo.append_text('View as Icons')
+        self.view_combo.append_text('View as List')
+        self.view_combo.set_active(int(self.action_group.get_action('view-as-list').get_active()))
+        self.view_combo.connect('changed', lambda combo: (self.action_group.get_action('view-as-icons').set_active(combo.get_active() == 0), self.action_group.get_action('view-as-list').set_active(combo.get_active() == 1)))
+        self.action_group.get_action('view-as-list').connect('toggled', lambda action, combo: combo.set_active(int(action.get_active())), self.view_combo)
+        item.add(self.view_combo)
+        self.view_combo.show()
 
         self.main_hbox = gtk.HPaned()
-        self.main_hbox.set_border_width(6)
+        self.main_hbox.set_border_width(0)
         self.main_vbox.pack_start(self.main_hbox, True, True, 0)
         self.main_hbox.show()
 
         self.sidepane = ThunarSidePane()
         self.main_hbox.set_position(self.sidepane.size_request()[0])
         self.sidepane.select_by_info(self.info)
-        self.sidepane.set_gtkfilechooser_like(True)
+        self.sidepane.set_gtkfilechooser_like(False)
         self.sidepane_selection_id = self.sidepane.connect('directory-changed', lambda ign, info: self._action_open_dir(info))
         self.sidepane_selection_id = self.sidepane.connect('hide-sidepane', lambda ign: self.action_group.get_action('sidebar-disabled').activate())
         self.main_hbox.pack1(self.sidepane, False, False)
@@ -167,7 +215,7 @@
         self.pathbar.set_info(self.info)
         self.pathbar.connect('directory-changed', lambda history, info: self._action_open_dir(info))
         vbox.pack_start(self.pathbar, False, False, 0)
-        self.pathbar.show()
+        self.pathbar.hide()
 
         self.swin = gtk.ScrolledWindow(None, None)
         self.swin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
@@ -242,9 +290,11 @@
 
     def _action_show_toolbars(self):
         if self.action_group.get_action('view-toolbars').get_active():
-            self.ui_manager.get_widget('/main-toolbar').show()
+            self.toolbar.show()
+            self.location_bar.show()
         else:
-            self.ui_manager.get_widget('/main-toolbar').hide()
+            self.toolbar.hide()
+            self.location_bar.hide()
 
 
     def _action_get_info(self):
@@ -296,6 +346,8 @@
         self.sidepane.select_by_info(info)
         self.sidepane.handler_unblock(self.sidepane_selection_id)
 
+        self.location_entry.set_text(info.get_path())
+        self.location_entry.set_position(-1)
         self.pathbar.set_info(info)
 
         # scroll to (0,0)




More information about the Thunar-workers mailing list