Merge lp:~artem-anufrij/scratch/button-aligment-to-the-right-side into lp:~elementary-apps/scratch/scratch

Proposed by Artem Anufrij
Status: Merged
Approved by: Robert Roth
Approved revision: 1424
Merged at revision: 1425
Proposed branch: lp:~artem-anufrij/scratch/button-aligment-to-the-right-side
Merge into: lp:~elementary-apps/scratch/scratch
Diff against target: 76 lines (+16/-16)
2 files modified
plugins/browser-preview/browser-preview.vala (+15/-15)
plugins/terminal/terminal.vala (+1/-1)
To merge this branch: bzr merge lp:~artem-anufrij/scratch/button-aligment-to-the-right-side
Reviewer Review Type Date Requested Status
Robert Roth (community) code Approve
Danielle Foré ux Approve
Review via email: mp+243600@code.launchpad.net

Commit message

Align plugin toolbar buttons to the right side (lp:1398965)

Description of the change

Plugin buttons was aligned to the right side. Browser Preview button was changed to a ToggleToolButton.

https://launchpadlibrarian.net/191787737/Screenshot%20from%202014-12-03%2023%3A09%3A30.png

To post a comment you must log in.
Revision history for this message
Danielle Foré (danrabbit) wrote :

UX approve :)

review: Approve (ux)
Revision history for this message
Robert Roth (evfool) wrote :

Code looks clean and does the job well, code approved, UX already approved, so approving branch.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/browser-preview/browser-preview.vala'
2--- plugins/browser-preview/browser-preview.vala 2014-12-03 21:01:42 +0000
3+++ plugins/browser-preview/browser-preview.vala 2014-12-03 22:06:35 +0000
4@@ -25,7 +25,7 @@
5
6 public class BrowserPreviewPlugin : Peas.ExtensionBase, Peas.Activatable {
7
8- Gtk.ToolButton? tool_button = null;
9+ Gtk.ToggleToolButton? tool_button = null;
10 GLib.HashTable<Scratch.Services.Document, BrowserPreview.BrowserView> previews = new GLib.HashTable<Scratch.Services.Document, BrowserPreview.BrowserView> (null, null);
11
12 BrowserPreview.BrowserView? view = null;
13@@ -80,14 +80,14 @@
14 return;
15
16 var icon = new Gtk.Image.from_icon_name ("emblem-web", Gtk.IconSize.LARGE_TOOLBAR);
17- tool_button = new Gtk.ToolButton (icon, _("Get preview!"));
18- tool_button.tooltip_text = _("Hide preview");
19- tool_button.clicked.connect (toggle_plugin_visibility);
20-
21- icon.show ();
22- tool_button.show ();
23-
24- toolbar.pack_start (tool_button);
25+ tool_button = new Gtk.ToggleToolButton ();
26+ tool_button.set_icon_widget (icon);
27+ tool_button.tooltip_text = _("Hide Preview");
28+ tool_button.toggled.connect (toggle_plugin_visibility);
29+
30+ tool_button.show_all ();
31+
32+ toolbar.pack_end (tool_button);
33 }
34
35 void on_hook_context (Gtk.Notebook notebook) {
36@@ -100,12 +100,12 @@
37 }
38
39 void toggle_plugin_visibility () {
40- if (notebook.page_num (view.paned) == -1) {
41- notebook.set_current_page (notebook.append_page (view.paned, new Gtk.Label (_("Web preview"))));
42- tool_button.tooltip_text = _("Hide preview");
43+ if (tool_button.active) {
44+ notebook.set_current_page (notebook.append_page (view.paned, new Gtk.Label (_("Web Preview"))));
45+ tool_button.tooltip_text = _("Hide Preview");
46 } else {
47 notebook.remove (view.paned);
48- tool_button.tooltip_text = _("Show preview");
49+ tool_button.tooltip_text = _("Show Preview");
50 }
51 }
52
53@@ -143,8 +143,8 @@
54 view.paned.show_all ();
55
56 // Check if removed tab was visible
57- if (tab_page_number > -1) {
58- notebook.insert_page (view.paned, new Gtk.Label (_("Web preview")), tab_page_number);
59+ if (tool_button.active) {
60+ notebook.insert_page (view.paned, new Gtk.Label (_("Web Preview")), tab_page_number);
61
62 // Select new tab if the removed tab was selected
63 if (tab_is_selected)
64
65=== modified file 'plugins/terminal/terminal.vala'
66--- plugins/terminal/terminal.vala 2014-12-03 20:42:30 +0000
67+++ plugins/terminal/terminal.vala 2014-12-03 22:06:35 +0000
68@@ -156,7 +156,7 @@
69
70 toolbutton.show_all ();
71
72- toolbar.pack_start (toolbutton);
73+ toolbar.pack_end (toolbutton);
74 }
75
76 void on_hook_notebook () {

Subscribers

People subscribed via source and target branches