From dc4622d35ddb2468622b3fb4fb0fee0a97f133a9 Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Thu, 9 Mar 2017 14:33:28 +0100 Subject: [PATCH] fix symbolic icons, app menu and few small issues --- IconRequests/utils.py | 9 ++++++--- IconRequests/widgets/application_row.py | 7 ++++++- IconRequests/widgets/window.py | 4 +++- data/ui/about.ui | 2 +- meson.build | 22 ++++++++++++++-------- meson_options.txt | 1 + po/icon-requests.pot | 14 +++++++------- update_pot.sh | 15 +++++++++------ 8 files changed, 47 insertions(+), 27 deletions(-) create mode 100644 meson_options.txt diff --git a/IconRequests/utils.py b/IconRequests/utils.py index 33d91cf..7750ea4 100644 --- a/IconRequests/utils.py +++ b/IconRequests/utils.py @@ -138,9 +138,12 @@ def get_icon(icon_path): :return: GdkPixbux Image """ try: - icon = GdkPixbuf.Pixbuf.new_from_file(icon_path) - if icon.get_width() != 48 or icon.get_height() != 48: - icon = icon.scale_simple(48, 48, GdkPixbuf.InterpType.BILINEAR) + if "symbolic" in icon_path: + icon = (None, icon_path) + else: + icon = GdkPixbuf.Pixbuf.new_from_file(icon_path) + if icon.get_width() != 48 or icon.get_height() != 48: + icon = icon.scale_simple(48, 48, GdkPixbuf.InterpType.BILINEAR) return icon except GLib.Error: return None diff --git a/IconRequests/widgets/application_row.py b/IconRequests/widgets/application_row.py index bf66408..dea2002 100644 --- a/IconRequests/widgets/application_row.py +++ b/IconRequests/widgets/application_row.py @@ -33,7 +33,12 @@ def generate(self): image = Gtk.Image(xalign=0) icon = get_icon(self.desktop_file.icon_path) if icon: - image.set_from_pixbuf(icon) + if type(icon) == tuple: + icon_name = path.basename(icon[1]).replace(".svg", "") + image.set_from_gicon(Gio.ThemedIcon(name=icon_name), + Gtk.IconSize.DIALOG) + else: + image.set_from_pixbuf(icon) else: image.set_from_icon_name("image-missing", Gtk.IconSize.DIALOG) image_box.pack_start(image, True, False, 6) diff --git a/IconRequests/widgets/window.py b/IconRequests/widgets/window.py index b380afb..2d4ecaa 100644 --- a/IconRequests/widgets/window.py +++ b/IconRequests/widgets/window.py @@ -67,7 +67,9 @@ def generate_window(self, application): self.popover = Gtk.Popover.new_from_model(self.menu_button, application.menu) self.popover.props.width_request = 200 self.menu_button.connect("clicked", self.show_menu_popover) - + else: + self.menu_button.set_visible(False) + self.menu_button.set_no_show_all(True) self.revealer = self.builder.get_object("Revealer") self.search_list = [self.all, self.unsupported, self.hardcoded] diff --git a/data/ui/about.ui b/data/ui/about.ui index 946ad36..f22527b 100644 --- a/data/ui/about.ui +++ b/data/ui/about.ui @@ -10,7 +10,7 @@ True menu Icon Requests - 0.1.1 + 0.1.2 Simple application to report missing icons to github repository This program comes with absolutely no warranty. See the <a href="http://www.gnu.org/licenses/gpl-3.0.html">GNU General Public License, version 3 or later</a> for details. Bilal Elmoussaoui diff --git a/meson.build b/meson.build index 2958c96..7bf865a 100644 --- a/meson.build +++ b/meson.build @@ -1,8 +1,6 @@ -# See https://github.com/mesonbuild/meson/issues/226 -project('icon-requests', 'c', - version: '0.1.1') - +project('icon-requests', 'c', version: '0.1.2') +message('Looking for dependencies') python = find_program('python3') git = find_program('git', required : false) intltool_merge = find_program('intltool-merge') @@ -12,15 +10,13 @@ else GITVERSION = '' endif -message('Looking for dependencies') -py3 = find_program('python3') glib = dependency('glib-2.0') gobject = dependency('gobject-2.0') gir = dependency('gobject-introspection-1.0') gtk = dependency('gtk+-3.0', version : '>=3.16') message('Getting python install dir') -r = run_command(py3, '-c', 'from distutils.sysconfig import get_python_lib; print(get_python_lib())') +r = run_command(python, '-c', 'from distutils.sysconfig import get_python_lib; print(get_python_lib())') if r.returncode() != 0 error('Cannot find python install dir') endif @@ -40,6 +36,13 @@ conf.set('VERSION', meson.project_version()) conf.set('BUILDDIR', meson.current_build_dir()) conf.set('PYTHONDIR', python_dir) +if get_option('post_install') == true + post_install = 'enabled' +else + post_install = 'disabled' +endif +message('post install script is : ' + post_install) + subdir('data') subdir('po') @@ -52,4 +55,7 @@ configure_file(input : 'icon-requests.in', output : 'icon-requests', configurati configure_file = '@0@/icon-requests'.format(meson.current_build_dir()) install_data(configure_file, install_dir: 'bin') -meson.add_install_script('meson_post_install.sh') + +if get_option('post_install') == true + meson.add_install_script('meson_post_install.sh') +endif \ No newline at end of file diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..3d1ee20 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1 @@ +option('post_install', type : 'boolean', value : 'true') diff --git a/po/icon-requests.pot b/po/icon-requests.pot index 446f35a..d857bc6 100644 --- a/po/icon-requests.pot +++ b/po/icon-requests.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: icon-requests\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-03-05 19:39+0100\n" +"POT-Creation-Date: 2017-03-09 14:33+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -32,24 +32,24 @@ msgstr "" msgid "Quit" msgstr "" -#: IconRequests/widgets/application_row.py:76 +#: IconRequests/widgets/application_row.py:81 msgid "Report" msgstr "" -#: IconRequests/widgets/application_row.py:89 +#: IconRequests/widgets/application_row.py:94 msgid "Fix" msgstr "" -#: IconRequests/widgets/application_row.py:132 +#: IconRequests/widgets/application_row.py:137 msgid "Please check your connexion" msgstr "" -#: IconRequests/widgets/application_row.py:136 -#: IconRequests/widgets/application_row.py:162 +#: IconRequests/widgets/application_row.py:141 +#: IconRequests/widgets/application_row.py:167 msgid "Theme not supported" msgstr "" -#: IconRequests/widgets/application_row.py:140 +#: IconRequests/widgets/application_row.py:145 msgid "You've reached your API limits" msgstr "" diff --git a/update_pot.sh b/update_pot.sh index d0f4854..73d6214 100755 --- a/update_pot.sh +++ b/update_pot.sh @@ -46,9 +46,12 @@ xgettext \ ${BASEDIR}/data/icon-requests.appdata.xml.in # Merge the messages with existing po files -echo "Merging with existing translations... " -for file in ${BASEDIR}/po/*.po -do - echo -n $file - msgmerge --update $file $OUTPUT_FILE -done +po_files=$(find ${BASEDIR}/po/ -name "*.po") +if [ ${#po_files[@]} != 0 ]; then + echo "Merging with existing translations..." + for file in $po_files + do + echo -n $file + msgmerge --update $file $OUTPUT_FILE + done +fi \ No newline at end of file