[Thunar-workers] CVS: design/ui ThunarLocationBar.py, NONE, 1.1 ChangeLog, 1.30, 1.31 ThunarWindow.py, 1.20, 1.21 thunar.ui, 1.9, 1.10
Benedikt Meurer
benny at xfce.org
Sun Mar 20 02:18:58 CET 2005
Update of /var/cvs/thunar/design/ui
In directory espresso.foo-projects.org:/tmp/cvs-serv22255
Modified Files:
ChangeLog ThunarWindow.py thunar.ui
Added Files:
ThunarLocationBar.py
Log Message:
2005-03-20 Benedikt Meurer <benny at xfce.org>
* thunar.ui, ThunarWindow.py, ThunarLocationBar.py: Show either the
path bar or the location bar in the UI (obsoletes the old non
GtkFileChooser way). This should make the location bar addicts
happy now.
--- NEW FILE: ThunarLocationBar.py ---
#!/usr/bin/env python
# vi:set ts=4 sw=4 et ai nocindent:
#
# $Id: ThunarLocationBar.py,v 1.1 2005/03/20 01:18:56 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
class ThunarLocationBar(gtk.HBox):
def __init__(self):
gtk.HBox.__init__(self)
self.set_spacing(2)
# label = gtk.Label('Location:')
# self.pack_start(label, False, False, 0)
# label.show()
self.__entry = gtk.Entry()
self.__entry.connect('activate', lambda e: self.__activated())
self.pack_start(self.__entry, True, True, 0)
self.__entry.show()
button = gtk.Button()
button.set_relief(gtk.RELIEF_NONE)
button.connect('clicked', lambda b: self.__entry.activate())
self.pack_start(button, False, False, 0)
button.show()
image = gtk.image_new_from_stock(gtk.STOCK_JUMP_TO, gtk.ICON_SIZE_MENU)
button.add(image)
image.show()
def __activated(self):
self.emit('directory-changed', self.get_info())
def get_info(self):
return ThunarFileInfo(self.__entry.get_text())
def set_info(self, info):
self.__entry.set_text(info.get_path())
self.__entry.set_position(-1)
self.__entry.select_region(0, 0)
def focus(self):
self.__entry.set_position(-1)
self.__entry.select_region(0, -1)
self.__entry.grab_focus()
gobject.type_register(ThunarLocationBar)
gobject.signal_new('directory-changed', ThunarLocationBar, \
gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, \
[ThunarFileInfo])
Index: ChangeLog
===================================================================
RCS file: /var/cvs/thunar/design/ui/ChangeLog,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- ChangeLog 19 Mar 2005 13:52:40 -0000 1.30
+++ ChangeLog 20 Mar 2005 01:18:56 -0000 1.31
@@ -1,3 +1,10 @@
+2005-03-20 Benedikt Meurer <benny at xfce.org>
+
+ * thunar.ui, ThunarWindow.py, ThunarLocationBar.py: Show either the
+ path bar or the location bar in the UI (obsoletes the old non
+ GtkFileChooser way). This should make the location bar addicts
+ happy now.
+
2005-03-19 Benedikt Meurer <benny at xfce.org>
* ThunarWindow.py, thunar.ui: Add 'Trash' to the 'Go' menu.
Index: ThunarWindow.py
===================================================================
RCS file: /var/cvs/thunar/design/ui/ThunarWindow.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- ThunarWindow.py 19 Mar 2005 13:52:40 -0000 1.20
+++ ThunarWindow.py 20 Mar 2005 01:18:56 -0000 1.21
@@ -29,6 +29,7 @@
import gtk
from ThunarModel import ThunarModel
+from ThunarLocationBar import ThunarLocationBar
from ThunarPathBar import ThunarPathBar
from ThunarFileInfo import ThunarFileInfo
from ThunarListView import ThunarListView
@@ -71,7 +72,7 @@
self.action_group = gtk.ActionGroup('thunar-window')
self.action_group.add_actions([
('file-menu', None, '_File'),
- ('open-location', None, 'Open _Location', '<Control>L', None, lambda ign, self: self._action_open_location()),
+ ('open-location', None, 'Open _Location', '<Control>L', None, lambda ign, self: self._action_open_location_other()),
('get-info', gtk.STOCK_PROPERTIES, 'Get _Info...', '<Alt>Return', None, lambda ign, self: self._action_get_info()),
('close-window', gtk.STOCK_CLOSE, '_Close', '<Control>W', None, lambda ign, self: self.destroy()),
], self)
@@ -96,13 +97,16 @@
('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),
], self)
self.action_group.add_radio_actions([
('view-as-icons', None, 'View as _Icons', None, None, 1),
('view-as-list', None, 'View as _List'),
], 1, lambda action, whatever, self: self._action_view_toggled(), self)
+ self.action_group.add_radio_actions([
+ ('view-pathbar', None, 'Path Bar', None, None, 1),
+ ('view-locationbar', None, 'Location Bar'),
+ ], 1, lambda action, whatever, self: self._action_bar_toggled(), self)
self.action_group.add_actions([
('go-menu', None, '_Go'),
('go-up', gtk.STOCK_GO_UP, '_Up', '<Alt>Up', None, lambda ign, self: self._action_open_dir(self.info.get_parent())),
@@ -170,20 +174,17 @@
self.main_hbox.pack1(self.sidepane, False, False)
self.sidepane.show()
- vbox = gtk.VBox(False, 6)
- self.main_hbox.pack2(vbox, True, False)
- vbox.show()
+ self.view_vbox = gtk.VBox(False, 6)
+ self.main_hbox.pack2(self.view_vbox, True, False)
+ self.view_vbox.show()
- self.pathbar = ThunarPathBar()
- 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()
+ # add the path bar
+ self._action_bar_toggled()
self.swin = gtk.ScrolledWindow(None, None)
self.swin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
self.swin.set_shadow_type(gtk.SHADOW_IN)
- vbox.pack_start(self.swin, True, True, 0)
+ self.view_vbox.pack_start(self.swin, True, True, 0)
self.swin.show()
if icon_view_support:
@@ -201,83 +202,83 @@
self.view.grab_focus()
self.view.show()
- if True:
- self.location_bar = gtk.Frame()
- self.location_bar.set_shadow_type(gtk.SHADOW_ETCHED_IN)
- vbox.pack_start(self.location_bar, False, False, 0)
- self.location_bar.hide()
- else:
- self.location_bar = gtk.VBox(False, 0)
- self.main_vbox.pack_start(self.location_bar, False, False, 0)
- self.location_bar.hide()
-
- separator = gtk.HSeparator()
- self.location_bar.pack_start(separator, False, False, 0)
- separator.show()
-
- lbox = gtk.HBox(False, 6)
- lbox.set_border_width(2)
- self.location_bar.add(lbox)
- lbox.show()
-
- if False:
- button = gtk.Button()
- button.set_relief(gtk.RELIEF_NONE)
- button.set_border_width(0)
- button.set_focus_on_click(False)
- button.connect('clicked', lambda btn: self._location_bar_activate())
- lbox.pack_start(button, False, False, 0)
- button.show()
-
- bbox = gtk.HBox(False, 0)
- bbox.set_border_width(0)
- button.add(bbox)
- bbox.show()
-
- image = gtk.image_new_from_stock(gtk.STOCK_JUMP_TO, gtk.ICON_SIZE_BUTTON)
- bbox.pack_start(image, False, False, 2)
- image.show()
-
- label = gtk.Label('Go')
- bbox.pack_start(label, False, False, 2)
- label.show()
- else:
- if True:
- close_button = gtk.Button()
- close_button.set_relief(gtk.RELIEF_NONE)
- close_button.set_border_width(0)
- close_button.set_focus_on_click(False)
- close_button.connect('clicked', lambda btn: self._location_bar_focus_out())
- lbox.pack_start(close_button, False, False, 0)
- close_button.show()
-
- close_image = gtk.image_new_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU)
- close_button.add(close_image)
- close_image.show()
-
- label = gtk.Label('Location:')
- lbox.pack_start(label, False, False, 0)
- label.show()
-
- self.location_entry = gtk.Entry()
- self.location_entry.connect('focus-out-event', lambda entry, event: self._location_bar_focus_out())
- self.location_entry.connect('key-press-event', lambda entry, event: self._location_bar_key_press(event))
- self.location_entry.connect('activate', lambda entry: self._location_bar_activate())
- lbox.pack_start(self.location_entry, True, True, 0)
- self.location_entry.show()
-
- if False:
- close_button = gtk.Button()
- close_button.set_relief(gtk.RELIEF_NONE)
- close_button.set_border_width(0)
- close_button.set_focus_on_click(False)
- close_button.connect('clicked', lambda btn: self._location_bar_focus_out())
- lbox.pack_start(close_button, False, False, 0)
- close_button.show()
-
- close_image = gtk.image_new_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU)
- close_button.add(close_image)
- close_image.show()
+# if True:
+# self.location_bar = gtk.Frame()
+# self.location_bar.set_shadow_type(gtk.SHADOW_ETCHED_IN)
+# vbox.pack_start(self.location_bar, False, False, 0)
+# self.location_bar.hide()
+# else:
+# self.location_bar = gtk.VBox(False, 0)
+# self.main_vbox.pack_start(self.location_bar, False, False, 0)
+# self.location_bar.hide()
+#
+# separator = gtk.HSeparator()
+# self.location_bar.pack_start(separator, False, False, 0)
+# separator.show()
+#
+# lbox = gtk.HBox(False, 6)
+# lbox.set_border_width(2)
+# self.location_bar.add(lbox)
+# lbox.show()
+#
+# if False:
+# button = gtk.Button()
+# button.set_relief(gtk.RELIEF_NONE)
+# button.set_border_width(0)
+# button.set_focus_on_click(False)
+# button.connect('clicked', lambda btn: self._location_bar_activate())
+# lbox.pack_start(button, False, False, 0)
+# button.show()
+#
+# bbox = gtk.HBox(False, 0)
+# bbox.set_border_width(0)
+# button.add(bbox)
+# bbox.show()
+#
+# image = gtk.image_new_from_stock(gtk.STOCK_JUMP_TO, gtk.ICON_SIZE_BUTTON)
+# bbox.pack_start(image, False, False, 2)
+# image.show()
+#
+# label = gtk.Label('Go')
+# bbox.pack_start(label, False, False, 2)
+# label.show()
+# else:
+# if True:
+# close_button = gtk.Button()
+# close_button.set_relief(gtk.RELIEF_NONE)
+# close_button.set_border_width(0)
+# close_button.set_focus_on_click(False)
+# close_button.connect('clicked', lambda btn: self._location_bar_focus_out())
+# lbox.pack_start(close_button, False, False, 0)
+# close_button.show()
+#
+# close_image = gtk.image_new_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU)
+# close_button.add(close_image)
+# close_image.show()
+#
+# label = gtk.Label('Location:')
+# lbox.pack_start(label, False, False, 0)
+# label.show()
+#
+# self.location_entry = gtk.Entry()
+# self.location_entry.connect('focus-out-event', lambda entry, event: self._location_bar_focus_out())
+# self.location_entry.connect('key-press-event', lambda entry, event: self._location_bar_key_press(event))
+# self.location_entry.connect('activate', lambda entry: self._location_bar_activate())
+# lbox.pack_start(self.location_entry, True, True, 0)
+# self.location_entry.show()
+#
+# if False:
+# close_button = gtk.Button()
+# close_button.set_relief(gtk.RELIEF_NONE)
+# close_button.set_border_width(0)
+# close_button.set_focus_on_click(False)
+# close_button.connect('clicked', lambda btn: self._location_bar_focus_out())
+# lbox.pack_start(close_button, False, False, 0)
+# close_button.show()
+#
+# close_image = gtk.image_new_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU)
+# close_button.add(close_image)
+# close_image.show()
self.status_bar = gtk.Statusbar()
self.status_id = self.status_bar.get_context_id('Selection state')
@@ -308,15 +309,20 @@
self.view.show()
- def _action_gtkfilechooser_like(self):
- value = self.action_group.get_action('view-gtkfilechooser').get_active()
- self.sidepane.set_gtkfilechooser_like(value)
- if value:
- self.pathbar.show()
- self.main_hbox.set_border_width(6)
+ def _action_bar_toggled(self):
+ try:
+ if self.pathbar: self.pathbar.destroy()
+ except:
+ pass
+ if self.action_group.get_action('view-pathbar').get_active():
+ self.pathbar = ThunarPathBar()
else:
- self.pathbar.hide()
- self.main_hbox.set_border_width(0)
+ self.pathbar = ThunarLocationBar()
+ self.pathbar.set_info(self.info)
+ self.pathbar.connect('directory-changed', lambda history, info: self._action_open_dir(info))
+ self.view_vbox.pack_start(self.pathbar, False, False, 0)
+ self.view_vbox.reorder_child(self.pathbar, 0)
+ self.pathbar.show()
def _action_sidebar_toggled(self):
@@ -378,6 +384,7 @@
def _internal_open_dir(self, info):
model = ThunarModel(info)
self.view.set_model(model)
+ self.view.grab_focus()
self.info = info
self.action_group.get_action('go-up').set_property('sensitive', (info.get_parent() != None))
self._selection_changed()
@@ -449,7 +456,11 @@
return False
- def _action_open_location_old(self):
+ def _action_open_location_other(self):
+ if self.pathbar.__class__ == ThunarLocationBar:
+ self.pathbar.focus()
+ return
+
dialog = gtk.Dialog('Open Location', self, gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_NO_SEPARATOR | gtk.DIALOG_MODAL, (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN, gtk.RESPONSE_OK))
dialog.set_default_response(gtk.RESPONSE_OK)
dialog.set_default_size(390, 50)
Index: thunar.ui
===================================================================
RCS file: /var/cvs/thunar/design/ui/thunar.ui,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- thunar.ui 19 Mar 2005 13:52:40 -0000 1.9
+++ thunar.ui 20 Mar 2005 01:18:56 -0000 1.10
@@ -66,7 +66,8 @@
<separator />
<menuitem action="view-toolbars" />
- <menuitem action="view-gtkfilechooser" />
+ <menuitem action="view-pathbar" />
+ <menuitem action="view-locationbar" />
<separator />
More information about the Thunar-workers
mailing list