From d8006d3987034f51ee84f034fb5c9cb33195600d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Mon, 19 Jan 2015 09:43:17 +0100 Subject: Imported Upstream version 3.15.4 --- src/ui.vala | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) (limited to 'src/ui.vala') diff --git a/src/ui.vala b/src/ui.vala index 2117a9a..c12b1cd 100644 --- a/src/ui.vala +++ b/src/ui.vala @@ -682,11 +682,10 @@ public class UserInterface : Gtk.ApplicationWindow return true; else return false; - case Gtk.ResponseType.CANCEL: - return false; case Gtk.ResponseType.NO: - default: return true; + default: + return false; } } @@ -1660,16 +1659,6 @@ public class UserInterface : Gtk.ApplicationWindow copy_to_clipboard_menuitem.sensitive = true; } - private bool shell_shows_menubar - { - get - { - bool shell_shows_menubar; - Gtk.Settings.get_default ().get ("gtk-shell-shows-menubar", out shell_shows_menubar); - return shell_shows_menubar; - } - } - private void load () { Gtk.IconTheme.get_default ().append_search_path (ICON_DIR); @@ -1678,7 +1667,13 @@ public class UserInterface : Gtk.ApplicationWindow var app = Application.get_default () as Gtk.Application; - if (!shell_shows_menubar) + if (is_desktop ("Unity") || is_desktop ("XFCE")) + { + set_titlebar (null); + menubar.visible = true; + toolbar.visible = true; + } + else { app.add_action_entries (action_entries, this); @@ -1717,12 +1712,6 @@ public class UserInterface : Gtk.ApplicationWindow app.add_accelerator ("F1", "app.help", null); app.add_accelerator ("Q", "app.quit", null); } - else - { - set_titlebar (null); - menubar.visible = true; - toolbar.visible = true; - } app.add_window (this); /* Add InfoBar (not supported in Glade) */ @@ -1867,7 +1856,20 @@ public class UserInterface : Gtk.ApplicationWindow progress_dialog = new ProgressBarDialog (this, _("Saving document...")); book.saving.connect (book_saving_cb); } - + + private bool is_desktop (string name) + { + var desktop_name_list = Environment.get_variable ("XDG_CURRENT_DESKTOP"); + if (desktop_name_list == null) + return false; + + foreach (var n in desktop_name_list.split (":")) + if (n == name) + return true; + + return false; + } + private string state_filename { owned get { return Path.build_filename (Environment.get_user_cache_dir (), "simple-scan", "state"); } -- cgit v1.2.3