[Pkg-bazaar-commits] ./bzr-gtk/unstable r121: Use OliveBookmarkDialog instead of OliveBookmark.
Szilveszter Farkas (Phanatic)
Szilveszter.Farkas at gmail.com
Fri Apr 10 07:45:39 UTC 2009
------------------------------------------------------------
revno: 121
committer: Szilveszter Farkas (Phanatic) <Szilveszter.Farkas at gmail.com>
branch nick: bzr-gtk
timestamp: Mon 2006-12-18 00:22:10 +0100
message:
Use OliveBookmarkDialog instead of OliveBookmark.
Fixed: #67922 (bookmarks in olive)
modified:
olive/__init__.py
olive/bookmark.py
olive/menu.py
olive/remove.py
-------------- next part --------------
=== modified file 'olive/__init__.py'
--- a/olive/__init__.py 2006-12-16 15:44:16 +0000
+++ b/olive/__init__.py 2006-12-17 23:22:10 +0000
@@ -351,8 +351,7 @@
from remove import OliveRemoveDialog
remove = OliveRemoveDialog(self.wt, self.wtpath,
selected=self.get_selected_right(),
- parent=self.window,
- single=False)
+ parent=self.window)
response = remove.run()
if response != gtk.RESPONSE_NONE:
@@ -405,7 +404,9 @@
# Create a menu
from menu import OliveMenu
- menu = OliveMenu(self.get_path(), self.get_selected_left())
+ menu = OliveMenu(path=self.get_path(),
+ selected=self.get_selected_left(),
+ app=self)
menu.left_context_menu().popup(None, None, None, 0,
event.time)
=== modified file 'olive/bookmark.py'
--- a/olive/bookmark.py 2006-10-25 16:29:18 +0000
+++ b/olive/bookmark.py 2006-12-17 23:22:10 +0000
@@ -36,7 +36,7 @@
self.window = self.glade.get_widget('window_bookmark')
- self.pref = self.pref = OlivePreferences()
+ self.pref = OlivePreferences()
# Dictionary for signal_autoconnect
dic = { "on_button_bookmark_save_clicked": self.bookmark,
@@ -72,3 +72,65 @@
def close(self, widget=None):
self.window.destroy()
+
+class OliveBookmarkDialog(gtk.Dialog):
+ """ This class wraps the old Bookmark window into a gtk.Dialog. """
+
+ def __init__(self, selected, parent=None):
+ """ Initialize the Bookmark dialog. """
+ gtk.Dialog.__init__(self, title="Bookmarks - Olive",
+ parent=parent,
+ flags=0,
+ buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
+
+ self.pref = OlivePreferences()
+
+ # Get arguments
+ self.selected = selected
+
+ # Create widgets
+ self._label_location = gtk.Label(_("Location:"))
+ self._label_title = gtk.Label(_("Title:"))
+ self._entry_location = gtk.Entry()
+ self._entry_title = gtk.Entry()
+ self._button_save = gtk.Button(stock=gtk.STOCK_SAVE)
+
+ self._button_save.connect('clicked', self._on_save_clicked)
+
+ # Set default values
+ self._entry_location.set_text(self.selected)
+ self._entry_location.set_sensitive(False)
+ self._entry_title.set_text(self.pref.get_bookmark_title(self.selected))
+ self._entry_title.set_flags(gtk.CAN_FOCUS | gtk.HAS_FOCUS)
+
+ # Create a table and put widgets into it
+ self._table = gtk.Table(rows=2, columns=2)
+ self._table.attach(self._label_location, 0, 1, 0, 1)
+ self._table.attach(self._label_title, 0, 1, 1, 2)
+ self._table.attach(self._entry_location, 1, 2, 0, 1)
+ self._table.attach(self._entry_title, 1, 2, 1, 2)
+
+ self._label_location.set_alignment(0, 0.5)
+ self._label_title.set_alignment(0, 0.5)
+ self._table.set_row_spacings(3)
+ self._table.set_col_spacings(3)
+ self.vbox.set_spacing(3)
+
+ self.vbox.add(self._table)
+
+ self.action_area.pack_end(self._button_save)
+
+ self.vbox.show_all()
+
+ def _on_save_clicked(self, button):
+ """ Save button clicked handler. """
+ if self._entry_title.get_text() == '':
+ error_dialog(_('No title given'),
+ _('Please specify a title to continue.'))
+ return
+
+ self.pref.set_bookmark_title(self._entry_location.get_text(),
+ self._entry_title.get_text())
+ self.pref.write()
+
+ self.response(gtk.RESPONSE_OK)
=== modified file 'olive/menu.py'
--- a/olive/menu.py 2006-12-16 15:44:16 +0000
+++ b/olive/menu.py 2006-12-17 23:22:10 +0000
@@ -245,14 +245,24 @@
else:
warning_dialog(_('Location already bookmarked'),
_('The current directory is already bookmarked.\nSee the left panel for reference.'))
+
+ self.app.refresh_left()
def edit_bookmark(self, action):
""" Left context menu -> Edit """
- from bookmark import OliveBookmark
-
+ from bookmark import OliveBookmarkDialog
+
if self.selected != None:
- bookmark = OliveBookmark(self.selected)
- bookmark.display()
+ bookmark = OliveBookmarkDialog(self.selected, self.app.window)
+ response = bookmark.run()
+
+ if response != gtk.RESPONSE_NONE:
+ bookmark.hide()
+
+ if response == gtk.RESPONSE_OK:
+ self.app.refresh_left()
+
+ bookmark.destroy()
def remove_bookmark(self, action):
""" Left context menu -> Remove """
@@ -260,6 +270,8 @@
if self.selected != None:
self.pref.remove_bookmark(self.selected)
self.pref.write()
+
+ self.app.refresh_left()
def open_folder(self, action):
""" Left context menu -> Open Folder """
=== modified file 'olive/remove.py'
--- a/olive/remove.py 2006-12-16 15:44:16 +0000
+++ b/olive/remove.py 2006-12-17 23:22:10 +0000
@@ -97,7 +97,7 @@
class OliveRemoveDialog(gtk.Dialog):
""" This class wraps the old Remove window into a gtk.Dialog. """
- def __init__(self, wt, wtpath, selected=[], parent=None, single=False):
+ def __init__(self, wt, wtpath, selected=[], parent=None):
""" Initialize the Remove file(s) dialog. """
gtk.Dialog.__init__(self, title="Remove files - Olive",
parent=parent,
@@ -108,7 +108,6 @@
self.wt = wt
self.wtpath = wtpath
self.selected = selected
- self.single = single
# Create widgets
self._label = gtk.Label(_("Which file(s) do you want to remove?"))
More information about the Pkg-bazaar-commits
mailing list