| 77 static gint get_statusbox_index(PidginStatusBox *box, PurpleSavedStatus *saved_status); |
77 static gint get_statusbox_index(PidginStatusBox *box, PurpleSavedStatus *saved_status); |
| 78 static PurpleAccount* check_active_accounts_for_identical_statuses(void); |
78 static PurpleAccount* check_active_accounts_for_identical_statuses(void); |
| 79 |
79 |
| 80 static void pidgin_status_box_pulse_typing(PidginStatusBox *status_box); |
80 static void pidgin_status_box_pulse_typing(PidginStatusBox *status_box); |
| 81 static void pidgin_status_box_refresh(PidginStatusBox *status_box); |
81 static void pidgin_status_box_refresh(PidginStatusBox *status_box); |
| 82 static void status_menu_refresh_iter(PidginStatusBox *status_box); |
82 static void status_menu_refresh_iter(PidginStatusBox *status_box, gboolean status_changed); |
| 83 static void pidgin_status_box_regenerate(PidginStatusBox *status_box); |
83 static void pidgin_status_box_regenerate(PidginStatusBox *status_box, gboolean status_changed); |
| 84 static void pidgin_status_box_changed(PidginStatusBox *box); |
84 static void pidgin_status_box_changed(PidginStatusBox *box); |
| 85 static void pidgin_status_box_size_request (GtkWidget *widget, GtkRequisition *requisition); |
85 static void pidgin_status_box_size_request (GtkWidget *widget, GtkRequisition *requisition); |
| 86 static void pidgin_status_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation); |
86 static void pidgin_status_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation); |
| 87 static gboolean pidgin_status_box_expose_event (GtkWidget *widget, GdkEventExpose *event); |
87 static gboolean pidgin_status_box_expose_event (GtkWidget *widget, GdkEventExpose *event); |
| 88 static void pidgin_status_box_redisplay_buddy_icon(PidginStatusBox *status_box); |
88 static void pidgin_status_box_redisplay_buddy_icon(PidginStatusBox *status_box); |
| 302 account_status_changed_cb(PurpleAccount *account, PurpleStatus *oldstatus, PurpleStatus *newstatus, PidginStatusBox *status_box) |
302 account_status_changed_cb(PurpleAccount *account, PurpleStatus *oldstatus, PurpleStatus *newstatus, PidginStatusBox *status_box) |
| 303 { |
303 { |
| 304 if (status_box->account == account) |
304 if (status_box->account == account) |
| 305 update_to_reflect_account_status(status_box, account, newstatus); |
305 update_to_reflect_account_status(status_box, account, newstatus); |
| 306 else if (status_box->token_status_account == account) |
306 else if (status_box->token_status_account == account) |
| 307 status_menu_refresh_iter(status_box); |
307 status_menu_refresh_iter(status_box, TRUE); |
| 308 } |
308 } |
| 309 |
309 |
| 310 static gboolean |
310 static gboolean |
| 311 icon_box_press_cb(GtkWidget *widget, GdkEventButton *event, PidginStatusBox *box) |
311 icon_box_press_cb(GtkWidget *widget, GdkEventButton *event, PidginStatusBox *box) |
| 312 { |
312 { |
| 557 if (statusbox->account) |
557 if (statusbox->account) |
| 558 statusbox->token_status_account = NULL; |
558 statusbox->token_status_account = NULL; |
| 559 else |
559 else |
| 560 statusbox->token_status_account = check_active_accounts_for_identical_statuses(); |
560 statusbox->token_status_account = check_active_accounts_for_identical_statuses(); |
| 561 |
561 |
| 562 pidgin_status_box_regenerate(statusbox); |
562 pidgin_status_box_regenerate(statusbox, TRUE); |
| 563 |
563 |
| 564 break; |
564 break; |
| 565 default: |
565 default: |
| 566 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec); |
566 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec); |
| 567 break; |
567 break; |
| 819 * |
819 * |
| 820 * Maybe we could accomplish this by triggering off the mouse and |
820 * Maybe we could accomplish this by triggering off the mouse and |
| 821 * keyboard signals instead of the changed signal? |
821 * keyboard signals instead of the changed signal? |
| 822 */ |
822 */ |
| 823 static void |
823 static void |
| 824 status_menu_refresh_iter(PidginStatusBox *status_box) |
824 status_menu_refresh_iter(PidginStatusBox *status_box, gboolean status_changed) |
| 825 { |
825 { |
| 826 PurpleSavedStatus *saved_status; |
826 PurpleSavedStatus *saved_status; |
| 827 PurpleStatusPrimitive primitive; |
827 PurpleStatusPrimitive primitive; |
| 828 gint index; |
828 gint index; |
| 829 const char *message; |
829 const char *message; |
| 910 status_box->active_row = gtk_tree_row_reference_new(GTK_TREE_MODEL(status_box->dropdown_store), path); |
910 status_box->active_row = gtk_tree_row_reference_new(GTK_TREE_MODEL(status_box->dropdown_store), path); |
| 911 gtk_tree_path_free(path); |
911 gtk_tree_path_free(path); |
| 912 } else |
912 } else |
| 913 status_box->active_row = NULL; |
913 status_box->active_row = NULL; |
| 914 |
914 |
| 915 message = purple_savedstatus_get_message(saved_status); |
915 if (status_changed) { |
| 916 if (!purple_savedstatus_is_transient(saved_status) || !message || !*message) |
916 message = purple_savedstatus_get_message(saved_status); |
| 917 { |
917 if (!purple_savedstatus_is_transient(saved_status) || !message || !*message) |
| 918 status_box->imhtml_visible = FALSE; |
918 { |
| 919 gtk_widget_hide_all(status_box->vbox); |
919 status_box->imhtml_visible = FALSE; |
| 920 } |
920 gtk_widget_hide_all(status_box->vbox); |
| 921 else |
921 } |
| 922 { |
922 else |
| 923 status_box->imhtml_visible = TRUE; |
923 { |
| 924 gtk_widget_show_all(status_box->vbox); |
924 status_box->imhtml_visible = TRUE; |
| 925 |
925 gtk_widget_show_all(status_box->vbox); |
| 926 /* |
926 |
| 927 * Suppress the "changed" signal because the status |
927 /* |
| 928 * was changed programmatically. |
928 * Suppress the "changed" signal because the status |
| 929 */ |
929 * was changed programmatically. |
| 930 gtk_widget_set_sensitive(GTK_WIDGET(status_box->imhtml), FALSE); |
930 */ |
| 931 |
931 gtk_widget_set_sensitive(GTK_WIDGET(status_box->imhtml), FALSE); |
| 932 gtk_imhtml_clear(GTK_IMHTML(status_box->imhtml)); |
932 |
| 933 gtk_imhtml_clear_formatting(GTK_IMHTML(status_box->imhtml)); |
933 gtk_imhtml_clear(GTK_IMHTML(status_box->imhtml)); |
| 934 gtk_imhtml_append_text(GTK_IMHTML(status_box->imhtml), message, 0); |
934 gtk_imhtml_clear_formatting(GTK_IMHTML(status_box->imhtml)); |
| 935 gtk_widget_set_sensitive(GTK_WIDGET(status_box->imhtml), TRUE); |
935 gtk_imhtml_append_text(GTK_IMHTML(status_box->imhtml), message, 0); |
| 936 } |
936 gtk_widget_set_sensitive(GTK_WIDGET(status_box->imhtml), TRUE); |
| 937 |
937 } |
| 938 update_size(status_box); |
938 |
| |
939 update_size(status_box); |
| |
940 } |
| 939 |
941 |
| 940 /* Stop suppressing the "changed" signal. */ |
942 /* Stop suppressing the "changed" signal. */ |
| 941 gtk_widget_set_sensitive(GTK_WIDGET(status_box), TRUE); |
943 gtk_widget_set_sensitive(GTK_WIDGET(status_box), TRUE); |
| 942 } |
944 } |
| 943 |
945 |
| 1102 |
1104 |
| 1103 pidgin_status_box_add_separator(PIDGIN_STATUS_BOX(status_box)); |
1105 pidgin_status_box_add_separator(PIDGIN_STATUS_BOX(status_box)); |
| 1104 pidgin_status_box_add(PIDGIN_STATUS_BOX(status_box), PIDGIN_STATUS_BOX_TYPE_CUSTOM, NULL, _("New status..."), NULL, NULL); |
1106 pidgin_status_box_add(PIDGIN_STATUS_BOX(status_box), PIDGIN_STATUS_BOX_TYPE_CUSTOM, NULL, _("New status..."), NULL, NULL); |
| 1105 pidgin_status_box_add(PIDGIN_STATUS_BOX(status_box), PIDGIN_STATUS_BOX_TYPE_SAVED, NULL, _("Saved statuses..."), NULL, NULL); |
1107 pidgin_status_box_add(PIDGIN_STATUS_BOX(status_box), PIDGIN_STATUS_BOX_TYPE_SAVED, NULL, _("Saved statuses..."), NULL, NULL); |
| 1106 |
1108 |
| 1107 status_menu_refresh_iter(status_box); |
1109 status_menu_refresh_iter(status_box, status_changed); |
| 1108 pidgin_status_box_refresh(status_box); |
1110 pidgin_status_box_refresh(status_box); |
| 1109 |
1111 |
| 1110 } else { |
1112 } else { |
| 1111 add_account_statuses(status_box, status_box->account); |
1113 add_account_statuses(status_box, status_box->account); |
| 1112 update_to_reflect_account_status(status_box, status_box->account, |
1114 update_to_reflect_account_status(status_box, status_box->account, |
| 1154 GTK_IMHTML(status_box->imhtml), TRUE); |
1156 GTK_IMHTML(status_box->imhtml), TRUE); |
| 1155 if (status_box->account != NULL) |
1157 if (status_box->account != NULL) |
| 1156 update_to_reflect_account_status(status_box, status_box->account, |
1158 update_to_reflect_account_status(status_box, status_box->account, |
| 1157 purple_account_get_active_status(status_box->account)); |
1159 purple_account_get_active_status(status_box->account)); |
| 1158 else { |
1160 else { |
| 1159 status_menu_refresh_iter(status_box); |
1161 status_menu_refresh_iter(status_box, TRUE); |
| 1160 pidgin_status_box_refresh(status_box); |
1162 pidgin_status_box_refresh(status_box); |
| 1161 } |
1163 } |
| 1162 return TRUE; |
1164 return TRUE; |
| 1163 } |
1165 } |
| 1164 |
1166 |
| 1227 |
1229 |
| 1228 status_box->token_status_account = check_active_accounts_for_identical_statuses(); |
1230 status_box->token_status_account = check_active_accounts_for_identical_statuses(); |
| 1229 |
1231 |
| 1230 /* Regenerate the list if it has changed */ |
1232 /* Regenerate the list if it has changed */ |
| 1231 if (initial_token_acct != status_box->token_status_account) { |
1233 if (initial_token_acct != status_box->token_status_account) { |
| 1232 pidgin_status_box_regenerate(status_box); |
1234 pidgin_status_box_regenerate(status_box, TRUE); |
| 1233 } |
1235 } |
| 1234 |
1236 |
| 1235 } |
1237 } |
| 1236 |
1238 |
| 1237 static void |
1239 static void |
| 1238 current_savedstatus_changed_cb(PurpleSavedStatus *now, PurpleSavedStatus *old, PidginStatusBox *status_box) |
1240 current_savedstatus_changed_cb(PurpleSavedStatus *now, PurpleSavedStatus *old, PidginStatusBox *status_box) |
| 1239 { |
1241 { |
| 1240 /* Make sure our current status is added to the list of popular statuses */ |
1242 /* Make sure our current status is added to the list of popular statuses */ |
| 1241 pidgin_status_box_regenerate(status_box); |
1243 pidgin_status_box_regenerate(status_box, TRUE); |
| 1242 } |
1244 } |
| 1243 |
1245 |
| 1244 static void |
1246 static void |
| 1245 saved_status_updated_cb(PurpleSavedStatus *status, PidginStatusBox *status_box) |
1247 saved_status_updated_cb(PurpleSavedStatus *status, PidginStatusBox *status_box) |
| 1246 { |
1248 { |
| 1247 pidgin_status_box_regenerate(status_box); |
1249 pidgin_status_box_regenerate(status_box, |
| |
1250 purple_savedstatus_get_current() == status); |
| 1248 } |
1251 } |
| 1249 |
1252 |
| 1250 static void |
1253 static void |
| 1251 spellcheck_prefs_cb(const char *name, PurplePrefType type, |
1254 spellcheck_prefs_cb(const char *name, PurplePrefType type, |
| 1252 gconstpointer value, gpointer data) |
1255 gconstpointer value, gpointer data) |
| 1917 #endif |
1920 #endif |
| 1918 |
1921 |
| 1919 status_box->token_status_account = check_active_accounts_for_identical_statuses(); |
1922 status_box->token_status_account = check_active_accounts_for_identical_statuses(); |
| 1920 |
1923 |
| 1921 cache_pixbufs(status_box); |
1924 cache_pixbufs(status_box); |
| 1922 pidgin_status_box_regenerate(status_box); |
1925 pidgin_status_box_regenerate(status_box, TRUE); |
| 1923 |
1926 |
| 1924 purple_signal_connect(purple_savedstatuses_get_handle(), "savedstatus-changed", |
1927 purple_signal_connect(purple_savedstatuses_get_handle(), "savedstatus-changed", |
| 1925 status_box, |
1928 status_box, |
| 1926 PURPLE_CALLBACK(current_savedstatus_changed_cb), |
1929 PURPLE_CALLBACK(current_savedstatus_changed_cb), |
| 1927 status_box); |
1930 status_box); |
| 2585 static void remove_typing_cb(PidginStatusBox *status_box) |
2588 static void remove_typing_cb(PidginStatusBox *status_box) |
| 2586 { |
2589 { |
| 2587 if (status_box->typing == 0) |
2590 if (status_box->typing == 0) |
| 2588 { |
2591 { |
| 2589 /* Nothing has changed, so we don't need to do anything */ |
2592 /* Nothing has changed, so we don't need to do anything */ |
| 2590 status_menu_refresh_iter(status_box); |
2593 status_menu_refresh_iter(status_box, FALSE); |
| 2591 return; |
2594 return; |
| 2592 } |
2595 } |
| 2593 |
2596 |
| 2594 gtk_imhtml_set_populate_primary_clipboard( |
2597 gtk_imhtml_set_populate_primary_clipboard( |
| 2595 GTK_IMHTML(status_box->imhtml), TRUE); |
2598 GTK_IMHTML(status_box->imhtml), TRUE); |
| 2643 if (purple_savedstatus_get_type(saved_status) == PURPLE_STATUS_AVAILABLE) |
2646 if (purple_savedstatus_get_type(saved_status) == PURPLE_STATUS_AVAILABLE) |
| 2644 saved_status = purple_savedstatus_new(NULL, PURPLE_STATUS_AWAY); |
2647 saved_status = purple_savedstatus_new(NULL, PURPLE_STATUS_AWAY); |
| 2645 pidgin_status_editor_show(FALSE, |
2648 pidgin_status_editor_show(FALSE, |
| 2646 purple_savedstatus_is_transient(saved_status) |
2649 purple_savedstatus_is_transient(saved_status) |
| 2647 ? saved_status : NULL); |
2650 ? saved_status : NULL); |
| 2648 status_menu_refresh_iter(status_box); |
2651 status_menu_refresh_iter(status_box, FALSE); |
| 2649 return; |
2652 return; |
| 2650 } |
2653 } |
| 2651 |
2654 |
| 2652 if (type == PIDGIN_STATUS_BOX_TYPE_SAVED) |
2655 if (type == PIDGIN_STATUS_BOX_TYPE_SAVED) |
| 2653 { |
2656 { |
| 2654 pidgin_status_window_show(); |
2657 pidgin_status_window_show(); |
| 2655 status_menu_refresh_iter(status_box); |
2658 status_menu_refresh_iter(status_box, FALSE); |
| 2656 return; |
2659 return; |
| 2657 } |
2660 } |
| 2658 } |
2661 } |
| 2659 |
2662 |
| 2660 /* |
2663 /* |