Mercurial > pidgin.yaz
changeset 14739:63d5b71d0c68
[gaim-migrate @ 17495]
This should fix the statusbox issues that were keeping us from releasing beta
4 (and which were just really annoying). Thakn sadrul for most of this, I just
added the if (index == -1) bit. Anyway, the way this works now is that for
saved/popular statuses the primitive underlying that status is where the
dropdown for the statusbox starts. If we don't like that we can change it but
I'm not sure we'll find something better.
Also, this might plug a couple leaks, I'm not really sure but it certainly
looks right.
Up next, the patch to make the docklet use the per-protocol statuses in the
top section.
committer: Tailor Script <tailor@pidgin.im>
author | Etan Reisner <pidgin@unreliablesource.net> |
---|---|
date | Tue, 17 Oct 2006 08:13:41 +0000 |
parents | e1cfdb131c62 |
children | a169177ffa4e |
files | gtk/gtkstatusbox.c |
diffstat | 1 files changed, 12 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/gtk/gtkstatusbox.c Tue Oct 17 05:00:19 2006 +0000 +++ b/gtk/gtkstatusbox.c Tue Oct 17 08:13:41 2006 +0000 @@ -696,19 +696,16 @@ gtk_widget_set_sensitive(GTK_WIDGET(status_box), FALSE); /* - * If the saved_status is transient, is Available, Away, Invisible - * or Offline, and it does not have an substatuses, then select - * the primitive in the dropdown menu. Otherwise select the - * popular status in the dropdown menu. + * If there is a token-account, then select the primitive from the + * dropdown using a loop. Otherwise select from the default list. */ primitive = gaim_savedstatus_get_type(saved_status); - if (!status_box->token_status_account && gaim_savedstatus_is_transient(saved_status) && - ((primitive == GAIM_STATUS_AVAILABLE) || (primitive == GAIM_STATUS_AWAY) || - (primitive == GAIM_STATUS_INVISIBLE) || (primitive == GAIM_STATUS_OFFLINE)) && - (!gaim_savedstatus_has_substatuses(saved_status))) + if (!status_box->token_status_account) { index = get_statusbox_index(status_box, saved_status); gtk_combo_box_set_active(GTK_COMBO_BOX(status_box), index); + if (index == -1) + gtk_gaim_status_box_refresh(status_box); } else { @@ -728,8 +725,7 @@ TYPE_COLUMN, &type, DATA_COLUMN, &data, -1); - if (status_box->token_status_account && gaim_savedstatus_is_transient(saved_status) - && type == GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE && primitive == GPOINTER_TO_INT(data)) + if (type == GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE && primitive == GPOINTER_TO_INT(data)) { char *name; const char *acct_status_name = gaim_status_get_name( @@ -738,8 +734,7 @@ gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter, TEXT_COLUMN, &name, -1); - if (!gaim_savedstatus_has_substatuses(saved_status) - || !strcmp(name, acct_status_name)) + if (!strcmp(name, acct_status_name)) { /* Found! */ gtk_combo_box_set_active_iter(GTK_COMBO_BOX(status_box), &iter); @@ -748,13 +743,6 @@ } g_free(name); } - else if ((type == GTK_GAIM_STATUS_BOX_TYPE_POPULAR) && - (GPOINTER_TO_INT(data) == gaim_savedstatus_get_creation_time(saved_status))) - { - /* Found! */ - gtk_combo_box_set_active_iter(GTK_COMBO_BOX(status_box), &iter); - break; - } } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(status_box->dropdown_store), &iter)); } @@ -984,6 +972,10 @@ gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE, pixbuf2, _("Away"), NULL, GINT_TO_POINTER(GAIM_STATUS_AWAY)); gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE, pixbuf4, _("Invisible"), NULL, GINT_TO_POINTER(GAIM_STATUS_INVISIBLE)); gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE, pixbuf3, _("Offline"), NULL, GINT_TO_POINTER(GAIM_STATUS_OFFLINE)); + + if (pixbuf2) g_object_unref(G_OBJECT(pixbuf2)); + if (pixbuf3) g_object_unref(G_OBJECT(pixbuf3)); + if (pixbuf4) g_object_unref(G_OBJECT(pixbuf4)); } add_popular_statuses(status_box); @@ -991,6 +983,7 @@ gtk_gaim_status_box_add_separator(GTK_GAIM_STATUS_BOX(status_box)); gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_CUSTOM, pixbuf, _("New..."), NULL, NULL); gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_SAVED, pixbuf, _("Saved..."), NULL, NULL); + if (pixbuf) g_object_unref(G_OBJECT(pixbuf)); gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), GTK_TREE_MODEL(status_box->dropdown_store)); status_menu_refresh_iter(status_box);