Merge lp:~artem-anufrij/scratch/Bugfix-1386443 into lp:~elementary-apps/scratch/scratch

Proposed by Artem Anufrij
Status: Merged
Approved by: Danielle Foré
Approved revision: 1401
Merged at revision: 1399
Proposed branch: lp:~artem-anufrij/scratch/Bugfix-1386443
Merge into: lp:~elementary-apps/scratch/scratch
Diff against target: 381 lines (+74/-74)
2 files modified
plugins/pastebin/pastebin_dialog.vala (+57/-57)
src/MainWindow.vala (+17/-17)
To merge this branch: bzr merge lp:~artem-anufrij/scratch/Bugfix-1386443
Reviewer Review Type Date Requested Status
Danielle Foré Needs Fixing
Review via email: mp+240054@code.launchpad.net

Commit message

Gtk.Stock replaced with named icons

Description of the change

Gtk.Stock replaced with named icons

To post a comment you must log in.
1399. By artem-anufrij

clipboard-icon

Revision history for this message
Danielle Foré (danrabbit) wrote :

There are still two stock items in the pastebin plugin on lines 360 and 362

Revision history for this message
Danielle Foré (danrabbit) wrote :

in plugins/pastebin/pastebin_dialog.vala

Revision history for this message
Danielle Foré (danrabbit) wrote :

Gtk.Stock.Quit -> application-exit
Gtk.Stock.Preferences -> preferences-desktop
Gtk.Stock.Fullscreen -> view-fullscreen

review: Needs Fixing
1400. By artem-anufrij

some changes (see merge comments)

1401. By artem-anufrij

some changes (see merge comments)

Revision history for this message
Artem Anufrij (artem-anufrij) wrote :

Daniel,

done...

Revision history for this message
Danielle Foré (danrabbit) wrote :

please revert changing from spaces to tabs

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/pastebin/pastebin_dialog.vala'
2--- plugins/pastebin/pastebin_dialog.vala 2014-06-25 10:20:01 +0000
3+++ plugins/pastebin/pastebin_dialog.vala 2014-10-29 21:26:30 +0000
4@@ -1,21 +1,21 @@
5 // -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*-
6 /***
7 BEGIN LICENSE
8-
9+
10 Copyright (C) 2011-2012 Giulio Collura <random.cpp@gmail.com>
11- This program is free software: you can redistribute it and/or modify it
12- under the terms of the GNU Lesser General Public License version 3, as published
13+ This program is free software: you can redistribute it and/or modify it
14+ under the terms of the GNU Lesser General Public License version 3, as published
15 by the Free Software Foundation.
16-
17- This program is distributed in the hope that it will be useful, but
18- WITHOUT ANY WARRANTY; without even the implied warranties of
19- MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
20+
21+ This program is distributed in the hope that it will be useful, but
22+ WITHOUT ANY WARRANTY; without even the implied warranties of
23+ MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
24 PURPOSE. See the GNU General Public License for more details.
25-
26- You should have received a copy of the GNU General Public License along
27- with this program. If not, see <http://www.gnu.org/licenses/>
28-
29- END LICENSE
30+
31+ You should have received a copy of the GNU General Public License along
32+ with this program. If not, see <http://www.gnu.org/licenses/>
33+
34+ END LICENSE
35 ***/
36
37 using Gtk;
38@@ -25,7 +25,7 @@
39 namespace Scratch.Dialogs {
40
41 public class PasteBinDialog : Granite.Widgets.LightWindow {
42-
43+
44 public string[,] languages = {
45 //if default, code, desc, scratch-equivalent
46 {"n", "4cs", "4CS", ""},
47@@ -228,16 +228,16 @@
48 {"n", "yaml", "YAML", ""},
49 {"n", "z80", "Z80 Assembler", ""},
50 {"n", "zxbasic", "ZXBasic", ""} };
51-
52+
53 private Scratch.Services.Document doc;
54-
55+
56 private Box content;
57 private Box padding;
58
59 private Entry name_entry;
60 private ComboBoxText expiry_combo;
61 private CheckButton private_check;
62-
63+
64 private ComboBoxText format_combo;
65 private Window format_others_win;
66 private TreeView format_others_view;
67@@ -245,15 +245,15 @@
68
69 private Button send_button;
70
71-
72+
73 public PasteBinDialog (Gtk.Window? parent, Scratch.Services.Document doc) {
74- this.doc = doc;
75-
76+ this.doc = doc;
77+
78 if (parent != null)
79 this.set_transient_for (parent);
80 this.title = _("Share via PasteBin");
81 this.type_hint = Gdk.WindowTypeHint.DIALOG;
82-
83+
84 create_dialog ();
85
86 send_button.clicked.connect (send_button_clicked);
87@@ -279,26 +279,26 @@
88 format_combo = new ComboBoxText();
89 var format_button = new Button.with_label (_("Others..."));
90 format_button.clicked.connect (format_button_clicked);
91-
92+
93 //populate combo box
94 var sel_lang = doc.get_language_id ();
95 for (var i=0; i < languages.length[0]; i++) {
96-
97+
98 //insert all languages that are in the scratch combo, and also those that are marked with "y"
99 if ( (languages[i, 3] != "") || (languages[i, 0] == "y")) format_combo.append (languages[i, 1], languages[i, 2]);
100 //if the inserted language is selected in scratch combo, select it as default
101 if ( languages[i, 3] == sel_lang ) format_combo.set_active_id(languages[i, 1]);
102 }
103-
104+
105 //if no language is selected, select text as default
106 if (format_combo.get_active_id() == null) format_combo.set_active_id("text");
107-
108-
109+
110+
111 var format_box = new Box (Gtk.Orientation.HORIZONTAL, 28);
112 format_box.pack_start (format_label);
113 format_box.pack_start (format_combo);
114 format_box.pack_start (format_button);
115-
116+
117
118 expiry_combo = new ComboBoxText ();
119 populate_expiry_combo ();
120@@ -329,77 +329,77 @@
121 read_settings ();
122
123 show_all ();
124-
125+
126 send_button.grab_focus ();
127
128 }
129
130
131 private void format_button_clicked() {
132-
133+
134 format_others_win = new Window();
135 format_others_win.set_modal(true);
136 format_others_win.set_title(_("Other formats"));
137 format_others_win.set_default_size (250, 300);
138-
139+
140 format_others_view = new TreeView();
141 format_others_view.set_headers_visible(false);
142 format_store = new ListStore (2, typeof (string), typeof (string));
143 format_others_view.set_model (format_store);
144- format_others_view.insert_column_with_attributes (-1, "Language", new CellRendererText (), "text", 0);
145+ format_others_view.insert_column_with_attributes (-1, "Language", new CellRendererText (), "text", 0);
146
147 TreeIter iter;
148- for (var i=0; i < languages.length[0]; i++) {
149+ for (var i=0; i < languages.length[0]; i++) {
150 format_store.append (out iter);
151 format_store.set (iter, 0, languages[i, 2], 1, languages[i, 1]);
152 }
153
154 var format_others_scroll = new ScrolledWindow(null, null);
155 format_others_scroll.add(format_others_view);
156-
157- var format_others_ok = new Button.from_stock ("gtk-ok");
158- format_others_ok.clicked.connect (format_others_ok_clicked);
159- var format_others_cancel = new Button.from_stock ("gtk-cancel");
160+
161+ var format_others_ok = new Button.from_icon_name ("dialog-ok", IconSize.BUTTON);
162+ format_others_ok.clicked.connect (format_others_ok_clicked);
163+ var format_others_cancel = new Button.from_icon_name ("dialog-cancel", IconSize.BUTTON);
164 format_others_cancel.clicked.connect (format_others_cancel_clicked);
165 var format_others_buttons = new ButtonBox (Orientation.HORIZONTAL);
166 format_others_buttons.set_layout (ButtonBoxStyle.CENTER);
167 format_others_buttons.pack_start (format_others_cancel);
168 format_others_buttons.pack_start (format_others_ok);
169-
170+
171 var format_others_box = new Box (Gtk.Orientation.VERTICAL, 10);
172 format_others_box.pack_start (format_others_scroll);
173- format_others_box.pack_start (format_others_buttons);
174-
175+ format_others_box.pack_start (format_others_buttons);
176+
177 format_others_win.add (format_others_box);
178 format_others_win.show_all();
179-
180+
181 }
182-
183+
184 private void format_others_cancel_clicked() {
185 format_others_win.destroy();
186 }
187
188 private void format_others_ok_clicked() {
189-
190+
191 var selection = format_others_view.get_selection ();
192 TreeIter iter;
193 if (selection.get_selected (null, out iter) == true) {
194-
195+
196 Value lang_name;
197- Value lang_code;
198+ Value lang_code;
199 format_store.get_value(iter, 0, out lang_name);
200 format_store.get_value(iter, 1, out lang_code);
201-
202+
203 format_combo.append ((string) lang_code, (string) lang_name);
204 format_combo.set_active_id((string) lang_code);
205-
206+
207 }
208-
209+
210 format_others_win.destroy();
211-
212+
213 }
214
215-
216+
217 private static Alignment wrap_alignment (Widget widget, int top, int right,
218 int bottom, int left) {
219
220@@ -408,7 +408,7 @@
221 alignment.right_padding = right;
222 alignment.bottom_padding = bottom;
223 alignment.left_padding = left;
224-
225+
226 alignment.add(widget);
227 return alignment;
228
229@@ -450,17 +450,17 @@
230 spinner.hide ();
231
232 var box = new Box (Gtk.Orientation.VERTICAL, 10);
233-
234+
235 if (submit_result == 0) {
236-
237+
238 //paste successfully
239 var link_button = new LinkButton (link);
240 box.pack_start (link_button, false, true, 25);
241 } else {
242-
243+
244 //paste error
245 var error_desc = new StringBuilder();
246-
247+
248 switch(submit_result) {
249 case 2:
250 error_desc.append("The text is void!");
251@@ -469,11 +469,11 @@
252 case 3:
253 error_desc.append("The text format doesn't exist");
254 break;
255-
256+
257 default:
258- error_desc.append("An error occured");
259+ error_desc.append("An error occured");
260 break;
261-
262+
263 }
264
265 error_desc.append("\n" + "The text was sent");
266@@ -518,4 +518,4 @@
267
268 }
269
270-}
271+}
272\ No newline at end of file
273
274=== modified file 'src/MainWindow.vala'
275--- src/MainWindow.vala 2014-10-26 08:26:36 +0000
276+++ src/MainWindow.vala 2014-10-29 21:26:30 +0000
277@@ -713,23 +713,23 @@
278
279 // Actions array
280 static const Gtk.ActionEntry[] main_entries = {
281- { "Fetch", Gtk.Stock.FIND,
282+ { "Fetch", "edit-find",
283 /* label, accelerator */ N_("Find…"), "<Control>f",
284 /* tooltip */ N_("Find…"),
285 action_fetch },
286- { "ShowGoTo", Gtk.Stock.OK,
287+ { "ShowGoTo", "dialog-ok",
288 /* label, accelerator */ N_("Go to line…"), "<Control>i",
289 /* tooltip */ N_("Go to line…"),
290 action_go_to },
291- { "Quit", Gtk.Stock.QUIT,
292+ { "Quit", "application-exit",
293 /* label, accelerator */ N_("Quit"), "<Control>q",
294 /* tooltip */ N_("Quit"),
295 action_quit },
296- { "CloseTab", Gtk.Stock.CLOSE,
297+ { "CloseTab", "window-close",
298 /* label, accelerator */ N_("Close"), "<Control>w",
299 /* tooltip */ N_("Close"),
300 action_close_tab },
301- { "ShowReplace", Gtk.Stock.OK,
302+ { "ShowReplace", "dialog-ok",
303 /* label, accelerator */ N_("Replace"), "<Control>r",
304 /* tooltip */ N_("Replace"),
305 action_fetch },
306@@ -737,27 +737,27 @@
307 /* label, accelerator */ N_("Reopen closed document"), "<Control><Shift>t",
308 /* tooltip */ N_("Open last closed document in a new tab"),
309 action_restore_tab },
310- { "NewTab", Gtk.Stock.NEW,
311+ { "NewTab", "add",
312 /* label, accelerator */ N_("Add New Tab"), "<Control>n",
313 /* tooltip */ N_("Add a new tab"),
314 action_new_tab },
315- { "NewView", Gtk.Stock.NEW,
316+ { "NewView", "add",
317 /* label, accelerator */ N_("Add New View"), "F3",
318 /* tooltip */ N_("Add a new view"),
319 action_new_view },
320- { "RemoveView", Gtk.Stock.CLOSE,
321+ { "RemoveView", "window-close",
322 /* label, accelerator */ N_("Remove Current View"), null,
323 /* tooltip */ N_("Remove this view"),
324 action_remove_view },
325- { "Undo", Gtk.Stock.UNDO,
326+ { "Undo", "edit-undo",
327 /* label, accelerator */ N_("Undo"), "<Control>z",
328 /* tooltip */ N_("Undo the last action"),
329 action_undo },
330- { "Redo", Gtk.Stock.REDO,
331+ { "Redo", "edit-redo",
332 /* label, accelerator */ N_("Redo"), "<Control><shift>z",
333 /* tooltip */ N_("Redo the last undone action"),
334 action_redo },
335- { "Revert", Gtk.Stock.REVERT_TO_SAVED,
336+ { "Revert", "document-revert",
337 /* label, accelerator */ N_("Revert"), "<Control><shift>o",
338 /* tooltip */ N_("Restore this file"),
339 action_revert },
340@@ -765,19 +765,19 @@
341 /* label, accelerator */ N_("Duplicate selected strings"), "<Control>d",
342 /* tooltip */ N_("Duplicate selected strings"),
343 action_duplicate },
344- { "Open", Gtk.Stock.OPEN,
345+ { "Open", "document-open",
346 /* label, accelerator */ N_("Open"), "<Control>o",
347 /* tooltip */ N_("Open a file"),
348 action_open },
349- { "Clipboard", Gtk.Stock.OPEN,
350+ { "Clipboard", "edit-paste",
351 /* label, accelerator */ N_("Clipboard"), null,
352 /* tooltip */ N_("New file from Clipboard"),
353 action_new_tab_from_clipboard },
354- { "SaveFile", Gtk.Stock.SAVE,
355+ { "SaveFile", "document-save",
356 /* label, accelerator */ N_("Save"), "<Control>s",
357 /* tooltip */ N_("Save this file"),
358 action_save },
359- { "SaveFileAs", Gtk.Stock.SAVE_AS,
360+ { "SaveFileAs", "document-save-as",
361 /* label, accelerator */ N_("Save As…"), "<Control><shift>s",
362 /* tooltip */ N_("Save this file with a different name"),
363 action_save_as },
364@@ -785,7 +785,7 @@
365 /* label, accelerator */ N_("Templates"), null,
366 /* tooltip */ N_("Project templates"),
367 action_templates },
368- { "Preferences", Gtk.Stock.PREFERENCES,
369+ { "Preferences", "preferences-desktop",
370 /* label, accelerator */ N_("Preferences"), null,
371 /* tooltip */ N_("Change Scratch settings"),
372 action_preferences },
373@@ -810,7 +810,7 @@
374 };
375
376 static const Gtk.ToggleActionEntry[] toggle_entries = {
377- { "Fullscreen", Gtk.Stock.FULLSCREEN,
378+ { "Fullscreen", "view-fullscreen",
379 /* label, accelerator */ N_("Fullscreen"), "F11",
380 /* tooltip */ N_("Fullscreen"),
381 action_fullscreen }

Subscribers

People subscribed via source and target branches