| 200 GtkTreePath *path; |
200 GtkTreePath *path; |
| 201 gtk_widget_set_sensitive(GTK_WIDGET(status_box), FALSE); |
201 gtk_widget_set_sensitive(GTK_WIDGET(status_box), FALSE); |
| 202 path = gtk_tree_path_new_from_indices(status_no, -1); |
202 path = gtk_tree_path_new_from_indices(status_no, -1); |
| 203 if (status_box->active_row) |
203 if (status_box->active_row) |
| 204 gtk_tree_row_reference_free(status_box->active_row); |
204 gtk_tree_row_reference_free(status_box->active_row); |
| 205 status_box->active_row = gtk_tree_row_reference_new(status_box->dropdown_store, path); |
205 status_box->active_row = gtk_tree_row_reference_new(GTK_TREE_MODEL(status_box->dropdown_store), path); |
| 206 gtk_tree_path_free(path); |
206 gtk_tree_path_free(path); |
| 207 |
207 |
| 208 message = gaim_status_get_attr_string(newstatus, "message"); |
208 message = gaim_status_get_attr_string(newstatus, "message"); |
| 209 |
209 |
| 210 if (!message || !*message) |
210 if (!message || !*message) |
| 713 if (!status_box->token_status_account && gaim_savedstatus_is_transient(saved_status) && |
714 if (!status_box->token_status_account && gaim_savedstatus_is_transient(saved_status) && |
| 714 ((primitive == GAIM_STATUS_AVAILABLE) || (primitive == GAIM_STATUS_AWAY) || |
715 ((primitive == GAIM_STATUS_AVAILABLE) || (primitive == GAIM_STATUS_AWAY) || |
| 715 (primitive == GAIM_STATUS_INVISIBLE) || (primitive == GAIM_STATUS_OFFLINE)) && |
716 (primitive == GAIM_STATUS_INVISIBLE) || (primitive == GAIM_STATUS_OFFLINE)) && |
| 716 (!gaim_savedstatus_has_substatuses(saved_status))) |
717 (!gaim_savedstatus_has_substatuses(saved_status))) |
| 717 { |
718 { |
| 718 GtkTreePath *path; |
|
| 719 index = get_statusbox_index(status_box, saved_status); |
719 index = get_statusbox_index(status_box, saved_status); |
| 720 path = gtk_tree_path_new_from_indices(index, -1); |
720 path = gtk_tree_path_new_from_indices(index, -1); |
| 721 if (status_box->active_row) |
|
| 722 gtk_tree_row_reference_free(status_box->active_row); |
|
| 723 status_box->active_row = gtk_tree_row_reference_new(status_box->dropdown_store, path); |
|
| 724 gtk_tree_path_free(path); |
|
| 725 |
|
| 726 } |
721 } |
| 727 else |
722 else |
| 728 { |
723 { |
| 729 GtkTreeIter iter; |
724 GtkTreeIter iter; |
| 730 GtkGaimStatusBoxItemType type; |
725 GtkGaimStatusBoxItemType type; |
| 731 gpointer data; |
726 gpointer data; |
| 732 |
|
| 733 /* Unset the active item */ |
|
| 734 if (status_box->active_row) |
|
| 735 gtk_tree_row_reference_free(status_box->active_row); |
|
| 736 status_box->active_row = NULL; |
|
| 737 |
727 |
| 738 /* If this saved status is in the list store, then set it as the active item */ |
728 /* If this saved status is in the list store, then set it as the active item */ |
| 739 if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(status_box->dropdown_store), &iter)) |
729 if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(status_box->dropdown_store), &iter)) |
| 740 { |
730 { |
| 741 do |
731 do |
| 759 |
749 |
| 760 if (!gaim_savedstatus_has_substatuses(saved_status) |
750 if (!gaim_savedstatus_has_substatuses(saved_status) |
| 761 || !strcmp(name, acct_status_name)) |
751 || !strcmp(name, acct_status_name)) |
| 762 { |
752 { |
| 763 /* Found! */ |
753 /* Found! */ |
| 764 // gtk_combo_box_set_active_iter(GTK_COMBO_BOX(status_box), &iter); |
754 path = gtk_tree_model_get_path(GTK_TREE_MODEL(status_box->dropdown_store), &iter); |
| 765 |
|
| 766 g_free(name); |
755 g_free(name); |
| 767 break; |
756 break; |
| 768 } |
757 } |
| 769 g_free(name); |
758 g_free(name); |
| 770 |
759 |
| 771 } else if ((type == GTK_GAIM_STATUS_BOX_TYPE_POPULAR) && |
760 } else if ((type == GTK_GAIM_STATUS_BOX_TYPE_POPULAR) && |
| 772 (GPOINTER_TO_INT(data) == gaim_savedstatus_get_creation_time(saved_status))) |
761 (GPOINTER_TO_INT(data) == gaim_savedstatus_get_creation_time(saved_status))) |
| 773 { |
762 { |
| 774 /* Found! */ |
763 /* Found! */ |
| 775 // gtk_combo_box_set_active_iter(GTK_COMBO_BOX(status_box), &iter); |
764 path = gtk_tree_model_get_path(GTK_TREE_MODEL(status_box->dropdown_store), &iter); |
| 776 break; |
765 break; |
| 777 } |
766 } |
| 778 } |
767 } |
| 779 while (gtk_tree_model_iter_next(GTK_TREE_MODEL(status_box->dropdown_store), &iter)); |
768 while (gtk_tree_model_iter_next(GTK_TREE_MODEL(status_box->dropdown_store), &iter)); |
| 780 } |
769 } |
| 781 } |
770 } |
| |
771 |
| |
772 if (status_box->active_row) |
| |
773 gtk_tree_row_reference_free(status_box->active_row); |
| |
774 if (path) { /* path should never be NULL */ |
| |
775 status_box->active_row = gtk_tree_row_reference_new(GTK_TREE_MODEL(status_box->dropdown_store), path); |
| |
776 gaim_debug_fatal("XXXX", "%s\n", gtk_tree_path_to_string(path)); |
| |
777 gtk_tree_path_free(path); |
| |
778 } else |
| |
779 status_box->active_row = NULL; |
| 782 |
780 |
| 783 message = gaim_savedstatus_get_message(saved_status); |
781 message = gaim_savedstatus_get_message(saved_status); |
| 784 if (!gaim_savedstatus_is_transient(saved_status) || !message || !*message) |
782 if (!gaim_savedstatus_is_transient(saved_status) || !message || !*message) |
| 785 { |
783 { |
| 786 status_box->imhtml_visible = FALSE; |
784 status_box->imhtml_visible = FALSE; |
| 1004 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_CUSTOM, pixbuf, _("New..."), NULL, NULL); |
1002 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_CUSTOM, pixbuf, _("New..."), NULL, NULL); |
| 1005 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_SAVED, pixbuf, _("Saved..."), NULL, NULL); |
1003 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_SAVED, pixbuf, _("Saved..."), NULL, NULL); |
| 1006 if (pixbuf) g_object_unref(G_OBJECT(pixbuf)); |
1004 if (pixbuf) g_object_unref(G_OBJECT(pixbuf)); |
| 1007 |
1005 |
| 1008 status_menu_refresh_iter(status_box); |
1006 status_menu_refresh_iter(status_box); |
| |
1007 gtk_gaim_status_box_refresh(status_box); |
| 1009 |
1008 |
| 1010 } else { |
1009 } else { |
| 1011 add_account_statuses(status_box, status_box->account); |
1010 add_account_statuses(status_box, status_box->account); |
| 1012 update_to_reflect_account_status(status_box, status_box->account, |
1011 update_to_reflect_account_status(status_box, status_box->account, |
| 1013 gaim_account_get_active_status(status_box->account)); |
1012 gaim_account_get_active_status(status_box->account)); |
| 1014 } |
1013 } |
| 1015 gtk_tree_view_set_model(GTK_TREE_VIEW(status_box->tree_view), status_box->dropdown_store); |
1014 gtk_tree_view_set_model(GTK_TREE_VIEW(status_box->tree_view), GTK_TREE_MODEL(status_box->dropdown_store)); |
| 1016 gtk_tree_view_set_search_column(GTK_TREE_VIEW(status_box->tree_view), TEXT_COLUMN); |
1015 gtk_tree_view_set_search_column(GTK_TREE_VIEW(status_box->tree_view), TEXT_COLUMN); |
| 1017 } |
1016 } |
| 1018 |
1017 |
| 1019 static gboolean combo_box_scroll_event_cb(GtkWidget *w, GdkEventScroll *event, GtkIMHtml *imhtml) |
1018 static gboolean combo_box_scroll_event_cb(GtkWidget *w, GdkEventScroll *event, GtkIMHtml *imhtml) |
| 1020 { |
1019 { |
| 1051 g_source_remove(status_box->typing); |
1050 g_source_remove(status_box->typing); |
| 1052 status_box->typing = 0; |
1051 status_box->typing = 0; |
| 1053 if (status_box->account != NULL) |
1052 if (status_box->account != NULL) |
| 1054 update_to_reflect_account_status(status_box, status_box->account, |
1053 update_to_reflect_account_status(status_box, status_box->account, |
| 1055 gaim_account_get_active_status(status_box->account)); |
1054 gaim_account_get_active_status(status_box->account)); |
| 1056 else |
1055 else { |
| 1057 status_menu_refresh_iter(status_box); |
1056 status_menu_refresh_iter(status_box); |
| |
1057 gtk_gaim_status_box_refresh(status_box); |
| |
1058 } |
| 1058 return TRUE; |
1059 return TRUE; |
| 1059 } |
1060 } |
| 1060 |
1061 |
| 1061 gtk_gaim_status_box_pulse_typing(status_box); |
1062 gtk_gaim_status_box_pulse_typing(status_box); |
| 1062 g_source_remove(status_box->typing); |
1063 g_source_remove(status_box->typing); |
| 1251 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (status_box->scrolled_window), |
1252 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (status_box->scrolled_window), |
| 1252 hpolicy, vpolicy); |
1253 hpolicy, vpolicy); |
| 1253 } |
1254 } |
| 1254 } |
1255 } |
| 1255 |
1256 |
| |
1257 static gboolean |
| 1256 popup_grab_on_window (GdkWindow *window, |
1258 popup_grab_on_window (GdkWindow *window, |
| 1257 guint32 activate_time, |
1259 guint32 activate_time, |
| 1258 gboolean grab_keyboard) |
1260 gboolean grab_keyboard) |
| 1259 { |
1261 { |
| 1260 if ((gdk_pointer_grab (window, TRUE, |
1262 if ((gdk_pointer_grab (window, TRUE, |
| 1296 gtk_grab_add (box->popup_window); |
1298 gtk_grab_add (box->popup_window); |
| 1297 box->popup_in_progress = TRUE; |
1299 box->popup_in_progress = TRUE; |
| 1298 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (box->toggle_button), |
1300 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (box->toggle_button), |
| 1299 TRUE); |
1301 TRUE); |
| 1300 |
1302 |
| |
1303 if (box->active_row) { |
| |
1304 GtkTreePath *path = gtk_tree_row_reference_get_path(box->active_row); |
| |
1305 GtkTreeSelection *sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (box->tree_view)); |
| |
1306 gtk_tree_selection_unselect_all(sel); |
| |
1307 gtk_tree_selection_select_path(sel, path); |
| |
1308 } |
| 1301 } |
1309 } |
| 1302 |
1310 |
| 1303 static void |
1311 static void |
| 1304 gaim_gtk_status_box_popdown(GtkGaimStatusBox *box) { |
1312 gaim_gtk_status_box_popdown(GtkGaimStatusBox *box) { |
| 1305 gtk_widget_hide(box->popup_window); |
1313 gtk_widget_hide(box->popup_window); |
| 1550 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (status_box->tree_view), |
1558 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (status_box->tree_view), |
| 1551 FALSE); |
1559 FALSE); |
| 1552 gtk_tree_view_set_hover_selection (GTK_TREE_VIEW (status_box->tree_view), |
1560 gtk_tree_view_set_hover_selection (GTK_TREE_VIEW (status_box->tree_view), |
| 1553 TRUE); |
1561 TRUE); |
| 1554 gtk_tree_view_set_model (GTK_TREE_VIEW (status_box->tree_view), |
1562 gtk_tree_view_set_model (GTK_TREE_VIEW (status_box->tree_view), |
| 1555 status_box->dropdown_store); |
1563 GTK_TREE_MODEL(status_box->dropdown_store)); |
| 1556 status_box->column = gtk_tree_view_column_new (); |
1564 status_box->column = gtk_tree_view_column_new (); |
| 1557 gtk_tree_view_append_column (GTK_TREE_VIEW (status_box->tree_view), |
1565 gtk_tree_view_append_column (GTK_TREE_VIEW (status_box->tree_view), |
| 1558 status_box->column); |
1566 status_box->column); |
| 1559 gtk_tree_view_column_pack_start(status_box->column, icon_rend, FALSE); |
1567 gtk_tree_view_column_pack_start(status_box->column, icon_rend, FALSE); |
| 1560 gtk_tree_view_column_pack_start(status_box->column, text_rend, TRUE); |
1568 gtk_tree_view_column_pack_start(status_box->column, text_rend, TRUE); |