simple-scan-team team mailing list archive
-
simple-scan-team team
-
Mailing list archive
-
Message #00881
[Merge] lp:~teemperor/simple-scan/elementary-ui into lp:simple-scan
Raphael Isemann has proposed merging lp:~teemperor/simple-scan/elementary-ui into lp:simple-scan.
Requested reviews:
Simple Scan Development Team (simple-scan-team)
For more details, see:
https://code.launchpad.net/~teemperor/simple-scan/elementary-ui/+merge/147199
I changed the UI as seen here ( https://lists.launchpad.net/elementary-dev-community/msg01568.html ) to meet the elementary-HIG.
My code shouldn't affect simple-scan on other desktops then pantheon in any way.
I get the DE-name from the DESKTOP_SESSION variable, so to test the changes from another distribution you need to run "export DESKTOP_SESSION=pantheon" before executing simple-scan (from the same shell as the export-command).
New dependencies are only the granite library.
For quick feedback i'm also available on #elementary-dev (freenode) as "teemperor".
Have a nice evening!
--
https://code.launchpad.net/~teemperor/simple-scan/elementary-ui/+merge/147199
Your team Simple Scan Development Team is requested to review the proposed merge of lp:~teemperor/simple-scan/elementary-ui into lp:simple-scan.
=== modified file 'configure.ac'
--- configure.ac 2013-01-19 02:45:11 +0000
+++ configure.ac 2013-02-07 18:13:26 +0000
@@ -28,6 +28,7 @@
gdk-pixbuf-2.0
gudev-1.0
sqlite3
+ granite
])
PKG_CHECK_MODULES(COLORD, [
=== modified file 'src/Makefile.am'
--- src/Makefile.am 2012-02-03 20:49:21 +0000
+++ src/Makefile.am 2013-02-07 18:13:26 +0000
@@ -19,7 +19,8 @@
--pkg=gudev-1.0 \
--pkg=gio-2.0 \
--pkg=gtk+-3.0 \
- --pkg=sqlite3
+ --pkg=sqlite3 \
+ --pkg=granite
if HAVE_COLORD
simple_scan_VALAFLAGS += -D HAVE_COLORD
=== modified file 'src/ui.vala'
--- src/ui.vala 2013-01-19 02:45:11 +0000
+++ src/ui.vala 2013-02-07 18:13:26 +0000
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2009-2011 Canonical Ltd.
- * Author: Robert Ancell <robert.ancell@xxxxxxxxxxxxx>
- *
+ * Authors: Robert Ancell <robert.ancell@xxxxxxxxxxxxx>
+ * Raphael Isemann <teemperor@xxxxxxxxxxxxxx>
* 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, either version 3 of the License, or (at your option) any later
@@ -92,6 +92,9 @@
private int window_height;
private bool window_is_maximized;
+ //indicates if the current enviroment is the pantheon shell
+ private bool is_pantheon;
+
public signal void start_scan (string? device, ScanOptions options);
public signal void stop_scan ();
public signal void email (string profile);
@@ -104,9 +107,13 @@
settings = new Settings ("org.gnome.SimpleScan");
+ string? env = Environment.get_variable("DESKTOP_SESSION");
+ is_pantheon = (env == "pantheon");
+
load ();
autosave_manager = AutosaveManager.create (ref book);
+
}
~UserInterface ()
@@ -1095,8 +1102,29 @@
/* Description of program */
string description = _("Simple document scanning tool");
-
- Gtk.show_about_dialog (window,
+ if(is_pantheon)
+ Granite.Widgets.show_about_dialog ((Gtk.Window) widget,
+ "program_name", "Simple Scan with elementary UI",
+ "version", VERSION,
+ "logo_icon_name", "scanner",
+
+ "comments", description,
+ "copyright", "2009-2011 Canonical Ltd.",
+ "website", "https://launchpad.net/elementary-scan",
+ "website_label", "Website",
+
+ "authors", authors,
+ //"documenters", about_documenters,
+ //"artists", about_artists,
+ "translator_credits", _("translator-credits"),
+ "license", license,
+ "license_type", Gtk.License.GPL_3_0,
+
+ "help", "https://answers.launchpad.net/elementary-scan",
+ "translate", "https://translations.launchpad.net/simple-scan",
+ "bug", "https://bugs.launchpad.net/elementary-scan");
+ else
+ Gtk.show_about_dialog (window,
"title", title,
"program-name", "Simple Scan",
"version", VERSION,
@@ -1109,6 +1137,7 @@
"license", license,
"wrap-license", true,
null);
+
}
private bool on_quit ()
@@ -1316,6 +1345,44 @@
photo_toolbar_menuitem = (Gtk.RadioMenuItem) builder.get_object ("photo_toolbutton_menuitem");
photo_menu_menuitem = (Gtk.RadioMenuItem) builder.get_object ("photo_menuitem");
+ if(is_pantheon) {
+ //hide the menubar to follow elementary-guidelines
+ var menubar = (Gtk.MenuBar) builder.get_object ("menubar");
+ menubar.hide();
+
+ //unparent menuitems that we want in the appmenu
+ var crop_menuitem = (Gtk.MenuItem) builder.get_object ("crop_menuitem");
+ crop_menuitem.unparent ();
+ var content_menuitem = (Gtk.MenuItem) builder.get_object ("help_contents_menuitem");
+ content_menuitem.unparent ();
+ var about_menuitem = (Gtk.MenuItem) builder.get_object ("about_menuitem");
+ about_menuitem.unparent ();
+ var preferences_menuitem = (Gtk.MenuItem) builder.get_object ("preferences_menuitem");
+ preferences_menuitem.unparent ();
+
+ //build the appmenu
+ var menu = new Gtk.Menu ();
+ menu.append (crop_menuitem);
+ menu.append (preferences_menuitem);
+ menu.append (new Gtk.SeparatorMenuItem ());
+ menu.append (content_menuitem);
+ menu.append (about_menuitem);
+
+ var appmenu = new Granite.Widgets.ToolButtonWithMenu.from_stock (
+ Gtk.Stock.PROPERTIES, Gtk.IconSize.MENU, _("Menu"), menu);
+ var appmenu_toolitem = new Gtk.ToolItem ();
+ appmenu_toolitem.add (appmenu);
+
+ //create a spacer to align the elementary-menuitems on the right side
+ var spacer = new Gtk.ToolItem ();
+ spacer.set_expand (true);
+
+ var toolbar = (Gtk.Toolbar) builder.get_object ("toolbar1");
+ toolbar.insert (spacer, 8);
+ toolbar.insert (appmenu_toolitem, 9);
+ toolbar.show_all ();
+ }
+
authorize_dialog = (Gtk.Dialog) builder.get_object ("authorize_dialog");
authorize_label = (Gtk.Label) builder.get_object ("authorize_label");
username_entry = (Gtk.Entry) builder.get_object ("username_entry");
Follow ups