ui/gtk3: Set title string in gnome-shell
gnome-shell uses .desktop files to get the application title names. Probably the reason is to manage any windows and Xorg and Wayland. BUG=https://mail.gnome.org/archives/gtk-app-devel-list/2018-February/msg00027.html R=Shawn.P.Huang@gmail.com Review URL: https://codereview.appspot.com/338520043
This commit is contained in:
Родитель
c57b7c34d7
Коммит
56c67b1362
|
@ -61,6 +61,8 @@ ui/gtk3/candidatepanel.vala
|
|||
ui/gtk3/emojier.vala
|
||||
ui/gtk3/emojierapp.vala
|
||||
ui/gtk3/handle.vala
|
||||
ui/gtk3/ibus-extension-gtk3.desktop.in.in
|
||||
ui/gtk3/ibus-ui-emojier.desktop.in.in
|
||||
ui/gtk3/iconwidget.vala
|
||||
ui/gtk3/keybindingmanager.vala
|
||||
ui/gtk3/panel.vala
|
||||
|
|
|
@ -161,6 +161,8 @@ EXTRA_DIST = \
|
|||
gtkpanel.xml.in \
|
||||
notification-item.xml \
|
||||
notification-watcher.xml \
|
||||
ibus-ui-emojier.desktop.in.in \
|
||||
ibus-extension-gtk3.desktop.in.in \
|
||||
panelbinding.vala \
|
||||
$(NULL)
|
||||
|
||||
|
@ -257,7 +259,32 @@ man_sevendir = $(mandir)/man7
|
|||
%.7.gz: %.7
|
||||
$(AM_V_GEN) gzip -c $< > $@.tmp && mv $@.tmp $@
|
||||
|
||||
desktop_in_in_files = \
|
||||
ibus-ui-emojier.desktop.in.in \
|
||||
ibus-extension-gtk3.desktop.in.in \
|
||||
$(NULL)
|
||||
desktop_in_files = $(desktop_in_in_files:.desktop.in.in=.desktop.in)
|
||||
desktop_DATA = \
|
||||
org.freedesktop.IBus.Panel.Emojier.desktop \
|
||||
org.freedesktop.IBus.Panel.Extension.Gtk3.desktop \
|
||||
$(NULL)
|
||||
desktopdir = $(datadir)/applications
|
||||
%.desktop.in: %.desktop.in.in
|
||||
$(AM_V_GEN) sed \
|
||||
-e 's|^_Name=|Name=|g' \
|
||||
-e 's|@libexecdir[@]|$(libexecdir)|g' $< > $@.tmp && \
|
||||
mv $@.tmp $@
|
||||
$(NULL)
|
||||
org.freedesktop.IBus.Panel.Emojier.desktop: ibus-ui-emojier.desktop.in
|
||||
$(AM_V_GEN) $(MSGFMT) --desktop --template $< -d $(top_srcdir)/po -o $@
|
||||
$(NULL)
|
||||
org.freedesktop.IBus.Panel.Extension.Gtk3.desktop: ibus-extension-gtk3.desktop.in
|
||||
$(AM_V_GEN) $(MSGFMT) --desktop --template $< -d $(top_srcdir)/po -o $@
|
||||
$(NULL)
|
||||
|
||||
CLEANFILES += \
|
||||
$(desktop_DATA) \
|
||||
$(desktop_in_files) \
|
||||
$(man_seven_DATA) \
|
||||
$(man_seven_files) \
|
||||
$(NULL)
|
||||
|
|
|
@ -26,14 +26,14 @@ bool partial_match = false;
|
|||
int partial_match_length = -1;
|
||||
int partial_match_condition = -1;
|
||||
|
||||
public class EmojiApplication : Application {
|
||||
public class EmojiApplication : Gtk.Application {
|
||||
private IBusEmojier? m_emojier;
|
||||
GLib.Settings m_settings_emoji =
|
||||
new GLib.Settings("org.freedesktop.ibus.panel.emoji");
|
||||
|
||||
|
||||
private EmojiApplication() {
|
||||
Object(application_id: "org.freedesktop.ibus.panel.emojier",
|
||||
Object(application_id: "org.freedesktop.IBus.Panel.Emojier",
|
||||
flags: ApplicationFlags.HANDLES_COMMAND_LINE);
|
||||
set_inactivity_timeout(100000);
|
||||
}
|
||||
|
@ -41,6 +41,8 @@ public class EmojiApplication : Application {
|
|||
|
||||
private void show_dialog(ApplicationCommandLine command_line) {
|
||||
m_emojier = new IBusEmojier();
|
||||
// For title handling in gnome-shell
|
||||
add_window(m_emojier);
|
||||
Gdk.Event event = Gtk.get_current_event();
|
||||
// Plasma and GNOME3 desktop returns null event
|
||||
if (event == null) {
|
||||
|
@ -51,6 +53,7 @@ public class EmojiApplication : Application {
|
|||
event.key.window.ref();
|
||||
}
|
||||
string emoji = m_emojier.run("", event);
|
||||
remove_window(m_emojier);
|
||||
if (emoji == null) {
|
||||
m_emojier = null;
|
||||
command_line.print("%s\n", _("Canceled to choose an emoji."));
|
||||
|
|
|
@ -21,16 +21,18 @@
|
|||
* USA
|
||||
*/
|
||||
|
||||
class ExtensionGtk {
|
||||
class ExtensionGtk : Gtk.Application {
|
||||
private IBus.Bus m_bus;
|
||||
private PanelBinding m_panel;
|
||||
|
||||
public ExtensionGtk(string[] argv) {
|
||||
public ExtensionGtk(string[] args) {
|
||||
Object(application_id: "org.freedesktop.IBus.Panel.Extension.Gtk3",
|
||||
flags: ApplicationFlags.FLAGS_NONE);
|
||||
GLib.Intl.bindtextdomain(Config.GETTEXT_PACKAGE,
|
||||
Config.GLIB_LOCALE_DIR);
|
||||
GLib.Intl.bind_textdomain_codeset(Config.GETTEXT_PACKAGE, "UTF-8");
|
||||
IBus.init();
|
||||
Gtk.init(ref argv);
|
||||
Gtk.init(ref args);
|
||||
|
||||
m_bus = new IBus.Bus();
|
||||
|
||||
|
@ -64,10 +66,6 @@ class ExtensionGtk {
|
|||
m_bus.request_name(IBus.SERVICE_PANEL_EXTENSION, flags);
|
||||
}
|
||||
|
||||
public int run() {
|
||||
Gtk.main();
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void bus_name_acquired_cb(DBusConnection connection,
|
||||
string sender_name,
|
||||
|
@ -76,7 +74,7 @@ class ExtensionGtk {
|
|||
string signal_name,
|
||||
Variant parameters) {
|
||||
debug("signal_name = %s", signal_name);
|
||||
m_panel = new PanelBinding(m_bus);
|
||||
m_panel = new PanelBinding(m_bus, this);
|
||||
m_panel.load_settings();
|
||||
}
|
||||
|
||||
|
@ -108,7 +106,13 @@ class ExtensionGtk {
|
|||
init();
|
||||
}
|
||||
|
||||
public static void main(string[] argv) {
|
||||
|
||||
public override void activate() {
|
||||
Gtk.main();
|
||||
}
|
||||
|
||||
|
||||
public static int main(string[] args) {
|
||||
// https://bugzilla.redhat.com/show_bug.cgi?id=1226465#c20
|
||||
// In /etc/xdg/plasma-workspace/env/gtk3_scrolling.sh
|
||||
// Plasma deskop sets this variable and prevents Super-space,
|
||||
|
@ -119,7 +123,8 @@ class ExtensionGtk {
|
|||
// launching the dialog secondly in Wayland.
|
||||
//Gdk.set_allowed_backends("x11");
|
||||
|
||||
ExtensionGtk extension = new ExtensionGtk(argv);
|
||||
extension.run();
|
||||
ExtensionGtk extension = new ExtensionGtk(args);
|
||||
int status = extension.run(args);
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
[Desktop Entry]
|
||||
_Name=Emoji Choice
|
||||
Icon=ibus
|
||||
Exec=@libexecdir@/ibus-extension-gtk3
|
||||
Type=Application
|
||||
OnlyShowIn=
|
|
@ -0,0 +1,6 @@
|
|||
[Desktop Entry]
|
||||
_Name=Emoji Choice
|
||||
Icon=ibus
|
||||
Exec=ibus emoji
|
||||
Type=Application
|
||||
OnlyShowIn=
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
class PanelBinding : IBus.PanelService {
|
||||
private IBus.Bus m_bus;
|
||||
private Gtk.Application m_application;
|
||||
private GLib.Settings m_settings_panel = null;
|
||||
private GLib.Settings m_settings_emoji = null;
|
||||
private string m_current_context_path = "";
|
||||
|
@ -38,13 +39,15 @@ class PanelBinding : IBus.PanelService {
|
|||
private bool m_load_unicode_at_startup;
|
||||
private bool m_loaded_unicode = false;
|
||||
|
||||
public PanelBinding(IBus.Bus bus) {
|
||||
public PanelBinding(IBus.Bus bus,
|
||||
Gtk.Application application) {
|
||||
GLib.assert(bus.is_connected());
|
||||
// Chain up base class constructor
|
||||
GLib.Object(connection : bus.get_connection(),
|
||||
object_path : IBus.PATH_PANEL_EXTENSION);
|
||||
|
||||
m_bus = bus;
|
||||
m_application = application;
|
||||
|
||||
init_settings();
|
||||
}
|
||||
|
@ -178,6 +181,7 @@ class PanelBinding : IBus.PanelService {
|
|||
GLib.Source.remove(m_emojier_set_emoji_lang_id);
|
||||
m_emojier_set_emoji_lang_id = 0;
|
||||
}
|
||||
m_application = null;
|
||||
}
|
||||
|
||||
|
||||
|
@ -189,7 +193,10 @@ class PanelBinding : IBus.PanelService {
|
|||
m_loaded_unicode = true;
|
||||
}
|
||||
m_emojier = new IBusEmojier();
|
||||
// For title handling in gnome-shell
|
||||
m_application.add_window(m_emojier);
|
||||
string emoji = m_emojier.run(m_real_current_context_path, event);
|
||||
m_application.remove_window(m_emojier);
|
||||
if (emoji == null) {
|
||||
m_emojier = null;
|
||||
return;
|
||||
|
|
Загрузка…
Ссылка в новой задаче