Merge lp:~name-is-carl/eidete/fix-for-freya into lp:eidete

Proposed by PerfectCarl
Status: Merged
Merged at revision: 176
Proposed branch: lp:~name-is-carl/eidete/fix-for-freya
Merge into: lp:eidete
Diff against target: 1173 lines (+494/-230)
7 files modified
CMakeLists.txt (+31/-7)
README (+22/-0)
po/eidete.pot (+87/-72)
src/Widgets/end_dialog.vala (+181/-74)
src/eidete.vala (+135/-63)
src/keycapture.c (+4/-0)
src/videobin_uploader.vala (+34/-14)
To merge this branch: bzr merge lp:~name-is-carl/eidete/fix-for-freya
Reviewer Review Type Date Requested Status
Tom Beckmann Pending
elementary Apps team Pending
Review via email: mp+245398@code.launchpad.net

Commit message

Make eidete work for elementary freya:
   - port it to gstreamer 1.0
   - fix contractors
   - fix video-bin (though videobin.org doesn't support webm files anymore)
   - update styling
   - update pot
   - fix misc issues

Note: the project is still compatible with gstreamer 0.10 and luna (see makefile for more info)

Description of the change

Make eidete work for elementary freya: fixing issues and port it to gstreamer 1.0.
The project is still compatible with gstreamer 0.10 (see makefile for more info)

To post a comment you must log in.
183. By PerfectCarl

Fixing the pause button issue

184. By PerfectCarl

Fix code formatting

185. By PerfectCarl

Revert the annoying code reformatting. Bump the version to 0.2

186. By PerfectCarl

Revert more geany code reformatting

187. By PerfectCarl

Add missing ':' in label

188. By PerfectCarl

Add a README file

189. By PerfectCarl

Porting contracts to Freya (work in progress)

190. By PerfectCarl

Fix tabs

191. By PerfectCarl

More work on the contracts

192. By PerfectCarl

Fix UI. Start fixing video-uploader

193. By PerfectCarl

Fix upload to video-bin

194. By PerfectCarl

Revert to old formatting

195. By PerfectCarl

Revert to old formatting

196. By PerfectCarl

Fixing new build warnings

197. By PerfectCarl

Fixing minor formatting issues

198. By PerfectCarl

Reverted to trunk pot

199. By PerfectCarl

Fix styling issues

200. By Tom Beckmann

fix some gtk deprecations and other minor problems with the ui

201. By Tom Beckmann

display an error dialog when gstreamer fails

202. By Tom Beckmann

simplify cmake logic for gst versions

203. By Tom Beckmann

more cmake cleanup

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2014-05-29 17:06:50 +0000
3+++ CMakeLists.txt 2015-01-04 13:23:18 +0000
4@@ -16,20 +16,44 @@
5 set (PKGDATADIR "${DATADIR}/eidete")
6 set (GETTEXT_PACKAGE "eidete")
7 set (RELEASE_NAME "Feature rich and functional.")
8-set (VERSION "0.1")
9+set (VERSION "0.2")
10 set (VERSION_INFO "Release")
11 set (CMAKE_C_FLAGS "-ggdb")
12 set (PREFIX ${CMAKE_INSTALL_PREFIX})
13 set (DOLLAR "$")
14
15+# Comment this out to enable C compiler warnings
16+add_definitions (-w)
17+
18 list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
19
20+# Building for GStreamer 1.0 by default
21+# Uncomment the following line to build for GStreamer 0.10
22+# set (USE_GSTREAMER_0_10 "TRUE")
23+
24+if(DEFINED USE_GSTREAMER_0_10)
25+ message ("-- Building eidete for GStreamer 0.10")
26+ set(EXTRA_DEFINITIONS -DGSTREAMER_0_10_IS_DEFINED)
27+ add_definitions(${EXTRA_DEFINITIONS})
28+ set(GST_PACKAGES gstreamer-interfaces-0.10 gstreamer-0.10 gstreamer-pbutils-0.10)
29+else ()
30+ message ("-- Building eidete for GStreamer 1.0")
31+ set(GST_PACKAGES gstreamer-1.0 gstreamer-pbutils-1.0)
32+endif ()
33+
34 configure_file (${CMAKE_SOURCE_DIR}/src/Config.vala.cmake ${CMAKE_BINARY_DIR}/src/Config.vala)
35-add_definitions(-DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\" -DWNCK_I_KNOW_THIS_IS_UNSTABLE `pkg-config --cflags --libs gstreamer-interfaces-0.10`)
36+add_definitions(-DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\" -DWNCK_I_KNOW_THIS_IS_UNSTABLE)
37
38 find_package(PkgConfig)
39-pkg_check_modules(DEPS REQUIRED gtk+-3.0>=3.10 libwnck-3.0 gstreamer-interfaces-0.10 gstreamer-0.10 gstreamer-pbutils-0.10 granite xtst gdk-x11-3.0 x11)
40+pkg_check_modules(DEPS REQUIRED gtk+-3.0>=3.10
41+ libwnck-3.0
42+ granite
43+ xtst
44+ gdk-x11-3.0
45+ x11
46+ ${GST_PACKAGES})
47
48+# TEST
49 add_definitions(${DEPS_CFLAGS})
50
51 link_libraries(${DEPS_LIBRARIES})
52@@ -40,6 +64,7 @@
53 ensure_vala_version("0.16.0" MINIMUM)
54
55 include(ValaPrecompile)
56+
57 vala_precompile(VALA_C
58 src/eidete.vala
59 src/Widgets/countdown.vala
60@@ -51,15 +76,14 @@
61 PACKAGES
62 granite
63 gtk+-3.0
64- gstreamer-0.10
65- gstreamer-pbutils-0.10
66- gstreamer-interfaces-0.10
67+ ${GST_PACKAGES}
68 libwnck-3.0
69 gdk-x11-3.0
70 OPTIONS
71 -X -lXtst
72 --thread
73 --vapidir=${CMAKE_CURRENT_SOURCE_DIR}/vapi/
74+ ${EXTRA_DEFINITIONS}
75 )
76
77 vala_precompile(VALA_C_VIDEOBIN
78@@ -79,4 +103,4 @@
79 install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/eidete.desktop DESTINATION share/applications)
80 install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/eidete.svg DESTINATION share/icons/hicolor/48x48/apps)
81 install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/videobin.svg DESTINATION share/icons/hicolor/48x48/apps)
82-install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/videobin.contract DESTINATION ${CMAKE_INSTALL_PREFIX}/share/contractor)
83\ No newline at end of file
84+install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/videobin.contract DESTINATION ${CMAKE_INSTALL_PREFIX}/share/contractor)
85
86=== added file 'README'
87--- README 1970-01-01 00:00:00 +0000
88+++ README 2015-01-04 13:23:18 +0000
89@@ -0,0 +1,22 @@
90+## Introduction
91+
92+A simple screencasting app for the elementary project
93+
94+Current Features
95+- encoding to webm
96+- selection of the area to be recorded
97+- display of the pressed keys
98+- audio recording
99+
100+For more information go to: https://launchpad.net/eidete
101+
102+## How to build
103+Install dependencies
104+ sudo apt-get build-dep eidete
105+OR
106+ sudo apt-get build-dep granite-demo
107+ sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
108+
109+ mkdir build && cd build
110+ cmake -DCMAKE_INSTALL_PREFIX=/usr ../
111+ make
112
113=== modified file 'po/eidete.pot'
114--- po/eidete.pot 2013-05-17 20:02:58 +0000
115+++ po/eidete.pot 2015-01-04 13:23:18 +0000
116@@ -8,7 +8,7 @@
117 msgstr ""
118 "Project-Id-Version: PACKAGE VERSION\n"
119 "Report-Msgid-Bugs-To: \n"
120-"POT-Creation-Date: 2013-05-17 23:02+0300\n"
121+"POT-Creation-Date: 2015-01-04 12:47+0100\n"
122 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
123 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
124 "Language-Team: LANGUAGE <LL@li.org>\n"
125@@ -17,183 +17,198 @@
126 "Content-Type: text/plain; charset=CHARSET\n"
127 "Content-Transfer-Encoding: 8bit\n"
128
129-#: /home/kristjan/translations/po/../src/desktop_launcher.vala:5
130-msgid "Record screencasts"
131-msgstr ""
132-
133-#: /home/kristjan/translations/po/../src/desktop_launcher.vala:6
134-msgid "Screencaster"
135-msgstr ""
136-
137-#: /home/kristjan/translations/po/../src/videobin_uploader.vala:45
138-msgid "Upload"
139-msgstr ""
140-
141-#: /home/kristjan/translations/po/../src/savedialog.vala:8
142-#: /home/kristjan/translations/po/../src/Widgets/end_dialog.vala:28
143-#: /home/kristjan/translations/po/../src/Widgets/end_dialog.vala:64
144-#: /home/kristjan/translations/po/../src/Widgets/end_dialog.vala:100
145-msgid "Save"
146-msgstr ""
147-
148-#: /home/kristjan/translations/po/../src/eidete.vala:138
149+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:140
150 msgid "Monitor"
151 msgstr ""
152
153-#: /home/kristjan/translations/po/../src/eidete.vala:158
154+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:160
155 msgid "Fullscreen"
156 msgstr ""
157
158-#: /home/kristjan/translations/po/../src/eidete.vala:159
159+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:161
160 msgid "Custom"
161 msgstr ""
162
163-#: /home/kristjan/translations/po/../src/eidete.vala:170
164+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:172
165 msgid "Default"
166 msgstr ""
167
168-#: /home/kristjan/translations/po/../src/eidete.vala:179
169+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:181
170 msgid "Sound"
171 msgstr ""
172
173-#: /home/kristjan/translations/po/../src/eidete.vala:182
174+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:184
175 msgid "Video"
176 msgstr ""
177
178-#: /home/kristjan/translations/po/../src/eidete.vala:185
179+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:187
180 msgid "Keyboard"
181 msgstr ""
182
183-#: /home/kristjan/translations/po/../src/eidete.vala:188
184+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:190
185 msgid "Mouse"
186 msgstr ""
187
188-#: /home/kristjan/translations/po/../src/eidete.vala:191
189+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:193
190 msgid "Start Recording"
191 msgstr ""
192
193-#: /home/kristjan/translations/po/../src/eidete.vala:197
194+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:199
195 msgid "About"
196 msgstr ""
197
198-#: /home/kristjan/translations/po/../src/eidete.vala:210
199+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:212
200 msgid "Record Computer Sounds"
201 msgstr ""
202
203-#: /home/kristjan/translations/po/../src/eidete.vala:212
204+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:214
205 msgid "Record from Microphone"
206 msgstr ""
207
208-#: /home/kristjan/translations/po/../src/eidete.vala:215
209+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:217
210 msgid "Record from Monitor"
211 msgstr ""
212
213-#: /home/kristjan/translations/po/../src/eidete.vala:217
214+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:219
215 msgid "Recording Area"
216 msgstr ""
217
218-#: /home/kristjan/translations/po/../src/eidete.vala:219
219+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:221
220 msgid "Width"
221 msgstr ""
222
223-#: /home/kristjan/translations/po/../src/eidete.vala:221
224+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:223
225 msgid "Height"
226 msgstr ""
227
228-#: /home/kristjan/translations/po/../src/eidete.vala:245
229+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:247
230 msgid "Pressed keys on screen"
231 msgstr ""
232
233-#: /home/kristjan/translations/po/../src/eidete.vala:248
234+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:250
235 msgid "Mouse clicks on screen"
236 msgstr ""
237
238-#: /home/kristjan/translations/po/../src/eidete.vala:250
239+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:252
240 msgid "Circle around the cursor"
241 msgstr ""
242
243-#: /home/kristjan/translations/po/../src/eidete.vala:256
244+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:258
245 msgid "Behavior"
246 msgstr ""
247
248-#: /home/kristjan/translations/po/../src/eidete.vala:257
249+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:259
250 msgid "Appearance"
251 msgstr ""
252
253-#: /home/kristjan/translations/po/../src/eidete.vala:449
254-#: /home/kristjan/translations/po/../src/eidete.vala:456
255-#: /home/kristjan/translations/po/../src/eidete.vala:641
256+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:461
257+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:682
258 msgid "Recording paused"
259 msgstr ""
260
261-#: /home/kristjan/translations/po/../src/eidete.vala:459
262+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:464
263 msgid "You can continue or finish the recording now"
264 msgstr ""
265
266-#: /home/kristjan/translations/po/../src/eidete.vala:468
267+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:473
268 msgid "Continue"
269 msgstr ""
270
271-#: /home/kristjan/translations/po/../src/eidete.vala:469
272+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:474
273 msgid "Continue recording"
274 msgstr ""
275
276-#: /home/kristjan/translations/po/../src/eidete.vala:472
277+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:477
278 msgid "Finish"
279 msgstr ""
280
281-#: /home/kristjan/translations/po/../src/eidete.vala:473
282+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:478
283 msgid "Stop the recording and save the file"
284 msgstr ""
285
286-#: /home/kristjan/translations/po/../src/eidete.vala:476
287+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:481
288+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/Widgets/end_dialog.vala:50
289 msgid "Cancel"
290 msgstr ""
291
292-#: /home/kristjan/translations/po/../src/eidete.vala:477
293+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:482
294 msgid "Cancel the recording without saving the file"
295 msgstr ""
296
297-#: /home/kristjan/translations/po/../src/eidete.vala:651
298+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:690
299 msgid "Pause recording"
300 msgstr ""
301
302-#: /home/kristjan/translations/po/../src/eidete.vala:671
303+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:719
304 msgid "Pause Recording"
305 msgstr ""
306
307-#: /home/kristjan/translations/po/../src/eidete.vala:672
308+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/eidete.vala:720
309 msgid "Finish Recording"
310 msgstr ""
311
312-#: /home/kristjan/translations/po/../src/Widgets/end_dialog.vala:24
313+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/desktop_launcher.vala:5
314+msgid "Record screencasts"
315+msgstr ""
316+
317+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/desktop_launcher.vala:6
318+msgid "Screencaster"
319+msgstr ""
320+
321+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/Widgets/end_dialog.vala:40
322 msgid "Recording complete"
323 msgstr ""
324
325-#: /home/kristjan/translations/po/../src/Widgets/end_dialog.vala:33
326-msgid "Don't save"
327-msgstr ""
328-
329-#: /home/kristjan/translations/po/../src/Widgets/end_dialog.vala:62
330-msgid "Could not contact Contractor. Click the Save button to save the file."
331-msgstr ""
332-
333-#: /home/kristjan/translations/po/../src/Widgets/keyview.vala:48
334+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/Widgets/end_dialog.vala:44
335+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/Widgets/end_dialog.vala:107
336+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/Widgets/end_dialog.vala:146
337+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/Widgets/end_dialog.vala:226
338+msgid "Save"
339+msgstr ""
340+
341+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/Widgets/end_dialog.vala:144
342+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/Widgets/end_dialog.vala:224
343+msgid "Could not contact Contractor."
344+msgstr ""
345+
346+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/Widgets/end_dialog.vala:214
347+msgid "Save file"
348+msgstr ""
349+
350+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/Widgets/end_dialog.vala:216
351+msgid "Execute"
352+msgstr ""
353+
354+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/Widgets/countdown.vala:27
355+msgid "Recording starts in"
356+msgstr ""
357+
358+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/Widgets/countdown.vala:34
359+msgid "Focus Eidete to stop recording"
360+msgstr ""
361+
362+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/Widgets/keyview.vala:48
363 msgid "Left"
364 msgstr ""
365
366-#: /home/kristjan/translations/po/../src/Widgets/keyview.vala:51
367+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/Widgets/keyview.vala:51
368 msgid "Middle"
369 msgstr ""
370
371-#: /home/kristjan/translations/po/../src/Widgets/keyview.vala:54
372+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/Widgets/keyview.vala:54
373 msgid "Right"
374 msgstr ""
375
376-#: /home/kristjan/translations/po/../src/Widgets/countdown.vala:27
377-msgid "Recording starts in"
378-msgstr ""
379-
380-#: /home/kristjan/translations/po/../src/Widgets/countdown.vala:34
381-msgid "Focus Eidete to stop recording"
382+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/videobin_uploader.vala:41
383+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/videobin_uploader.vala:43
384+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/videobin_uploader.vala:45
385+msgid "Optional"
386+msgstr ""
387+
388+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/videobin_uploader.vala:48
389+msgid "Upload"
390+msgstr ""
391+
392+#: /home/cran/Documents/Projects/elementary/eidete/fix-for-freya/po/../src/videobin_uploader.vala:57
393+msgid "Your email address for relocating your videos"
394 msgstr ""
395
396=== modified file 'src/Widgets/end_dialog.vala'
397--- src/Widgets/end_dialog.vala 2013-05-15 15:57:25 +0000
398+++ src/Widgets/end_dialog.vala 2015-01-04 13:23:18 +0000
399@@ -1,37 +1,54 @@
400 using Gtk;
401
402-
403 namespace Eidete.Widgets {
404
405- private bool contractor;
406+ public class EndDialog : Dialog {
407
408- public class EndDialog : Window {
409+ private bool contractor;
410+
411+ private EideteApp app ;
412+ private Button export ;
413+ private Grid grid;
414+ private ListStore list ;
415+ private TreeView treeview ;
416+ private File source ;
417+
418 public EndDialog (EideteApp app){
419+ this.app = app ;
420+ build_ui () ;
421+ this.window_position = WindowPosition.CENTER;
422+ }
423+
424+ private void build_ui () {
425+ this.get_header_bar ().get_style_context ().remove_class ("header-bar");
426 this.set_default_size (400, 200);
427-
428+ this.resizable = false;
429 this.set_application (app);
430-
431+
432 if (app.selectionarea != null)
433- app.selectionarea.destroy ();
434+ app.selectionarea.destroy ();
435 if (app.keyview != null)
436- app.keyview.destroy ();
437- this.window_position = WindowPosition.CENTER;
438+ app.keyview.destroy ();
439+
440 this.icon_name = "eidete";
441
442- var grid = new Grid ();
443+ grid = new Grid ();
444 grid.margin = 12;
445
446+ var content = (Gtk.Box) this.get_content_area () ;
447 var title = new Label ("<span size='30000'>"+_("Recording complete")+"</span>");
448 title.use_markup = true;
449 title.halign = Align.START;
450
451- var export = new Button.with_label (_("Save"));
452+ export = new Button.with_label (_("Save"));
453 export.image = new Image.from_stock (Stock.SAVE, IconSize.BUTTON);
454 export.can_default = true;
455+ export.get_style_context ().add_class ("suggested-action");
456 this.set_default (export);
457
458- var cancel = new Button.with_label (_("Don't save"));
459+ var cancel = new Button.with_label (_("Cancel"));
460 cancel.image = new Image.from_stock (Stock.DELETE, IconSize.BUTTON);
461+ cancel.margin_end = 6;
462 cancel.halign = Align.END;
463
464 var bbox = new ButtonBox (Orientation.HORIZONTAL);
465@@ -39,84 +56,174 @@
466 bbox.pack_end (export, false, true, 0);
467 bbox.layout_style = ButtonBoxStyle.END;
468
469- //contractor
470- var list = new ListStore (2, typeof (Gdk.Pixbuf), typeof (string));
471- var t = new TreeView.with_model (list);
472- t.headers_visible = false;
473- t.hexpand = true;
474+
475+ list = new ListStore (2, typeof (Gdk.Pixbuf), typeof (string));
476+ treeview = new TreeView.with_model (list);
477+ treeview.headers_visible = false;
478+ treeview.hexpand = true;
479+ treeview.set_activate_on_single_click (false) ;
480+ treeview.row_activated.connect ( on_contract_executed) ;
481
482 var cell1 = new CellRendererPixbuf ();
483 cell1.set_padding (5, 15);
484- t.insert_column_with_attributes (-1, "", cell1, "pixbuf", 0);
485+ treeview.insert_column_with_attributes (-1, "", cell1, "pixbuf", 0);
486 var cell2 = new CellRendererText ();
487 cell2.set_padding (2, 15);
488- t.insert_column_with_attributes (-1, "", cell2, "markup", 1);
489-
490-
491- var c = Granite.Services.Contractor.get_contract (app.settings.destination, "video");
492- if (c == null || c.length <= 1){
493- warning ("You should install and/or run contractor");
494- contractor = false;
495- var info = new InfoBar ();
496- info.message_type = MessageType.WARNING;
497- info.pack_start (new Label (_("Could not contact Contractor. Click the Save button to save the file.")));
498- grid.attach (info, 0, 3, 2, 1);
499- export.label = _("Save");
500- }else{
501- contractor = true;
502- for (var i=0;i<c.length; i++){
503- TreeIter it;
504- list.append (out it);
505- Gdk.Pixbuf icon = null;
506- try{
507- icon = IconTheme.get_default ().load_icon (c[i].lookup ("IconName"), 32, 0);
508- }catch (Error e){warning (e.message);}
509- list.set (it, 0, icon, 1,
510- "<b>"+c[i].lookup ("Name")+"</b>\n"+c[i].lookup ("Description"));
511- }
512- t.set_cursor (new TreePath.from_string ("0"), null, false);
513- }
514+ treeview.insert_column_with_attributes (-1, "", cell2, "markup", 1);
515+
516+ //contractor
517+ load_contracts () ;
518
519 grid.attach (title, 0, 0, 2, 1);
520 grid.attach (new Label (""), 0, 2, 1, 1);
521- grid.attach (t, 0, 4, 1, 1);
522+ grid.attach (treeview, 0, 4, 1, 1);
523 grid.attach (new Label (""), 0, 5, 1, 1);
524 grid.attach (bbox, 0, 6, 1, 1);
525-
526+ source = File.new_for_path (app.settings.destination);
527+
528 if (contractor){
529- export.clicked.connect ( () => {
530- TreePath path;
531- t.get_cursor (out path, null);
532- try{
533- Process.spawn_command_line_async (c[int.parse (path.to_string ())].lookup ("Exec"));
534- }catch (Error e){
535- print(e.message);
536- }
537- this.destroy ();
538- });
539+ export.clicked.connect (on_contract_executed) ;
540 } else {
541- export.clicked.connect ( () => {
542- var source = File.new_for_path (app.settings.destination);
543- var file = new FileChooserDialog (_("Save"), null, FileChooserAction.SAVE, Stock.OK, ResponseType.OK);
544- file.set_current_name (source.get_basename ());
545- file.do_overwrite_confirmation = true;
546- var res = file.run ();
547- if (res == ResponseType.OK){
548- var destination = File.new_for_path (file.get_filename ());
549- try{
550- source.copy (destination, FileCopyFlags.OVERWRITE);
551- }catch (GLib.Error e){stderr.printf ("Error: %s\n", e.message);}
552-
553- file.destroy ();
554- this.destroy ();
555- }else{
556- file.destroy ();
557- }
558- });
559+ export.clicked.connect ( () => {
560+ save_file () ;
561+ this.destroy ();
562+ });
563 }
564 cancel.clicked.connect ( () => {this.destroy ();});
565
566- this.add (grid);
567+ content.add (grid);
568+ }
569+
570+ private void on_contract_executed () {
571+ TreePath path;
572+ treeview.get_cursor (out path, null);
573+ int index = int.parse (path.to_string ()) ;
574+ execute_command (index) ;
575+ this.destroy ();
576+ }
577+
578+ private void save_file () {
579+ var dialog = new FileChooserDialog (_("Save"), null, FileChooserAction.SAVE, Stock.OK, ResponseType.OK);
580+ dialog.set_current_name (source.get_basename ());
581+ var videos_folder = Environment.get_user_special_dir(UserDirectory.VIDEOS);
582+ dialog.set_current_folder (videos_folder);
583+ dialog.do_overwrite_confirmation = true;
584+ var res = dialog.run ();
585+ if (res == ResponseType.OK){
586+ var destination = File.new_for_path (dialog.get_filename ());
587+ try{
588+ source.copy (destination, FileCopyFlags.OVERWRITE);
589+ }catch (GLib.Error e){
590+ stderr.printf ("Error: %s\n", e.message);
591+ }
592+ }
593+ dialog.destroy ();
594+ }
595+ // Using deprecated Contractor API. Necesserary to maintain luna compatibility
596+#if false
597+ private void execute_command_deprecated (int index) {
598+ string cmd = contracts_dep[index].lookup ("Exec") ;
599+ try{
600+ Process.spawn_command_line_async (cmd);
601+ }catch (Error e){
602+ print(e.message);
603+ }
604+ }
605+
606+ private HashTable<string,string>[] contracts_dep ;
607+
608+ private void load_contracts_deprecated () {
609+ // CARL deprecated Contractor API
610+ contracts_dep = Granite.Services.Contractor.get_contract (app.settings.destination, "video");
611+ if (contracts_dep == null || contracts_dep.length <= 1){
612+ warning ("You should install and/or run contractor");
613+ contractor = false;
614+ var info = new InfoBar ();
615+ info.message_type = MessageType.WARNING;
616+ info.pack_start (new Label (_("Could not contact Contractor.")));
617+ grid.attach (info, 0, 3, 2, 1);
618+ export.label = _("Save");
619+ }else{
620+ contractor = true;
621+ for (var i=0;i<contracts_dep.length; i++){
622+ TreeIter it;
623+ list.append (out it);
624+ Gdk.Pixbuf icon = null;
625+ try{
626+ icon = IconTheme.get_default ().load_icon (contracts_dep[i].lookup ("IconName"), 32, 0);
627+ }catch (Error e){
628+ warning (e.message);
629+ }
630+ list.set (it, 0, icon, 1,
631+ "<b>"+contracts_dep[i].lookup ("Name")+"</b>\n"+contracts_dep[i].lookup ("Description"));
632+ }
633+ treeview.set_cursor (new TreePath.from_string ("0"), null, false);
634+ }
635+ }
636+#endif
637+ private Gee.List<Granite.Services.Contract> contracts ;
638+ private int contracts_size = 0 ;
639+
640+ private void execute_command (int index) {
641+ if( index < contracts_size ) {
642+ var contract = contracts.@get (index) ;
643+ try{
644+ contract.execute_with_file (source) ;
645+ }catch (Error e){
646+ warning (e.message);
647+ }
648+ }
649+ else
650+ save_file () ;
651+ }
652+
653+ private void load_contracts () {
654+ contracts_size = 0 ;
655+ try{
656+ contracts = Granite.Services.ContractorProxy.get_contracts_by_mime ("video");
657+ }catch (Error e){
658+ warning (e.message);
659+ }
660+ if (contracts != null){
661+
662+ contractor = true;
663+ foreach( var contract in contracts ) {
664+ TreeIter it;
665+ list.append (out it);
666+ Gdk.Pixbuf icon = null;
667+ try{
668+ icon = IconTheme.get_default ().load_icon (contract.get_icon ().to_string (), 32, 0);
669+
670+ }catch (Error e){
671+ warning (e.message);
672+ }
673+ list.set (it, 0, icon, 1,
674+ "<b>"+contract.get_display_name ()+"</b>\n"+contract.get_description ());
675+ contracts_size ++ ;
676+ }
677+ TreeIter it;
678+ list.append (out it);
679+ Gdk.Pixbuf icon = null;
680+ try{
681+ icon = IconTheme.get_default ().load_icon ("document-save", 32, 0);
682+ }catch (Error e){
683+ warning (e.message);
684+ }
685+ list.set (it, 0, icon, 1,
686+ "<b>"+_("Save file")+"</b>\n"+("Save the file onto a disk"));
687+ treeview.set_cursor (new TreePath.from_string (contracts_size.to_string ()), null, false);
688+ export.label = _("Execute");
689+ }
690+ if( contracts_size == 0 )
691+ {
692+ warning ("You should install and/or run contractor");
693+ contractor = false;
694+ var info = new InfoBar ();
695+ info.message_type = MessageType.WARNING;
696+ info.pack_start (new Label (_("Could not contact Contractor.")));
697+ grid.attach (info, 0, 3, 2, 1);
698+ export.label = _("Save");
699+ }
700 }
701 }
702 }
703
704=== modified file 'src/eidete.vala'
705--- src/eidete.vala 2014-05-29 17:08:23 +0000
706+++ src/eidete.vala 2015-01-04 13:23:18 +0000
707@@ -1,4 +1,3 @@
708-//valac --pkg gtk+-3.0 --pkg gstreamer-0.10 --pkg gstreamer-pbutils-0.10 --pkg granite screencast.vala
709
710 using Gst;
711 using Granite;
712@@ -81,9 +80,8 @@
713 public Window main_window;
714 public Eidete.Widgets.KeyView keyview;
715 public Eidete.Widgets.SelectionArea selectionarea;
716- public Granite.Widgets.StaticNotebook tabs;
717+ public Gtk.Stack tabs;
718 public Grid pause_grid;
719- public Image pause_icon;
720 public Wnck.Window win;
721 public Gdk.Screen screen;
722 public Gdk.Rectangle monitor_rec;
723@@ -125,12 +123,7 @@
724 UI
725 */
726
727- tabs = new Granite.Widgets.StaticNotebook (false);
728- tabs.margin = 12;
729-
730- pause_icon = new Image.from_icon_name ("media-playback-pause", IconSize.DIALOG);
731- pause_icon.pixel_size = 64;
732-
733+ tabs = new Gtk.Stack ();
734
735 var grid = new Grid ();
736 grid.column_spacing = 12;
737@@ -140,6 +133,7 @@
738 var monitors_combo = new ComboBoxText ();
739 monitors_combo.hexpand = true;
740 for (var i=0;i<Gdk.Screen.get_default ().get_n_monitors (); i++)
741+ // TODO proper translation here
742 monitors_combo.append (i.to_string (), _("Monitor")+" "+(i+1).to_string ());
743 monitors_combo.active = 0;
744 if (Gdk.Screen.get_default ().get_n_monitors () == 1)
745@@ -148,12 +142,10 @@
746 var width = new SpinButton.with_range (50, Gdk.Screen.get_default ().get_width (), 1);
747 width.max_length = 4;
748 width.margin_left = 1;
749- width.margin_right = -4;
750
751 var height = new SpinButton.with_range (50, Gdk.Screen.get_default ().get_height (), 1);
752 height.max_length = 4;
753 height.margin_left = 1;
754- height.margin_right = -4;
755 width.set_sensitive (false);
756 height.set_sensitive (false);
757 width.halign = Align.START;
758@@ -181,23 +173,24 @@
759 audio_box.pack_start (use_audio, false, true, 0);
760 audio_box.pack_start (audio_source, true, true, 0);
761
762- var sound = new LLabel.markup ("<b>"+_("Sound")+":"+"</b>");
763+ var sound = new LLabel.markup ("<b>"+_("Sound")+"</b>");
764 sound.margin_top = 18;
765
766- var video = new LLabel.markup ("<b>"+_("Video")+":"+"</b>");
767+ var video = new LLabel.markup ("<b>"+_("Video")+"</b>");
768 video.margin_top = 12;
769
770- var keyboard = new LLabel.markup ("<b>"+_("Keyboard")+":"+"</b>");
771+ var keyboard = new LLabel.markup ("<b>"+_("Keyboard")+"</b>");
772 keyboard.margin_top = 18;
773
774- var mouse = new LLabel.markup ("<b>"+_("Mouse")+":"+"</b>");
775+ var mouse = new LLabel.markup ("<b>"+_("Mouse")+"</b>");
776 mouse.margin_top = 12;
777
778 var start_bt = new Button.with_label (_("Start Recording"));
779 start_bt.can_default = true;
780 start_bt.get_style_context ().add_class ("noundo");
781-
782- var cancel_bt = new Button.from_stock (Stock.CANCEL);
783+ start_bt.get_style_context ().add_class ("suggested-action");
784+
785+ var cancel_bt = new Button.with_label (_("Cancel"));
786
787 var about_bt = new Button.with_label (_("About"));
788 about_bt.image = new Image.from_stock (Stock.ABOUT, IconSize.BUTTON);
789@@ -212,7 +205,7 @@
790 this.main_window.set_default (start_bt);
791
792 grid.attach ((sound), 0, 0, 1, 1);
793- grid.attach (new LLabel.right (_("Record Computer Sounds")), 0, 1, 1, 1);
794+ grid.attach (new LLabel.right (_("Record Computer Sounds")+":"), 0, 1, 1, 1);
795 grid.attach (use_comp_sounds, 1, 1, 1, 1);
796 grid.attach (new LLabel.right (_("Record from Microphone")+":"), 0, 2, 1, 1);
797 grid.attach (audio_box, 1, 2, 1, 1);
798@@ -258,10 +251,20 @@
799 grid2.row_spacing = 6;
800 grid2.hexpand = true;
801
802- tabs.append_page (grid, new Label (_("Behavior")));
803- tabs.append_page (grid2, new Label (_("Appearance")));
804-
805- this.main_window.add (tabs);
806+ tabs.add_titled (grid, "behavior", _("Behavior"));
807+ tabs.add_titled (grid2, "apperance", _("Appearance"));
808+
809+ var main_box = new Gtk.Grid ();
810+ var stack_switcher = new Gtk.StackSwitcher ();
811+ stack_switcher.stack = tabs;
812+ stack_switcher.halign = Gtk.Align.CENTER;
813+
814+ main_box.attach (stack_switcher, 0, 0, 1, 1);
815+ main_box.attach (tabs, 0, 1, 1, 1);
816+ main_box.margin = 12;
817+
818+ this.main_window.add (main_box);
819+ build_pause_ui () ;
820 this.main_window.show_all ();
821 this.main_window.present ();
822
823@@ -353,11 +356,7 @@
824 settings.audio = false;
825 use_audio.toggled.connect ( () => {
826 settings.audio = use_audio.active;
827- if (use_audio.active){
828- audio_source.set_sensitive (true);
829- }else{
830- audio_source.set_sensitive (false);
831- }
832+ audio_source.set_sensitive (use_audio.active);
833 });
834
835
836@@ -433,6 +432,12 @@
837
838 Granite.Services.Logger.initialize ("Eidete");
839 Granite.Services.Logger.DisplayLevel = Granite.Services.LogLevel.DEBUG;
840+ uint major ;
841+ uint minor ;
842+ uint micro ;
843+ uint nano ;
844+ Gst.version (out major, out minor, out micro, out nano) ;
845+ message ("GStreamer version: %u.%u.%u.%u", major, minor, micro, nano ) ;
846 }
847
848 public override void activate (){
849@@ -451,7 +456,7 @@
850
851 pause_grid = new Grid ();
852 pause_grid.margin = 12;
853- this.main_window.title = _("Recording paused");
854+ //this.main_window.title = _("Recording paused");
855
856
857 var img_text_grid = new Grid ();
858@@ -477,6 +482,7 @@
859 var stop_bt = new Button.with_label (_("Finish"));
860 stop_bt.set_tooltip_text (_("Stop the recording and save the file"));
861 stop_bt.image = new Image.from_stock (Stock.APPLY, IconSize.BUTTON);
862+ stop_bt.get_style_context ().add_class ("suggested-action");
863
864 var cancel_bt = new Button.with_label (_("Cancel"));
865 cancel_bt.set_tooltip_text (_("Cancel the recording without saving the file"));
866@@ -539,15 +545,25 @@
867 }
868
869 pipeline = new Pipeline ("screencast-pipe");
870+
871+ #if GSTREAMER_0_10_IS_DEFINED
872 dynamic Element muxer = ElementFactory.make ("webmmux", "mux");
873 dynamic Element sink = ElementFactory.make ("filesink", "sink");
874-
875+ #else
876+ var muxer = ElementFactory.make ("webmmux", "mux");
877+ var sink = ElementFactory.make ("filesink", "sink");
878+ #endif
879 //video bin
880 this.videobin = new Gst.Bin ("video");
881 try {
882- videobin = (Gst.Bin)parse_bin_from_description (
883- "ximagesrc name=\"videosrc\" ! video/x-raw-rgb, framerate=15/1 !
884- ffmpegcolorspace ! vp8enc name=\"encoder\" ! queue", true);
885+ #if GSTREAMER_0_10_IS_DEFINED
886+ videobin = (Gst.Bin)parse_bin_from_description (
887+ "ximagesrc name=\"videosrc\" ! video/x-raw-rgb, framerate=15/1 !
888+ ffmpegcolorspace ! vp8enc name=\"encoder\" ! queue", true);
889+ #else
890+ videobin = (Gst.Bin)parse_bin_from_description (
891+ "ximagesrc name=\"videosrc\" ! video/x-raw, framerate=24/1 ! videoconvert ! vp8enc name=\"encoder\" ! queue", true);
892+ #endif
893 }catch (Error e){ stderr.printf ("Error: %s\n", e.message);}
894
895 //audio bin
896@@ -564,19 +580,32 @@
897 }catch (Error e){warning (e.message);}
898
899 //configure
900+ assert( sink != null ) ;
901 sink.set ("location", settings.destination);
902- videobin.get_by_name ("videosrc").set ("startx", this.settings.sx);
903- videobin.get_by_name ("videosrc").set ("starty", this.settings.sy);
904- videobin.get_by_name ("videosrc").set ("endx", this.settings.ex);
905- videobin.get_by_name ("videosrc").set ("endy", this.settings.ey);
906- videobin.get_by_name ("videosrc").set ("use-damage", false);
907- videobin.get_by_name ("videosrc").set ("screen-num", this.settings.monitor);
908+ var src = videobin.get_by_name ("videosrc") ;
909+ assert (src != null) ;
910+ src.set ("startx", this.settings.sx);
911+ src.set ("starty", this.settings.sy);
912+ src.set ("endx", this.settings.ex);
913+ src.set ("endy", this.settings.ey);
914+ src.set ("use-damage", false);
915+ src.set ("screen-num", this.settings.monitor);
916
917 //videobin.get_by_name ("encoder").set ("mode", 1);
918- videobin.get_by_name ("encoder").set ("quality", 8.0);
919- videobin.get_by_name ("encoder").set ("speed", 6);
920- videobin.get_by_name ("encoder").set ("max-keyframe-distance", 150);
921- videobin.get_by_name ("encoder").set ("threads", int.parse (cores.substring (2)));
922+ var encoder = videobin.get_by_name ("encoder") ;
923+ assert (encoder != null) ;
924+ #if GSTREAMER_0_10_IS_DEFINED
925+ encoder.set ("quality", 8.0);
926+ encoder.set ("speed", 6);
927+ encoder.set ("max-keyframe-distance", 150);
928+ #else
929+ // From these values see https://mail.gnome.org/archives/commits-list/2012-September/msg08183.html
930+ encoder.set ("min_quantizer", 13);
931+ encoder.set ("max_quantizer", 13);
932+ encoder.set ("cpu-used", 5);
933+ encoder.set ("deadline", 1000000);
934+ #endif
935+ encoder.set ("threads", int.parse (cores.substring (2)));
936
937
938 if (pipeline==null||muxer==null||sink==null||videobin==null||audiobin==null){
939@@ -589,14 +618,28 @@
940 pipeline.add_many (videobin, muxer, sink);
941
942
943- videobin.get_static_pad ("src").link(muxer.get_request_pad ("video_%d"));
944- if (settings.audio)
945- audiobin.get_static_pad ("src").link(muxer.get_request_pad ("audio_%d"));
946-
947+ var video_pad = videobin.get_static_pad ("src") ;
948+ assert (video_pad != null ) ;
949+ #if GSTREAMER_0_10_IS_DEFINED
950+ var m = muxer.get_request_pad ("video_%d") ;
951+ #else
952+ var m = muxer.get_request_pad ("video_%u") ;
953+ #endif
954+ assert (m != null ) ;
955+ video_pad.link(m);
956+ if (settings.audio){
957+ #if GSTREAMER_0_10_IS_DEFINED
958+ audiobin.get_static_pad ("src").link (muxer.get_request_pad ("audio_%d"));
959+ #else
960+ audiobin.get_static_pad ("src").link (muxer.get_request_pad ("audio_%u"));
961+ #endif
962+ }
963 muxer.link (sink);
964-
965- pipeline.get_bus ().add_watch (bus_message_cb);
966-
967+ #if GSTREAMER_0_10_IS_DEFINED
968+ pipeline.get_bus ().add_watch (bus_message_cb);
969+ #else
970+ pipeline.get_bus ().add_watch (Priority.DEFAULT, bus_message_cb);
971+ #endif
972 pipeline.set_state (State.READY);
973
974 if (selectionarea != null)
975@@ -620,7 +663,10 @@
976 case Gst.MessageType.ERROR:
977 GLib.Error err; string debug;
978 msg.parse_error (out err, out debug);
979- stderr.printf ("Error: %s\n", err.message);
980+
981+ display_error ("Eidete encountered a gstreamer error while recording, creating a screencast is not possible:\n%s\n\n[%s]"
982+ .printf (err.message, debug), true);
983+ stderr.printf ("Error: %s\n", debug);
984 pipeline.set_state (State.NULL);
985 break;
986 case Gst.MessageType.EOS:
987@@ -644,25 +690,51 @@
988
989 if (to_normal){
990 this.main_window.title = _("Recording paused");
991- this.main_window.remove (pause_icon);
992- if (pause_grid == null)
993- this.build_pause_ui ();
994- this.main_window.add (pause_grid);
995+ remove_widget (tabs) ;
996+ add_widget (pause_grid) ;
997+
998 this.main_window.icon_name = "eidete";
999 this.app_icon = "eidete";
1000- this.main_window.show_all ();
1001- this.main_window.resize (1, 1);
1002+
1003 }else{
1004 this.main_window.title = _("Pause recording");
1005- if (this.main_window.get_child () == tabs)
1006- this.main_window.remove (tabs);
1007- else
1008- this.main_window.remove (pause_grid);
1009- this.main_window.add (pause_icon);
1010+ if (this.main_window.get_child () == tabs) {
1011+ remove_widget (tabs) ;
1012+ add_widget (pause_grid) ;
1013+ }
1014 this.main_window.icon_name = "media-playback-pause";
1015 this.app_icon = "media-playback-pause";
1016- this.main_window.show_all ();
1017+
1018 }
1019+ this.main_window.show_all ();
1020+ }
1021+ private void remove_widget (Gtk.Widget widget) {
1022+ if (this.main_window.get_child () == widget)
1023+ this.main_window.remove (widget);
1024+ }
1025+
1026+ private void add_widget (Gtk.Widget widget) {
1027+ if (this.main_window.get_child () != widget)
1028+ this.main_window.add (widget);
1029+ }
1030+
1031+ /**
1032+ * Displays an error dialog with the given message to the user
1033+ *
1034+ * @param error The message to display
1035+ * @param fatal Quit eidete after the user dismissed the dialog
1036+ */
1037+ private void display_error (string error, bool fatal) {
1038+ var dialog = new Gtk.MessageDialog (main_window, Gtk.DialogFlags.MODAL,
1039+ Gtk.MessageType.ERROR, Gtk.ButtonsType.OK, error);
1040+ dialog.show_all ();
1041+ dialog.response.connect (() => {
1042+ dialog.destroy ();
1043+
1044+ if (fatal)
1045+ main_window.destroy ();
1046+ });
1047+ dialog.run ();
1048 }
1049 }
1050 }
1051@@ -692,4 +764,4 @@
1052 eidete = new Eidete.EideteApp ();
1053
1054 return eidete.run (args);
1055-}
1056\ No newline at end of file
1057+}
1058
1059=== modified file 'src/keycapture.c'
1060--- src/keycapture.c 2012-04-04 00:02:38 +0000
1061+++ src/keycapture.c 2015-01-04 13:23:18 +0000
1062@@ -4,8 +4,12 @@
1063 #include <X11/Xlib.h>
1064 #include <X11/XKBlib.h>
1065 #include <X11/extensions/record.h> //libxtst-dev, Xtst
1066+#ifdef GSTREAMER_0_10_IS_DEFINED
1067 #include <gstreamer-0.10/gst/gst.h>
1068 #include <gstreamer-0.10/gst/gstinterface.h>
1069+#else
1070+#include <gstreamer-1.0/gst/gst.h>
1071+#endif
1072 /*
1073 GList *list_devices (){
1074 GstElement *pulsesrc = gst_element_factory_make ("pulsesrc", "src");
1075
1076=== modified file 'src/videobin_uploader.vala'
1077--- src/videobin_uploader.vala 2012-01-03 12:54:48 +0000
1078+++ src/videobin_uploader.vala 2015-01-04 13:23:18 +0000
1079@@ -27,7 +27,7 @@
1080 }
1081
1082
1083- public Uploader (string file){
1084+ public Uploader (File file){
1085 this.title = "Upload to videobin.org";
1086 this.set_default_size (300, 1);
1087 this.window_position = WindowPosition.CENTER;
1088@@ -38,21 +38,26 @@
1089 grid.row_spacing = 5;
1090
1091 var title = new Entry ();
1092+ title.placeholder_text = _("Optional") ;
1093 var description = new Entry ();
1094+ description.placeholder_text = _("Optional") ;
1095 var email = new Entry ();
1096+ email.placeholder_text = _("Optional") ;
1097 var img = new Image.from_icon_name ("videobin", IconSize.DIALOG);
1098
1099- var upload = new Button.with_label (_("Upload"));
1100+ var upload_button = new Button.with_label (_("Upload"));
1101+ upload_button.get_style_context ().add_class ("suggested-action");
1102 var cancel = new Button.from_stock (Stock.CANCEL);
1103+ cancel.margin_end = 6;
1104
1105 var bbox = new Box (Orientation.HORIZONTAL, 0);
1106- bbox.pack_end (upload, false, true, 0);
1107+ bbox.pack_end (upload_button, false, true, 0);
1108 bbox.pack_end (cancel, false, true, 0);
1109
1110- email.set_tooltip_text ("Your email address for relocating your videos");
1111- upload.image = new Image.from_icon_name ("mail-reply-sender", IconSize.BUTTON);
1112- upload.can_default = true;
1113- this.set_default (upload);
1114+ email.set_tooltip_text (_("Your email address for relocating your videos"));
1115+ upload_button.image = new Image.from_icon_name ("mail-reply-sender", IconSize.BUTTON);
1116+ upload_button.can_default = true;
1117+ this.set_default (upload_button);
1118
1119 grid.attach (img, 0, 0, 1, 2);
1120 grid.attach (new LLabel ("Title"), 1, 0, 1, 1);
1121@@ -68,9 +73,12 @@
1122
1123 cancel.clicked.connect (Gtk.main_quit);
1124
1125- upload.clicked.connect ( () => {
1126+ upload_button.clicked.connect ( () => {
1127 string url;
1128- string command = "curl -F\"api=1\" -F\"videoFile=@"+file+"\" ";
1129+ string path = file.get_path() ;
1130+ if( path.has_prefix ("'") && path.has_suffix ("'"))
1131+ path = path.substring (1, path.length-2) ;
1132+ string command = "curl -F\"api=1\" -F\"videoFile=@"+path+"\" ";
1133 if (email.text != "")
1134 command += "-F\"email="+email.text+"\" ";
1135 if (title.text != "")
1136@@ -78,11 +86,15 @@
1137 if (description.text != "")
1138 command += "-F\"description="+description.text+"\" ";
1139 command += "http://videobin.org/add";
1140-
1141 try{
1142 Process.spawn_command_line_sync (command, out url);
1143 }catch (Error e){error (e.message);}
1144 try{
1145+ if( url == null || url == "" )
1146+ {
1147+ warning( "The upload has failed. Command: %s", command) ;
1148+ }
1149+ else
1150 Process.spawn_command_line_async ("sensible-browser "+url);
1151 }catch (Error e){error (e.message);}
1152 Gtk.main_quit ();
1153@@ -93,9 +105,17 @@
1154
1155 public static void main (string [] args){
1156 Gtk.init (ref args);
1157- var file = File.new_for_uri (args[1]);
1158- var u = new Uploader (file.get_path ());
1159- u.show_all ();
1160- Gtk.main ();
1161+ if( args.length<=1)
1162+ {
1163+ warning ("You must provide a valid file path" ) ;
1164+ }
1165+ else
1166+ {
1167+ var path = args[1] ;
1168+ var file = File.new_for_path (path);
1169+ var dialog = new Uploader (file);
1170+ dialog.show_all ();
1171+ Gtk.main ();
1172+ }
1173 }
1174

Subscribers

People subscribed via source and target branches