[meld] Move DirDiff actions to UI file
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] Move DirDiff actions to UI file
- Date: Fri, 27 Sep 2013 22:06:17 +0000 (UTC)
commit 2181c63494de2acef09e6f6358841d3ffa5dd449
Author: Kai Willadsen <kai willadsen gmail com>
Date: Tue Sep 3 07:04:09 2013 +1000
Move DirDiff actions to UI file
data/ui/dirdiff.ui | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++
meld/dirdiff.py | 29 ++--------------
2 files changed, 96 insertions(+), 25 deletions(-)
---
diff --git a/data/ui/dirdiff.ui b/data/ui/dirdiff.ui
index a6a1212..ebaef4b 100644
--- a/data/ui/dirdiff.ui
+++ b/data/ui/dirdiff.ui
@@ -3,6 +3,98 @@
<!-- interface-requires gtk+ 2.12 -->
<!-- interface-requires meld.ui.gladesupport 0.0 -->
<!-- interface-naming-policy toplevel-contextual -->
+ <object class="GtkActionGroup" id="DirdiffActions">
+ <child>
+ <object class="GtkAction" id="DirCompare">
+ <property name="label" translatable="yes">_Compare</property>
+ <property name="tooltip" translatable="yes">Compare selected files</property>
+ <property name="stock_id">gtk-dialog-info</property>
+ <property name="is_important">True</property>
+ <signal name="activate" handler="on_button_diff_clicked" swapped="no"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkAction" id="DirCopyLeft">
+ <property name="label" translatable="yes">Copy _Left</property>
+ <property name="tooltip" translatable="yes">Copy to left</property>
+ <property name="stock_id">gtk-go-back</property>
+ <property name="is_important">True</property>
+ <signal name="activate" handler="on_button_copy_left_clicked" swapped="no"/>
+ </object>
+ <accelerator key="Left" modifiers="GDK_MOD1_MASK"/>
+ </child>
+ <child>
+ <object class="GtkAction" id="DirCopyRight">
+ <property name="label" translatable="yes">Copy _Right</property>
+ <property name="tooltip" translatable="yes">Copy to right</property>
+ <property name="stock_id">gtk-go-forward</property>
+ <property name="is_important">True</property>
+ <signal name="activate" handler="on_button_copy_right_clicked" swapped="no"/>
+ </object>
+ <accelerator key="Right" modifiers="GDK_MOD1_MASK"/>
+ </child>
+ <child>
+ <object class="GtkAction" id="DirDelete">
+ <property name="tooltip" translatable="yes">Delete selected</property>
+ <property name="stock_id">gtk-delete</property>
+ <property name="is_important">True</property>
+ <signal name="activate" handler="on_button_delete_clicked" swapped="no"/>
+ </object>
+ <accelerator key="Delete"/>
+ </child>
+ <child>
+ <object class="GtkAction" id="Hide">
+ <property name="label" translatable="yes">Hide</property>
+ <property name="tooltip" translatable="yes">Hide selected</property>
+ <property name="stock_id">gtk-no</property>
+ <signal name="activate" handler="on_filter_hide_current_clicked" swapped="no"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkToggleAction" id="IgnoreCase">
+ <property name="label" translatable="yes">Ignore Filename Case</property>
+ <property name="tooltip" translatable="yes">Consider differently-cased filenames that are
otherwise-identical to be the same</property>
+ <property name="stock_id">gtk-italic</property>
+ <signal name="toggled" handler="on_button_ignore_case_toggled" swapped="no"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkToggleAction" id="ShowSame">
+ <property name="label" translatable="yes">Same</property>
+ <property name="tooltip" translatable="yes">Show identical</property>
+ <property name="stock_id">gtk-apply</property>
+ <property name="is_important">True</property>
+ <signal name="toggled" handler="on_filter_state_toggled" swapped="no"/>
+ </object>
+ </child>
+
+ <child>
+ <object class="GtkToggleAction" id="ShowNew">
+ <property name="label" translatable="yes">New</property>
+ <property name="tooltip" translatable="yes">Show new</property>
+ <property name="stock_id">gtk-add</property>
+ <property name="is_important">True</property>
+ <signal name="toggled" handler="on_filter_state_toggled" swapped="no"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkToggleAction" id="ShowModified">
+ <property name="label" translatable="yes">Modified</property>
+ <property name="tooltip" translatable="yes">Show modified</property>
+ <property name="stock_id">gtk-remove</property>
+ <property name="is_important">True</property>
+ <signal name="toggled" handler="on_filter_state_toggled" swapped="no"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkToggleAction" id="CustomFilterMenu">
+ <property name="label" translatable="yes">Filters</property>
+ <property name="tooltip" translatable="yes">Set active filters</property>
+ <property name="is_important">True</property>
+ <signal name="toggled" handler="on_custom_filter_menu_toggled" swapped="no"/>
+ </object>
+ </child>
+ </object>
<object class="GtkWindow" id="container">
<property name="visible">True</property>
<property name="can_focus">False</property>
diff --git a/meld/dirdiff.py b/meld/dirdiff.py
index 6f60329..3ae3190 100644
--- a/meld/dirdiff.py
+++ b/meld/dirdiff.py
@@ -265,29 +265,12 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
def __init__(self, prefs, num_panes):
melddoc.MeldDoc.__init__(self, prefs)
- gnomeglade.Component.__init__(self, paths.ui_dir("dirdiff.ui"), "dirdiff")
-
- actions = (
- ("DirCompare", gtk.STOCK_DIALOG_INFO, _("_Compare"), None, _("Compare selected"),
self.on_button_diff_clicked),
- ("DirCopyLeft", gtk.STOCK_GO_BACK, _("Copy _Left"), "<Alt>Left", _("Copy to left"),
self.on_button_copy_left_clicked),
- ("DirCopyRight", gtk.STOCK_GO_FORWARD, _("Copy _Right"), "<Alt>Right", _("Copy to right"),
self.on_button_copy_right_clicked),
- ("DirDelete", gtk.STOCK_DELETE, None, "Delete", _("Delete selected"),
self.on_button_delete_clicked),
- ("Hide", gtk.STOCK_NO, _("Hide"), None, _("Hide selected"),
self.on_filter_hide_current_clicked),
- )
-
- toggleactions = (
- ("IgnoreCase", gtk.STOCK_ITALIC, _("Ignore Filename Case"), None, _("Consider
differently-cased filenames that are otherwise-identical to be the same"),
self.on_button_ignore_case_toggled, False),
- ("ShowSame", gtk.STOCK_APPLY, _("Same"), None, _("Show identical"),
self.on_filter_state_toggled, False),
- ("ShowNew", gtk.STOCK_ADD, _("New"), None, _("Show new"),
self.on_filter_state_toggled, False),
- ("ShowModified", gtk.STOCK_REMOVE, _("Modified"), None, _("Show modified"),
self.on_filter_state_toggled, False),
-
- ("CustomFilterMenu", None, _("Filters"), None, _("Set active filters"),
self.on_custom_filter_menu_toggled, False),
- )
+ gnomeglade.Component.__init__(self, paths.ui_dir("dirdiff.ui"),
+ "dirdiff", ["DirdiffActions"])
+
self.ui_file = paths.ui_dir("dirdiff-ui.xml")
- self.actiongroup = gtk.ActionGroup('DirdiffToolbarActions')
+ self.actiongroup = self.DirdiffActions
self.actiongroup.set_translation_domain("meld")
- self.actiongroup.add_actions(actions)
- self.actiongroup.add_toggle_actions(toggleactions)
self.main_actiongroup = None
self.name_filters = []
@@ -299,10 +282,6 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
app.connect("text-filters-changed",
self.on_text_filters_changed)]
- for button in ("DirCompare", "DirCopyLeft", "DirCopyRight",
- "DirDelete", "ShowSame",
- "ShowNew", "ShowModified", "CustomFilterMenu"):
- self.actiongroup.get_action(button).props.is_important = True
self.map_widgets_into_lists(["treeview", "fileentry", "scrolledwindow",
"diffmap", "linkmap", "msgarea_mgr",
"vbox"])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]