From d5277646dbe9a88d32c42187c9c3701a7c57a469 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Thu, 26 Oct 2017 19:17:41 +0200 Subject: Fork from Ubuntu's indicator-keyboard. --- data/Makefile.am | 8 +- data/ayatana-indicator-keyboard.conf.in | 9 + data/ayatana-indicator-keyboard.desktop.in | 8 + data/icon-generator.vala | 241 +++++++++++++++++++++ data/indicator-keyboard.conf.in | 9 - data/indicator-keyboard.desktop.in | 9 - data/main.vala | 241 --------------------- data/upstart/Makefile.am | 4 +- data/upstart/ayatana-indicator-keyboard.desktop.in | 9 + data/upstart/indicator-keyboard.desktop.in | 9 - 10 files changed, 273 insertions(+), 274 deletions(-) create mode 100644 data/ayatana-indicator-keyboard.conf.in create mode 100644 data/ayatana-indicator-keyboard.desktop.in create mode 100644 data/icon-generator.vala delete mode 100644 data/indicator-keyboard.conf.in delete mode 100644 data/indicator-keyboard.desktop.in delete mode 100644 data/main.vala create mode 100644 data/upstart/ayatana-indicator-keyboard.desktop.in delete mode 100644 data/upstart/indicator-keyboard.desktop.in (limited to 'data') diff --git a/data/Makefile.am b/data/Makefile.am index bb9a1f82..6f33aeaf 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -13,7 +13,7 @@ AM_VALAFLAGS = --enable-experimental-non-null \ --metadatadir $(top_srcdir)/deps \ --vapidir $(top_srcdir)/deps -ayatana_indicator_keyboard_icon_generator_SOURCES = main.vala \ +ayatana_indicator_keyboard_icon_generator_SOURCES = icon-generator.vala \ $(top_srcdir)/lib/common.vala ayatana_indicator_keyboard_icon_generator_VALAFLAGS = $(AM_VALAFLAGS) \ --pkg gee-1.0 \ @@ -68,7 +68,7 @@ indicatordir = $(INDICATOR_DIR) org.ayatana.indicator.keyboard: $(AM_V_GEN) (echo '[Indicator Service]'; \ - echo 'Name=indicator-keyboard'; \ + echo 'Name=ayatana-indicator-keyboard'; \ echo 'ObjectPath=/org/ayatana/indicator/keyboard'; \ echo 'Position=80'; \ echo ''; \ @@ -101,6 +101,6 @@ gschemas.compiled: $(gsettings_SCHEMAS) EXTRA_DIST = $(dist_service_DATA) \ $(dist_indicator_DATA) \ $(gsettings_SCHEMAS) \ - indicator-keyboard.conf.in \ - indicator-keyboard.desktop.in + ayatana-indicator-keyboard.conf.in \ + ayatana-indicator-keyboard.desktop.in diff --git a/data/ayatana-indicator-keyboard.conf.in b/data/ayatana-indicator-keyboard.conf.in new file mode 100644 index 00000000..5083a485 --- /dev/null +++ b/data/ayatana-indicator-keyboard.conf.in @@ -0,0 +1,9 @@ +description "Ayatana Indicator Keyboard Backend" + +start on ayatana-indicator-services-start +stop on desktop-end or ayatana-indicator-services-end + +respawn +respawn limit 2 10 + +exec @pkglibexecdir@/ayatana-indicator-keyboard-service --use-gtk diff --git a/data/ayatana-indicator-keyboard.desktop.in b/data/ayatana-indicator-keyboard.desktop.in new file mode 100644 index 00000000..b31bec51 --- /dev/null +++ b/data/ayatana-indicator-keyboard.desktop.in @@ -0,0 +1,8 @@ +[Desktop Entry] +Type=Application +Name=Ayatana Indicator Keyboard +Exec=@pkglibexecdir@/ayatana-indicator-keyboard-service +OnlyShowIn=MATE; +NoDisplay=true +StartupNotify=false +Terminal=false diff --git a/data/icon-generator.vala b/data/icon-generator.vala new file mode 100644 index 00000000..8077f093 --- /dev/null +++ b/data/icon-generator.vala @@ -0,0 +1,241 @@ +/* + * Copyright 2013 Canonical Ltd. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * Authors: William Hua + */ + +int main (string[] args) { + var force = false; + var width = 22.0; + var height = 22.0; + var icon_width = 20.0; + var icon_height = 20.0; + var radius = 2.0; + var colour = "black"; + var font = "Ubuntu"; + var weight = 500; + var layout_size = 12; + var subscript_size = 8; + string? output_path = null; + string? no_subscript_path = null; + string? with_subscript_path = null; + + OptionEntry[] options = new OptionEntry[15]; + options[0] = { "force", 'f', 0, OptionArg.NONE, ref force, "Overwrite existing files" }; + options[1] = { "width", 'w', 0, OptionArg.DOUBLE, ref width, "Template width", "DOUBLE" }; + options[2] = { "height", 'h', 0, OptionArg.DOUBLE, ref height, "Template height", "DOUBLE" }; + options[3] = { "icon-width", 'W', 0, OptionArg.DOUBLE, ref icon_width, "Icon width", "DOUBLE" }; + options[4] = { "icon-height", 'H', 0, OptionArg.DOUBLE, ref icon_height, "Icon height", "DOUBLE" }; + options[5] = { "radius", 'r', 0, OptionArg.DOUBLE, ref radius, "Icon radius", "DOUBLE" }; + options[6] = { "colour", 'c', 0, OptionArg.STRING, ref colour, "Icon colour", "COLOUR" }; + options[7] = { "font", 'F', 0, OptionArg.STRING, ref font, "Font family", "NAME" }; + options[8] = { "weight", 'G', 0, OptionArg.INT, ref weight, "Font weight (100 to 1000)", "INT" }; + options[9] = { "layout-size", 's', 0, OptionArg.INT, ref layout_size, "Layout font size", "INT" }; + options[10] = { "subscript-size", 'S', 0, OptionArg.INT, ref subscript_size, "Subscript font size", "INT" }; + options[11] = { "output", 'o', 0, OptionArg.FILENAME, ref output_path, "Output directory", "PATH" }; + options[12] = { "no-subscript", 'i', 0, OptionArg.FILENAME, ref no_subscript_path, "Icon template", "PATH" }; + options[13] = { "with-subscript", 'I', 0, OptionArg.FILENAME, ref with_subscript_path, "Subscript icon template", "PATH" }; + options[14] = { }; + + try { + var context = new OptionContext ("- generate keyboard layout icons"); + context.add_main_entries (options, null); + context.set_help_enabled (true); + context.parse (ref args); + } catch (OptionError error) { + GLib.error ("error: %s", error.message); + } + + if (no_subscript_path == null && with_subscript_path == null) { + error ("error: No icon template"); + } else if (no_subscript_path == null) { + no_subscript_path = with_subscript_path; + } else if (with_subscript_path == null) { + with_subscript_path = no_subscript_path; + } + + if (output_path != null) { + var file = File.new_for_path ((!) output_path); + + if (!file.query_exists (null)) { + try { + file.make_directory_with_parents (null); + } catch (Error error) { + GLib.error ("error: %s", error.message); + } + } + } else { + output_path = "."; + } + + Gtk.init (ref args); + + var info = new Gnome.XkbInfo (); + var layouts = info.get_all_layouts (); + var occurrences = new Gee.HashMap (); + + layouts.foreach ((name) => { + string? short_name; + + info.get_layout_info (name, null, out short_name, null, null); + + var abbreviation = abbreviate (short_name); + var has_abbreviation = abbreviation != null && ((!) abbreviation).get_char () != '\0'; + + if (has_abbreviation) { + if (!occurrences.has_key ((!) abbreviation)) { + occurrences[(!) abbreviation] = 1; + } else { + occurrences[(!) abbreviation] = occurrences[(!) abbreviation] + 1; + } + } + }); + + string no_subscript_data; + string with_subscript_data; + + try { + uint8[] contents; + + var icon_x = 0.5 * (width - icon_width); + var icon_y = 0.5 * (height - icon_height); + var layout_font = @"font-family:$font;font-weight:$weight;font-size:$layout_size"; + var subscript_font = @"font-family:$font;font-weight:$weight;font-size:$subscript_size"; + + File.new_for_path ((!) no_subscript_path).load_contents (null, out contents, null); + no_subscript_data = (string) contents; + no_subscript_data = no_subscript_data.replace ("@WIDTH@", @"$width"); + no_subscript_data = no_subscript_data.replace ("@HEIGHT@", @"$height"); + no_subscript_data = no_subscript_data.replace ("@ICON_X@", @"$icon_x"); + no_subscript_data = no_subscript_data.replace ("@ICON_Y@", @"$icon_y"); + no_subscript_data = no_subscript_data.replace ("@ICON_WIDTH@", @"$icon_width"); + no_subscript_data = no_subscript_data.replace ("@ICON_HEIGHT@", @"$icon_height"); + no_subscript_data = no_subscript_data.replace ("@RADIUS@", @"$radius"); + no_subscript_data = no_subscript_data.replace ("@COLOUR@", colour); + no_subscript_data = no_subscript_data.replace ("@LAYOUT_FONT@", layout_font); + no_subscript_data = no_subscript_data.replace ("@SUBSCRIPT_FONT@", subscript_font); + + File.new_for_path ((!) with_subscript_path).load_contents (null, out contents, null); + with_subscript_data = (string) contents; + with_subscript_data = with_subscript_data.replace ("@WIDTH@", @"$width"); + with_subscript_data = with_subscript_data.replace ("@HEIGHT@", @"$height"); + with_subscript_data = with_subscript_data.replace ("@ICON_X@", @"$icon_x"); + with_subscript_data = with_subscript_data.replace ("@ICON_Y@", @"$icon_y"); + with_subscript_data = with_subscript_data.replace ("@ICON_WIDTH@", @"$icon_width"); + with_subscript_data = with_subscript_data.replace ("@ICON_HEIGHT@", @"$icon_height"); + with_subscript_data = with_subscript_data.replace ("@RADIUS@", @"$radius"); + with_subscript_data = with_subscript_data.replace ("@COLOUR@", colour); + with_subscript_data = with_subscript_data.replace ("@LAYOUT_FONT@", layout_font); + with_subscript_data = with_subscript_data.replace ("@SUBSCRIPT_FONT@", subscript_font); + } catch (Error error) { + GLib.error ("error: %s", error.message); + } + + var font_map = new PangoFT2.FontMap (); + var layout_layout = new Pango.Layout (font_map.create_context ()); + var subscript_layout = new Pango.Layout (font_map.create_context ()); + + var font_description = new Pango.FontDescription (); + font_description.set_family (font); + font_description.set_weight ((Pango.Weight) weight); + font_description.set_size (layout_size * Pango.SCALE); + layout_layout.set_font_description (font_description); + + font_description = new Pango.FontDescription (); + font_description.set_family (font); + font_description.set_weight ((Pango.Weight) weight); + font_description.set_size (subscript_size * Pango.SCALE); + subscript_layout.set_font_description (font_description); + + foreach (var entry in occurrences.entries) { + var layout = entry.key; + var count = entry.value; + var file = File.new_for_path (@"$((!) output_path)/indicator-keyboard-$layout.svg"); + + if (force || !file.query_exists (null)) { + int layout_width; + int layout_height; + + layout_layout.set_text (layout, -1); + layout_layout.get_size (out layout_width, out layout_height); + var layout_baseline = layout_layout.get_baseline (); + + var layout_x = 0.5 * (width - 1.0 * layout_width / Pango.SCALE); + var layout_y = 0.5 * (height - 1.0 * layout_height / Pango.SCALE) + 1.0 * layout_baseline / Pango.SCALE; + + var output_data = no_subscript_data; + output_data = output_data.replace ("@LAYOUT@", layout); + output_data = output_data.replace ("@LAYOUT_X@", @"$layout_x"); + output_data = output_data.replace ("@LAYOUT_Y@", @"$layout_y"); + output_data = output_data.replace ("@SUBSCRIPT@", ""); + output_data = output_data.replace ("@SUBSCRIPT_X@", "0"); + output_data = output_data.replace ("@SUBSCRIPT_Y@", "0"); + + try { + file.replace_contents (output_data.data, null, false, FileCreateFlags.REPLACE_DESTINATION, null, null); + } catch (Error error) { + GLib.error ("error: %s", error.message); + } + } + + if (count > 1) { + int layout_width; + int layout_height; + + layout_layout.set_text (layout, -1); + layout_layout.get_size (out layout_width, out layout_height); + var layout_baseline = layout_layout.get_baseline (); + + var layout_y = 0.5 * (height - 1.0 * layout_height / Pango.SCALE) + 1.0 * layout_baseline / Pango.SCALE; + + var partial_data = with_subscript_data; + partial_data = partial_data.replace ("@LAYOUT@", layout); + partial_data = partial_data.replace ("@LAYOUT_Y@", @"$layout_y"); + + for (var i = 1; i <= count; i++) { + file = File.new_for_path (@"$((!) output_path)/indicator-keyboard-$layout-$i.svg"); + + if (force || !file.query_exists (null)) { + var subscript = @"$i"; + int subscript_width; + int subscript_height; + + subscript_layout.set_text (subscript, -1); + subscript_layout.get_size (out subscript_width, out subscript_height); + var subscript_baseline = subscript_layout.get_baseline (); + + var layout_x = 0.5 * (width - 1.0 * (layout_width + subscript_width) / Pango.SCALE); + var subscript_x = layout_x + 1.0 * layout_width / Pango.SCALE; + var subscript_y = layout_y - 0.5 * subscript_height / Pango.SCALE + 1.0 * subscript_baseline / Pango.SCALE; + + var output_data = partial_data; + output_data = output_data.replace ("@LAYOUT_X@", @"$layout_x"); + output_data = output_data.replace ("@LAYOUT_Y@", @"$layout_y"); + output_data = output_data.replace ("@SUBSCRIPT@", subscript); + output_data = output_data.replace ("@SUBSCRIPT_X@", @"$subscript_x"); + output_data = output_data.replace ("@SUBSCRIPT_Y@", @"$subscript_y"); + + try { + file.replace_contents (output_data.data, null, false, FileCreateFlags.REPLACE_DESTINATION, null, null); + } catch (Error error) { + GLib.error ("error: %s", error.message); + } + } + } + } + } + + return 0; +} diff --git a/data/indicator-keyboard.conf.in b/data/indicator-keyboard.conf.in deleted file mode 100644 index 737a4830..00000000 --- a/data/indicator-keyboard.conf.in +++ /dev/null @@ -1,9 +0,0 @@ -description "Indicator Keyboard Backend" - -start on indicator-services-start -stop on desktop-end or indicator-services-end - -respawn -respawn limit 2 10 - -exec @pkglibexecdir@/indicator-keyboard-service --use-gtk diff --git a/data/indicator-keyboard.desktop.in b/data/indicator-keyboard.desktop.in deleted file mode 100644 index 3fca71fb..00000000 --- a/data/indicator-keyboard.desktop.in +++ /dev/null @@ -1,9 +0,0 @@ -[Desktop Entry] -Type=Application -Name=Indicator Keyboard -Exec=@pkglibexecdir@/indicator-keyboard-service -OnlyShowIn=Unity;GNOME; -NoDisplay=true -StartupNotify=false -Terminal=false -AutostartCondition=GNOME3 unless-session gnome diff --git a/data/main.vala b/data/main.vala deleted file mode 100644 index 8077f093..00000000 --- a/data/main.vala +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright 2013 Canonical Ltd. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, version 3 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * Authors: William Hua - */ - -int main (string[] args) { - var force = false; - var width = 22.0; - var height = 22.0; - var icon_width = 20.0; - var icon_height = 20.0; - var radius = 2.0; - var colour = "black"; - var font = "Ubuntu"; - var weight = 500; - var layout_size = 12; - var subscript_size = 8; - string? output_path = null; - string? no_subscript_path = null; - string? with_subscript_path = null; - - OptionEntry[] options = new OptionEntry[15]; - options[0] = { "force", 'f', 0, OptionArg.NONE, ref force, "Overwrite existing files" }; - options[1] = { "width", 'w', 0, OptionArg.DOUBLE, ref width, "Template width", "DOUBLE" }; - options[2] = { "height", 'h', 0, OptionArg.DOUBLE, ref height, "Template height", "DOUBLE" }; - options[3] = { "icon-width", 'W', 0, OptionArg.DOUBLE, ref icon_width, "Icon width", "DOUBLE" }; - options[4] = { "icon-height", 'H', 0, OptionArg.DOUBLE, ref icon_height, "Icon height", "DOUBLE" }; - options[5] = { "radius", 'r', 0, OptionArg.DOUBLE, ref radius, "Icon radius", "DOUBLE" }; - options[6] = { "colour", 'c', 0, OptionArg.STRING, ref colour, "Icon colour", "COLOUR" }; - options[7] = { "font", 'F', 0, OptionArg.STRING, ref font, "Font family", "NAME" }; - options[8] = { "weight", 'G', 0, OptionArg.INT, ref weight, "Font weight (100 to 1000)", "INT" }; - options[9] = { "layout-size", 's', 0, OptionArg.INT, ref layout_size, "Layout font size", "INT" }; - options[10] = { "subscript-size", 'S', 0, OptionArg.INT, ref subscript_size, "Subscript font size", "INT" }; - options[11] = { "output", 'o', 0, OptionArg.FILENAME, ref output_path, "Output directory", "PATH" }; - options[12] = { "no-subscript", 'i', 0, OptionArg.FILENAME, ref no_subscript_path, "Icon template", "PATH" }; - options[13] = { "with-subscript", 'I', 0, OptionArg.FILENAME, ref with_subscript_path, "Subscript icon template", "PATH" }; - options[14] = { }; - - try { - var context = new OptionContext ("- generate keyboard layout icons"); - context.add_main_entries (options, null); - context.set_help_enabled (true); - context.parse (ref args); - } catch (OptionError error) { - GLib.error ("error: %s", error.message); - } - - if (no_subscript_path == null && with_subscript_path == null) { - error ("error: No icon template"); - } else if (no_subscript_path == null) { - no_subscript_path = with_subscript_path; - } else if (with_subscript_path == null) { - with_subscript_path = no_subscript_path; - } - - if (output_path != null) { - var file = File.new_for_path ((!) output_path); - - if (!file.query_exists (null)) { - try { - file.make_directory_with_parents (null); - } catch (Error error) { - GLib.error ("error: %s", error.message); - } - } - } else { - output_path = "."; - } - - Gtk.init (ref args); - - var info = new Gnome.XkbInfo (); - var layouts = info.get_all_layouts (); - var occurrences = new Gee.HashMap (); - - layouts.foreach ((name) => { - string? short_name; - - info.get_layout_info (name, null, out short_name, null, null); - - var abbreviation = abbreviate (short_name); - var has_abbreviation = abbreviation != null && ((!) abbreviation).get_char () != '\0'; - - if (has_abbreviation) { - if (!occurrences.has_key ((!) abbreviation)) { - occurrences[(!) abbreviation] = 1; - } else { - occurrences[(!) abbreviation] = occurrences[(!) abbreviation] + 1; - } - } - }); - - string no_subscript_data; - string with_subscript_data; - - try { - uint8[] contents; - - var icon_x = 0.5 * (width - icon_width); - var icon_y = 0.5 * (height - icon_height); - var layout_font = @"font-family:$font;font-weight:$weight;font-size:$layout_size"; - var subscript_font = @"font-family:$font;font-weight:$weight;font-size:$subscript_size"; - - File.new_for_path ((!) no_subscript_path).load_contents (null, out contents, null); - no_subscript_data = (string) contents; - no_subscript_data = no_subscript_data.replace ("@WIDTH@", @"$width"); - no_subscript_data = no_subscript_data.replace ("@HEIGHT@", @"$height"); - no_subscript_data = no_subscript_data.replace ("@ICON_X@", @"$icon_x"); - no_subscript_data = no_subscript_data.replace ("@ICON_Y@", @"$icon_y"); - no_subscript_data = no_subscript_data.replace ("@ICON_WIDTH@", @"$icon_width"); - no_subscript_data = no_subscript_data.replace ("@ICON_HEIGHT@", @"$icon_height"); - no_subscript_data = no_subscript_data.replace ("@RADIUS@", @"$radius"); - no_subscript_data = no_subscript_data.replace ("@COLOUR@", colour); - no_subscript_data = no_subscript_data.replace ("@LAYOUT_FONT@", layout_font); - no_subscript_data = no_subscript_data.replace ("@SUBSCRIPT_FONT@", subscript_font); - - File.new_for_path ((!) with_subscript_path).load_contents (null, out contents, null); - with_subscript_data = (string) contents; - with_subscript_data = with_subscript_data.replace ("@WIDTH@", @"$width"); - with_subscript_data = with_subscript_data.replace ("@HEIGHT@", @"$height"); - with_subscript_data = with_subscript_data.replace ("@ICON_X@", @"$icon_x"); - with_subscript_data = with_subscript_data.replace ("@ICON_Y@", @"$icon_y"); - with_subscript_data = with_subscript_data.replace ("@ICON_WIDTH@", @"$icon_width"); - with_subscript_data = with_subscript_data.replace ("@ICON_HEIGHT@", @"$icon_height"); - with_subscript_data = with_subscript_data.replace ("@RADIUS@", @"$radius"); - with_subscript_data = with_subscript_data.replace ("@COLOUR@", colour); - with_subscript_data = with_subscript_data.replace ("@LAYOUT_FONT@", layout_font); - with_subscript_data = with_subscript_data.replace ("@SUBSCRIPT_FONT@", subscript_font); - } catch (Error error) { - GLib.error ("error: %s", error.message); - } - - var font_map = new PangoFT2.FontMap (); - var layout_layout = new Pango.Layout (font_map.create_context ()); - var subscript_layout = new Pango.Layout (font_map.create_context ()); - - var font_description = new Pango.FontDescription (); - font_description.set_family (font); - font_description.set_weight ((Pango.Weight) weight); - font_description.set_size (layout_size * Pango.SCALE); - layout_layout.set_font_description (font_description); - - font_description = new Pango.FontDescription (); - font_description.set_family (font); - font_description.set_weight ((Pango.Weight) weight); - font_description.set_size (subscript_size * Pango.SCALE); - subscript_layout.set_font_description (font_description); - - foreach (var entry in occurrences.entries) { - var layout = entry.key; - var count = entry.value; - var file = File.new_for_path (@"$((!) output_path)/indicator-keyboard-$layout.svg"); - - if (force || !file.query_exists (null)) { - int layout_width; - int layout_height; - - layout_layout.set_text (layout, -1); - layout_layout.get_size (out layout_width, out layout_height); - var layout_baseline = layout_layout.get_baseline (); - - var layout_x = 0.5 * (width - 1.0 * layout_width / Pango.SCALE); - var layout_y = 0.5 * (height - 1.0 * layout_height / Pango.SCALE) + 1.0 * layout_baseline / Pango.SCALE; - - var output_data = no_subscript_data; - output_data = output_data.replace ("@LAYOUT@", layout); - output_data = output_data.replace ("@LAYOUT_X@", @"$layout_x"); - output_data = output_data.replace ("@LAYOUT_Y@", @"$layout_y"); - output_data = output_data.replace ("@SUBSCRIPT@", ""); - output_data = output_data.replace ("@SUBSCRIPT_X@", "0"); - output_data = output_data.replace ("@SUBSCRIPT_Y@", "0"); - - try { - file.replace_contents (output_data.data, null, false, FileCreateFlags.REPLACE_DESTINATION, null, null); - } catch (Error error) { - GLib.error ("error: %s", error.message); - } - } - - if (count > 1) { - int layout_width; - int layout_height; - - layout_layout.set_text (layout, -1); - layout_layout.get_size (out layout_width, out layout_height); - var layout_baseline = layout_layout.get_baseline (); - - var layout_y = 0.5 * (height - 1.0 * layout_height / Pango.SCALE) + 1.0 * layout_baseline / Pango.SCALE; - - var partial_data = with_subscript_data; - partial_data = partial_data.replace ("@LAYOUT@", layout); - partial_data = partial_data.replace ("@LAYOUT_Y@", @"$layout_y"); - - for (var i = 1; i <= count; i++) { - file = File.new_for_path (@"$((!) output_path)/indicator-keyboard-$layout-$i.svg"); - - if (force || !file.query_exists (null)) { - var subscript = @"$i"; - int subscript_width; - int subscript_height; - - subscript_layout.set_text (subscript, -1); - subscript_layout.get_size (out subscript_width, out subscript_height); - var subscript_baseline = subscript_layout.get_baseline (); - - var layout_x = 0.5 * (width - 1.0 * (layout_width + subscript_width) / Pango.SCALE); - var subscript_x = layout_x + 1.0 * layout_width / Pango.SCALE; - var subscript_y = layout_y - 0.5 * subscript_height / Pango.SCALE + 1.0 * subscript_baseline / Pango.SCALE; - - var output_data = partial_data; - output_data = output_data.replace ("@LAYOUT_X@", @"$layout_x"); - output_data = output_data.replace ("@LAYOUT_Y@", @"$layout_y"); - output_data = output_data.replace ("@SUBSCRIPT@", subscript); - output_data = output_data.replace ("@SUBSCRIPT_X@", @"$subscript_x"); - output_data = output_data.replace ("@SUBSCRIPT_Y@", @"$subscript_y"); - - try { - file.replace_contents (output_data.data, null, false, FileCreateFlags.REPLACE_DESTINATION, null, null); - } catch (Error error) { - GLib.error ("error: %s", error.message); - } - } - } - } - } - - return 0; -} diff --git a/data/upstart/Makefile.am b/data/upstart/Makefile.am index c0b6a2eb..c762a603 100644 --- a/data/upstart/Makefile.am +++ b/data/upstart/Makefile.am @@ -3,10 +3,10 @@ ########################### xdg_autostartdir = $(datadir)/upstart/xdg/autostart -xdg_autostart_DATA = indicator-keyboard.desktop +xdg_autostart_DATA = ayatana-indicator-keyboard.desktop %.desktop: %.desktop.in $(AM_V_GEN) sed -e "s|\@pkglibexecdir\@|$(pkglibexecdir)|" $< > $@ -EXTRA_DIST = indicator-keyboard.desktop.in +EXTRA_DIST = ayatana-indicator-keyboard.desktop.in diff --git a/data/upstart/ayatana-indicator-keyboard.desktop.in b/data/upstart/ayatana-indicator-keyboard.desktop.in new file mode 100644 index 00000000..f20783be --- /dev/null +++ b/data/upstart/ayatana-indicator-keyboard.desktop.in @@ -0,0 +1,9 @@ +[Desktop Entry] +Type=Application +Name=Ayatana Indicator Keyboard +Exec=@pkglibexecdir@/ayatana-indicator-keyboard-service +OnlyShowIn=Unity; +NoDisplay=true +StartupNotify=false +Terminal=false +Hidden=true diff --git a/data/upstart/indicator-keyboard.desktop.in b/data/upstart/indicator-keyboard.desktop.in deleted file mode 100644 index ec7e565c..00000000 --- a/data/upstart/indicator-keyboard.desktop.in +++ /dev/null @@ -1,9 +0,0 @@ -[Desktop Entry] -Type=Application -Name=Indicator Keyboard -Exec=@pkglibexecdir@/indicator-keyboard-service -OnlyShowIn=Unity; -NoDisplay=true -StartupNotify=false -Terminal=false -Hidden=true -- cgit v1.2.3