Add custom actions symbolic icons
Using gresource file and based on the suggestions for the merge menu made in https://github.com/MightyCreak/diffuse/issues/90.
This commit is contained in:
parent
ee813f22a4
commit
4926ca91de
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<gresources>
|
||||
<gresource prefix="/io/github/mightycreak/Diffuse/icons/scalable/actions">
|
||||
<file preprocess="xml-stripblanks" alias="new-2way-merge-symbolic.svg">icons/hicolor/scalable/actions/new-2way-merge-symbolic.svg</file>
|
||||
<file preprocess="xml-stripblanks" alias="new-3way-merge-symbolic.svg">icons/hicolor/scalable/actions/new-3way-merge-symbolic.svg</file>
|
||||
<file preprocess="xml-stripblanks" alias="copy-selection-left-symbolic.svg">icons/hicolor/scalable/actions/copy-selection-left-symbolic.svg</file>
|
||||
<file preprocess="xml-stripblanks" alias="copy-selection-right-symbolic.svg">icons/hicolor/scalable/actions/copy-selection-right-symbolic.svg</file>
|
||||
<file preprocess="xml-stripblanks" alias="copy-left-into-selection-symbolic.svg">icons/hicolor/scalable/actions/copy-left-into-selection-symbolic.svg</file>
|
||||
<file preprocess="xml-stripblanks" alias="copy-right-into-selection-symbolic.svg">icons/hicolor/scalable/actions/copy-right-into-selection-symbolic.svg</file>
|
||||
</gresource>
|
||||
</gresources>
|
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg height="16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M11 14a1 1 0 0 0 .707-.293l4-4a1 1 0 0 0 0-1.414l-4-4a1 1 0 1 0-1.414 1.414L13.586 9l-3.293 3.293A1 1 0 0 0 11 14zm-4 0a1 1 0 0 0 .707-.293l4-4a1 1 0 0 0 0-1.414l-4-4a1 1 0 1 0-1.414 1.414L8.586 8H4c-1.117 0-2-.883-2-2V3c0-.55-.45-1-1-1s-1 .45-1 1v3c0 .023 0 .047.004.07A4.01 4.01 0 0 0 4 10h4.586l-2.293 2.293A1 1 0 0 0 7 14zm0 0" fill="#2e3436"/></svg>
|
After Width: | Height: | Size: 466 B |
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg height="16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M5 14a1 1 0 0 1-.707-.293l-4-4a1 1 0 0 1 0-1.414l4-4a1 1 0 1 1 1.414 1.414L2.414 9l3.293 3.293A1 1 0 0 1 5 14zm4 0a1 1 0 0 1-.707-.293l-4-4a1 1 0 0 1 0-1.414l4-4a1 1 0 1 1 1.414 1.414L7.414 8H12c1.117 0 2-.883 2-2V3c0-.55.45-1 1-1s1 .45 1 1v3c0 .023 0 .047-.004.07A4.01 4.01 0 0 1 12 10H7.414l2.293 2.293A1 1 0 0 1 9 14zm0 0" fill="#2e3436"/></svg>
|
After Width: | Height: | Size: 460 B |
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><g fill="#2e3436"><path d="m 9 2.933594 c 4.042969 0 5.890625 3.613281 5.890625 3.613281 l -1.785156 0.902344 s -1.246094 -2.515625 -4.105469 -2.515625 c -2.054688 0 -3.097656 1.394531 -3.484375 2.074218 h 0.910156 c 1.332031 0 1.574219 1.253907 1.574219 2.035157 l -6 -0.046875 l -0.046875 -6 c 1.046875 0 2.035156 0.523437 2.035156 1.667968 v 0.929688 l 0.0625 0.0625 c 0.757813 -1.089844 2.3125 -2.722656 4.949219 -2.722656 z m 0 0"/><path d="m 13.617188 8.996094 c 0.683593 0 1.265624 0.582031 1.265624 1.265625 v 3.46875 c 0 0.683593 -0.582031 1.265625 -1.265624 1.265625 h -3.46875 c -0.683594 0 -1.265626 -0.582032 -1.265626 -1.265625 v -3.46875 c 0 -0.683594 0.582032 -1.265625 1.265626 -1.265625 z m -0.734376 2 h -2 v 2 h 2 z m 0 0"/></g></svg>
|
After Width: | Height: | Size: 881 B |
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><g fill="#2e3436"><path d="m 7 2.933594 c -4.042969 0 -5.894531 3.613281 -5.894531 3.613281 l 1.785156 0.902344 s 1.25 -2.515625 4.109375 -2.515625 c 2.054688 0 3.097656 1.394531 3.484375 2.074218 h -0.910156 c -1.332031 0 -1.574219 1.253907 -1.574219 2.035157 l 6 -0.046875 l 0.042969 -6 c -1.042969 0 -2.03125 0.523437 -2.03125 1.667968 v 0.929688 l -0.0625 0.0625 c -0.757813 -1.089844 -2.316407 -2.722656 -4.949219 -2.722656 z m 0 0"/><path d="m 2.382812 8.996094 c -0.683593 0 -1.265624 0.582031 -1.265624 1.265625 v 3.46875 c 0 0.683593 0.582031 1.265625 1.265624 1.265625 h 3.46875 c 0.683594 0 1.265626 -0.582032 1.265626 -1.265625 v -3.46875 c 0 -0.683594 -0.582032 -1.265625 -1.265626 -1.265625 z m 0.734376 2 h 2 v 2 h -2 z m 0 0"/></g></svg>
|
After Width: | Height: | Size: 880 B |
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg height="16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M3.094.25A2.45 2.45 0 0 0 .656 2.688v8.124c0 1.324 1.18 2.416 2.5 2.436v.064a2.45 2.45 0 0 0 2.438 2.438H8.03a.814.814 0 0 0 0-1.625H5.594a.794.794 0 0 1-.813-.813V5.187c0-.463.35-.812.813-.812h4.539l2.773 2.773v.477a.814.814 0 0 0 1.625 0v-.813a.812.812 0 0 0-.238-.574l-3.102-3.101-.148-.149-2.5-2.5A.812.812 0 0 0 7.969.25zm0 1.625H7.63l.875.875H5.594a2.45 2.45 0 0 0-2.438 2.438v6.433c-.45-.018-.875-.358-.875-.809V2.688c0-.464.35-.813.813-.813zM11.28 9.25v2.438H8.844v1.624h2.437v2.438h1.625v-2.438h2.438v-1.624h-2.438V9.25z" fill="#2e3436"/></svg>
|
After Width: | Height: | Size: 665 B |
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg height="16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M2.656.25C1.526.25.594 1.182.594 2.313v6.874c0 1.094 1.151 1.999 2.25 2.057v.193c0 1.127 1.123 2.057 2.25 2.063v.187c0 1.131.932 2.063 2.062 2.063H9.22a.689.689 0 0 0 0-1.375H7.156a.672.672 0 0 1-.687-.688V6.812c0-.392.295-.687.687-.687h3.84l2.348 2.348v.402a.688.688 0 0 0 1.375 0v-.688a.687.687 0 0 0-.201-.486l-2.65-2.65-.1-.1-2.15-2.15L7.267.45a.687.687 0 0 0-.487-.2zm0 1.375h3.84l.875.875H4.906c-1.13 0-2.062.932-2.062 2.063v5.302c-.384-.047-.875-.32-.875-.677V2.311c0-.392.295-.687.687-.687zm2.25 2.25h3.84l.875.875H7.156c-1.13 0-2.062.932-2.062 2.063v5.31c-.39-.006-.875-.297-.875-.685V4.561c0-.392.295-.687.687-.687zm7.063 6.375v2.063H9.906v1.374h2.063v2.063h1.375v-2.063h2.062v-1.374h-2.062V10.25z" fill="#2e3436"/></svg>
|
After Width: | Height: | Size: 843 B |
|
@ -1,4 +1,12 @@
|
|||
pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())
|
||||
gnome = import('gnome')
|
||||
|
||||
gnome.compile_resources(meson.project_name(),
|
||||
meson.project_name() + '.gresource.xml',
|
||||
gresource_bundle: true,
|
||||
install: true,
|
||||
install_dir: pkgdatadir,
|
||||
)
|
||||
|
||||
if build_machine.system() == 'linux'
|
||||
desktop_file = i18n.merge_file(
|
||||
|
|
|
@ -19,9 +19,12 @@
|
|||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
import os
|
||||
import sys
|
||||
import gettext
|
||||
|
||||
from gi.repository import Gio
|
||||
|
||||
VERSION = '@VERSION@'
|
||||
PKGDATADIR = '@PKGDATADIR@'
|
||||
LOCALEDIR = '@LOCALEDIR@'
|
||||
|
@ -34,4 +37,9 @@ gettext.textdomain('diffuse')
|
|||
|
||||
if __name__ == '__main__':
|
||||
from diffuse import main
|
||||
|
||||
resource = Gio.resource_load(
|
||||
os.path.join(PKGDATADIR, 'diffuse.gresource'))
|
||||
Gio.Resource._register(resource)
|
||||
|
||||
sys.exit(main.main(VERSION, SYSCONFIGDIR))
|
||||
|
|
|
@ -914,8 +914,8 @@ class DiffuseWindow(Gtk.ApplicationWindow):
|
|||
# create toolbar
|
||||
hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=0)
|
||||
button_specs = [
|
||||
[DIFFUSE_STOCK_NEW_2WAY_MERGE, self.new_2_way_file_merge_cb, None, _('New 2-Way File Merge')], # noqa: E501
|
||||
[DIFFUSE_STOCK_NEW_3WAY_MERGE, self.new_3_way_file_merge_cb, None, _('New 3-Way File Merge')], # noqa: E501
|
||||
['new-2way-merge-symbolic', self.new_2_way_file_merge_cb, None, _('New 2-Way File Merge')], # noqa: E501
|
||||
['new-3way-merge-symbolic', self.new_3_way_file_merge_cb, None, _('New 3-Way File Merge')], # noqa: E501
|
||||
[],
|
||||
['system-run-symbolic', self.button_cb, 'realign-all', _('Realign All')],
|
||||
['go-top-symbolic', self.button_cb, 'first-difference', _('First Difference')],
|
||||
|
@ -923,12 +923,12 @@ class DiffuseWindow(Gtk.ApplicationWindow):
|
|||
['go-down-symbolic', self.button_cb, 'next-difference', _('Next Difference')],
|
||||
['go-bottom-symbolic', self.button_cb, 'last-difference', _('Last Difference')],
|
||||
[],
|
||||
['go-last-symbolic', self.button_cb, 'copy-selection-right', _('Copy Selection Right')], # noqa: E501
|
||||
['go-first-symbolic', self.button_cb, 'copy-selection-left', _('Copy Selection Left')],
|
||||
['go-next-symbolic', self.button_cb, 'copy-left-into-selection', _('Copy Left Into Selection')], # noqa: E501
|
||||
['go-previous-symbolic', self.button_cb, 'copy-right-into-selection', _('Copy Right Into Selection')], # noqa: E501
|
||||
[DIFFUSE_STOCK_LEFT_RIGHT, self.button_cb, 'merge-from-left-then-right', _('Merge From Left Then Right')], # noqa: E501
|
||||
[DIFFUSE_STOCK_RIGHT_LEFT, self.button_cb, 'merge-from-right-then-left', _('Merge From Right Then Left')], # noqa: E501
|
||||
['copy-selection-right-symbolic', self.button_cb, 'copy-selection-right', _('Copy Selection Right')], # noqa: E501
|
||||
['copy-selection-left-symbolic', self.button_cb, 'copy-selection-left', _('Copy Selection Left')], # noqa: E501
|
||||
['copy-left-into-selection-symbolic', self.button_cb, 'copy-left-into-selection', _('Copy Left Into Selection')], # noqa: E501
|
||||
['copy-right-into-selection-symbolic', self.button_cb, 'copy-right-into-selection', _('Copy Right Into Selection')], # noqa: E501
|
||||
['document-revert-rtl-symbolic', self.button_cb, 'merge-from-left-then-right', _('Merge From Left Then Right')], # noqa: E501
|
||||
['document-revert-symbolic', self.button_cb, 'merge-from-right-then-left', _('Merge From Right Then Left')], # noqa: E501
|
||||
[],
|
||||
['edit-undo-symbolic', self.button_cb, 'undo', _('Undo')],
|
||||
['edit-redo-symbolic', self.button_cb, 'redo', _('Redo')],
|
||||
|
@ -1811,10 +1811,7 @@ def _append_buttons(box, size, specs):
|
|||
button.set_relief(Gtk.ReliefStyle.NONE)
|
||||
button.set_can_focus(False)
|
||||
image = Gtk.Image()
|
||||
if icon_name.startswith('diffuse'):
|
||||
image.set_from_stock(icon_name, size)
|
||||
else:
|
||||
image.set_from_icon_name(icon_name, size)
|
||||
image.set_from_icon_name(icon_name, size)
|
||||
button.add(image)
|
||||
image.show()
|
||||
button.connect('clicked', cb, cb_data)
|
||||
|
|
Loading…
Reference in New Issue