Mercurial > pidgin
comparison src/gtkstatusbox.c @ 11960:082a2a9aa998
[gaim-migrate @ 14251]
commit what i was working on, as it shouldn't effect anything.
I'll try to get this closer to finished tonight.
Btw, what am I supposed to do with the return value of
gaim_signal_connect()? None of the disconnect functions seem to take it.
committer: Tailor Script <tailor@pidgin.im>
author | Tim Ringenbach <marv@pidgin.im> |
---|---|
date | Thu, 03 Nov 2005 15:10:01 +0000 |
parents | 351f4dd75718 |
children | 225e1b274033 |
comparison
equal
deleted
inserted
replaced
11959:6f8869d95c09 | 11960:082a2a9aa998 |
---|---|
110 break; | 110 break; |
111 } | 111 } |
112 } | 112 } |
113 | 113 |
114 static void | 114 static void |
115 account_status_changed_cb(GaimAccount *account, GaimStatus *oldstatus, GaimStatus *newstatus, GtkGaimStatusBox* status_box) | |
116 { | |
117 /*update_to_reflect_current_status(status_box);*/ | |
118 } | |
119 | |
120 static void | |
115 gtk_gaim_status_box_set_property(GObject *object, guint param_id, | 121 gtk_gaim_status_box_set_property(GObject *object, guint param_id, |
116 const GValue *value, GParamSpec *pspec) | 122 const GValue *value, GParamSpec *pspec) |
117 { | 123 { |
118 GtkGaimStatusBox *statusbox = GTK_GAIM_STATUS_BOX(object); | 124 GtkGaimStatusBox *statusbox = GTK_GAIM_STATUS_BOX(object); |
119 | 125 |
120 switch (param_id) { | 126 switch (param_id) { |
121 case PROP_ACCOUNT: | 127 case PROP_ACCOUNT: |
122 statusbox->account = g_value_get_pointer(value); | 128 statusbox->account = g_value_get_pointer(value); |
129 | |
130 /* FIXME: call this in the destroy function too, if we had one */ | |
131 if (0 && statusbox->status_changed_signal) | |
132 ;/*gaim_signals_disconnect_by_handle(statusbox->status_changed_signal);*/ | |
133 if (statusbox->account) | |
134 statusbox->status_changed_signal = gaim_signal_connect(gaim_accounts_get_handle(), "account_status_changed", | |
135 statusbox, GAIM_CALLBACK(account_status_changed_cb), | |
136 statusbox); | |
123 gtk_gaim_status_box_regenerate(statusbox); | 137 gtk_gaim_status_box_regenerate(statusbox); |
124 break; | 138 break; |
125 default: | 139 default: |
126 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec); | 140 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec); |
127 break; | 141 break; |
180 style->text_aa[GTK_STATE_NORMAL].blue >> 8); | 194 style->text_aa[GTK_STATE_NORMAL].blue >> 8); |
181 | 195 |
182 title = status_box->title; | 196 title = status_box->title; |
183 if (!title) | 197 if (!title) |
184 title = ""; | 198 title = ""; |
199 | |
185 | 200 |
186 if (status_box->error) { | 201 if (status_box->error) { |
187 text = g_strdup_printf("%s\n<span size=\"smaller\" weight=\"bold\" color=\"red\">%s</span>", | 202 text = g_strdup_printf("%s\n<span size=\"smaller\" weight=\"bold\" color=\"red\">%s</span>", |
188 title, status_box->error); | 203 title, status_box->error); |
189 } else if (status_box->typing) { | 204 } else if (status_box->typing) { |
196 text = g_strdup_printf("%s\n<span size=\"smaller\" color=\"%s\">%s</span>", | 211 text = g_strdup_printf("%s\n<span size=\"smaller\" color=\"%s\">%s</span>", |
197 title, aa_color, status_box->desc); | 212 title, aa_color, status_box->desc); |
198 } else { | 213 } else { |
199 text = g_strdup_printf("%s", title); | 214 text = g_strdup_printf("%s", title); |
200 } | 215 } |
216 | |
217 if (status_box->account) { | |
218 char *text2 = g_strdup_printf("%s\n<span size=\"smaller\">%s</span>", gaim_account_get_username(status_box->account), text); | |
219 g_free(text); | |
220 text = text2; | |
221 } | |
222 | |
201 | 223 |
202 if (status_box->connecting) | 224 if (status_box->connecting) |
203 pixbuf = status_box->connecting_pixbufs[status_box->connecting_index]; | 225 pixbuf = status_box->connecting_pixbufs[status_box->connecting_index]; |
204 else if (status_box->error) | 226 else if (status_box->error) |
205 pixbuf = status_box->error_pixbuf; | 227 pixbuf = status_box->error_pixbuf; |
388 gaim_status_type_get_primitive(status_type), | 410 gaim_status_type_get_primitive(status_type), |
389 load_icon(gaim_status_type_get_id(status_type)), | 411 load_icon(gaim_status_type_get_id(status_type)), |
390 gaim_status_type_get_name(status_type), | 412 gaim_status_type_get_name(status_type), |
391 NULL); | 413 NULL); |
392 } | 414 } |
415 gtk_combo_box_set_active(GTK_COMBO_BOX(status_box), 0); /* set something active to avoid blowing up */ | |
393 } | 416 } |
394 | 417 |
395 } | 418 } |
396 | 419 |
397 #if GTK_CHECK_VERSION(2,6,0) | 420 #if GTK_CHECK_VERSION(2,6,0) |
737 GtkGaimStatusBox *status_box; | 760 GtkGaimStatusBox *status_box; |
738 GtkTreeIter iter; | 761 GtkTreeIter iter; |
739 GtkGaimStatusBoxItemType type; | 762 GtkGaimStatusBoxItemType type; |
740 char *text, *sec_text; | 763 char *text, *sec_text; |
741 GdkPixbuf *pixbuf; | 764 GdkPixbuf *pixbuf; |
742 GList *accounts, *node; | 765 GList *accounts = NULL, *node; |
743 | 766 |
744 status_box = GTK_GAIM_STATUS_BOX(box); | 767 status_box = GTK_GAIM_STATUS_BOX(box); |
745 | 768 |
746 gtk_combo_box_get_active_iter(GTK_COMBO_BOX(status_box), &iter); | 769 gtk_combo_box_get_active_iter(GTK_COMBO_BOX(status_box), &iter); |
747 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter, | 770 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter, |
779 } | 802 } |
780 } | 803 } |
781 | 804 |
782 /* | 805 /* |
783 * Show the message box whenever 'type' allows for a | 806 * Show the message box whenever 'type' allows for a |
784 * message attribute on any protocol that is enabled. | 807 * message attribute on any protocol that is enabled, |
808 * or our protocol, if we have account set | |
785 */ | 809 */ |
786 accounts = gaim_accounts_get_all_active(); | 810 if (status_box->account) |
811 accounts = g_list_prepend(accounts, status_box->account); | |
812 else | |
813 accounts = gaim_accounts_get_all_active(); | |
787 status_box->imhtml_visible = FALSE; | 814 status_box->imhtml_visible = FALSE; |
788 for (node = accounts; node != NULL; node = node->next) | 815 for (node = accounts; node != NULL; node = node->next) |
789 { | 816 { |
790 GaimAccount *account; | 817 GaimAccount *account; |
791 GaimStatusType *status_type; | 818 GaimStatusType *status_type; |