Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(252)

Side by Side Diff: ui/gtk3/emojierapp.vala

Issue 317540043: ui/gtk3: Get emoji font size from gsettings (Closed) Base URL: git@github.com:ibus/ibus.git@master
Patch Set: Created 6 years, 11 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/gtk3/emojier.vala ('k') | ui/gtk3/panel.vala » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* vim:set et sts=4 sw=4: 1 /* vim:set et sts=4 sw=4:
2 * 2 *
3 * ibus - The Input Bus 3 * ibus - The Input Bus
4 * 4 *
5 * Copyright (c) 2017 Peng Wu <alexepico@gmail.com> 5 * Copyright (c) 2017 Peng Wu <alexepico@gmail.com>
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public 8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version. 10 * version 2.1 of the License, or (at your option) any later version.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 54
55 public void activate_dialog(ApplicationCommandLine command_line) { 55 public void activate_dialog(ApplicationCommandLine command_line) {
56 this.hold (); 56 this.hold ();
57 show_dialog(command_line); 57 show_dialog(command_line);
58 this.release (); 58 this.release ();
59 } 59 }
60 60
61 61
62 private int _command_line (ApplicationCommandLine command_line) { 62 private int _command_line (ApplicationCommandLine command_line) {
63 // Set default font size
64 IBusEmojier.set_emoji_font(m_settings_emoji.get_string("font"));
65
63 const OptionEntry[] options = { 66 const OptionEntry[] options = {
64 { "font", 0, 0, OptionArg.STRING, out emoji_font, 67 { "font", 0, 0, OptionArg.STRING, out emoji_font,
65 /* TRANSLATORS: "FONT" should be capital and translatable. 68 /* TRANSLATORS: "FONT" should be capital and translatable.
66 * It's used for an argument command --font=FONT 69 * It's used for an argument command --font=FONT
67 */ 70 */
68 N_("\"FONT\" for emoji chracters on emoji dialog"), 71 N_("\"FONT\" for emoji chracters on emoji dialog"),
69 N_("FONT") }, 72 N_("FONT") },
70 { "lang", 0, 0, OptionArg.STRING, out annotation_lang, 73 { "lang", 0, 0, OptionArg.STRING, out annotation_lang,
71 /* TRANSLATORS: "LANG" should be capital and translatable. 74 /* TRANSLATORS: "LANG" should be capital and translatable.
72 * It's used for an argument command --lang=LANG 75 * It's used for an argument command --lang=LANG
73 */ 76 */
74 N_("\"LANG\" for annotations on emoji dialog. E.g. \"en\""), 77 N_("\"LANG\" for annotations on emoji dialog. E.g. \"en\""),
75 N_("LANG") }, 78 N_("LANG") },
76 { null } 79 { null }
77 }; 80 };
78 81
79 var option = new OptionContext(); 82 var option = new OptionContext();
80 option.add_main_entries(options, Config.GETTEXT_PACKAGE); 83 option.add_main_entries(options, Config.GETTEXT_PACKAGE);
81 84
82 // We have to make an extra copy of the array, 85 // We have to make an extra copy of the array,
83 // since .parse assumes that it can remove strings 86 // since .parse assumes that it can remove strings
84 // from the array without freeing them. 87 // from the array without freeing them.
85 string[] args = command_line.get_arguments(); 88 string[] args = command_line.get_arguments();
86 string*[] _args = new string[args.length]; 89 string*[] _args = new string[args.length];
87 for (int i = 0; i < args.length; i++) { 90 for (int i = 0; i < args.length; i++) {
88 _args[i] = args[i]; 91 _args[i] = args[i];
89 } 92 }
90 93
94 // Need to initialize for the second instance.
95 emoji_font = null;
96 annotation_lang = null;
97
91 try { 98 try {
92 unowned string[] tmp = _args; 99 unowned string[] tmp = _args;
93 option.parse(ref tmp); 100 option.parse(ref tmp);
94 } catch (OptionError e) { 101 } catch (OptionError e) {
95 stderr.printf("%s\n", e.message); 102 stderr.printf("%s\n", e.message);
96 return Posix.EXIT_FAILURE; 103 return Posix.EXIT_FAILURE;
97 } 104 }
98 105
99 if (m_emojier != null && m_emojier.is_running()) { 106 if (m_emojier != null && m_emojier.is_running()) {
100 m_emojier.present_centralize(); 107 m_emojier.present_centralize();
101 return Posix.EXIT_SUCCESS; 108 return Posix.EXIT_SUCCESS;
102 } 109 }
103 110
104 if (emoji_font == null)
105 emoji_font = m_settings_emoji.get_string("font");
106 if (annotation_lang == null) 111 if (annotation_lang == null)
107 annotation_lang = m_settings_emoji.get_string("lang"); 112 annotation_lang = m_settings_emoji.get_string("lang");
113 IBusEmojier.set_annotation_lang(annotation_lang);
108 114
109 IBusEmojier.set_annotation_lang(annotation_lang); 115 if (emoji_font != null)
110 IBusEmojier.set_emoji_font(emoji_font); 116 IBusEmojier.set_emoji_font(emoji_font);
111 117
112 activate_dialog(command_line); 118 activate_dialog(command_line);
113 119
114 return Posix.EXIT_SUCCESS; 120 return Posix.EXIT_SUCCESS;
115 } 121 }
116 122
117 123
118 public override int command_line (ApplicationCommandLine command_line) { 124 public override int command_line (ApplicationCommandLine command_line) {
119 // keep the application running until we are done with this commandline 125 // keep the application running until we are done with this commandline
120 this.hold(); 126 this.hold();
(...skipping 11 matching lines...) Expand all
132 138
133 IBus.init(); 139 IBus.init();
134 140
135 Gtk.init(ref args); 141 Gtk.init(ref args);
136 142
137 EmojiApplication app = new EmojiApplication(); 143 EmojiApplication app = new EmojiApplication();
138 int status = app.run(args); 144 int status = app.run(args);
139 return status; 145 return status;
140 } 146 }
141 } 147 }
OLDNEW
« no previous file with comments | « ui/gtk3/emojier.vala ('k') | ui/gtk3/panel.vala » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b