[gedit] externaltools: rework the buttons to use a toolbar and symbolic icons
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] externaltools: rework the buttons to use a toolbar and symbolic icons
- Date: Mon, 20 Jun 2011 15:02:19 +0000 (UTC)
commit 228bbdc624395c00a6618c0882811a975ea37632
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Mon Jun 20 17:00:38 2011 +0200
externaltools: rework the buttons to use a toolbar and symbolic icons
plugins/externaltools/tools/manager.py | 14 ++--
plugins/externaltools/tools/tools.ui | 142 ++++++++++++++++---------------
2 files changed, 80 insertions(+), 76 deletions(-)
---
diff --git a/plugins/externaltools/tools/manager.py b/plugins/externaltools/tools/manager.py
index d1e49d0..c0bbf3a 100644
--- a/plugins/externaltools/tools/manager.py
+++ b/plugins/externaltools/tools/manager.py
@@ -280,8 +280,8 @@ class Manager:
def build(self):
callbacks = {
- 'on_new_tool_button_clicked' : self.on_new_tool_button_clicked,
- 'on_remove_tool_button_clicked' : self.on_remove_tool_button_clicked,
+ 'on_action_add_tool_activated' : self.on_action_add_tool_activated,
+ 'on_action_remove_tool_activated' : self.on_action_remove_tool_activated,
'on_tool_manager_dialog_response' : self.on_tool_manager_dialog_response,
'on_tool_manager_dialog_focus_out': self.on_tool_manager_dialog_focus_out,
'on_accelerator_key_press' : self.on_accelerator_key_press,
@@ -590,8 +590,8 @@ class Manager:
removable = node is not None and node.is_local()
- self['remove-tool-button'].set_sensitive(removable)
- self['revert-tool-button'].set_sensitive(removable)
+ self['remove-tool-action'].set_sensitive(removable)
+ self['revert-tool-action'].set_sensitive(removable)
if node is not None and node.is_global():
self['remove-tool-button'].hide()
@@ -636,7 +636,7 @@ class Manager:
return self.language_id_from_iter(piter)
- def on_new_tool_button_clicked(self, button):
+ def on_action_add_tool_activated(self, action):
self.save_current_tool()
# block handlers while inserting a new item
@@ -668,7 +668,7 @@ class Manager:
self.update_remove_revert()
- def on_remove_tool_button_clicked(self, button):
+ def on_action_remove_tool_activated(self, action):
piter, node = self.get_selected_tool()
if not node:
@@ -681,7 +681,7 @@ class Manager:
self.remove_accelerator(node, shortcut)
self.add_accelerator(node)
- self['revert-tool-button'].set_sensitive(False)
+ self['revert-tool-action'].set_sensitive(False)
self.fill_fields()
self.tool_changed(node)
diff --git a/plugins/externaltools/tools/tools.ui b/plugins/externaltools/tools/tools.ui
index 3d202e8..0f469fc 100644
--- a/plugins/externaltools/tools/tools.ui
+++ b/plugins/externaltools/tools/tools.ui
@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 2.12 -->
+ <object class="GtkAction" id="add-tool-action">
+ <signal name="activate" handler="on_action_add_tool_activated" swapped="no"/>
+ </object>
<object class="GtkListStore" id="model_applicability">
<columns>
<!-- column-name gchararray -->
@@ -125,6 +128,12 @@
</row>
</data>
</object>
+ <object class="GtkAction" id="remove-tool-action">
+ <signal name="activate" handler="on_action_remove_tool_activated" swapped="no"/>
+ </object>
+ <object class="GtkAction" id="revert-tool-action">
+ <signal name="activate" handler="on_action_remove_tool_activated" swapped="no"/>
+ </object>
<object class="GeditDocument" id="commands_buffer">
<property name="highlight-matching-brackets">True</property>
</object>
@@ -201,121 +210,116 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
- <property name="spacing">6</property>
<child>
- <object class="GtkLabel" id="label20">
+ <object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">_Tools:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">view</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkScrolledWindow" id="scrolled_window1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="shadow_type">in</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
<child>
- <object class="GtkTreeView" id="view">
+ <object class="GtkLabel" id="label20">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Tools:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">view</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolled_window1">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="headers_visible">False</property>
- <property name="reorderable">True</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="treeview-selection1"/>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="view">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">False</property>
+ <property name="reorderable">True</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="treeview-selection"/>
+ </child>
+ </object>
</child>
</object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
</child>
</object>
<packing>
- <property name="expand">True</property>
+ <property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">1</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkBox" id="hbox2">
+ <object class="GtkToolbar" id="toolbar1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">6</property>
<child>
- <object class="GtkButton" id="new-tool-button">
+ <object class="GtkToolButton" id="add-tool-button">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">Add a new tool</property>
+ <property name="related_action">add-tool-action</property>
<property name="use_action_appearance">False</property>
- <signal name="clicked" handler="on_new_tool_button_clicked" swapped="no"/>
- <child>
- <object class="GtkImage" id="new-tool-image">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-new</property>
- </object>
- </child>
+ <property name="label" translatable="yes">Add Tool</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">list-add-symbolic</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
+ <property name="homogeneous">True</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="remove-tool-button">
+ <object class="GtkToolButton" id="remove-tool-button">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">Remove selected tool</property>
+ <property name="related_action">remove-tool-action</property>
<property name="use_action_appearance">False</property>
- <signal name="clicked" handler="on_remove_tool_button_clicked" swapped="no"/>
- <child>
- <object class="GtkImage" id="remove-tool-image">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-delete</property>
- </object>
- </child>
+ <property name="label" translatable="yes">Remove Tool</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">list-remove-symbolic</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">False</property>
- <property name="pack_type">end</property>
- <property name="position">1</property>
+ <property name="homogeneous">True</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="revert-tool-button">
+ <object class="GtkToolButton" id="revert-tool-button">
+ <property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">Revert tool</property>
+ <property name="related_action">revert-tool-action</property>
<property name="use_action_appearance">False</property>
- <signal name="clicked" handler="on_remove_tool_button_clicked" swapped="no"/>
- <child>
- <object class="GtkImage" id="revert-tool-image">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-revert-to-saved</property>
- </object>
- </child>
+ <property name="label" translatable="yes">Revert Tool</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">edit-undo-symbolic</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">False</property>
- <property name="pack_type">end</property>
- <property name="position">2</property>
+ <property name="homogeneous">True</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]