aboutsummaryrefslogtreecommitdiff
path: root/src/ui/new_platform.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/new_platform.c')
-rw-r--r--src/ui/new_platform.c34
1 files changed, 27 insertions, 7 deletions
diff --git a/src/ui/new_platform.c b/src/ui/new_platform.c
index 0eb0ced..6521b83 100644
--- a/src/ui/new_platform.c
+++ b/src/ui/new_platform.c
@@ -89,14 +89,21 @@ handle_confirm_button_click(UNUSED GtkButton *button,
89 gtk_window_close(GTK_WINDOW(app->ui.new_platform.dialog)); 89 gtk_window_close(GTK_WINDOW(app->ui.new_platform.dialog));
90} 90}
91 91
92static void
93handle_dialog_destroy(UNUSED GtkWidget *window,
94 gpointer user_data)
95{
96 ui_new_platform_dialog_cleanup((UI_NEW_PLATFORM_Handle*) user_data);
97}
98
92void 99void
93ui_new_platform_dialog_init(MESSENGER_Application *app, 100ui_new_platform_dialog_init(MESSENGER_Application *app,
94 UI_NEW_PLATFORM_Handle *handle) 101 UI_NEW_PLATFORM_Handle *handle)
95{ 102{
96 GtkBuilder* builder = gtk_builder_new_from_file("resources/ui/new_platform.ui"); 103 handle->builder = gtk_builder_new_from_file("resources/ui/new_platform.ui");
97 104
98 handle->dialog = GTK_DIALOG( 105 handle->dialog = GTK_DIALOG(
99 gtk_builder_get_object(builder, "new_platform_dialog") 106 gtk_builder_get_object(handle->builder, "new_platform_dialog")
100 ); 107 );
101 108
102 gtk_window_set_title( 109 gtk_window_set_title(
@@ -110,15 +117,15 @@ ui_new_platform_dialog_init(MESSENGER_Application *app,
110 ); 117 );
111 118
112 handle->platform_avatar = HDY_AVATAR( 119 handle->platform_avatar = HDY_AVATAR(
113 gtk_builder_get_object(builder, "platform_avatar") 120 gtk_builder_get_object(handle->builder, "platform_avatar")
114 ); 121 );
115 122
116 handle->platform_avatar_file = GTK_FILE_CHOOSER_BUTTON( 123 handle->platform_avatar_file = GTK_FILE_CHOOSER_BUTTON(
117 gtk_builder_get_object(builder, "platform_avatar_file") 124 gtk_builder_get_object(handle->builder, "platform_avatar_file")
118 ); 125 );
119 126
120 handle->platform_entry = GTK_ENTRY( 127 handle->platform_entry = GTK_ENTRY(
121 gtk_builder_get_object(builder, "platform_entry") 128 gtk_builder_get_object(handle->builder, "platform_entry")
122 ); 129 );
123 130
124 g_signal_connect( 131 g_signal_connect(
@@ -136,7 +143,7 @@ ui_new_platform_dialog_init(MESSENGER_Application *app,
136 ); 143 );
137 144
138 handle->cancel_button = GTK_BUTTON( 145 handle->cancel_button = GTK_BUTTON(
139 gtk_builder_get_object(builder, "cancel_button") 146 gtk_builder_get_object(handle->builder, "cancel_button")
140 ); 147 );
141 148
142 g_signal_connect( 149 g_signal_connect(
@@ -147,7 +154,7 @@ ui_new_platform_dialog_init(MESSENGER_Application *app,
147 ); 154 );
148 155
149 handle->confirm_button = GTK_BUTTON( 156 handle->confirm_button = GTK_BUTTON(
150 gtk_builder_get_object(builder, "confirm_button") 157 gtk_builder_get_object(handle->builder, "confirm_button")
151 ); 158 );
152 159
153 g_signal_connect( 160 g_signal_connect(
@@ -156,4 +163,17 @@ ui_new_platform_dialog_init(MESSENGER_Application *app,
156 G_CALLBACK(handle_confirm_button_click), 163 G_CALLBACK(handle_confirm_button_click),
157 app 164 app
158 ); 165 );
166
167 g_signal_connect(
168 handle->dialog,
169 "destroy",
170 G_CALLBACK(handle_dialog_destroy),
171 handle
172 );
173}
174
175void
176ui_new_platform_dialog_cleanup(UI_NEW_PLATFORM_Handle *handle)
177{
178 g_object_unref(handle->builder);
159} 179}