pidgin/pidginabout.c

changeset 38661
cf4073d0d648
parent 38660
d6a4308481c7
child 38662
808d7958b434
equal deleted inserted replaced
38660:d6a4308481c7 38661:cf4073d0d648
1 #include <gdk-pixbuf/gdk-pixbuf.h> 1 #include <gdk-pixbuf/gdk-pixbuf.h>
2 #include <json-glib/json-glib.h> 2 #include <json-glib/json-glib.h>
3 3
4 #include "pidginabout.h" 4 #include "pidginabout.h"
5 #include "pidginresources.h" 5 #include "pidginresources.h"
6 #include "internal.h"
6 7
7 #include <stdio.h> 8 #include <stdio.h>
8 9
9 #include "config.h" 10 #include "config.h"
10 #ifdef HAVE_MESON_CONFIG 11 #ifdef HAVE_MESON_CONFIG
22 GtkTreeStore *credits_store; 23 GtkTreeStore *credits_store;
23 24
24 GtkWidget *build_info_button; 25 GtkWidget *build_info_button;
25 GtkWidget *build_info_page; 26 GtkWidget *build_info_page;
26 GtkWidget *build_info_treeview; 27 GtkWidget *build_info_treeview;
27 GtkWidget *build_info_store; 28 GtkTreeStore *build_info_store;
28 29
29 gboolean switching_pages; 30 gboolean switching_pages;
30 }; 31 };
31 32
32 /****************************************************************************** 33 /******************************************************************************
136 137
137 g_input_stream_close(istream, NULL, NULL); 138 g_input_stream_close(istream, NULL, NULL);
138 } 139 }
139 140
140 static void 141 static void
141 _pidgin_about_dialog_add_config_args(PidginAboutDialog *about) { 142 _pidgin_about_dialog_add_build_args(
142 #ifdef CONFIG_ARGS 143 PidginAboutDialog *about,
143 #endif /* CONFIG_ARGS */ 144 const gchar *title,
144 } 145 const gchar *build_args
145 146 ) {
146 static void 147 GtkTreeIter section, value;
147 _pidgin_about_dialog_add_meson_args(PidginAboutDialog *about) {
148 #ifdef MESON_ARGS
149 GtkTreeIter meson, value;
150 gchar **splits = NULL; 148 gchar **splits = NULL;
151 gchar *split = NULL; 149 gchar *markup = NULL;
152 gint idx = 0; 150 gint idx = 0;
153 151
154 gtk_tree_store_append(about->priv->build_info_store, &meson, NULL); 152 markup = g_strdup_printf("<span font-weight=\"bold\">%s</span>", title);
153 gtk_tree_store_append(about->priv->build_info_store, &section, NULL);
155 gtk_tree_store_set( 154 gtk_tree_store_set(
156 about->priv->build_info_store, 155 about->priv->build_info_store,
157 &meson, 156 &section,
158 0, "<span font-weight=\"bold\">Meson Arguments</span>", 157 0, markup,
159 -1 158 -1
160 ); 159 );
160 g_free(markup);
161 161
162 /* now walk through the arguments and add them */ 162 /* now walk through the arguments and add them */
163 splits = g_strsplit(MESON_ARGS, " ", -1); 163 splits = g_strsplit(build_args, " ", -1);
164 for(idx = 0; splits[idx]; idx++) { 164 for(idx = 0; splits[idx]; idx++) {
165 gchar **value_split = g_strsplit(splits[idx], "=", 2); 165 gchar **value_split = g_strsplit(splits[idx], "=", 2);
166 166
167 gtk_tree_store_append(about->priv->build_info_store, &value, &meson); 167 gtk_tree_store_append(about->priv->build_info_store, &value, &section);
168 gtk_tree_store_set( 168 gtk_tree_store_set(
169 about->priv->build_info_store, 169 about->priv->build_info_store,
170 &value, 170 &value,
171 0, value_split[0], 171 0, value_split[0],
172 1, value_split[1], 172 1, value_split[1],
175 175
176 g_strfreev(value_split); 176 g_strfreev(value_split);
177 } 177 }
178 178
179 g_strfreev(splits); 179 g_strfreev(splits);
180 }
181
182 static void
183 _pidgin_about_dialog_build_info_add_version(
184 GtkTreeStore *store,
185 GtkTreeIter *section,
186 const gchar *title,
187 guint major,
188 guint minor,
189 guint micro
190 ) {
191 GtkTreeIter item;
192 gchar *version = g_strdup_printf("%u.%u.%u", major, minor, micro);
193
194 gtk_tree_store_append(store, &item, section);
195 gtk_tree_store_set(
196 store, &item,
197 0, title,
198 1, version,
199 -1
200 );
201 g_free(version);
202 }
203
204 static void
205 _pidgin_about_dialog_load_build_info(PidginAboutDialog *about) {
206 GtkTreeIter section;
207 gchar *markup = NULL;
208
209 /* create the section */
210 markup = g_strdup_printf(
211 "<span font-weight=\"bold\">%s</span>",
212 _("Build Information")
213 );
214 gtk_tree_store_append(about->priv->build_info_store, &section, NULL);
215 gtk_tree_store_set(
216 about->priv->build_info_store,
217 &section,
218 0, markup,
219 -1
220 );
221 g_free(markup);
222
223 /* add the purple version */
224 _pidgin_about_dialog_build_info_add_version(
225 about->priv->build_info_store,
226 &section,
227 _("Purple Version"),
228 PURPLE_MAJOR_VERSION,
229 PURPLE_MINOR_VERSION,
230 PURPLE_MICRO_VERSION
231 );
232
233 /* add the glib version */
234 _pidgin_about_dialog_build_info_add_version(
235 about->priv->build_info_store,
236 &section,
237 _("GLib Version"),
238 GLIB_MAJOR_VERSION,
239 GLIB_MINOR_VERSION,
240 GLIB_MICRO_VERSION
241 );
242
243 /* add the gtk version */
244 _pidgin_about_dialog_build_info_add_version(
245 about->priv->build_info_store,
246 &section,
247 _("Gtk+ Version"),
248 GTK_MAJOR_VERSION,
249 GTK_MINOR_VERSION,
250 GTK_MICRO_VERSION
251 );
252 }
253
254 static void
255 _pidgin_about_dialog_load_runtime_info(PidginAboutDialog *about) {
256 GtkTreeIter section;
257 gchar *markup = NULL;
258
259 /* create the section */
260 markup = g_strdup_printf(
261 "<span font-weight=\"bold\">%s</span>",
262 _("Runtime Information")
263 );
264 gtk_tree_store_append(about->priv->build_info_store, &section, NULL);
265 gtk_tree_store_set(
266 about->priv->build_info_store,
267 &section,
268 0, markup,
269 -1
270 );
271 g_free(markup);
272
273 /* add the purple version */
274 _pidgin_about_dialog_build_info_add_version(
275 about->priv->build_info_store,
276 &section,
277 _("Purple Version"),
278 purple_major_version,
279 purple_minor_version,
280 purple_micro_version
281 );
282
283 /* add the glib version */
284 _pidgin_about_dialog_build_info_add_version(
285 about->priv->build_info_store,
286 &section,
287 _("GLib Version"),
288 glib_major_version,
289 glib_minor_version,
290 glib_micro_version
291 );
292
293 /* add the gtk version */
294 _pidgin_about_dialog_build_info_add_version(
295 about->priv->build_info_store,
296 &section,
297 _("Gtk+ Version"),
298 gtk_major_version,
299 gtk_minor_version,
300 gtk_micro_version
301 );
302 }
303
304 static void
305 _pidgin_about_dialog_load_build_configuration(PidginAboutDialog *about) {
306 #ifdef MESON_ARGS
307 _pidgin_about_dialog_add_build_args(about, "Meson Arguments", MESON_ARGS);
180 #endif /* MESON_ARGS */ 308 #endif /* MESON_ARGS */
181 } 309 #ifdef CONFIG_ARGS
182 310 _pidgin_about_dialog_add_build_args(about, "Configure Arguments", CONFIG_ARGS);
183 static void 311 #endif /* CONFIG_ARGS */
184 _pidgin_about_dialog_load_build_info(PidginAboutDialog *about) { 312
185 _pidgin_about_dialog_add_config_args(about); 313 _pidgin_about_dialog_load_build_info(about);
186 _pidgin_about_dialog_add_meson_args(about); 314 _pidgin_about_dialog_load_runtime_info(about);
187 } 315 }
188 316
189 /****************************************************************************** 317 /******************************************************************************
190 * Callbacks 318 * Callbacks
191 *****************************************************************************/ 319 *****************************************************************************/
267 "toggled", 395 "toggled",
268 G_CALLBACK(_pidgin_about_dialog_toggle_build_info), 396 G_CALLBACK(_pidgin_about_dialog_toggle_build_info),
269 about 397 about
270 ); 398 );
271 399
272 _pidgin_about_dialog_load_build_info(about); 400 _pidgin_about_dialog_load_build_configuration(about);
273 gtk_tree_view_expand_all(GTK_TREE_VIEW(about->priv->build_info_treeview)); 401 gtk_tree_view_expand_all(GTK_TREE_VIEW(about->priv->build_info_treeview));
274 } 402 }
275 403
276 GtkWidget * 404 GtkWidget *
277 pidgin_about_dialog_new(void) { 405 pidgin_about_dialog_new(void) {

mercurial