Mercurial > pidgin
comparison src/gtkstatusbox.c @ 11967:225e1b274033
[gaim-migrate @ 14259]
I think I'm starting to get there. Now that update to reflect changes
in status. Only 3 or so other things to do.
committer: Tailor Script <tailor@pidgin.im>
author | Tim Ringenbach <marv@pidgin.im> |
---|---|
date | Fri, 04 Nov 2005 05:27:52 +0000 |
parents | 082a2a9aa998 |
children | 053bb5ad040b |
comparison
equal
deleted
inserted
replaced
11966:bf4fe41d5e94 | 11967:225e1b274033 |
---|---|
35 #include "gtkstatusbox.h" | 35 #include "gtkstatusbox.h" |
36 | 36 |
37 static void imhtml_changed_cb(GtkTextBuffer *buffer, void *data); | 37 static void imhtml_changed_cb(GtkTextBuffer *buffer, void *data); |
38 static void remove_typing_cb(GtkGaimStatusBox *box); | 38 static void remove_typing_cb(GtkGaimStatusBox *box); |
39 | 39 |
40 static void gtk_gaim_status_box_refresh(GtkGaimStatusBox *status_box); | |
40 static void gtk_gaim_status_box_regenerate(GtkGaimStatusBox *status_box); | 41 static void gtk_gaim_status_box_regenerate(GtkGaimStatusBox *status_box); |
41 static void gtk_gaim_status_box_changed(GtkComboBox *box); | 42 static void gtk_gaim_status_box_changed(GtkComboBox *box); |
42 static void gtk_gaim_status_box_size_request (GtkWidget *widget, GtkRequisition *requisition); | 43 static void gtk_gaim_status_box_size_request (GtkWidget *widget, GtkRequisition *requisition); |
43 static void gtk_gaim_status_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation); | 44 static void gtk_gaim_status_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation); |
44 static gboolean gtk_gaim_status_box_expose_event (GtkWidget *widget, GdkEventExpose *event); | 45 static gboolean gtk_gaim_status_box_expose_event (GtkWidget *widget, GdkEventExpose *event); |
110 break; | 111 break; |
111 } | 112 } |
112 } | 113 } |
113 | 114 |
114 static void | 115 static void |
115 account_status_changed_cb(GaimAccount *account, GaimStatus *oldstatus, GaimStatus *newstatus, GtkGaimStatusBox* status_box) | 116 update_to_reflect_account_status(GtkGaimStatusBox *status_box, GaimAccount *account, GaimStatus *newstatus) |
116 { | 117 { |
117 /*update_to_reflect_current_status(status_box);*/ | 118 const GList *l; |
119 int status_no = -1; | |
120 const GaimStatusType *statustype = NULL; | |
121 | |
122 statustype = gaim_status_type_find_with_id((GList *)gaim_account_get_status_types(account), | |
123 (char *)gaim_status_type_get_id(gaim_status_get_type(newstatus))); | |
124 | |
125 for (l = gaim_account_get_status_types(account); l != NULL; l = l->next) { | |
126 GaimStatusType *status_type = (GaimStatusType *)l->data; | |
127 | |
128 if (!gaim_status_type_is_user_settable(status_type)) | |
129 continue; | |
130 status_no++; | |
131 if (statustype == status_type) | |
132 break; | |
133 } | |
134 | |
135 if (status_no != -1) { | |
136 gtk_widget_set_sensitive(GTK_WIDGET(status_box), FALSE); | |
137 gtk_combo_box_set_active(GTK_COMBO_BOX(status_box), status_no); | |
138 gtk_gaim_status_box_refresh(status_box); | |
139 gtk_widget_set_sensitive(GTK_WIDGET(status_box), TRUE); | |
140 } | |
141 | |
142 } | |
143 | |
144 static void | |
145 account_status_changed_cb(GaimAccount *account, GaimStatus *oldstatus, GaimStatus *newstatus, GtkGaimStatusBox *status_box) | |
146 { | |
147 if (status_box->account == account) | |
148 update_to_reflect_account_status(status_box, account, newstatus); | |
118 } | 149 } |
119 | 150 |
120 static void | 151 static void |
121 gtk_gaim_status_box_set_property(GObject *object, guint param_id, | 152 gtk_gaim_status_box_set_property(GObject *object, guint param_id, |
122 const GValue *value, GParamSpec *pspec) | 153 const GValue *value, GParamSpec *pspec) |
126 switch (param_id) { | 157 switch (param_id) { |
127 case PROP_ACCOUNT: | 158 case PROP_ACCOUNT: |
128 statusbox->account = g_value_get_pointer(value); | 159 statusbox->account = g_value_get_pointer(value); |
129 | 160 |
130 /* FIXME: call this in the destroy function too, if we had one */ | 161 /* FIXME: call this in the destroy function too, if we had one */ |
131 if (0 && statusbox->status_changed_signal) | 162 if (statusbox->status_changed_signal) { |
132 ;/*gaim_signals_disconnect_by_handle(statusbox->status_changed_signal);*/ | 163 gaim_signal_disconnect(gaim_accounts_get_handle(), "account-status-changed", |
164 statusbox, GAIM_CALLBACK(account_status_changed_cb)); | |
165 statusbox->status_changed_signal = 0; | |
166 } | |
133 if (statusbox->account) | 167 if (statusbox->account) |
134 statusbox->status_changed_signal = gaim_signal_connect(gaim_accounts_get_handle(), "account_status_changed", | 168 statusbox->status_changed_signal = gaim_signal_connect(gaim_accounts_get_handle(), "account-status-changed", |
135 statusbox, GAIM_CALLBACK(account_status_changed_cb), | 169 statusbox, GAIM_CALLBACK(account_status_changed_cb), |
136 statusbox); | 170 statusbox); |
137 gtk_gaim_status_box_regenerate(statusbox); | 171 gtk_gaim_status_box_regenerate(statusbox); |
138 break; | 172 break; |
139 default: | 173 default: |
410 gaim_status_type_get_primitive(status_type), | 444 gaim_status_type_get_primitive(status_type), |
411 load_icon(gaim_status_type_get_id(status_type)), | 445 load_icon(gaim_status_type_get_id(status_type)), |
412 gaim_status_type_get_name(status_type), | 446 gaim_status_type_get_name(status_type), |
413 NULL); | 447 NULL); |
414 } | 448 } |
415 gtk_combo_box_set_active(GTK_COMBO_BOX(status_box), 0); /* set something active to avoid blowing up */ | 449 update_to_reflect_account_status(status_box, account, gaim_account_get_active_status(account)); |
416 } | 450 } |
417 | 451 |
418 } | 452 } |
419 | 453 |
420 #if GTK_CHECK_VERSION(2,6,0) | 454 #if GTK_CHECK_VERSION(2,6,0) |