Merge lp:~gotwig/simple-scan/headerbars into lp:~simple-scan-team/simple-scan/trunk

Proposed by Eduard Gotwig
Status: Merged
Approved by: Robert Ancell
Approved revision: 725
Merged at revision: 706
Proposed branch: lp:~gotwig/simple-scan/headerbars
Merge into: lp:~simple-scan-team/simple-scan/trunk
Diff against target: 505 lines (+311/-26)
2 files modified
data/simple-scan.ui (+263/-13)
src/ui.vala (+48/-13)
To merge this branch: bzr merge lp:~gotwig/simple-scan/headerbars
Reviewer Review Type Date Requested Status
Robert Ancell Approve
Eduard Gotwig (community) Needs Resubmitting
Review via email: mp+220878@code.launchpad.net

Description of the change

Add headerbars; upcoming: add GtkActionBar

To post a comment you must log in.
lp:~gotwig/simple-scan/headerbars updated
711. By Eduard Gotwig

Adjust minimum size to headerbar dimensions

Revision history for this message
Eduard Gotwig (gotwig) wrote :

The bottom line is missing. I have no idea how to add it... Please help if you can.

lp:~gotwig/simple-scan/headerbars updated
712. By Eduard Gotwig

add buttons back; still canvas styling issue

Revision history for this message
Robert Ancell (robert-ancell) wrote :

The new layout looks nice! Thanks.

- You can't access the preferences unless the scan fails - you need to be able to access these before starting a scan.
- The rotate buttons seem the wrong way around to me; did you switch them for a particular reason?
- There are some document level options that are no longer accessible, i.e. page reordering, email. We should be able to access these somehow - a drop down menu of less frequent options?
- You can't stop the scan - I agree that stop shouldn't be a top-level option but there should be a visible way to cancel a scan while in progress (a button over the currently scanning page?). This is because scans can take a long time to complete.
- The bottom of the pages seems to be clipped. Is this what you mean by the bottom line comment?
- We need to support non-headerbar operation for Ubuntu so both methods need to work.
- For some reason running a test scan fails (run "simple-scan test" to use the test backend). I can't immediately see how your changes could affect it though.

review: Needs Fixing
Revision history for this message
Eduard Gotwig (gotwig) wrote :

Thanks for the feedback.

Could you take a look at the "bottom line issue"? I really have no idea how it works :)

I am trying to work on the other issues as good as I can.

Revision history for this message
Rico Tzschichholz (ricotz) wrote :

@gotwig: you can avoid a large amount of the diff if you drop the additiontal indentation of 4 spaces in the whole file

Revision history for this message
Eduard Gotwig (gotwig) wrote :

Some answers to your critics

- You can't access the preferences unless the scan fails - you need to be able to access these before starting a scan. Answer: I didt change this behaviour. It was like it was before.
- The rotate buttons seem the wrong way around to me; did you switch them for a particular reason?
Answer: you are right. I will do them the right way, and add them into a link box.
- There are some document level options that are no longer accessible, i.e. page reordering, email. We should be able to access these somehow - a drop down menu of less frequent options?
Answer: I dont understand. I changed nothing about this??

- You can't stop the scan - I agree that stop shouldn't be a top-level option but there should be a visible way to cancel a scan while in progress (a button over the currently scanning page?). This is because scans can take a long time to complete.
Answer: I will be working on this. I try to fix this with a normaly invisible button for STOP, becoming visible, when a scan is in progress, replacing the "scan" button.

- The bottom of the pages seems to be clipped. Is this what you mean by the bottom line comment?
Answer: I hope you can work on that. I tried long and got no result. But when I tried the testscan, which btw should be documented in the simplescan manpage pls!, the bottom line for new pages was indeed there.
- We need to support non-headerbar operation for Ubuntu so both methods need to work.
Answer: I try to work on this. So we get the classical Toolbar back for Ubuntu only?
- For some reason running a test scan fails (run "simple-scan test" to use the test backend). I can't immediately see how your changes could affect it though.
Answer: The test scan worked for me.

Revision history for this message
Eduard Gotwig (gotwig) wrote :

- There are some document level options that are no longer accessible, i.e. page reordering, email. We should be able to access these somehow - a drop down menu of less frequent options?
Answer: I get what you mean. I try to work on a gnome headerbar solution for this.
Probably I will create a dropdown, and put all document-related actions in there, to save space.

So I will add rotate and cut there too.

lp:~gotwig/simple-scan/headerbars updated
713. By Eduardd Gotwig <email address hidden>

Added stop mechanism; introduced deprecated .UI file for deskop environments which not support GTK > 3.10 features
Added all actions to the headerbar, which were before in the menubar, linked rotate buttons

714. By Eduardd Gotwig <email address hidden>

Last commit contained Manpage change, to add [test] to the manpage (sry I forgot to note this)
Now both interfaces should work as expected; fixed deprecated crop button

715. By Eduardd Gotwig <email address hidden>

Update icons; reset deprecated UI icon

716. By Eduardd Gotwig <email address hidden>

Update icon again

Revision history for this message
Eduard Gotwig (gotwig) wrote :

I would be happy if you could take a look at it again.

review: Needs Resubmitting
Revision history for this message
Robert Ancell (robert-ancell) wrote :

Thanks Eduard! Patch is improving.

I was using the new Launchpad support for inline comments, I'm guessing they didn't show for you.

Things still needing fixing:
- Duplicating the whole .ui file for showing the HeaderBar is too hard to maintain. The .ui should contain a HeaderBar, menu and toolbar. For Systems that support it the HeaderBar should be shown and the menu and toolbar hidden. The opposite for systems that do not support HeaderBars.
- While you have added back some missing buttons to access document level functions there is still not a way to access preferences. Also, it looks very cluttered - did you investigate putting the less used options into a menu?
- You changed the return value of button_cb in book-view.vala to return true instead of false. Was there a reason for this change?
- You have some tab characters where they should be spaces
- You've changed the default window size but this doesn't seem necessary for this patch - does it not look correct with the existing defaults?

As Rico said, please investigate if you can make the .ui files easier to diff. It is very hard to review the changes as they are currently (a big downside of using .ui files :( ).

I think the bottom being clipped off the page is due to the border size changes. I will have a look later when I have time (I am currently travelling).

review: Needs Fixing
Revision history for this message
Eduard Gotwig (gotwig) wrote :

I tried to not duplicate the .ui file, but (!), there is no way to enable/disable headerbars trough .ui logic. I tried it. What you have to do, is to remove the "type="titlebar" option from the <child> tag. You cant do this. I found no way to do this.

There is a way to access the preferences. There is an entry in the AppMenu for this. This is following GNOME HIG.

There was a reason for this change, because if I wouldnt have done this, there would be no right-click in the headerbar version. Try it yourself.

I have no idea how to do the spaces/tabs/indentation. Im sorry.

The window size thing should be reverted, I agree. But this is very easy todo. I experimented with this, because I wanted to enable the most minimium size by default for the window.

Thanks for your review. I think about howto put the less used actions into some submenu.

Revision history for this message
Michael Catanzaro (mike-catanzaro) wrote :

I think that if you want to add the header bar only conditionally, then you should not attempt to do so in the UI file at all; this is doomed. Create the header bar entirely in Vala, pack your buttons into it, then grab your GtkApplicationWindow out of the UI file using GtkBuilder in order to set it as the titlebar. It's much, much nicer to define the header bar in a UI file than in Vala, but only if you want to use it unconditionally. Mahjongg is probably the best example of how to do this in Vala: https://git.gnome.org/browse/gnome-mahjongg/tree/src/gnome-mahjongg.vala

P.S. To convert tabs to spaces, open the file in gedit, press Ctrl+H to do a search and replace, type \t in the search box and the desired number of spaces in the replace box.

P.S.S. Also, saving the toolbar toolbuttons and header bar toolbar buttons separately is not a good idea; note that Gtk.ToolButton is derived from Gtk.Button so you should not need two different variables.

Revision history for this message
Robert Ancell (robert-ancell) wrote :

I've pushed a branch to lp:~robert-ancell/simple-scan/optional-headerbar-ui that shows how you can have both the header bar and the toolbar in the same .ui file and conditionally use each one.

You disable the HeaderBar by using Gtk.Window.set_titlebar (null). This doesn't work in GTK+ 3.10 because it doesn't have [1] but I will backport that to Ubuntu.

I'm also open to changes that do the UI in the .vala files. Vala is not too bad at being concise in generating UI and it makes the patches easier to read.

[1] https://git.gnome.org/browse/gtk+/commit/?h=gtk-3-12&id=8db2ba425aaff107faaa4c7468be63f8ef2fa8e9

Revision history for this message
Robert Ancell (robert-ancell) wrote :

Regarding the size changes - these aren't the minimum sizes but the default size. The numbers you have chosen are probably related to the particular theme you are using and will probably change over time as the theme is changed.

I recommend removing these changes from this branch and they can be re-proposed as a later merge proposal. Smaller branches are easier to review.

Revision history for this message
Eduard Gotwig (gotwig) wrote :

Hey Robert,

I would welcome it, if you could take a look at this bug report as well.
https://bugs.launchpad.net/simple-scan/+bug/1325760

Its somewhat related to this headerbar change as well.

We could move the buttons from the headerbar, to a GtkActionBar. And its not so hard to do, I just dont know yet where to place it. Would be nice if you could take a look, and tell me where the right place would be to add a GtkActionBar as a child of a page for the book view.

lp:~gotwig/simple-scan/headerbars updated
717. By Eduard Gotwig <<email address hidden>

Merge lp:~robert-ancell/simple-scan/optional-headerbar-ui , revert commit nr 771

718. By Eduard Gotwig <<email address hidden>

Fix last merge with lp:~robert-ancell/simple-scan/optional-headerbar-ui

719. By Eduard Gotwig <<email address hidden>

Reset book-view border

720. By Eduard Gotwig <<email address hidden>

Revert /* Show pop-up menu on right click */ to return false again

721. By Eduard Gotwig <<email address hidden>

revert to old style, fix border problem

Revision history for this message
Eduard Gotwig (gotwig) wrote :

Good news: I finally fixed the border problem.

I can reproduce the problem with no image after a scan.

Revision history for this message
Eduard Gotwig (gotwig) wrote :

The part about the broken image scan functionality is a problem of simple scan trunk, master branch and not of this branch.

Revision history for this message
Robert Ancell (robert-ancell) wrote :

Please fix the whitespace changes in the .ui file - I've made p:~robert-ancell/simple-scan/headerbars-ui-whitespace with these fixed, please merge/copy in those changes.

Revision history for this message
Robert Ancell (robert-ancell) wrote :

Please drop the changes to the man page - they don't relate to this merge.

Note that 'simple-scan test' works because SANE has a 'test' driver compiled in by default. It's probably worth mentioning that in the man page, and not that it's not guaranteed to be provided. This should be a separate merge though.

Revision history for this message
Robert Ancell (robert-ancell) wrote :

Looking at the diff below you seem to have moved the app menu logic inside the try clause for no reason - please move it back to the original location. Also there is a whitespace change on line 2521 which doesn't seem relevant.

With those changes this diff should be the appropriate size for this enhancement.

Revision history for this message
Robert Ancell (robert-ancell) wrote :

A number of buttons don't work after these changes - it's because of the object renames you did in the .ui file - check references to these are updated both in the .ui file and in the .vala files.

Revision history for this message
Eduard Gotwig (gotwig) wrote :

I will update the button names. "Looking at the diff below you seem to have moved the app menu logic inside the try clause for no reason - please move it back to the original location. Also there is a whitespace change on line 2521 which doesn't seem relevant."

Ok, I did the app menu logic in another line, to not check twice for has_app_menu().

In your version, the part was missing where you actually add the appmenu.ui file if the application has an app_menu.

lp:~gotwig/simple-scan/headerbars updated
722. By Eduard Gotwig <<email address hidden>

remove whitespace with merge lp:~robert-ancell/simple-scan/headerbars-ui-whitespace; revert manpage change

723. By Eduard Gotwig <<email address hidden>

Fix buttonnames

Revision history for this message
Eduard Gotwig (gotwig) wrote :

Please check it again...

review: Needs Resubmitting
Revision history for this message
Eduard Gotwig (gotwig) wrote :

In your merge you replaced all my GtkButtons with GtkToolButtons again.
This is against the GNOME HIG, I have to disapprove this merge.

review: Disapprove
Revision history for this message
Robert Ancell (robert-ancell) wrote :

Thanks for fixing the .ui file indentation - it's much easier to read now.

You haven't done the replaces in src/ui.vala - for example on line 1670 there is a reference to "text_toolbutton_menuitem" but you've renamed it to "text_menuitem".

Please move the app menu logic back - there's no problem calling has_app_menu () more than once and it makes the try clause contain more code than necessary. We are only checking for UI load failures at this point.

btw You should change your review to "Approve" unless you disapprove of your own code!

Revision history for this message
Eduard Gotwig (gotwig) wrote :

I don't know if this is really the way to do buttons for the headerbar.
My version with a seperate UI files used GtkButtons instead of GtkToolButtons, and also, when I tested with Ubuntu 14.04, it worked. When I now test your version with the headerbar version, I see GtkToolButtons instead of GtkButtons, they look different. And also your version fails to work for me under Ubuntu 14.04. I dont see window rendering, only the content. I tried to remove every toolbutton from the new version.. thats the reason we have now these references without toolbutton ...

When I talked to users in GTK+ in IRC on GIMPNet, they actually told me that soon toolbars are going to be deprecated. I fear when this happens, we cant use GtkToolButtons anymore as well.

Revision history for this message
Robert Ancell (robert-ancell) wrote :

Eduard, you shouldn't need to modify any of the existing code. Your additions don't add GtkToolButtons, and the existing code continues to work as it did before.

Revision history for this message
Eduard Gotwig (gotwig) wrote :

I talk about wanting to use GtkButtons not GtkToolButtons

Revision history for this message
Robert Ancell (robert-ancell) wrote :

This merge request is "Add headerbars" - the current changes do that and don't add any use of GtkButton. The best way to make changes is to keep them as small as possible. If there's an issue with the existing use of GtkToolButton then this should be proposed in a separate merge.

Revision history for this message
Eduard Gotwig (gotwig) wrote :

Ok, I will sort out your issues soon and approve it.

lp:~gotwig/simple-scan/headerbars updated
724. By Eduard Gotwig <<email address hidden>

Clearer AppMenu Check logic

725. By Eduard Gotwig <<email address hidden>

Renamed buttonnames

Revision history for this message
Eduard Gotwig (gotwig) wrote :

I renamed the buttonnames, and added the old load appmenu logic back.

review: Needs Resubmitting
Revision history for this message
Robert Ancell (robert-ancell) wrote :

Eduard - my apologies I misread your comments regarding the less frequently used options. As you correctly stated they are in the appmenu (which wasn't showing in Unity when I was testing it). So I have removed those options and let the user use the appmenu instead.

I added the reorder pages to the appmenu as it was never added there.

Merged with fixed to the indentation added in your last commit.

Thanks for your work!

review: Approve
Revision history for this message
Robert Ancell (robert-ancell) wrote :

Also regarding the use of Launchpad - when you set the review field to "resubmit" you are asking yourself to resubmit the proposal (kind of sounds like you have a split personality). In Launchpad you should never need to review your own code - it's implied you approve of your own proposal!! Not a problem, just looks kind of funny :) It's a Launchpad UI bug I guess - a proposer should probably not see the review options since they're not applicable.

Resubmitting is a method of proposing where you can generate a new merge request for this proposal (obsoleting the current one). I don't know of any projects that use that since just making new commits and then merging when ready seems sufficient for me.

Revision history for this message
Robert Ancell (robert-ancell) wrote :

I opened bug 1330333 about the Launchpad UI issue.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/simple-scan.ui'
2--- data/simple-scan.ui 2014-04-14 03:59:00 +0000
3+++ data/simple-scan.ui 2014-06-15 15:40:52 +0000
4@@ -1,7 +1,6 @@
5 <?xml version="1.0" encoding="UTF-8"?>
6-<!-- Generated with glade 3.16.0 on Tue Nov 19 13:50:35 2013 -->
7 <interface>
8- <!-- interface-requires gtk+ 3.8 -->
9+ <!-- interface-requires gtk+ 3.10 -->
10 <object class="GtkDialog" id="authorize_dialog">
11 <property name="can_focus">False</property>
12 <property name="border_width">12</property>
13@@ -254,7 +253,7 @@
14 <property name="orientation">vertical</property>
15 <child>
16 <object class="GtkMenuBar" id="menubar">
17- <property name="visible">True</property>
18+ <property name="visible">False</property>
19 <property name="can_focus">False</property>
20 <child>
21 <object class="GtkMenuItem" id="document_menuitem">
22@@ -683,8 +682,8 @@
23 </packing>
24 </child>
25 <child>
26- <object class="GtkToolbar" id="toolbar1">
27- <property name="visible">True</property>
28+ <object class="GtkToolbar" id="toolbar">
29+ <property name="visible">False</property>
30 <property name="can_focus">False</property>
31 <style>
32 <class name="primary-toolbar"/>
33@@ -713,7 +712,7 @@
34 <property name="label" translatable="yes" comments="Label on scan toolbar item">Scan</property>
35 <property name="use_underline">True</property>
36 <property name="icon_name">scanner</property>
37- <property name="menu">scan_toolbutton_menu</property>
38+ <property name="menu">scan_button_menu</property>
39 <signal name="clicked" handler="scan_button_clicked_cb" swapped="no"/>
40 </object>
41 <packing>
42@@ -822,6 +821,258 @@
43 </child>
44 </object>
45 </child>
46+ <child type="titlebar">
47+ <object class="GtkHeaderBar" id="headerbar">
48+ <property name="visible">True</property>
49+ <property name="can_focus">False</property>
50+ <property name="vexpand">True</property>
51+ <property name="show_close_button">True</property>
52+ <property name="title" translatable="yes" comments="Title of scan window">Simple Scan</property>
53+ <style>
54+ <class name="titlebar"/>
55+ </style>
56+ <child>
57+ <object class="GtkBox" id="open_box">
58+ <property name="visible">True</property>
59+ <property name="orientation">horizontal</property>
60+ <property name="valign">center</property>
61+ <style>
62+ <class name="linked"/>
63+ </style>
64+ <child>
65+ <object class="GtkButton" id="stop_button">
66+ <property name="visible">false</property>
67+ <property name="tooltip_text" translatable="yes" comments="Tooltip for stop button">Stop the current scan</property>
68+ <property name="label" translatable="yes">Stop</property>
69+ <property name="use_underline">True</property>
70+ <signal name="clicked" handler="stop_scan_button_clicked_cb" swapped="no"/>
71+ <style>
72+ <class name="image-button"/>
73+ </style>
74+ <child>
75+ <object class="GtkImage" id="stop_image">
76+ <property name="visible">True</property>
77+ <property name="icon_size">1</property>
78+ <property name="icon_name">process-stop-symbolic</property>
79+ </object>
80+ </child>
81+ </object>
82+ </child>
83+ <child>
84+ <object class="GtkButton" id="scan_button">
85+ <property name="visible">True</property>
86+ <property name="tooltip_text" translatable="yes" comments="Tooltip for scan toolbar button">Scan a single page from the scanner</property>
87+ <property name="label" translatable="yes" comments="Label on scan toolbar item">Scan</property>
88+ <property name="use_underline">True</property>
89+ <signal name="clicked" handler="scan_button_clicked_cb" swapped="no"/>
90+ <style>
91+ <class name="text-button"/>
92+ </style>
93+ </object>
94+ </child>
95+ <child>
96+ <object class="GtkMenuButton" id="open_menu">
97+ <property name="visible">True</property>
98+ <property name="popup">scan_button_menu</property>
99+ <style>
100+ <class name="image-button"/>
101+ </style>
102+ </object>
103+ </child>
104+ </object>
105+ <packing>
106+ <property name="pack_type">start</property>
107+ </packing>
108+ </child>
109+ <child>
110+ <object class="GtkButton" id="save_button">
111+ <property name="visible">True</property>
112+ <property name="sensitive">False</property>
113+ <property name="can_focus">False</property>
114+ <property name="tooltip_text" translatable="yes" comments="Tooltip for save toolbar button">Save document to a file</property>
115+ <property name="use_underline">True</property>
116+ <signal name="clicked" handler="save_file_button_clicked_cb" swapped="no"/>
117+ <style>
118+ <class name="image-button"/>
119+ </style>
120+ <child>
121+ <object class="GtkImage" id="save_image">
122+ <property name="visible">True</property>
123+ <property name="icon_size">1</property>
124+ <property name="icon_name">document-save-symbolic</property>
125+ </object>
126+ </child>
127+ </object>
128+ <packing>
129+ </packing>
130+ </child>
131+ <child>
132+ <object class="GtkButton" id="new_button">
133+ <property name="visible">True</property>
134+ <property name="can_focus">False</property>
135+ <property name="tooltip_text" translatable="yes" comments="Tooltip for new document button">Start a new document</property>
136+ <property name="use_underline">True</property>
137+ <signal name="clicked" handler="new_button_clicked_cb" swapped="no"/>
138+ <style>
139+ <class name="image-button"/>
140+ </style>
141+ <child>
142+ <object class="GtkImage" id="new_image">
143+ <property name="visible">True</property>
144+ <property name="icon_size">1</property>
145+ <property name="icon_name">document-new-symbolic</property>
146+ </object>
147+ </child>
148+ </object>
149+ <packing>
150+ </packing>
151+ </child>
152+ <child>
153+ <object class="GtkBox" id="rotate_box">
154+ <property name="visible">True</property>
155+ <property name="orientation">horizontal</property>
156+ <property name="valign">center</property>
157+ <style>
158+ <class name="linked"/>
159+ </style>
160+ <child>
161+ <object class="GtkButton" id="rotate_right_button">
162+ <property name="visible">True</property>
163+ <property name="can_focus">False</property>
164+ <property name="tooltip_text" translatable="yes" comments="Tooltip for rotate right (clockwise) button">Rotate the page to the right (clockwise)</property>
165+ <property name="use_underline">True</property>
166+ <signal name="clicked" handler="rotate_right_button_clicked_cb" swapped="no"/>
167+ <style>
168+ <class name="image-button"/>
169+ </style>
170+ <child>
171+ <object class="GtkImage" id="objectrotateright-button">
172+ <property name="visible">True</property>
173+ <property name="icon_size">1</property>
174+ <property name="icon_name">object-rotate-right-symbolic</property>
175+ </object>
176+ </child>
177+ </object>
178+ <packing>
179+ <property name="pack_type">end</property>
180+ </packing>
181+ </child>
182+ <child>
183+ <object class="GtkButton" id="rotate_left_button">
184+ <property name="visible">True</property>
185+ <property name="can_focus">False</property>
186+ <property name="tooltip_text" translatable="yes" comments="Tooltip for rotate left (counter-clockwise) button">Rotate the page to the left (counter-clockwise)</property>
187+ <property name="use_underline">True</property>
188+ <signal name="clicked" handler="rotate_left_button_clicked_cb" swapped="no"/>
189+ <style>
190+ <class name="image-button"/>
191+ </style>
192+ <child>
193+ <object class="GtkImage" id="objectrotateleft-button">
194+ <property name="visible">True</property>
195+ <property name="icon_size">1</property>
196+ <property name="icon_name">object-rotate-left-symbolic</property>
197+ </object>
198+ </child>
199+ </object>
200+ <packing>
201+ <property name="pack_type">end</property>
202+ </packing>
203+ </child>
204+ </object>
205+ <packing>
206+ <property name="pack_type">end</property>
207+ </packing>
208+ </child>
209+ <child>
210+ <object class="GtkToggleButton" id="crop_button">
211+ <property name="visible">True</property>
212+ <property name="can_focus">False</property>
213+ <property name="tooltip_text" translatable="yes">Crop the selected page</property>
214+ <property name="use_underline">True</property>
215+ <signal name="toggled" handler="crop_button_toggled_cb" swapped="no"/>
216+ <style>
217+ <class name="image-button"/>
218+ </style>
219+ <child>
220+ <object class="GtkImage" id="objectcrop-button">
221+ <property name="visible">True</property>
222+ <property name="icon_size">1</property>
223+ <property name="icon_name">edit-cut-symbolic</property>
224+ </object>
225+ </child>
226+ </object>
227+ <packing>
228+ <property name="pack_type">end</property>
229+ </packing>
230+ </child>
231+ <child>
232+ <object class="GtkButton" id="email_button">
233+ <property name="visible">True</property>
234+ <property name="can_focus">False</property>
235+ <property name="use_underline">True</property>
236+ <signal name="clicked" handler="email_button_clicked_cb" swapped="no"/>
237+ <style>
238+ <class name="image-button"/>
239+ </style>
240+ <child>
241+ <object class="GtkImage" id="objectemail-button">
242+ <property name="visible">True</property>
243+ <property name="icon_size">1</property>
244+ <property name="icon_name">document-send-symbolic</property>
245+ </object>
246+ </child>
247+ </object>
248+ <packing>
249+ <property name="pack_type">end</property>
250+ </packing>
251+ </child>
252+ <child>
253+ <object class="GtkButton" id="print_button">
254+ <property name="visible">True</property>
255+ <property name="can_focus">False</property>
256+ <property name="use_underline">True</property>
257+ <signal name="clicked" handler="print_button_clicked_cb" swapped="no"/>
258+ <style>
259+ <class name="image-button"/>
260+ </style>
261+ <child>
262+ <object class="GtkImage" id="objectprint-button">
263+ <property name="visible">True</property>
264+ <property name="icon_size">1</property>
265+ <property name="icon_name">document-print</property>
266+ </object>
267+ </child>
268+ </object>
269+ <packing>
270+ <property name="pack_type">end</property>
271+ </packing>
272+ </child>
273+ <child>
274+ <object class="GtkButton" id="reorder_button">
275+ <property name="visible">True</property>
276+ <property name="can_focus">False</property>
277+ <property name="use_underline">True</property>
278+ <signal name="clicked" handler="reorder_menuitem_activate_cb" swapped="no"/>
279+ <style>
280+ <class name="image-button"/>
281+ </style>
282+ <child>
283+ <object class="GtkImage" id="objectreorder-button">
284+ <property name="visible">True</property>
285+ <property name="icon_size">1</property>
286+ <property name="icon_name">view-paged-symbolic</property>
287+ </object>
288+ </child>
289+ </object>
290+ <packing>
291+ <property name="pack_type">end</property>
292+ </packing>
293+ </child>
294+ </object>
295+ <packing>
296+ </packing>
297+ </child>
298 </object>
299 <object class="GtkListStore" id="text_dpi_store">
300 <columns>
301@@ -903,7 +1154,6 @@
302 <property name="can_focus">False</property>
303 <property name="hexpand">True</property>
304 <property name="model">device_store</property>
305- <property name="button_sensitivity">on</property>
306 <signal name="changed" handler="device_combo_changed_cb" swapped="no"/>
307 </object>
308 <packing>
309@@ -1138,11 +1388,11 @@
310 <action-widget response="1">preferences_close_button</action-widget>
311 </action-widgets>
312 </object>
313- <object class="GtkMenu" id="scan_toolbutton_menu">
314+ <object class="GtkMenu" id="scan_button_menu">
315 <property name="visible">True</property>
316 <property name="can_focus">False</property>
317 <child>
318- <object class="GtkMenuItem" id="scan_single_toolbutton_menuitem">
319+ <object class="GtkMenuItem" id="scan_single_button_menuitem">
320 <property name="visible">True</property>
321 <property name="can_focus">False</property>
322 <property name="label" translatable="yes" comments="Toolbar scan menu item to scan a single page from the scanner">Single _Page</property>
323@@ -1151,7 +1401,7 @@
324 </object>
325 </child>
326 <child>
327- <object class="GtkMenuItem" id="scan_all_toolbutton_menuitem">
328+ <object class="GtkMenuItem" id="scan_all_button_menuitem">
329 <property name="visible">True</property>
330 <property name="can_focus">False</property>
331 <property name="label" translatable="yes" comments="Toolbar scan menu item to scan all pages from a document feeder">All Pages From _Feeder</property>
332@@ -1166,7 +1416,7 @@
333 </object>
334 </child>
335 <child>
336- <object class="GtkRadioMenuItem" id="text_toolbutton_menuitem">
337+ <object class="GtkRadioMenuItem" id="text_button_menuitem">
338 <property name="visible">True</property>
339 <property name="can_focus">False</property>
340 <property name="label" translatable="yes">Text</property>
341@@ -1176,14 +1426,14 @@
342 </object>
343 </child>
344 <child>
345- <object class="GtkRadioMenuItem" id="photo_toolbutton_menuitem">
346+ <object class="GtkRadioMenuItem" id="photo_button_menuitem">
347 <property name="visible">True</property>
348 <property name="can_focus">False</property>
349 <property name="label" translatable="yes">Photo</property>
350 <property name="use_underline">True</property>
351 <property name="active">True</property>
352 <property name="draw_as_radio">True</property>
353- <property name="group">text_toolbutton_menuitem</property>
354+ <property name="group">text_button_menuitem</property>
355 <signal name="toggled" handler="photo_menuitem_toggled_cb" swapped="no"/>
356 </object>
357 </child>
358
359=== modified file 'src/ui.vala'
360--- src/ui.vala 2014-04-14 23:46:26 +0000
361+++ src/ui.vala 2014-06-15 15:40:52 +0000
362@@ -1,6 +1,7 @@
363 /*
364 * Copyright (C) 2009-2011 Canonical Ltd.
365- * Author: Robert Ancell <robert.ancell@canonical.com>
366+ * Author: Robert Ancell <robert.ancell@canonical.com>,
367+ * Eduard Gotwig <g@ox.io>
368 *
369 * This program is free software: you can redistribute it and/or modify it under
370 * the terms of the GNU General Public License as published by the Free Software
371@@ -33,7 +34,6 @@
372
373 private Gtk.ApplicationWindow window;
374 private GLib.MenuModel app_menu;
375- private Gtk.MenuBar menubar;
376 private Gtk.Box main_vbox;
377 private Gtk.InfoBar info_bar;
378 private Gtk.Image info_bar_image;
379@@ -47,9 +47,12 @@
380 private Gtk.MenuItem save_menuitem;
381 private Gtk.MenuItem save_as_menuitem;
382 private Gtk.MenuItem copy_to_clipboard_menuitem;
383+ private Gtk.Button save_button;
384 private Gtk.ToolButton save_toolbutton;
385 private Gtk.MenuItem stop_menuitem;
386 private Gtk.ToolButton stop_toolbutton;
387+ private Gtk.Button stop_button;
388+ private Gtk.Button scan_button;
389
390 private Gtk.RadioMenuItem text_toolbar_menuitem;
391 private Gtk.RadioMenuItem text_menu_menuitem;
392@@ -126,6 +129,8 @@
393 page_delete_menuitem.sensitive = !value;
394 stop_menuitem.sensitive = value;
395 stop_toolbutton.sensitive = value;
396+ scan_button.visible = !value;
397+ stop_button.visible = value;
398 }
399 }
400
401@@ -897,9 +902,12 @@
402
403 var menuitem = builder.get_object (name) as Gtk.RadioMenuItem;
404 menuitem.active = true;
405- var toolbutton = builder.get_object ("crop_toolbutton") as Gtk.ToggleToolButton;
406- toolbutton.active = page.has_crop;
407+ var crop_button = builder.get_object ("crop_button") as Gtk.ToggleButton;
408+ crop_button.active = page.has_crop;
409
410+ var crop_toolbutton = builder.get_object ("crop_toolbutton") as Gtk.ToggleToolButton;
411+ crop_toolbutton.active = page.has_crop;
412+
413 updating_page_menu = false;
414 }
415
416@@ -1003,6 +1011,20 @@
417 set_crop ("custom");
418 }
419
420+ [CCode (cname = "G_MODULE_EXPORT crop_button_toggled_cb", instance_pos = -1)]
421+ public void crop_button_toggled_cb (Gtk.ToggleButton widget)
422+ {
423+ if (updating_page_menu)
424+ return;
425+
426+ Gtk.RadioMenuItem menuitem;
427+ if (widget.active)
428+ menuitem = builder.get_object ("custom_crop_menuitem") as Gtk.RadioMenuItem;
429+ else
430+ menuitem = builder.get_object ("no_crop_menuitem") as Gtk.RadioMenuItem;
431+ menuitem.active = true;
432+ }
433+
434 [CCode (cname = "G_MODULE_EXPORT crop_toolbutton_toggled_cb", instance_pos = -1)]
435 public void crop_toolbutton_toggled_cb (Gtk.ToggleToolButton widget)
436 {
437@@ -1564,6 +1586,7 @@
438 private void needs_saving_cb (Book book)
439 {
440 save_menuitem.sensitive = book.needs_saving;
441+ save_button.sensitive = book.needs_saving;
442 save_toolbutton.sensitive = book.needs_saving;
443 if (book.needs_saving)
444 save_as_menuitem.sensitive = true;
445@@ -1598,8 +1621,11 @@
446 try
447 {
448 builder.add_from_resource ("/org/gnome/SimpleScan/simple-scan.ui");
449- if (has_app_menu (app))
450- builder.add_from_resource ("/org/gnome/SimpleScan/simple-scan-menu.ui");
451+ if (has_app_menu (app))
452+ {
453+ builder.add_from_resource ("/org/gnome/SimpleScan/simple-scan-menu.ui");
454+ }
455+
456 }
457 catch (Error e)
458 {
459@@ -1612,16 +1638,22 @@
460 }
461 builder.connect_signals (this);
462
463- window = builder.get_object ("simple_scan_window") as Gtk.ApplicationWindow;
464- app.add_window (window);
465- menubar = builder.get_object ("menubar") as Gtk.MenuBar;
466+ window = builder.get_object ("simple_scan_window") as Gtk.ApplicationWindow;
467 if (has_app_menu (app))
468 {
469 app_menu = builder.get_object ("appmenu") as GLib.MenuModel;
470 app.add_action_entries (action_entries, this);
471 app.app_menu = app_menu;
472- menubar.visible = false;
473- }
474+ }
475+ else
476+ {
477+ window.set_titlebar (null);
478+ var menubar = builder.get_object ("menubar") as Gtk.MenuBar;
479+ menubar.visible = true;
480+ var toolbar = builder.get_object ("toolbar") as Gtk.Toolbar;
481+ toolbar.visible = true;
482+ }
483+ app.add_window (window);
484 main_vbox = builder.get_object ("main_vbox") as Gtk.Box;
485 page_move_left_menuitem = builder.get_object ("page_move_left_menuitem") as Gtk.MenuItem;
486 page_move_right_menuitem = builder.get_object ("page_move_right_menuitem") as Gtk.MenuItem;
487@@ -1630,13 +1662,16 @@
488 save_menuitem = builder.get_object ("save_menuitem") as Gtk.MenuItem;
489 save_as_menuitem = builder.get_object ("save_as_menuitem") as Gtk.MenuItem;
490 copy_to_clipboard_menuitem = builder.get_object ("copy_to_clipboard_menuitem") as Gtk.MenuItem;
491+ save_button = builder.get_object ("save_button") as Gtk.Button;
492 save_toolbutton = builder.get_object ("save_toolbutton") as Gtk.ToolButton;
493 stop_menuitem = builder.get_object ("stop_scan_menuitem") as Gtk.MenuItem;
494+ stop_button = builder.get_object ("stop_button") as Gtk.Button;
495 stop_toolbutton = builder.get_object ("stop_toolbutton") as Gtk.ToolButton;
496+ scan_button = builder.get_object ("scan_button") as Gtk.Button;
497
498- text_toolbar_menuitem = builder.get_object ("text_toolbutton_menuitem") as Gtk.RadioMenuItem;
499+ text_toolbar_menuitem = builder.get_object ("text_button_menuitem") as Gtk.RadioMenuItem;
500 text_menu_menuitem = builder.get_object ("text_menuitem") as Gtk.RadioMenuItem;
501- photo_toolbar_menuitem = builder.get_object ("photo_toolbutton_menuitem") as Gtk.RadioMenuItem;
502+ photo_toolbar_menuitem = builder.get_object ("photo_button_menuitem") as Gtk.RadioMenuItem;
503 photo_menu_menuitem = builder.get_object ("photo_menuitem") as Gtk.RadioMenuItem;
504
505 authorize_dialog = builder.get_object ("authorize_dialog") as Gtk.Dialog;

Subscribers

People subscribed via source and target branches