| 13 #else |
15 #else |
| 14 #error HAVE_MESON_CONFIG is not defined |
16 #error HAVE_MESON_CONFIG is not defined |
| 15 #endif |
17 #endif |
| 16 |
18 |
| 17 struct _PidginAboutDialogPrivate { |
19 struct _PidginAboutDialogPrivate { |
| |
20 GtkWidget *application_name; |
| 18 GtkWidget *stack; |
21 GtkWidget *stack; |
| |
22 |
| |
23 GtkWidget *main_scrolled_window; |
| 19 |
24 |
| 20 GtkWidget *developers_button; |
25 GtkWidget *developers_button; |
| 21 GtkWidget *developers_page; |
26 GtkWidget *developers_page; |
| 22 GtkWidget *developers_treeview; |
27 GtkWidget *developers_treeview; |
| 23 GtkTreeStore *developers_store; |
28 GtkTreeStore *developers_store; |
| 61 GTK_TOGGLE_BUTTON(about->priv->build_info_button), |
66 GTK_TOGGLE_BUTTON(about->priv->build_info_button), |
| 62 g_str_equal("build-info", name) |
67 g_str_equal("build-info", name) |
| 63 ); |
68 ); |
| 64 |
69 |
| 65 about->priv->switching_pages = FALSE; |
70 about->priv->switching_pages = FALSE; |
| |
71 } |
| |
72 |
| |
73 static void |
| |
74 _pidgin_about_dialog_load_main_page(PidginAboutDialog *about) { |
| |
75 GtkWidget *webview = NULL; |
| |
76 GInputStream *istream = NULL; |
| |
77 GString *str = NULL; |
| |
78 gchar buffer[8192]; |
| |
79 gssize read = 0; |
| |
80 |
| |
81 /* create our webview */ |
| |
82 webview = pidgin_webview_new(FALSE); |
| |
83 pidgin_setup_webview(webview); |
| |
84 pidgin_webview_set_format_functions(PIDGIN_WEBVIEW(webview), PIDGIN_WEBVIEW_ALL ^ PIDGIN_WEBVIEW_SMILEY); |
| |
85 |
| |
86 gtk_container_add(GTK_CONTAINER(about->priv->main_scrolled_window), webview); |
| |
87 |
| |
88 /* now load the html */ |
| |
89 istream = g_resource_open_stream( |
| |
90 pidgin_get_resource(), |
| |
91 "/im/pidgin/Pidgin/About/about.html", |
| |
92 G_RESOURCE_LOOKUP_FLAGS_NONE, |
| |
93 NULL |
| |
94 ); |
| |
95 |
| |
96 str = g_string_new(""); |
| |
97 |
| |
98 while((read = g_input_stream_read(istream, buffer, sizeof(buffer), NULL, NULL)) > 0) { |
| |
99 g_string_append_len(str, (gchar *)buffer, read); |
| |
100 } |
| |
101 |
| |
102 pidgin_webview_append_html(PIDGIN_WEBVIEW(webview), str->str); |
| |
103 |
| |
104 g_string_free(str, TRUE); |
| |
105 |
| |
106 g_input_stream_close(istream, NULL, NULL); |
| 66 } |
107 } |
| 67 |
108 |
| 68 static void |
109 static void |
| 69 _pidgin_about_dialog_load_developers(PidginAboutDialog *about) { |
110 _pidgin_about_dialog_load_developers(PidginAboutDialog *about) { |
| 70 GInputStream *istream = NULL; |
111 GInputStream *istream = NULL; |
| 463 gtk_widget_class_set_template_from_resource( |
504 gtk_widget_class_set_template_from_resource( |
| 464 widget_class, |
505 widget_class, |
| 465 "/im/pidgin/Pidgin/About/about.ui" |
506 "/im/pidgin/Pidgin/About/about.ui" |
| 466 ); |
507 ); |
| 467 |
508 |
| |
509 gtk_widget_class_bind_template_child_private(widget_class, PidginAboutDialog, application_name); |
| 468 gtk_widget_class_bind_template_child_private(widget_class, PidginAboutDialog, stack); |
510 gtk_widget_class_bind_template_child_private(widget_class, PidginAboutDialog, stack); |
| |
511 |
| |
512 gtk_widget_class_bind_template_child_private(widget_class, PidginAboutDialog, main_scrolled_window); |
| 469 |
513 |
| 470 gtk_widget_class_bind_template_child_private(widget_class, PidginAboutDialog, developers_button); |
514 gtk_widget_class_bind_template_child_private(widget_class, PidginAboutDialog, developers_button); |
| 471 gtk_widget_class_bind_template_child_private(widget_class, PidginAboutDialog, developers_page); |
515 gtk_widget_class_bind_template_child_private(widget_class, PidginAboutDialog, developers_page); |
| 472 gtk_widget_class_bind_template_child_private(widget_class, PidginAboutDialog, developers_store); |
516 gtk_widget_class_bind_template_child_private(widget_class, PidginAboutDialog, developers_store); |
| 473 gtk_widget_class_bind_template_child_private(widget_class, PidginAboutDialog, developers_treeview); |
517 gtk_widget_class_bind_template_child_private(widget_class, PidginAboutDialog, developers_treeview); |
| 488 about->priv = pidgin_about_dialog_get_instance_private(about); |
532 about->priv = pidgin_about_dialog_get_instance_private(about); |
| 489 |
533 |
| 490 about->priv->switching_pages = FALSE; |
534 about->priv->switching_pages = FALSE; |
| 491 |
535 |
| 492 gtk_widget_init_template(GTK_WIDGET(about)); |
536 gtk_widget_init_template(GTK_WIDGET(about)); |
| |
537 |
| |
538 /* setup the main page */ |
| |
539 _pidgin_about_dialog_load_main_page(about); |
| 493 |
540 |
| 494 /* setup the developers stuff */ |
541 /* setup the developers stuff */ |
| 495 g_signal_connect( |
542 g_signal_connect( |
| 496 about->priv->developers_button, |
543 about->priv->developers_button, |
| 497 "toggled", |
544 "toggled", |