Merge lp:~xapantu/granite/graniteinit into lp:~elementary-pantheon/granite/granite

Proposed by xapantu
Status: Merged
Approved by: Fabian Thoma
Approved revision: 124
Merged at revision: 129
Proposed branch: lp:~xapantu/granite/graniteinit
Merge into: lp:~elementary-pantheon/granite/granite
Diff against target: 120 lines (+34/-11)
5 files modified
demo/CMakeLists.txt (+0/-5)
demo/main.vala (+4/-2)
lib/Application.vala (+2/-4)
lib/CMakeLists.txt (+1/-0)
lib/Main.vala (+27/-0)
To merge this branch: bzr merge lp:~xapantu/granite/graniteinit
Reviewer Review Type Date Requested Status
Fabian Thoma Approve
Avi Romanoff (community) Approve
Review via email: mp+81312@code.launchpad.net

Commit message

Add a Granite.init function, that may be needed in the future

Description of the change

Add a Granite.init function, which is called transparently by Granite.Application. It may be needed for the future, if we want to deal with clutter, or with some other things like that.

To post a comment you must log in.
Revision history for this message
Avi Romanoff (aroman) :
review: Approve
Revision history for this message
Fabian Thoma (fabianthoma) :
review: Approve
Revision history for this message
Fabian Thoma (fabianthoma) :
review: Needs Information
Revision history for this message
Fabian Thoma (fabianthoma) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'demo/CMakeLists.txt'
2--- demo/CMakeLists.txt 2011-09-27 19:26:06 +0000
3+++ demo/CMakeLists.txt 2011-11-04 18:58:25 +0000
4@@ -2,9 +2,7 @@
5 include(ValaVersion)
6 ensure_vala_version("0.11.3" MINIMUM)
7 include(ValaPrecompile)
8-
9 include_directories(${CMAKE_CURRENT_BINARY_DIR}/../lib/)
10-
11 # pkgconfig, real C code
12
13 set(CMAKE_INCLUDE_CURRENT_DIR ON)
14@@ -12,13 +10,10 @@
15
16 find_package(PkgConfig)
17 pkg_check_modules(DEPS REQUIRED gtk+-3.0)
18-
19 set(CFLAGS ${DEPS_CFLAGS} ${DEPS_CFLAGS_OTHER} )
20 set(LIB_PATHS ${DEPS_LIBRARY_DIRS})
21-
22 link_directories(${LIB_PATHS} ${CMAKE_CURRENT_BINARY_DIR}/../lib/)
23 add_definitions(${CFLAGS})
24-
25 vala_precompile(VALA_C
26 main.vala
27 CUSTOM_VAPIS
28
29=== modified file 'demo/main.vala'
30--- demo/main.vala 2011-10-15 20:49:49 +0000
31+++ demo/main.vala 2011-11-04 18:58:25 +0000
32@@ -57,6 +57,9 @@
33 }
34 public Demo()
35 {
36+ }
37+
38+ public override void activate() {
39 var win = new Gtk.Window();
40 win.delete_event.connect( () => { Gtk.main_quit(); return false; });
41
42@@ -182,8 +185,7 @@
43
44 public static int main(string[] args)
45 {
46- Gtk.init(ref args);
47- new Granite.Demo();
48+ new Granite.Demo().run(args);
49
50 Gtk.main();
51
52
53=== modified file 'lib/Application.vala'
54--- lib/Application.vala 2011-10-24 20:20:21 +0000
55+++ lib/Application.vala 2011-11-04 18:58:25 +0000
56@@ -69,6 +69,8 @@
57
58 public Application () {
59
60+
61+ Granite.init ();
62 // set program name
63 prctl (15, exec_name, 0, 0, 0);
64 Environment.set_prgname (exec_name);
65@@ -86,10 +88,6 @@
66
67 Intl.bindtextdomain (exec_name, build_data_dir + "/locale");
68
69- if (!Thread.supported ())
70- error ("Problem initializing thread support.");
71- Gdk.threads_init ();
72-
73 // Deprecated
74 Granite.app = this;
75
76
77=== modified file 'lib/CMakeLists.txt'
78--- lib/CMakeLists.txt 2011-10-30 20:48:16 +0000
79+++ lib/CMakeLists.txt 2011-11-04 18:58:25 +0000
80@@ -67,6 +67,7 @@
81 Widgets/Welcome.vala
82 Widgets/ToolButtonWithMenu.vala
83 Widgets/PopOver.vala
84+ Main.vala
85 config.vapi
86 CUSTOM_VAPIS
87 ${CMAKE_CURRENT_SOURCE_DIR}/GtkPatch/gtkpatch-utils.vapi
88
89=== added file 'lib/Main.vala'
90--- lib/Main.vala 1970-01-01 00:00:00 +0000
91+++ lib/Main.vala 2011-11-04 18:58:25 +0000
92@@ -0,0 +1,27 @@
93+/*
94+ * Copyright (c) 2011 Lucas Baudin <xapantu@gmail.com>
95+ *
96+ * This is a free software; you can redistribute it and/or
97+ * modify it under the terms of the GNU General Public License as
98+ * published by the Free Software Foundation; either version 2 of the
99+ * License, or (at your option) any later version.
100+ *
101+ * This is distributed in the hope that it will be useful,
102+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
103+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
104+ * General Public License for more details.
105+ *
106+ * You should have received a copy of the GNU General Public
107+ * License along with this program; see the file COPYING. If not,
108+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
109+ * Boston, MA 02111-1307, USA.
110+ *
111+ */
112+
113+namespace Granite {
114+ public void init () {
115+ if (!Thread.supported ())
116+ error ("Problem initializing thread support.");
117+ Gdk.threads_init ();
118+ }
119+}
120\ No newline at end of file

Subscribers

People subscribed via source and target branches