Mercurial > pidgin
comparison src/gtkstatusbox.c @ 12379:24c5fbfca306
[gaim-migrate @ 14683]
Sadrul is totally awesome and fixed the crash that I was seeing when disabling an account and then trying to change status.
committer: Tailor Script <tailor@pidgin.im>
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Wed, 07 Dec 2005 01:22:14 +0000 |
parents | c2867c4ddcd3 |
children | 3d999a4d4892 |
comparison
equal
deleted
inserted
replaced
12378:c9aeafdb445e | 12379:24c5fbfca306 |
---|---|
68 enum { | 68 enum { |
69 PROP_0, | 69 PROP_0, |
70 PROP_ACCOUNT | 70 PROP_ACCOUNT |
71 }; | 71 }; |
72 | 72 |
73 GtkComboBoxClass *parent_class = NULL; | |
74 | |
73 static void gtk_gaim_status_box_class_init (GtkGaimStatusBoxClass *klass); | 75 static void gtk_gaim_status_box_class_init (GtkGaimStatusBoxClass *klass); |
74 static void gtk_gaim_status_box_init (GtkGaimStatusBox *status_box); | 76 static void gtk_gaim_status_box_init (GtkGaimStatusBox *status_box); |
75 | 77 |
76 GType | 78 GType |
77 gtk_gaim_status_box_get_type (void) | 79 gtk_gaim_status_box_get_type (void) |
181 | 183 |
182 switch (param_id) { | 184 switch (param_id) { |
183 case PROP_ACCOUNT: | 185 case PROP_ACCOUNT: |
184 statusbox->account = g_value_get_pointer(value); | 186 statusbox->account = g_value_get_pointer(value); |
185 | 187 |
186 /* FIXME: call this in the destroy function too, if we had one */ | |
187 if (statusbox->status_changed_signal) { | 188 if (statusbox->status_changed_signal) { |
188 gaim_signal_disconnect(gaim_accounts_get_handle(), "account-status-changed", | 189 gaim_signal_disconnect(gaim_accounts_get_handle(), "account-status-changed", |
189 statusbox, GAIM_CALLBACK(account_status_changed_cb)); | 190 statusbox, GAIM_CALLBACK(account_status_changed_cb)); |
190 statusbox->status_changed_signal = 0; | 191 statusbox->status_changed_signal = 0; |
191 } | 192 } |
202 break; | 203 break; |
203 } | 204 } |
204 } | 205 } |
205 | 206 |
206 static void | 207 static void |
208 gtk_gaim_status_box_finalize(GObject *obj) | |
209 { | |
210 GtkGaimStatusBox *statusbox = GTK_GAIM_STATUS_BOX(obj); | |
211 | |
212 if (statusbox->status_changed_signal) { | |
213 gaim_signal_disconnect(gaim_accounts_get_handle(), "account-status-changed", | |
214 statusbox, GAIM_CALLBACK(account_status_changed_cb)); | |
215 statusbox->status_changed_signal = 0; | |
216 } | |
217 gaim_prefs_disconnect_by_handle(statusbox); | |
218 | |
219 G_OBJECT_CLASS(parent_class)->finalize(obj); | |
220 } | |
221 | |
222 static void | |
207 gtk_gaim_status_box_class_init (GtkGaimStatusBoxClass *klass) | 223 gtk_gaim_status_box_class_init (GtkGaimStatusBoxClass *klass) |
208 { | 224 { |
209 GObjectClass *object_class; | 225 GObjectClass *object_class; |
226 GtkComboBoxClass *combo_class; | |
210 GtkWidgetClass *widget_class; | 227 GtkWidgetClass *widget_class; |
211 GtkComboBoxClass *parent_class = (GtkComboBoxClass*)klass; | |
212 GtkContainerClass *container_class = (GtkContainerClass*)klass; | 228 GtkContainerClass *container_class = (GtkContainerClass*)klass; |
213 | 229 |
214 parent_class->changed = gtk_gaim_status_box_changed; | 230 parent_class = g_type_class_peek_parent(klass); |
231 | |
232 combo_class = (GtkComboBoxClass*)klass; | |
233 combo_class->changed = gtk_gaim_status_box_changed; | |
234 | |
215 widget_class = (GtkWidgetClass*)klass; | 235 widget_class = (GtkWidgetClass*)klass; |
216 combo_box_size_request = widget_class->size_request; | 236 combo_box_size_request = widget_class->size_request; |
217 widget_class->size_request = gtk_gaim_status_box_size_request; | 237 widget_class->size_request = gtk_gaim_status_box_size_request; |
218 combo_box_size_allocate = widget_class->size_allocate; | 238 combo_box_size_allocate = widget_class->size_allocate; |
219 widget_class->size_allocate = gtk_gaim_status_box_size_allocate; | 239 widget_class->size_allocate = gtk_gaim_status_box_size_allocate; |
221 | 241 |
222 combo_box_forall = container_class->forall; | 242 combo_box_forall = container_class->forall; |
223 container_class->forall = gtk_gaim_status_box_forall; | 243 container_class->forall = gtk_gaim_status_box_forall; |
224 | 244 |
225 object_class = (GObjectClass *)klass; | 245 object_class = (GObjectClass *)klass; |
246 | |
247 object_class->finalize = gtk_gaim_status_box_finalize; | |
226 | 248 |
227 object_class->get_property = gtk_gaim_status_box_get_property; | 249 object_class->get_property = gtk_gaim_status_box_get_property; |
228 object_class->set_property = gtk_gaim_status_box_set_property; | 250 object_class->set_property = gtk_gaim_status_box_set_property; |
229 | 251 |
230 g_object_class_install_property(object_class, | 252 g_object_class_install_property(object_class, |
654 gtk_gaim_status_box_regenerate(status_box); | 676 gtk_gaim_status_box_regenerate(status_box); |
655 | 677 |
656 /* Monitor changes in the "/core/savedstatus/current" preference */ | 678 /* Monitor changes in the "/core/savedstatus/current" preference */ |
657 gaim_prefs_connect_callback(status_box, "/core/savedstatus/current", | 679 gaim_prefs_connect_callback(status_box, "/core/savedstatus/current", |
658 current_status_pref_changed_cb, status_box); | 680 current_status_pref_changed_cb, status_box); |
659 | |
660 /* TODO: Need to override the destroy method for this object and put the following line in it */ | |
661 /* gaim_prefs_disconnect_by_handle(status_box); */ | |
662 } | 681 } |
663 | 682 |
664 static void | 683 static void |
665 gtk_gaim_status_box_size_request(GtkWidget *widget, | 684 gtk_gaim_status_box_size_request(GtkWidget *widget, |
666 GtkRequisition *requisition) | 685 GtkRequisition *requisition) |