| 20 * along with this program; if not, see <https://www.gnu.org/licenses/>. |
20 * along with this program; if not, see <https://www.gnu.org/licenses/>. |
| 21 */ |
21 */ |
| 22 |
22 |
| 23 #include <purple.h> |
23 #include <purple.h> |
| 24 |
24 |
| 25 #include <handy.h> |
25 #include <adwaita.h> |
| 26 |
26 |
| 27 #include "pidginawayprefs.h" |
27 #include "pidginawayprefs.h" |
| 28 #include "gtksavedstatuses.h" |
28 #include "gtksavedstatuses.h" |
| 29 #include "gtkutils.h" |
29 #include "gtkutils.h" |
| 30 #include "pidginprefsinternal.h" |
30 #include "pidginprefsinternal.h" |
| 31 |
31 |
| 32 struct _PidginAwayPrefs { |
32 struct _PidginAwayPrefs { |
| 33 HdyPreferencesPage parent; |
33 AdwPreferencesPage parent; |
| 34 |
34 |
| 35 PidginPrefCombo idle_reporting; |
35 PidginPrefCombo idle_reporting; |
| 36 GtkWidget *mins_before_away; |
36 GtkWidget *mins_before_away; |
| 37 GtkWidget *idle_hbox; |
37 GtkWidget *idle_hbox; |
| 38 GtkWidget *away_when_idle; |
38 GtkWidget *away_when_idle; |
| 40 GtkWidget *startup_current_status; |
40 GtkWidget *startup_current_status; |
| 41 GtkWidget *startup_hbox; |
41 GtkWidget *startup_hbox; |
| 42 GtkWidget *startup_label; |
42 GtkWidget *startup_label; |
| 43 }; |
43 }; |
| 44 |
44 |
| 45 G_DEFINE_TYPE(PidginAwayPrefs, pidgin_away_prefs, HDY_TYPE_PREFERENCES_PAGE) |
45 G_DEFINE_TYPE(PidginAwayPrefs, pidgin_away_prefs, ADW_TYPE_PREFERENCES_PAGE) |
| 46 |
46 |
| 47 /****************************************************************************** |
47 /****************************************************************************** |
| 48 * Helpers |
48 * Helpers |
| 49 *****************************************************************************/ |
49 *****************************************************************************/ |
| 50 static void |
50 static void |
| 110 prefs->away_when_idle); |
110 prefs->away_when_idle); |
| 111 |
111 |
| 112 /* TODO: Show something useful if we don't have any saved statuses. */ |
112 /* TODO: Show something useful if we don't have any saved statuses. */ |
| 113 menu = pidgin_status_menu(purple_savedstatus_get_idleaway(), |
113 menu = pidgin_status_menu(purple_savedstatus_get_idleaway(), |
| 114 G_CALLBACK(set_idle_away)); |
114 G_CALLBACK(set_idle_away)); |
| 115 gtk_widget_show_all(menu); |
115 gtk_box_append(GTK_BOX(prefs->idle_hbox), menu); |
| 116 gtk_box_pack_start(GTK_BOX(prefs->idle_hbox), menu, FALSE, FALSE, 0); |
|
| 117 |
116 |
| 118 g_object_bind_property(prefs->away_when_idle, "active", |
117 g_object_bind_property(prefs->away_when_idle, "active", |
| 119 menu, "sensitive", |
118 menu, "sensitive", |
| 120 G_BINDING_SYNC_CREATE); |
119 G_BINDING_SYNC_CREATE); |
| 121 |
120 |
| 129 prefs->startup_current_status); |
128 prefs->startup_current_status); |
| 130 |
129 |
| 131 /* TODO: Show something useful if we don't have any saved statuses. */ |
130 /* TODO: Show something useful if we don't have any saved statuses. */ |
| 132 menu = pidgin_status_menu(purple_savedstatus_get_startup(), |
131 menu = pidgin_status_menu(purple_savedstatus_get_startup(), |
| 133 G_CALLBACK(set_startupstatus)); |
132 G_CALLBACK(set_startupstatus)); |
| 134 gtk_widget_show_all(menu); |
133 gtk_box_append(GTK_BOX(prefs->startup_hbox), menu); |
| 135 gtk_box_pack_start(GTK_BOX(prefs->startup_hbox), menu, FALSE, FALSE, 0); |
|
| 136 gtk_label_set_mnemonic_widget(GTK_LABEL(prefs->startup_label), menu); |
134 gtk_label_set_mnemonic_widget(GTK_LABEL(prefs->startup_label), menu); |
| 137 pidgin_set_accessible_label(menu, GTK_LABEL(prefs->startup_label)); |
135 pidgin_set_accessible_label(menu, GTK_LABEL(prefs->startup_label)); |
| 138 g_object_bind_property(prefs->startup_current_status, "active", |
136 g_object_bind_property(prefs->startup_current_status, "active", |
| 139 prefs->startup_hbox, "sensitive", |
137 prefs->startup_hbox, "sensitive", |
| 140 G_BINDING_SYNC_CREATE|G_BINDING_INVERT_BOOLEAN); |
138 G_BINDING_SYNC_CREATE|G_BINDING_INVERT_BOOLEAN); |