pidgin/gtkstatusbox.c

changeset 15577
b8129373f65e
parent 15568
cd19bb5a51b8
child 15656
c1f66538f8c6
equal deleted inserted replaced
15576:149facbe2fbd 15577:b8129373f65e
46 #include "network.h" 46 #include "network.h"
47 #include "savedstatuses.h" 47 #include "savedstatuses.h"
48 #include "status.h" 48 #include "status.h"
49 #include "debug.h" 49 #include "debug.h"
50 50
51 #include "gtkgaim.h" 51 #include "pidgin.h"
52 #include "gtksavedstatuses.h" 52 #include "gtksavedstatuses.h"
53 #include "gaimstock.h" 53 #include "gaimstock.h"
54 #include "gtkstatusbox.h" 54 #include "gtkstatusbox.h"
55 #include "gtkutils.h" 55 #include "gtkutils.h"
56 56
63 63
64 #define TYPING_TIMEOUT 4000 64 #define TYPING_TIMEOUT 4000
65 65
66 static void imhtml_changed_cb(GtkTextBuffer *buffer, void *data); 66 static void imhtml_changed_cb(GtkTextBuffer *buffer, void *data);
67 static void imhtml_format_changed_cb(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons, void *data); 67 static void imhtml_format_changed_cb(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons, void *data);
68 static void remove_typing_cb(GtkGaimStatusBox *box); 68 static void remove_typing_cb(PidginStatusBox *box);
69 static void update_size (GtkGaimStatusBox *box); 69 static void update_size (PidginStatusBox *box);
70 static gint get_statusbox_index(GtkGaimStatusBox *box, GaimSavedStatus *saved_status); 70 static gint get_statusbox_index(PidginStatusBox *box, GaimSavedStatus *saved_status);
71 71
72 static void gtk_gaim_status_box_pulse_typing(GtkGaimStatusBox *status_box); 72 static void pidgin_status_box_pulse_typing(PidginStatusBox *status_box);
73 static void gtk_gaim_status_box_refresh(GtkGaimStatusBox *status_box); 73 static void pidgin_status_box_refresh(PidginStatusBox *status_box);
74 static void status_menu_refresh_iter(GtkGaimStatusBox *status_box); 74 static void status_menu_refresh_iter(PidginStatusBox *status_box);
75 static void gtk_gaim_status_box_regenerate(GtkGaimStatusBox *status_box); 75 static void pidgin_status_box_regenerate(PidginStatusBox *status_box);
76 static void gtk_gaim_status_box_changed(GtkGaimStatusBox *box); 76 static void pidgin_status_box_changed(PidginStatusBox *box);
77 static void gtk_gaim_status_box_size_request (GtkWidget *widget, GtkRequisition *requisition); 77 static void pidgin_status_box_size_request (GtkWidget *widget, GtkRequisition *requisition);
78 static void gtk_gaim_status_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation); 78 static void pidgin_status_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation);
79 static gboolean gtk_gaim_status_box_expose_event (GtkWidget *widget, GdkEventExpose *event); 79 static gboolean pidgin_status_box_expose_event (GtkWidget *widget, GdkEventExpose *event);
80 static void gtk_gaim_status_box_redisplay_buddy_icon(GtkGaimStatusBox *status_box); 80 static void pidgin_status_box_redisplay_buddy_icon(PidginStatusBox *status_box);
81 static void gtk_gaim_status_box_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data); 81 static void pidgin_status_box_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data);
82 static void pidgin_status_box_popup(GtkGaimStatusBox *box); 82 static void pidgin_status_box_popup(PidginStatusBox *box);
83 static void pidgin_status_box_popdown(GtkGaimStatusBox *box); 83 static void pidgin_status_box_popdown(PidginStatusBox *box);
84 84
85 static void do_colorshift (GdkPixbuf *dest, GdkPixbuf *src, int shift); 85 static void do_colorshift (GdkPixbuf *dest, GdkPixbuf *src, int shift);
86 static void icon_choose_cb(const char *filename, gpointer data); 86 static void icon_choose_cb(const char *filename, gpointer data);
87 static void remove_buddy_icon_cb(GtkWidget *w, GtkGaimStatusBox *box); 87 static void remove_buddy_icon_cb(GtkWidget *w, PidginStatusBox *box);
88 88
89 enum { 89 enum {
90 /** A GtkGaimStatusBoxItemType */ 90 /** A PidginStatusBoxItemType */
91 TYPE_COLUMN, 91 TYPE_COLUMN,
92 92
93 /** 93 /**
94 * This is a GdkPixbuf (the other columns are strings). 94 * This is a GdkPixbuf (the other columns are strings).
95 * This column is visible. 95 * This column is visible.
121 PROP_ICON_SEL, 121 PROP_ICON_SEL,
122 }; 122 };
123 123
124 GtkContainerClass *parent_class = NULL; 124 GtkContainerClass *parent_class = NULL;
125 125
126 static void gtk_gaim_status_box_class_init (GtkGaimStatusBoxClass *klass); 126 static void pidgin_status_box_class_init (PidginStatusBoxClass *klass);
127 static void gtk_gaim_status_box_init (GtkGaimStatusBox *status_box); 127 static void pidgin_status_box_init (PidginStatusBox *status_box);
128 128
129 GType 129 GType
130 gtk_gaim_status_box_get_type (void) 130 pidgin_status_box_get_type (void)
131 { 131 {
132 static GType status_box_type = 0; 132 static GType status_box_type = 0;
133 133
134 if (!status_box_type) 134 if (!status_box_type)
135 { 135 {
136 static const GTypeInfo status_box_info = 136 static const GTypeInfo status_box_info =
137 { 137 {
138 sizeof (GtkGaimStatusBoxClass), 138 sizeof (PidginStatusBoxClass),
139 NULL, /* base_init */ 139 NULL, /* base_init */
140 NULL, /* base_finalize */ 140 NULL, /* base_finalize */
141 (GClassInitFunc) gtk_gaim_status_box_class_init, 141 (GClassInitFunc) pidgin_status_box_class_init,
142 NULL, /* class_finalize */ 142 NULL, /* class_finalize */
143 NULL, /* class_data */ 143 NULL, /* class_data */
144 sizeof (GtkGaimStatusBox), 144 sizeof (PidginStatusBox),
145 0, 145 0,
146 (GInstanceInitFunc) gtk_gaim_status_box_init, 146 (GInstanceInitFunc) pidgin_status_box_init,
147 NULL /* value_table */ 147 NULL /* value_table */
148 }; 148 };
149 149
150 status_box_type = g_type_register_static(GTK_TYPE_CONTAINER, 150 status_box_type = g_type_register_static(GTK_TYPE_CONTAINER,
151 "GtkGaimStatusBox", 151 "PidginStatusBox",
152 &status_box_info, 152 &status_box_info,
153 0); 153 0);
154 } 154 }
155 155
156 return status_box_type; 156 return status_box_type;
157 } 157 }
158 158
159 static void 159 static void
160 gtk_gaim_status_box_get_property(GObject *object, guint param_id, 160 pidgin_status_box_get_property(GObject *object, guint param_id,
161 GValue *value, GParamSpec *psec) 161 GValue *value, GParamSpec *psec)
162 { 162 {
163 GtkGaimStatusBox *statusbox = GTK_GAIM_STATUS_BOX(object); 163 PidginStatusBox *statusbox = PIDGIN_STATUS_BOX(object);
164 164
165 switch (param_id) { 165 switch (param_id) {
166 case PROP_ACCOUNT: 166 case PROP_ACCOUNT:
167 g_value_set_pointer(value, statusbox->account); 167 g_value_set_pointer(value, statusbox->account);
168 break; 168 break;
174 break; 174 break;
175 } 175 }
176 } 176 }
177 177
178 static void 178 static void
179 update_to_reflect_account_status(GtkGaimStatusBox *status_box, GaimAccount *account, GaimStatus *newstatus) 179 update_to_reflect_account_status(PidginStatusBox *status_box, GaimAccount *account, GaimStatus *newstatus)
180 { 180 {
181 const GList *l; 181 const GList *l;
182 int status_no = -1; 182 int status_no = -1;
183 const GaimStatusType *statustype = NULL; 183 const GaimStatusType *statustype = NULL;
184 const char *message; 184 const char *message;
219 gtk_imhtml_clear(GTK_IMHTML(status_box->imhtml)); 219 gtk_imhtml_clear(GTK_IMHTML(status_box->imhtml));
220 gtk_imhtml_clear_formatting(GTK_IMHTML(status_box->imhtml)); 220 gtk_imhtml_clear_formatting(GTK_IMHTML(status_box->imhtml));
221 gtk_imhtml_append_text(GTK_IMHTML(status_box->imhtml), message, 0); 221 gtk_imhtml_append_text(GTK_IMHTML(status_box->imhtml), message, 0);
222 } 222 }
223 gtk_widget_set_sensitive(GTK_WIDGET(status_box), TRUE); 223 gtk_widget_set_sensitive(GTK_WIDGET(status_box), TRUE);
224 gtk_gaim_status_box_refresh(status_box); 224 pidgin_status_box_refresh(status_box);
225 } 225 }
226 } 226 }
227 227
228 static void 228 static void
229 account_status_changed_cb(GaimAccount *account, GaimStatus *oldstatus, GaimStatus *newstatus, GtkGaimStatusBox *status_box) 229 account_status_changed_cb(GaimAccount *account, GaimStatus *oldstatus, GaimStatus *newstatus, PidginStatusBox *status_box)
230 { 230 {
231 if (status_box->account == account) 231 if (status_box->account == account)
232 update_to_reflect_account_status(status_box, account, newstatus); 232 update_to_reflect_account_status(status_box, account, newstatus);
233 else if (status_box->token_status_account == account) 233 else if (status_box->token_status_account == account)
234 status_menu_refresh_iter(status_box); 234 status_menu_refresh_iter(status_box);
235 } 235 }
236 236
237 static gboolean 237 static gboolean
238 icon_box_press_cb(GtkWidget *widget, GdkEventButton *event, GtkGaimStatusBox *box) 238 icon_box_press_cb(GtkWidget *widget, GdkEventButton *event, PidginStatusBox *box)
239 { 239 {
240 if (event->button == 3) { 240 if (event->button == 3) {
241 GtkWidget *menu_item; 241 GtkWidget *menu_item;
242 242
243 if (box->icon_box_menu) 243 if (box->icon_box_menu)
266 return FALSE; 266 return FALSE;
267 } 267 }
268 268
269 static void 269 static void
270 icon_box_dnd_cb(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, 270 icon_box_dnd_cb(GtkWidget *widget, GdkDragContext *dc, gint x, gint y,
271 GtkSelectionData *sd, guint info, guint t, GtkGaimStatusBox *box) 271 GtkSelectionData *sd, guint info, guint t, PidginStatusBox *box)
272 { 272 {
273 gchar *name = (gchar *)sd->data; 273 gchar *name = (gchar *)sd->data;
274 274
275 if ((sd->length >= 0) && (sd->format == 8)) { 275 if ((sd->length >= 0) && (sd->format == 8)) {
276 /* Well, it looks like the drag event was cool. 276 /* Well, it looks like the drag event was cool.
295 gtk_drag_finish(dc, FALSE, FALSE, t); 295 gtk_drag_finish(dc, FALSE, FALSE, t);
296 } 296 }
297 297
298 298
299 static gboolean 299 static gboolean
300 icon_box_enter_cb(GtkWidget *widget, GdkEventCrossing *event, GtkGaimStatusBox *box) 300 icon_box_enter_cb(GtkWidget *widget, GdkEventCrossing *event, PidginStatusBox *box)
301 { 301 {
302 gdk_window_set_cursor(widget->window, box->hand_cursor); 302 gdk_window_set_cursor(widget->window, box->hand_cursor);
303 gtk_image_set_from_pixbuf(GTK_IMAGE(box->icon), box->buddy_icon_hover); 303 gtk_image_set_from_pixbuf(GTK_IMAGE(box->icon), box->buddy_icon_hover);
304 return FALSE; 304 return FALSE;
305 } 305 }
306 306
307 static gboolean 307 static gboolean
308 icon_box_leave_cb(GtkWidget *widget, GdkEventCrossing *event, GtkGaimStatusBox *box) 308 icon_box_leave_cb(GtkWidget *widget, GdkEventCrossing *event, PidginStatusBox *box)
309 { 309 {
310 gdk_window_set_cursor(widget->window, box->arrow_cursor); 310 gdk_window_set_cursor(widget->window, box->arrow_cursor);
311 gtk_image_set_from_pixbuf(GTK_IMAGE(box->icon), box->buddy_icon) ; 311 gtk_image_set_from_pixbuf(GTK_IMAGE(box->icon), box->buddy_icon) ;
312 return FALSE; 312 return FALSE;
313 } 313 }
318 {"text/uri-list", 0, 1}, 318 {"text/uri-list", 0, 1},
319 {"STRING", 0, 2} 319 {"STRING", 0, 2}
320 }; 320 };
321 321
322 static void 322 static void
323 setup_icon_box(GtkGaimStatusBox *status_box) 323 setup_icon_box(PidginStatusBox *status_box)
324 { 324 {
325 if (status_box->icon_box != NULL) 325 if (status_box->icon_box != NULL)
326 return; 326 return;
327 327
328 status_box->icon = gtk_image_new(); 328 status_box->icon = gtk_image_new();
332 332
333 if (status_box->account && 333 if (status_box->account &&
334 !gaim_account_get_bool(status_box->account, "use-global-buddyicon", TRUE)) 334 !gaim_account_get_bool(status_box->account, "use-global-buddyicon", TRUE))
335 { 335 {
336 char *string = gaim_buddy_icons_get_full_path(gaim_account_get_buddy_icon(status_box->account)); 336 char *string = gaim_buddy_icons_get_full_path(gaim_account_get_buddy_icon(status_box->account));
337 gtk_gaim_status_box_set_buddy_icon(status_box, string); 337 pidgin_status_box_set_buddy_icon(status_box, string);
338 g_free(string); 338 g_free(string);
339 } 339 }
340 else 340 else
341 { 341 {
342 gtk_gaim_status_box_set_buddy_icon(status_box, gaim_prefs_get_path("/gaim/gtk/accounts/buddyicon")); 342 pidgin_status_box_set_buddy_icon(status_box, gaim_prefs_get_path("/gaim/gtk/accounts/buddyicon"));
343 } 343 }
344 344
345 status_box->hand_cursor = gdk_cursor_new (GDK_HAND2); 345 status_box->hand_cursor = gdk_cursor_new (GDK_HAND2);
346 status_box->arrow_cursor = gdk_cursor_new (GDK_LEFT_PTR); 346 status_box->arrow_cursor = gdk_cursor_new (GDK_LEFT_PTR);
347 347
361 gtk_container_add(GTK_CONTAINER(status_box->icon_box), status_box->icon); 361 gtk_container_add(GTK_CONTAINER(status_box->icon_box), status_box->icon);
362 gtk_widget_show(status_box->icon); 362 gtk_widget_show(status_box->icon);
363 } 363 }
364 364
365 static void 365 static void
366 destroy_icon_box(GtkGaimStatusBox *statusbox) 366 destroy_icon_box(PidginStatusBox *statusbox)
367 { 367 {
368 if (statusbox->icon_box == NULL) 368 if (statusbox->icon_box == NULL)
369 return; 369 return;
370 370
371 gtk_widget_destroy(statusbox->icon_box); 371 gtk_widget_destroy(statusbox->icon_box);
392 statusbox->hand_cursor = NULL; 392 statusbox->hand_cursor = NULL;
393 statusbox->arrow_cursor = NULL; 393 statusbox->arrow_cursor = NULL;
394 } 394 }
395 395
396 static void 396 static void
397 gtk_gaim_status_box_set_property(GObject *object, guint param_id, 397 pidgin_status_box_set_property(GObject *object, guint param_id,
398 const GValue *value, GParamSpec *pspec) 398 const GValue *value, GParamSpec *pspec)
399 { 399 {
400 GtkGaimStatusBox *statusbox = GTK_GAIM_STATUS_BOX(object); 400 PidginStatusBox *statusbox = PIDGIN_STATUS_BOX(object);
401 401
402 switch (param_id) { 402 switch (param_id) {
403 case PROP_ICON_SEL: 403 case PROP_ICON_SEL:
404 if (g_value_get_boolean(value)) { 404 if (g_value_get_boolean(value)) {
405 if (statusbox->account) { 405 if (statusbox->account) {
417 } 417 }
418 break; 418 break;
419 case PROP_ACCOUNT: 419 case PROP_ACCOUNT:
420 statusbox->account = g_value_get_pointer(value); 420 statusbox->account = g_value_get_pointer(value);
421 421
422 gtk_gaim_status_box_regenerate(statusbox); 422 pidgin_status_box_regenerate(statusbox);
423 423
424 break; 424 break;
425 default: 425 default:
426 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec); 426 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
427 break; 427 break;
428 } 428 }
429 } 429 }
430 430
431 static void 431 static void
432 gtk_gaim_status_box_finalize(GObject *obj) 432 pidgin_status_box_finalize(GObject *obj)
433 { 433 {
434 GtkGaimStatusBox *statusbox = GTK_GAIM_STATUS_BOX(obj); 434 PidginStatusBox *statusbox = PIDGIN_STATUS_BOX(obj);
435 435
436 gaim_signals_disconnect_by_handle(statusbox); 436 gaim_signals_disconnect_by_handle(statusbox);
437 gaim_prefs_disconnect_by_handle(statusbox); 437 gaim_prefs_disconnect_by_handle(statusbox);
438 438
439 gdk_cursor_unref(statusbox->hand_cursor); 439 gdk_cursor_unref(statusbox->hand_cursor);
449 449
450 G_OBJECT_CLASS(parent_class)->finalize(obj); 450 G_OBJECT_CLASS(parent_class)->finalize(obj);
451 } 451 }
452 452
453 static GType 453 static GType
454 gtk_gaim_status_box_child_type (GtkContainer *container) 454 pidgin_status_box_child_type (GtkContainer *container)
455 { 455 {
456 return GTK_TYPE_WIDGET; 456 return GTK_TYPE_WIDGET;
457 } 457 }
458 458
459 static void 459 static void
460 gtk_gaim_status_box_class_init (GtkGaimStatusBoxClass *klass) 460 pidgin_status_box_class_init (PidginStatusBoxClass *klass)
461 { 461 {
462 GObjectClass *object_class; 462 GObjectClass *object_class;
463 GtkWidgetClass *widget_class; 463 GtkWidgetClass *widget_class;
464 GtkContainerClass *container_class = (GtkContainerClass*)klass; 464 GtkContainerClass *container_class = (GtkContainerClass*)klass;
465 465
466 parent_class = g_type_class_peek_parent(klass); 466 parent_class = g_type_class_peek_parent(klass);
467 467
468 widget_class = (GtkWidgetClass*)klass; 468 widget_class = (GtkWidgetClass*)klass;
469 widget_class->size_request = gtk_gaim_status_box_size_request; 469 widget_class->size_request = pidgin_status_box_size_request;
470 widget_class->size_allocate = gtk_gaim_status_box_size_allocate; 470 widget_class->size_allocate = pidgin_status_box_size_allocate;
471 widget_class->expose_event = gtk_gaim_status_box_expose_event; 471 widget_class->expose_event = pidgin_status_box_expose_event;
472 472
473 container_class->child_type = gtk_gaim_status_box_child_type; 473 container_class->child_type = pidgin_status_box_child_type;
474 container_class->forall = gtk_gaim_status_box_forall; 474 container_class->forall = pidgin_status_box_forall;
475 container_class->remove = NULL; 475 container_class->remove = NULL;
476 476
477 object_class = (GObjectClass *)klass; 477 object_class = (GObjectClass *)klass;
478 478
479 object_class->finalize = gtk_gaim_status_box_finalize; 479 object_class->finalize = pidgin_status_box_finalize;
480 480
481 object_class->get_property = gtk_gaim_status_box_get_property; 481 object_class->get_property = pidgin_status_box_get_property;
482 object_class->set_property = gtk_gaim_status_box_set_property; 482 object_class->set_property = pidgin_status_box_set_property;
483 483
484 g_object_class_install_property(object_class, 484 g_object_class_install_property(object_class,
485 PROP_ACCOUNT, 485 PROP_ACCOUNT,
486 g_param_spec_pointer("account", 486 g_param_spec_pointer("account",
487 "Account", 487 "Account",
504 * This updates the text displayed on the status box so that it shows 504 * This updates the text displayed on the status box so that it shows
505 * the current status. This is the only function in this file that 505 * the current status. This is the only function in this file that
506 * should modify status_box->store 506 * should modify status_box->store
507 */ 507 */
508 static void 508 static void
509 gtk_gaim_status_box_refresh(GtkGaimStatusBox *status_box) 509 pidgin_status_box_refresh(PidginStatusBox *status_box)
510 { 510 {
511 GtkIconSize icon_size; 511 GtkIconSize icon_size;
512 GtkStyle *style; 512 GtkStyle *style;
513 char aa_color[8]; 513 char aa_color[8];
514 GaimSavedStatus *saved_status; 514 GaimSavedStatus *saved_status;
534 534
535 /* Primary */ 535 /* Primary */
536 if (status_box->typing != 0) 536 if (status_box->typing != 0)
537 { 537 {
538 GtkTreeIter iter; 538 GtkTreeIter iter;
539 GtkGaimStatusBoxItemType type; 539 PidginStatusBoxItemType type;
540 gpointer data; 540 gpointer data;
541 541
542 /* Primary (get the status selected in the dropdown) */ 542 /* Primary (get the status selected in the dropdown) */
543 path = gtk_tree_row_reference_get_path(status_box->active_row); 543 path = gtk_tree_row_reference_get_path(status_box->active_row);
544 if (!gtk_tree_model_get_iter (GTK_TREE_MODEL(status_box->dropdown_store), &iter, path)) 544 if (!gtk_tree_model_get_iter (GTK_TREE_MODEL(status_box->dropdown_store), &iter, path))
547 547
548 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter, 548 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter,
549 TYPE_COLUMN, &type, 549 TYPE_COLUMN, &type,
550 DATA_COLUMN, &data, 550 DATA_COLUMN, &data,
551 -1); 551 -1);
552 if (type == GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE) 552 if (type == PIDGIN_STATUS_BOX_TYPE_PRIMITIVE)
553 primary = g_strdup(gaim_primitive_get_name_from_type(GPOINTER_TO_INT(data))); 553 primary = g_strdup(gaim_primitive_get_name_from_type(GPOINTER_TO_INT(data)));
554 else 554 else
555 /* This should never happen, but just in case... */ 555 /* This should never happen, but just in case... */
556 primary = g_strdup("New status"); 556 primary = g_strdup("New status");
557 } 557 }
633 { 633 {
634 GdkPixbuf *emblem; 634 GdkPixbuf *emblem;
635 635
636 /* Overlay a disk in the bottom left corner */ 636 /* Overlay a disk in the bottom left corner */
637 emblem = gtk_widget_render_icon(GTK_WIDGET(status_box->vbox), 637 emblem = gtk_widget_render_icon(GTK_WIDGET(status_box->vbox),
638 GTK_STOCK_SAVE, icon_size, "GtkGaimStatusBox"); 638 GTK_STOCK_SAVE, icon_size, "PidginStatusBox");
639 if (emblem != NULL) 639 if (emblem != NULL)
640 { 640 {
641 int width, height; 641 int width, height;
642 width = gdk_pixbuf_get_width(pixbuf) / 2; 642 width = gdk_pixbuf_get_width(pixbuf) / 2;
643 height = gdk_pixbuf_get_height(pixbuf) / 2; 643 height = gdk_pixbuf_get_height(pixbuf) / 2;
712 * 712 *
713 * Maybe we could accomplish this by triggering off the mouse and 713 * Maybe we could accomplish this by triggering off the mouse and
714 * keyboard signals instead of the changed signal? 714 * keyboard signals instead of the changed signal?
715 */ 715 */
716 static void 716 static void
717 status_menu_refresh_iter(GtkGaimStatusBox *status_box) 717 status_menu_refresh_iter(PidginStatusBox *status_box)
718 { 718 {
719 GaimSavedStatus *saved_status; 719 GaimSavedStatus *saved_status;
720 GaimStatusPrimitive primitive; 720 GaimStatusPrimitive primitive;
721 gint index; 721 gint index;
722 const char *message; 722 const char *message;
748 path = gtk_tree_path_new_from_indices(index, -1); 748 path = gtk_tree_path_new_from_indices(index, -1);
749 } 749 }
750 else 750 else
751 { 751 {
752 GtkTreeIter iter; 752 GtkTreeIter iter;
753 GtkGaimStatusBoxItemType type; 753 PidginStatusBoxItemType type;
754 gpointer data; 754 gpointer data;
755 755
756 /* If this saved status is in the list store, then set it as the active item */ 756 /* If this saved status is in the list store, then set it as the active item */
757 if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(status_box->dropdown_store), &iter)) 757 if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(status_box->dropdown_store), &iter))
758 { 758 {
764 -1); 764 -1);
765 765
766 /* This is a special case because Primitives for the token_status_account are actually 766 /* This is a special case because Primitives for the token_status_account are actually
767 * saved statuses with substatuses for the enabled accounts */ 767 * saved statuses with substatuses for the enabled accounts */
768 if (status_box->token_status_account && gaim_savedstatus_is_transient(saved_status) 768 if (status_box->token_status_account && gaim_savedstatus_is_transient(saved_status)
769 && type == GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE && primitive == GPOINTER_TO_INT(data)) 769 && type == PIDGIN_STATUS_BOX_TYPE_PRIMITIVE && primitive == GPOINTER_TO_INT(data))
770 { 770 {
771 char *name; 771 char *name;
772 const char *acct_status_name = gaim_status_get_name( 772 const char *acct_status_name = gaim_status_get_name(
773 gaim_account_get_active_status(status_box->token_status_account)); 773 gaim_account_get_active_status(status_box->token_status_account));
774 774
783 g_free(name); 783 g_free(name);
784 break; 784 break;
785 } 785 }
786 g_free(name); 786 g_free(name);
787 787
788 } else if ((type == GTK_GAIM_STATUS_BOX_TYPE_POPULAR) && 788 } else if ((type == PIDGIN_STATUS_BOX_TYPE_POPULAR) &&
789 (GPOINTER_TO_INT(data) == gaim_savedstatus_get_creation_time(saved_status))) 789 (GPOINTER_TO_INT(data) == gaim_savedstatus_get_creation_time(saved_status)))
790 { 790 {
791 /* Found! */ 791 /* Found! */
792 path = gtk_tree_model_get_path(GTK_TREE_MODEL(status_box->dropdown_store), &iter); 792 path = gtk_tree_model_get_path(GTK_TREE_MODEL(status_box->dropdown_store), &iter);
793 break; 793 break;
832 /* Stop suppressing the "changed" signal. */ 832 /* Stop suppressing the "changed" signal. */
833 gtk_widget_set_sensitive(GTK_WIDGET(status_box), TRUE); 833 gtk_widget_set_sensitive(GTK_WIDGET(status_box), TRUE);
834 } 834 }
835 835
836 static void 836 static void
837 add_popular_statuses(GtkGaimStatusBox *statusbox) 837 add_popular_statuses(PidginStatusBox *statusbox)
838 { 838 {
839 GtkIconSize icon_size; 839 GtkIconSize icon_size;
840 GList *list, *cur; 840 GList *list, *cur;
841 GdkPixbuf *pixbuf, *emblem; 841 GdkPixbuf *pixbuf, *emblem;
842 int width, height; 842 int width, height;
846 /* Odd... oh well, nothing we can do about it. */ 846 /* Odd... oh well, nothing we can do about it. */
847 return; 847 return;
848 848
849 icon_size = gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL); 849 icon_size = gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL);
850 850
851 gtk_gaim_status_box_add_separator(statusbox); 851 pidgin_status_box_add_separator(statusbox);
852 852
853 for (cur = list; cur != NULL; cur = cur->next) 853 for (cur = list; cur != NULL; cur = cur->next)
854 { 854 {
855 GaimSavedStatus *saved = cur->data; 855 GaimSavedStatus *saved = cur->data;
856 const gchar *message; 856 const gchar *message;
893 gaim_util_chrreplace(stripped, '\n', ' '); 893 gaim_util_chrreplace(stripped, '\n', ' ');
894 } 894 }
895 #if 0 895 #if 0
896 /* Overlay a disk in the bottom left corner */ 896 /* Overlay a disk in the bottom left corner */
897 emblem = gtk_widget_render_icon(GTK_WIDGET(statusbox->vbox), 897 emblem = gtk_widget_render_icon(GTK_WIDGET(statusbox->vbox),
898 GTK_STOCK_SAVE, icon_size, "GtkGaimStatusBox"); 898 GTK_STOCK_SAVE, icon_size, "PidginStatusBox");
899 if (emblem != NULL) 899 if (emblem != NULL)
900 { 900 {
901 width = gdk_pixbuf_get_width(pixbuf) / 2; 901 width = gdk_pixbuf_get_width(pixbuf) / 2;
902 height = gdk_pixbuf_get_height(pixbuf) / 2; 902 height = gdk_pixbuf_get_height(pixbuf) / 2;
903 gdk_pixbuf_composite(emblem, pixbuf, 0, height, 903 gdk_pixbuf_composite(emblem, pixbuf, 0, height,
906 g_object_unref(G_OBJECT(emblem)); 906 g_object_unref(G_OBJECT(emblem));
907 } 907 }
908 #endif 908 #endif
909 } 909 }
910 910
911 gtk_gaim_status_box_add(statusbox, GTK_GAIM_STATUS_BOX_TYPE_POPULAR, 911 pidgin_status_box_add(statusbox, PIDGIN_STATUS_BOX_TYPE_POPULAR,
912 pixbuf, gaim_savedstatus_get_title(saved), stripped, 912 pixbuf, gaim_savedstatus_get_title(saved), stripped,
913 GINT_TO_POINTER(gaim_savedstatus_get_creation_time(saved))); 913 GINT_TO_POINTER(gaim_savedstatus_get_creation_time(saved)));
914 g_free(stripped); 914 g_free(stripped);
915 if (pixbuf != NULL) 915 if (pixbuf != NULL)
916 g_object_unref(G_OBJECT(pixbuf)); 916 g_object_unref(G_OBJECT(pixbuf));
968 968
969 return acct; 969 return acct;
970 } 970 }
971 971
972 static void 972 static void
973 add_account_statuses(GtkGaimStatusBox *status_box, GaimAccount *account) 973 add_account_statuses(PidginStatusBox *status_box, GaimAccount *account)
974 { 974 {
975 /* Per-account */ 975 /* Per-account */
976 const GList *l; 976 const GList *l;
977 GdkPixbuf *pixbuf; 977 GdkPixbuf *pixbuf;
978 978
1001 icon_size, "PidginStatusBox"); 1001 icon_size, "PidginStatusBox");
1002 else 1002 else
1003 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), PIDGIN_STOCK_STATUS_AVAILABLE, 1003 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), PIDGIN_STOCK_STATUS_AVAILABLE,
1004 icon_size, "PidginStatusBox"); 1004 icon_size, "PidginStatusBox");
1005 1005
1006 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), 1006 pidgin_status_box_add(PIDGIN_STATUS_BOX(status_box),
1007 GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE, pixbuf, 1007 PIDGIN_STATUS_BOX_TYPE_PRIMITIVE, pixbuf,
1008 gaim_status_type_get_name(status_type), 1008 gaim_status_type_get_name(status_type),
1009 NULL, 1009 NULL,
1010 GINT_TO_POINTER(gaim_status_type_get_primitive(status_type))); 1010 GINT_TO_POINTER(gaim_status_type_get_primitive(status_type)));
1011 if (pixbuf != NULL) 1011 if (pixbuf != NULL)
1012 g_object_unref(pixbuf); 1012 g_object_unref(pixbuf);
1013 } 1013 }
1014 } 1014 }
1015 1015
1016 static void 1016 static void
1017 gtk_gaim_status_box_regenerate(GtkGaimStatusBox *status_box) 1017 pidgin_status_box_regenerate(PidginStatusBox *status_box)
1018 { 1018 {
1019 GdkPixbuf *pixbuf, *pixbuf2, *pixbuf3, *pixbuf4; 1019 GdkPixbuf *pixbuf, *pixbuf2, *pixbuf3, *pixbuf4;
1020 GtkIconSize icon_size; 1020 GtkIconSize icon_size;
1021 1021
1022 icon_size = gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL); 1022 icon_size = gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL);
1030 /* gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), GTK_TREE_MODEL(status_box->dropdown_store)); */ 1030 /* gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), GTK_TREE_MODEL(status_box->dropdown_store)); */
1031 1031
1032 if (status_box->account == NULL) 1032 if (status_box->account == NULL)
1033 { 1033 {
1034 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), PIDGIN_STOCK_STATUS_AVAILABLE, 1034 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), PIDGIN_STOCK_STATUS_AVAILABLE,
1035 icon_size, "GtkGaimStatusBox"); 1035 icon_size, "PidginStatusBox");
1036 /* Do all the currently enabled accounts have the same statuses? 1036 /* Do all the currently enabled accounts have the same statuses?
1037 * If so, display them instead of our global list. 1037 * If so, display them instead of our global list.
1038 */ 1038 */
1039 if (status_box->token_status_account) { 1039 if (status_box->token_status_account) {
1040 add_account_statuses(status_box, status_box->token_status_account); 1040 add_account_statuses(status_box, status_box->token_status_account);
1045 pixbuf3 = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), PIDGIN_STOCK_STATUS_OFFLINE, 1045 pixbuf3 = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), PIDGIN_STOCK_STATUS_OFFLINE,
1046 icon_size, "PidginStatusBox"); 1046 icon_size, "PidginStatusBox");
1047 pixbuf4 = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), PIDGIN_STOCK_STATUS_AVAILABLE_I, 1047 pixbuf4 = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), PIDGIN_STOCK_STATUS_AVAILABLE_I,
1048 icon_size, "PidginStatusBox"); 1048 icon_size, "PidginStatusBox");
1049 1049
1050 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE, pixbuf, _("Available"), NULL, GINT_TO_POINTER(GAIM_STATUS_AVAILABLE)); 1050 pidgin_status_box_add(PIDGIN_STATUS_BOX(status_box), PIDGIN_STATUS_BOX_TYPE_PRIMITIVE, pixbuf, _("Available"), NULL, GINT_TO_POINTER(GAIM_STATUS_AVAILABLE));
1051 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)); 1051 pidgin_status_box_add(PIDGIN_STATUS_BOX(status_box), PIDGIN_STATUS_BOX_TYPE_PRIMITIVE, pixbuf2, _("Away"), NULL, GINT_TO_POINTER(GAIM_STATUS_AWAY));
1052 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)); 1052 pidgin_status_box_add(PIDGIN_STATUS_BOX(status_box), PIDGIN_STATUS_BOX_TYPE_PRIMITIVE, pixbuf4, _("Invisible"), NULL, GINT_TO_POINTER(GAIM_STATUS_INVISIBLE));
1053 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)); 1053 pidgin_status_box_add(PIDGIN_STATUS_BOX(status_box), PIDGIN_STATUS_BOX_TYPE_PRIMITIVE, pixbuf3, _("Offline"), NULL, GINT_TO_POINTER(GAIM_STATUS_OFFLINE));
1054 1054
1055 if (pixbuf2) g_object_unref(G_OBJECT(pixbuf2)); 1055 if (pixbuf2) g_object_unref(G_OBJECT(pixbuf2));
1056 if (pixbuf3) g_object_unref(G_OBJECT(pixbuf3)); 1056 if (pixbuf3) g_object_unref(G_OBJECT(pixbuf3));
1057 if (pixbuf4) g_object_unref(G_OBJECT(pixbuf4)); 1057 if (pixbuf4) g_object_unref(G_OBJECT(pixbuf4));
1058 } 1058 }
1059 1059
1060 add_popular_statuses(status_box); 1060 add_popular_statuses(status_box);
1061 1061
1062 gtk_gaim_status_box_add_separator(GTK_GAIM_STATUS_BOX(status_box)); 1062 pidgin_status_box_add_separator(PIDGIN_STATUS_BOX(status_box));
1063 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_CUSTOM, pixbuf, _("New..."), NULL, NULL); 1063 pidgin_status_box_add(PIDGIN_STATUS_BOX(status_box), PIDGIN_STATUS_BOX_TYPE_CUSTOM, pixbuf, _("New..."), NULL, NULL);
1064 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_SAVED, pixbuf, _("Saved..."), NULL, NULL); 1064 pidgin_status_box_add(PIDGIN_STATUS_BOX(status_box), PIDGIN_STATUS_BOX_TYPE_SAVED, pixbuf, _("Saved..."), NULL, NULL);
1065 if (pixbuf) g_object_unref(G_OBJECT(pixbuf)); 1065 if (pixbuf) g_object_unref(G_OBJECT(pixbuf));
1066 1066
1067 status_menu_refresh_iter(status_box); 1067 status_menu_refresh_iter(status_box);
1068 gtk_gaim_status_box_refresh(status_box); 1068 pidgin_status_box_refresh(status_box);
1069 1069
1070 } else { 1070 } else {
1071 add_account_statuses(status_box, status_box->account); 1071 add_account_statuses(status_box, status_box->account);
1072 update_to_reflect_account_status(status_box, status_box->account, 1072 update_to_reflect_account_status(status_box, status_box->account,
1073 gaim_account_get_active_status(status_box->account)); 1073 gaim_account_get_active_status(status_box->account));
1076 gtk_tree_view_set_search_column(GTK_TREE_VIEW(status_box->tree_view), TEXT_COLUMN); 1076 gtk_tree_view_set_search_column(GTK_TREE_VIEW(status_box->tree_view), TEXT_COLUMN);
1077 } 1077 }
1078 1078
1079 static gboolean combo_box_scroll_event_cb(GtkWidget *w, GdkEventScroll *event, GtkIMHtml *imhtml) 1079 static gboolean combo_box_scroll_event_cb(GtkWidget *w, GdkEventScroll *event, GtkIMHtml *imhtml)
1080 { 1080 {
1081 pidgin_status_box_popup(GTK_GAIM_STATUS_BOX(w)); 1081 pidgin_status_box_popup(PIDGIN_STATUS_BOX(w));
1082 return TRUE; 1082 return TRUE;
1083 } 1083 }
1084 1084
1085 static gboolean imhtml_scroll_event_cb(GtkWidget *w, GdkEventScroll *event, GtkIMHtml *imhtml) 1085 static gboolean imhtml_scroll_event_cb(GtkWidget *w, GdkEventScroll *event, GtkIMHtml *imhtml)
1086 { 1086 {
1089 else if (event->direction == GDK_SCROLL_DOWN) 1089 else if (event->direction == GDK_SCROLL_DOWN)
1090 gtk_imhtml_page_down(imhtml); 1090 gtk_imhtml_page_down(imhtml);
1091 return TRUE; 1091 return TRUE;
1092 } 1092 }
1093 1093
1094 static int imhtml_remove_focus(GtkWidget *w, GdkEventKey *event, GtkGaimStatusBox *status_box) 1094 static int imhtml_remove_focus(GtkWidget *w, GdkEventKey *event, PidginStatusBox *status_box)
1095 { 1095 {
1096 if (event->keyval == GDK_Tab || event->keyval == GDK_KP_Tab) 1096 if (event->keyval == GDK_Tab || event->keyval == GDK_KP_Tab)
1097 { 1097 {
1098 /* If last inserted character is a tab, then remove the focus from here */ 1098 /* If last inserted character is a tab, then remove the focus from here */
1099 GtkWidget *top = gtk_widget_get_toplevel(w); 1099 GtkWidget *top = gtk_widget_get_toplevel(w);
1113 if (status_box->account != NULL) 1113 if (status_box->account != NULL)
1114 update_to_reflect_account_status(status_box, status_box->account, 1114 update_to_reflect_account_status(status_box, status_box->account,
1115 gaim_account_get_active_status(status_box->account)); 1115 gaim_account_get_active_status(status_box->account));
1116 else { 1116 else {
1117 status_menu_refresh_iter(status_box); 1117 status_menu_refresh_iter(status_box);
1118 gtk_gaim_status_box_refresh(status_box); 1118 pidgin_status_box_refresh(status_box);
1119 } 1119 }
1120 return TRUE; 1120 return TRUE;
1121 } 1121 }
1122 1122
1123 gtk_gaim_status_box_pulse_typing(status_box); 1123 pidgin_status_box_pulse_typing(status_box);
1124 g_source_remove(status_box->typing); 1124 g_source_remove(status_box->typing);
1125 status_box->typing = g_timeout_add(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, status_box); 1125 status_box->typing = g_timeout_add(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, status_box);
1126 1126
1127 return FALSE; 1127 return FALSE;
1128 } 1128 }
1130 #if GTK_CHECK_VERSION(2,6,0) 1130 #if GTK_CHECK_VERSION(2,6,0)
1131 static gboolean 1131 static gboolean
1132 dropdown_store_row_separator_func(GtkTreeModel *model, 1132 dropdown_store_row_separator_func(GtkTreeModel *model,
1133 GtkTreeIter *iter, gpointer data) 1133 GtkTreeIter *iter, gpointer data)
1134 { 1134 {
1135 GtkGaimStatusBoxItemType type; 1135 PidginStatusBoxItemType type;
1136 1136
1137 gtk_tree_model_get(model, iter, TYPE_COLUMN, &type, -1); 1137 gtk_tree_model_get(model, iter, TYPE_COLUMN, &type, -1);
1138 1138
1139 if (type == GTK_GAIM_STATUS_BOX_TYPE_SEPARATOR) 1139 if (type == PIDGIN_STATUS_BOX_TYPE_SEPARATOR)
1140 return TRUE; 1140 return TRUE;
1141 1141
1142 return FALSE; 1142 return FALSE;
1143 } 1143 }
1144 #endif 1144 #endif
1145 1145
1146 static void 1146 static void
1147 cache_pixbufs(GtkGaimStatusBox *status_box) 1147 cache_pixbufs(PidginStatusBox *status_box)
1148 { 1148 {
1149 GtkIconSize icon_size; 1149 GtkIconSize icon_size;
1150 1150
1151 g_object_set(G_OBJECT(status_box->icon_rend), "xpad", 3, NULL); 1151 g_object_set(G_OBJECT(status_box->icon_rend), "xpad", 3, NULL);
1152 icon_size = gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL); 1152 icon_size = gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL);
1188 icon_size, "PidginStatusBox"); 1188 icon_size, "PidginStatusBox");
1189 status_box->typing_pixbufs[3] = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), PIDGIN_STOCK_ANIMATION_TYPING3, 1189 status_box->typing_pixbufs[3] = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), PIDGIN_STOCK_ANIMATION_TYPING3,
1190 icon_size, "PidginStatusBox"); 1190 icon_size, "PidginStatusBox");
1191 } 1191 }
1192 1192
1193 static void account_enabled_cb(GaimAccount *acct, GtkGaimStatusBox *status_box) { 1193 static void account_enabled_cb(GaimAccount *acct, PidginStatusBox *status_box) {
1194 GaimAccount *initial_token_acct = status_box->token_status_account; 1194 GaimAccount *initial_token_acct = status_box->token_status_account;
1195 1195
1196 status_box->token_status_account = check_active_accounts_for_identical_statuses(); 1196 status_box->token_status_account = check_active_accounts_for_identical_statuses();
1197 1197
1198 /* Regenerate the list if it has changed */ 1198 /* Regenerate the list if it has changed */
1199 if (initial_token_acct != status_box->token_status_account) { 1199 if (initial_token_acct != status_box->token_status_account) {
1200 gtk_gaim_status_box_regenerate(status_box); 1200 pidgin_status_box_regenerate(status_box);
1201 } 1201 }
1202 1202
1203 } 1203 }
1204 1204
1205 static void 1205 static void
1206 current_savedstatus_changed_cb(GaimSavedStatus *now, GaimSavedStatus *old, GtkGaimStatusBox *status_box) 1206 current_savedstatus_changed_cb(GaimSavedStatus *now, GaimSavedStatus *old, PidginStatusBox *status_box)
1207 { 1207 {
1208 /* Make sure our current status is added to the list of popular statuses */ 1208 /* Make sure our current status is added to the list of popular statuses */
1209 gtk_gaim_status_box_regenerate(status_box); 1209 pidgin_status_box_regenerate(status_box);
1210 } 1210 }
1211 1211
1212 static void 1212 static void
1213 spellcheck_prefs_cb(const char *name, GaimPrefType type, 1213 spellcheck_prefs_cb(const char *name, GaimPrefType type,
1214 gconstpointer value, gpointer data) 1214 gconstpointer value, gpointer data)
1215 { 1215 {
1216 #ifdef USE_GTKSPELL 1216 #ifdef USE_GTKSPELL
1217 GtkGaimStatusBox *status_box = (GtkGaimStatusBox *)data; 1217 PidginStatusBox *status_box = (PidginStatusBox *)data;
1218 1218
1219 if (value) 1219 if (value)
1220 pidgin_setup_gtkspell(GTK_TEXT_VIEW(status_box->imhtml)); 1220 pidgin_setup_gtkspell(GTK_TEXT_VIEW(status_box->imhtml));
1221 else 1221 else
1222 { 1222 {
1226 } 1226 }
1227 #endif 1227 #endif
1228 } 1228 }
1229 1229
1230 #if 0 1230 #if 0
1231 static gboolean button_released_cb(GtkWidget *widget, GdkEventButton *event, GtkGaimStatusBox *box) 1231 static gboolean button_released_cb(GtkWidget *widget, GdkEventButton *event, PidginStatusBox *box)
1232 { 1232 {
1233 1233
1234 if (event->button != 1) 1234 if (event->button != 1)
1235 return FALSE; 1235 return FALSE;
1236 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(box->toggle_button), FALSE); 1236 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(box->toggle_button), FALSE);
1237 if (!box->imhtml_visible) 1237 if (!box->imhtml_visible)
1238 g_signal_emit_by_name(G_OBJECT(box), "changed", NULL, NULL); 1238 g_signal_emit_by_name(G_OBJECT(box), "changed", NULL, NULL);
1239 return TRUE; 1239 return TRUE;
1240 } 1240 }
1241 1241
1242 static gboolean button_pressed_cb(GtkWidget *widget, GdkEventButton *event, GtkGaimStatusBox *box) 1242 static gboolean button_pressed_cb(GtkWidget *widget, GdkEventButton *event, PidginStatusBox *box)
1243 { 1243 {
1244 if (event->button != 1) 1244 if (event->button != 1)
1245 return FALSE; 1245 return FALSE;
1246 gtk_combo_box_popup(GTK_COMBO_BOX(box)); 1246 gtk_combo_box_popup(GTK_COMBO_BOX(box));
1247 // Disabled until button_released_cb works 1247 // Disabled until button_released_cb works
1249 return TRUE; 1249 return TRUE;
1250 } 1250 }
1251 #endif 1251 #endif
1252 1252
1253 static void 1253 static void
1254 gtk_gaim_status_box_list_position (GtkGaimStatusBox *status_box, int *x, int *y, int *width, int *height) 1254 pidgin_status_box_list_position (PidginStatusBox *status_box, int *x, int *y, int *width, int *height)
1255 { 1255 {
1256 #if GTK_CHECK_VERSION(2,2,0) 1256 #if GTK_CHECK_VERSION(2,2,0)
1257 GdkScreen *screen; 1257 GdkScreen *screen;
1258 gint monitor_num; 1258 gint monitor_num;
1259 GdkRectangle monitor; 1259 GdkRectangle monitor;
1349 return FALSE; 1349 return FALSE;
1350 } 1350 }
1351 1351
1352 1352
1353 static void 1353 static void
1354 pidgin_status_box_popup(GtkGaimStatusBox *box) 1354 pidgin_status_box_popup(PidginStatusBox *box)
1355 { 1355 {
1356 int width, height, x, y; 1356 int width, height, x, y;
1357 gtk_gaim_status_box_list_position (box, &x, &y, &width, &height); 1357 pidgin_status_box_list_position (box, &x, &y, &width, &height);
1358 1358
1359 gtk_widget_set_size_request (box->popup_window, width, height); 1359 gtk_widget_set_size_request (box->popup_window, width, height);
1360 gtk_window_move (GTK_WINDOW (box->popup_window), x, y); 1360 gtk_window_move (GTK_WINDOW (box->popup_window), x, y);
1361 gtk_widget_show(box->popup_window); 1361 gtk_widget_show(box->popup_window);
1362 gtk_widget_grab_focus (box->tree_view); 1362 gtk_widget_grab_focus (box->tree_view);
1376 gtk_tree_path_free(path); 1376 gtk_tree_path_free(path);
1377 } 1377 }
1378 } 1378 }
1379 1379
1380 static void 1380 static void
1381 pidgin_status_box_popdown(GtkGaimStatusBox *box) { 1381 pidgin_status_box_popdown(PidginStatusBox *box) {
1382 gtk_widget_hide(box->popup_window); 1382 gtk_widget_hide(box->popup_window);
1383 box->popup_in_progress = FALSE; 1383 box->popup_in_progress = FALSE;
1384 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (box->toggle_button), 1384 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (box->toggle_button),
1385 FALSE); 1385 FALSE);
1386 gtk_grab_remove (box->popup_window); 1386 gtk_grab_remove (box->popup_window);
1387 } 1387 }
1388 1388
1389 1389
1390 static void 1390 static void
1391 toggled_cb(GtkWidget *widget, GtkGaimStatusBox *box) 1391 toggled_cb(GtkWidget *widget, PidginStatusBox *box)
1392 { 1392 {
1393 if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) { 1393 if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
1394 if (!box->popup_in_progress) 1394 if (!box->popup_in_progress)
1395 pidgin_status_box_popup (box); 1395 pidgin_status_box_popup (box);
1396 } else { 1396 } else {
1397 pidgin_status_box_popdown(box); 1397 pidgin_status_box_popdown(box);
1398 } 1398 }
1399 } 1399 }
1400 1400
1401 static void 1401 static void
1402 buddy_icon_set_cb(const char *filename, GtkGaimStatusBox *box) 1402 buddy_icon_set_cb(const char *filename, PidginStatusBox *box)
1403 { 1403 {
1404 1404
1405 if (box->account) { 1405 if (box->account) {
1406 GaimPlugin *plug = gaim_find_prpl(gaim_account_get_protocol_id(box->account)); 1406 GaimPlugin *plug = gaim_find_prpl(gaim_account_get_protocol_id(box->account));
1407 if (plug) { 1407 if (plug) {
1435 g_free(icon); 1435 g_free(icon);
1436 } 1436 }
1437 } 1437 }
1438 } 1438 }
1439 } 1439 }
1440 gtk_gaim_status_box_set_buddy_icon(box, filename); 1440 pidgin_status_box_set_buddy_icon(box, filename);
1441 } 1441 }
1442 1442
1443 static void 1443 static void
1444 remove_buddy_icon_cb(GtkWidget *w, GtkGaimStatusBox *box) 1444 remove_buddy_icon_cb(GtkWidget *w, PidginStatusBox *box)
1445 { 1445 {
1446 if (box->account == NULL) 1446 if (box->account == NULL)
1447 /* The pref-connect callback does the actual work */ 1447 /* The pref-connect callback does the actual work */
1448 gaim_prefs_set_path("/gaim/gtk/accounts/buddyicon", NULL); 1448 gaim_prefs_set_path("/gaim/gtk/accounts/buddyicon", NULL);
1449 else 1449 else
1454 } 1454 }
1455 1455
1456 static void 1456 static void
1457 icon_choose_cb(const char *filename, gpointer data) 1457 icon_choose_cb(const char *filename, gpointer data)
1458 { 1458 {
1459 GtkGaimStatusBox *box = data; 1459 PidginStatusBox *box = data;
1460 if (filename) { 1460 if (filename) {
1461 if (box->account == NULL) 1461 if (box->account == NULL)
1462 /* The pref-connect callback does the actual work */ 1462 /* The pref-connect callback does the actual work */
1463 gaim_prefs_set_path("/gaim/gtk/accounts/buddyicon", filename); 1463 gaim_prefs_set_path("/gaim/gtk/accounts/buddyicon", filename);
1464 else 1464 else
1470 1470
1471 static void 1471 static void
1472 update_buddyicon_cb(const char *name, GaimPrefType type, 1472 update_buddyicon_cb(const char *name, GaimPrefType type,
1473 gconstpointer value, gpointer data) 1473 gconstpointer value, gpointer data)
1474 { 1474 {
1475 buddy_icon_set_cb(value, (GtkGaimStatusBox*) data); 1475 buddy_icon_set_cb(value, (PidginStatusBox*) data);
1476 } 1476 }
1477 1477
1478 static void 1478 static void
1479 treeview_activate_current_selection(GtkGaimStatusBox *status_box, GtkTreePath *path) 1479 treeview_activate_current_selection(PidginStatusBox *status_box, GtkTreePath *path)
1480 { 1480 {
1481 if (status_box->active_row) 1481 if (status_box->active_row)
1482 gtk_tree_row_reference_free(status_box->active_row); 1482 gtk_tree_row_reference_free(status_box->active_row);
1483 1483
1484 status_box->active_row = gtk_tree_row_reference_new(GTK_TREE_MODEL(status_box->dropdown_store), path); 1484 status_box->active_row = gtk_tree_row_reference_new(GTK_TREE_MODEL(status_box->dropdown_store), path);
1485 1485
1486 pidgin_status_box_popdown (status_box); 1486 pidgin_status_box_popdown (status_box);
1487 gtk_gaim_status_box_changed(status_box); 1487 pidgin_status_box_changed(status_box);
1488 } 1488 }
1489 1489
1490 static gboolean 1490 static gboolean
1491 treeview_button_release_cb(GtkWidget *widget, GdkEventButton *event, GtkGaimStatusBox *status_box) 1491 treeview_button_release_cb(GtkWidget *widget, GdkEventButton *event, PidginStatusBox *status_box)
1492 { 1492 {
1493 GtkTreePath *path = NULL; 1493 GtkTreePath *path = NULL;
1494 int ret; 1494 int ret;
1495 GtkWidget *ewidget = gtk_get_event_widget ((GdkEvent *)event); 1495 GtkWidget *ewidget = gtk_get_event_widget ((GdkEvent *)event);
1496 1496
1526 return TRUE; 1526 return TRUE;
1527 } 1527 }
1528 1528
1529 static gboolean 1529 static gboolean
1530 treeview_key_press_event(GtkWidget *widget, 1530 treeview_key_press_event(GtkWidget *widget,
1531 GdkEventKey *event, GtkGaimStatusBox *box) 1531 GdkEventKey *event, PidginStatusBox *box)
1532 { 1532 {
1533 if (box->popup_in_progress) { 1533 if (box->popup_in_progress) {
1534 if (event->keyval == GDK_Escape) { 1534 if (event->keyval == GDK_Escape) {
1535 pidgin_status_box_popdown(box); 1535 pidgin_status_box_popdown(box);
1536 return TRUE; 1536 return TRUE;
1549 } 1549 }
1550 return FALSE; 1550 return FALSE;
1551 } 1551 }
1552 1552
1553 static void 1553 static void
1554 gtk_gaim_status_box_init (GtkGaimStatusBox *status_box) 1554 pidgin_status_box_init (PidginStatusBox *status_box)
1555 { 1555 {
1556 GtkCellRenderer *text_rend; 1556 GtkCellRenderer *text_rend;
1557 GtkCellRenderer *icon_rend; 1557 GtkCellRenderer *icon_rend;
1558 GtkTextBuffer *buffer; 1558 GtkTextBuffer *buffer;
1559 GtkWidget *toplevel; 1559 GtkWidget *toplevel;
1702 #endif 1702 #endif
1703 1703
1704 status_box->token_status_account = check_active_accounts_for_identical_statuses(); 1704 status_box->token_status_account = check_active_accounts_for_identical_statuses();
1705 1705
1706 cache_pixbufs(status_box); 1706 cache_pixbufs(status_box);
1707 gtk_gaim_status_box_regenerate(status_box); 1707 pidgin_status_box_regenerate(status_box);
1708 1708
1709 gaim_signal_connect(gaim_savedstatuses_get_handle(), "savedstatus-changed", 1709 gaim_signal_connect(gaim_savedstatuses_get_handle(), "savedstatus-changed",
1710 status_box, 1710 status_box,
1711 GAIM_CALLBACK(current_savedstatus_changed_cb), 1711 GAIM_CALLBACK(current_savedstatus_changed_cb),
1712 status_box); 1712 status_box);
1725 gaim_prefs_connect_callback(status_box, "/gaim/gtk/accounts/buddyicon", 1725 gaim_prefs_connect_callback(status_box, "/gaim/gtk/accounts/buddyicon",
1726 update_buddyicon_cb, status_box); 1726 update_buddyicon_cb, status_box);
1727 } 1727 }
1728 1728
1729 static void 1729 static void
1730 gtk_gaim_status_box_size_request(GtkWidget *widget, 1730 pidgin_status_box_size_request(GtkWidget *widget,
1731 GtkRequisition *requisition) 1731 GtkRequisition *requisition)
1732 { 1732 {
1733 GtkRequisition box_req; 1733 GtkRequisition box_req;
1734 gint border_width = GTK_CONTAINER (widget)->border_width; 1734 gint border_width = GTK_CONTAINER (widget)->border_width;
1735 1735
1736 gtk_widget_size_request(GTK_GAIM_STATUS_BOX(widget)->toggle_button, requisition); 1736 gtk_widget_size_request(PIDGIN_STATUS_BOX(widget)->toggle_button, requisition);
1737 1737
1738 /* Make this icon the same size as other buddy icons in the list; unless it already wants to be bigger */ 1738 /* Make this icon the same size as other buddy icons in the list; unless it already wants to be bigger */
1739 requisition->height = MAX(requisition->height, 34); 1739 requisition->height = MAX(requisition->height, 34);
1740 requisition->height += border_width * 2; 1740 requisition->height += border_width * 2;
1741 1741
1742 /* If the gtkimhtml is visible, then add some additional padding */ 1742 /* If the gtkimhtml is visible, then add some additional padding */
1743 gtk_widget_size_request(GTK_GAIM_STATUS_BOX(widget)->vbox, &box_req); 1743 gtk_widget_size_request(PIDGIN_STATUS_BOX(widget)->vbox, &box_req);
1744 if (box_req.height > 1) 1744 if (box_req.height > 1)
1745 requisition->height += box_req.height + border_width * 2; 1745 requisition->height += box_req.height + border_width * 2;
1746 1746
1747 requisition->width = 1; 1747 requisition->width = 1;
1748 } 1748 }
1786 } 1786 }
1787 } 1787 }
1788 } 1788 }
1789 1789
1790 static void 1790 static void
1791 gtk_gaim_status_box_size_allocate(GtkWidget *widget, 1791 pidgin_status_box_size_allocate(GtkWidget *widget,
1792 GtkAllocation *allocation) 1792 GtkAllocation *allocation)
1793 { 1793 {
1794 GtkGaimStatusBox *status_box = GTK_GAIM_STATUS_BOX(widget); 1794 PidginStatusBox *status_box = PIDGIN_STATUS_BOX(widget);
1795 GtkRequisition req = {0,0}; 1795 GtkRequisition req = {0,0};
1796 GtkAllocation parent_alc, box_alc, icon_alc; 1796 GtkAllocation parent_alc, box_alc, icon_alc;
1797 gint border_width = GTK_CONTAINER (widget)->border_width; 1797 gint border_width = GTK_CONTAINER (widget)->border_width;
1798 1798
1799 gtk_widget_size_request(status_box->toggle_button, &req); 1799 gtk_widget_size_request(status_box->toggle_button, &req);
1832 icon_alc.y += 1; 1832 icon_alc.y += 1;
1833 1833
1834 if (status_box->icon_size != icon_alc.height) 1834 if (status_box->icon_size != icon_alc.height)
1835 { 1835 {
1836 status_box->icon_size = icon_alc.height; 1836 status_box->icon_size = icon_alc.height;
1837 gtk_gaim_status_box_redisplay_buddy_icon(status_box); 1837 pidgin_status_box_redisplay_buddy_icon(status_box);
1838 } 1838 }
1839 gtk_widget_size_allocate(status_box->icon_box, &icon_alc); 1839 gtk_widget_size_allocate(status_box->icon_box, &icon_alc);
1840 } 1840 }
1841 gtk_widget_size_allocate(status_box->toggle_button, &parent_alc); 1841 gtk_widget_size_allocate(status_box->toggle_button, &parent_alc);
1842 widget->allocation = *allocation; 1842 widget->allocation = *allocation;
1843 } 1843 }
1844 1844
1845 static gboolean 1845 static gboolean
1846 gtk_gaim_status_box_expose_event(GtkWidget *widget, 1846 pidgin_status_box_expose_event(GtkWidget *widget,
1847 GdkEventExpose *event) 1847 GdkEventExpose *event)
1848 { 1848 {
1849 GtkGaimStatusBox *status_box = GTK_GAIM_STATUS_BOX(widget); 1849 PidginStatusBox *status_box = PIDGIN_STATUS_BOX(widget);
1850 gtk_container_propagate_expose(GTK_CONTAINER(widget), status_box->vbox, event); 1850 gtk_container_propagate_expose(GTK_CONTAINER(widget), status_box->vbox, event);
1851 gtk_container_propagate_expose(GTK_CONTAINER(widget), status_box->toggle_button, event); 1851 gtk_container_propagate_expose(GTK_CONTAINER(widget), status_box->toggle_button, event);
1852 if (status_box->icon_box && status_box->icon_opaque) { 1852 if (status_box->icon_box && status_box->icon_opaque) {
1853 gtk_paint_box(widget->style, widget->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT, NULL, 1853 gtk_paint_box(widget->style, widget->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT, NULL,
1854 status_box->icon_box, "button", status_box->icon_box->allocation.x-1, status_box->icon_box->allocation.y-1, 1854 status_box->icon_box, "button", status_box->icon_box->allocation.x-1, status_box->icon_box->allocation.y-1,
1856 } 1856 }
1857 return FALSE; 1857 return FALSE;
1858 } 1858 }
1859 1859
1860 static void 1860 static void
1861 gtk_gaim_status_box_forall(GtkContainer *container, 1861 pidgin_status_box_forall(GtkContainer *container,
1862 gboolean include_internals, 1862 gboolean include_internals,
1863 GtkCallback callback, 1863 GtkCallback callback,
1864 gpointer callback_data) 1864 gpointer callback_data)
1865 { 1865 {
1866 GtkGaimStatusBox *status_box = GTK_GAIM_STATUS_BOX (container); 1866 PidginStatusBox *status_box = PIDGIN_STATUS_BOX (container);
1867 1867
1868 if (include_internals) 1868 if (include_internals)
1869 { 1869 {
1870 (* callback) (status_box->vbox, callback_data); 1870 (* callback) (status_box->vbox, callback_data);
1871 (* callback) (status_box->toggle_button, callback_data); 1871 (* callback) (status_box->toggle_button, callback_data);
1874 (* callback) (status_box->icon_box, callback_data); 1874 (* callback) (status_box->icon_box, callback_data);
1875 } 1875 }
1876 } 1876 }
1877 1877
1878 GtkWidget * 1878 GtkWidget *
1879 gtk_gaim_status_box_new() 1879 pidgin_status_box_new()
1880 { 1880 {
1881 return g_object_new(GTK_GAIM_TYPE_STATUS_BOX, "account", NULL, 1881 return g_object_new(PIDGIN_TYPE_STATUS_BOX, "account", NULL,
1882 "iconsel", TRUE, NULL); 1882 "iconsel", TRUE, NULL);
1883 } 1883 }
1884 1884
1885 GtkWidget * 1885 GtkWidget *
1886 gtk_gaim_status_box_new_with_account(GaimAccount *account) 1886 pidgin_status_box_new_with_account(GaimAccount *account)
1887 { 1887 {
1888 return g_object_new(GTK_GAIM_TYPE_STATUS_BOX, "account", account, 1888 return g_object_new(PIDGIN_TYPE_STATUS_BOX, "account", account,
1889 "iconsel", TRUE, NULL); 1889 "iconsel", TRUE, NULL);
1890 } 1890 }
1891 1891
1892 /** 1892 /**
1893 * Add a row to the dropdown menu. 1893 * Add a row to the dropdown menu.
1894 * 1894 *
1895 * @param status_box The status box itself. 1895 * @param status_box The status box itself.
1896 * @param type A GtkGaimStatusBoxItemType. 1896 * @param type A PidginStatusBoxItemType.
1897 * @param pixbuf The icon to associate with this row in the menu. 1897 * @param pixbuf The icon to associate with this row in the menu.
1898 * @param title The title of this item. For the primitive entries, 1898 * @param title The title of this item. For the primitive entries,
1899 * this is something like "Available" or "Away." For 1899 * this is something like "Available" or "Away." For
1900 * the saved statuses, this is something like 1900 * the saved statuses, this is something like
1901 * "My favorite away message!" This should be 1901 * "My favorite away message!" This should be
1908 * menu. For primitives this is the value of the 1908 * menu. For primitives this is the value of the
1909 * GaimStatusPrimitive. For saved statuses this is the 1909 * GaimStatusPrimitive. For saved statuses this is the
1910 * creation timestamp. 1910 * creation timestamp.
1911 */ 1911 */
1912 void 1912 void
1913 gtk_gaim_status_box_add(GtkGaimStatusBox *status_box, GtkGaimStatusBoxItemType type, GdkPixbuf *pixbuf, const char *title, const char *desc, gpointer data) 1913 pidgin_status_box_add(PidginStatusBox *status_box, PidginStatusBoxItemType type, GdkPixbuf *pixbuf, const char *title, const char *desc, gpointer data)
1914 { 1914 {
1915 GtkTreeIter iter; 1915 GtkTreeIter iter;
1916 char *text; 1916 char *text;
1917 1917
1918 if (desc == NULL) 1918 if (desc == NULL)
1951 -1); 1951 -1);
1952 g_free(text); 1952 g_free(text);
1953 } 1953 }
1954 1954
1955 void 1955 void
1956 gtk_gaim_status_box_add_separator(GtkGaimStatusBox *status_box) 1956 pidgin_status_box_add_separator(PidginStatusBox *status_box)
1957 { 1957 {
1958 /* Don't do anything unless GTK actually supports 1958 /* Don't do anything unless GTK actually supports
1959 * gtk_combo_box_set_row_separator_func */ 1959 * gtk_combo_box_set_row_separator_func */
1960 #if GTK_CHECK_VERSION(2,6,0) 1960 #if GTK_CHECK_VERSION(2,6,0)
1961 GtkTreeIter iter; 1961 GtkTreeIter iter;
1962 1962
1963 gtk_list_store_append(status_box->dropdown_store, &iter); 1963 gtk_list_store_append(status_box->dropdown_store, &iter);
1964 gtk_list_store_set(status_box->dropdown_store, &iter, 1964 gtk_list_store_set(status_box->dropdown_store, &iter,
1965 TYPE_COLUMN, GTK_GAIM_STATUS_BOX_TYPE_SEPARATOR, 1965 TYPE_COLUMN, PIDGIN_STATUS_BOX_TYPE_SEPARATOR,
1966 -1); 1966 -1);
1967 #endif 1967 #endif
1968 } 1968 }
1969 1969
1970 void 1970 void
1971 gtk_gaim_status_box_set_network_available(GtkGaimStatusBox *status_box, gboolean available) 1971 pidgin_status_box_set_network_available(PidginStatusBox *status_box, gboolean available)
1972 { 1972 {
1973 if (!status_box) 1973 if (!status_box)
1974 return; 1974 return;
1975 status_box->network_available = available; 1975 status_box->network_available = available;
1976 gtk_gaim_status_box_refresh(status_box); 1976 pidgin_status_box_refresh(status_box);
1977 } 1977 }
1978 1978
1979 void 1979 void
1980 gtk_gaim_status_box_set_connecting(GtkGaimStatusBox *status_box, gboolean connecting) 1980 pidgin_status_box_set_connecting(PidginStatusBox *status_box, gboolean connecting)
1981 { 1981 {
1982 if (!status_box) 1982 if (!status_box)
1983 return; 1983 return;
1984 status_box->connecting = connecting; 1984 status_box->connecting = connecting;
1985 gtk_gaim_status_box_refresh(status_box); 1985 pidgin_status_box_refresh(status_box);
1986 } 1986 }
1987 1987
1988 static void 1988 static void
1989 gtk_gaim_status_box_redisplay_buddy_icon(GtkGaimStatusBox *status_box) 1989 pidgin_status_box_redisplay_buddy_icon(PidginStatusBox *status_box)
1990 { 1990 {
1991 1991
1992 /* This is sometimes called before the box is shown, and we will not have a size */ 1992 /* This is sometimes called before the box is shown, and we will not have a size */
1993 if (status_box->icon_size <= 0) 1993 if (status_box->icon_size <= 0)
1994 return; 1994 return;
2023 gtk_widget_queue_resize(GTK_WIDGET(status_box)); 2023 gtk_widget_queue_resize(GTK_WIDGET(status_box));
2024 } 2024 }
2025 } 2025 }
2026 2026
2027 void 2027 void
2028 gtk_gaim_status_box_set_buddy_icon(GtkGaimStatusBox *status_box, const char *filename) 2028 pidgin_status_box_set_buddy_icon(PidginStatusBox *status_box, const char *filename)
2029 { 2029 {
2030 g_free(status_box->buddy_icon_path); 2030 g_free(status_box->buddy_icon_path);
2031 status_box->buddy_icon_path = g_strdup(filename); 2031 status_box->buddy_icon_path = g_strdup(filename);
2032 2032
2033 gtk_gaim_status_box_redisplay_buddy_icon(status_box); 2033 pidgin_status_box_redisplay_buddy_icon(status_box);
2034 } 2034 }
2035 2035
2036 const char* 2036 const char*
2037 gtk_gaim_status_box_get_buddy_icon(GtkGaimStatusBox *box) 2037 pidgin_status_box_get_buddy_icon(PidginStatusBox *box)
2038 { 2038 {
2039 return box->buddy_icon_path; 2039 return box->buddy_icon_path;
2040 } 2040 }
2041 2041
2042 void 2042 void
2043 gtk_gaim_status_box_pulse_connecting(GtkGaimStatusBox *status_box) 2043 pidgin_status_box_pulse_connecting(PidginStatusBox *status_box)
2044 { 2044 {
2045 if (!status_box) 2045 if (!status_box)
2046 return; 2046 return;
2047 if (status_box->connecting_index == 3) 2047 if (status_box->connecting_index == 3)
2048 status_box->connecting_index = 0; 2048 status_box->connecting_index = 0;
2049 else 2049 else
2050 status_box->connecting_index++; 2050 status_box->connecting_index++;
2051 gtk_gaim_status_box_refresh(status_box); 2051 pidgin_status_box_refresh(status_box);
2052 } 2052 }
2053 2053
2054 static void 2054 static void
2055 gtk_gaim_status_box_pulse_typing(GtkGaimStatusBox *status_box) 2055 pidgin_status_box_pulse_typing(PidginStatusBox *status_box)
2056 { 2056 {
2057 if (status_box->typing_index == 3) 2057 if (status_box->typing_index == 3)
2058 status_box->typing_index = 0; 2058 status_box->typing_index = 0;
2059 else 2059 else
2060 status_box->typing_index++; 2060 status_box->typing_index++;
2061 gtk_gaim_status_box_refresh(status_box); 2061 pidgin_status_box_refresh(status_box);
2062 } 2062 }
2063 2063
2064 static gboolean 2064 static gboolean
2065 message_changed(const char *one, const char *two) 2065 message_changed(const char *one, const char *two)
2066 { 2066 {
2072 2072
2073 return (g_utf8_collate(one, two) != 0); 2073 return (g_utf8_collate(one, two) != 0);
2074 } 2074 }
2075 2075
2076 static void 2076 static void
2077 activate_currently_selected_status(GtkGaimStatusBox *status_box) 2077 activate_currently_selected_status(PidginStatusBox *status_box)
2078 { 2078 {
2079 GtkGaimStatusBoxItemType type; 2079 PidginStatusBoxItemType type;
2080 gpointer data; 2080 gpointer data;
2081 gchar *title; 2081 gchar *title;
2082 GtkTreeIter iter; 2082 GtkTreeIter iter;
2083 GtkTreePath *path; 2083 GtkTreePath *path;
2084 char *message; 2084 char *message;
2101 * Popular statuses are 2101 * Popular statuses are
2102 * activated elsewhere, and we update the status_box 2102 * activated elsewhere, and we update the status_box
2103 * accordingly by connecting to the savedstatus-changed 2103 * accordingly by connecting to the savedstatus-changed
2104 * signal and then calling status_menu_refresh_iter() 2104 * signal and then calling status_menu_refresh_iter()
2105 */ 2105 */
2106 if (type != GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE) 2106 if (type != PIDGIN_STATUS_BOX_TYPE_PRIMITIVE)
2107 return; 2107 return;
2108 2108
2109 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter, 2109 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter,
2110 TITLE_COLUMN, &title, -1); 2110 TITLE_COLUMN, &title, -1);
2111 2111
2112 message = gtk_gaim_status_box_get_message(status_box); 2112 message = pidgin_status_box_get_message(status_box);
2113 if (!message || !*message) 2113 if (!message || !*message)
2114 { 2114 {
2115 gtk_widget_hide_all(status_box->vbox); 2115 gtk_widget_hide_all(status_box->vbox);
2116 status_box->imhtml_visible = FALSE; 2116 status_box->imhtml_visible = FALSE;
2117 if (message != NULL) 2117 if (message != NULL)
2264 2264
2265 g_free(title); 2265 g_free(title);
2266 g_free(message); 2266 g_free(message);
2267 } 2267 }
2268 2268
2269 static void update_size(GtkGaimStatusBox *status_box) 2269 static void update_size(PidginStatusBox *status_box)
2270 { 2270 {
2271 GtkTextBuffer *buffer; 2271 GtkTextBuffer *buffer;
2272 GtkTextIter iter; 2272 GtkTextIter iter;
2273 int wrapped_lines; 2273 int wrapped_lines;
2274 int lines; 2274 int lines;
2305 height += (oneline.height + pad_inside) * (wrapped_lines - lines); 2305 height += (oneline.height + pad_inside) * (wrapped_lines - lines);
2306 2306
2307 gtk_widget_set_size_request(status_box->vbox, -1, height + GAIM_HIG_BOX_SPACE); 2307 gtk_widget_set_size_request(status_box->vbox, -1, height + GAIM_HIG_BOX_SPACE);
2308 } 2308 }
2309 2309
2310 static void remove_typing_cb(GtkGaimStatusBox *status_box) 2310 static void remove_typing_cb(PidginStatusBox *status_box)
2311 { 2311 {
2312 if (status_box->typing == 0) 2312 if (status_box->typing == 0)
2313 { 2313 {
2314 /* Nothing has changed, so we don't need to do anything */ 2314 /* Nothing has changed, so we don't need to do anything */
2315 status_menu_refresh_iter(status_box); 2315 status_menu_refresh_iter(status_box);
2318 2318
2319 g_source_remove(status_box->typing); 2319 g_source_remove(status_box->typing);
2320 status_box->typing = 0; 2320 status_box->typing = 0;
2321 2321
2322 activate_currently_selected_status(status_box); 2322 activate_currently_selected_status(status_box);
2323 gtk_gaim_status_box_refresh(status_box); 2323 pidgin_status_box_refresh(status_box);
2324 } 2324 }
2325 2325
2326 static void gtk_gaim_status_box_changed(GtkGaimStatusBox *status_box) 2326 static void pidgin_status_box_changed(PidginStatusBox *status_box)
2327 { 2327 {
2328 GtkTreePath *path = gtk_tree_row_reference_get_path(status_box->active_row); 2328 GtkTreePath *path = gtk_tree_row_reference_get_path(status_box->active_row);
2329 GtkTreeIter iter; 2329 GtkTreeIter iter;
2330 GtkGaimStatusBoxItemType type; 2330 PidginStatusBoxItemType type;
2331 gpointer data; 2331 gpointer data;
2332 GList *accounts = NULL, *node; 2332 GList *accounts = NULL, *node;
2333 int active; 2333 int active;
2334 2334
2335 2335
2347 g_source_remove(status_box->typing); 2347 g_source_remove(status_box->typing);
2348 status_box->typing = 0; 2348 status_box->typing = 0;
2349 2349
2350 if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box))) 2350 if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box)))
2351 { 2351 {
2352 if (type == GTK_GAIM_STATUS_BOX_TYPE_POPULAR) 2352 if (type == PIDGIN_STATUS_BOX_TYPE_POPULAR)
2353 { 2353 {
2354 GaimSavedStatus *saved; 2354 GaimSavedStatus *saved;
2355 saved = gaim_savedstatus_find_by_creation_time(GPOINTER_TO_INT(data)); 2355 saved = gaim_savedstatus_find_by_creation_time(GPOINTER_TO_INT(data));
2356 g_return_if_fail(saved != NULL); 2356 g_return_if_fail(saved != NULL);
2357 gaim_savedstatus_activate(saved); 2357 gaim_savedstatus_activate(saved);
2358 return; 2358 return;
2359 } 2359 }
2360 2360
2361 if (type == GTK_GAIM_STATUS_BOX_TYPE_CUSTOM) 2361 if (type == PIDGIN_STATUS_BOX_TYPE_CUSTOM)
2362 { 2362 {
2363 GaimSavedStatus *saved_status; 2363 GaimSavedStatus *saved_status;
2364 saved_status = gaim_savedstatus_get_current(); 2364 saved_status = gaim_savedstatus_get_current();
2365 pidgin_status_editor_show(FALSE, 2365 pidgin_status_editor_show(FALSE,
2366 gaim_savedstatus_is_transient(saved_status) 2366 gaim_savedstatus_is_transient(saved_status)
2367 ? saved_status : NULL); 2367 ? saved_status : NULL);
2368 status_menu_refresh_iter(status_box); 2368 status_menu_refresh_iter(status_box);
2369 return; 2369 return;
2370 } 2370 }
2371 2371
2372 if (type == GTK_GAIM_STATUS_BOX_TYPE_SAVED) 2372 if (type == PIDGIN_STATUS_BOX_TYPE_SAVED)
2373 { 2373 {
2374 pidgin_status_window_show(); 2374 pidgin_status_window_show();
2375 status_menu_refresh_iter(status_box); 2375 status_menu_refresh_iter(status_box);
2376 return; 2376 return;
2377 } 2377 }
2417 gtk_widget_hide_all(status_box->vbox); 2417 gtk_widget_hide_all(status_box->vbox);
2418 activate_currently_selected_status(status_box); /* This is where we actually set the status */ 2418 activate_currently_selected_status(status_box); /* This is where we actually set the status */
2419 return; 2419 return;
2420 } 2420 }
2421 } 2421 }
2422 gtk_gaim_status_box_refresh(status_box); 2422 pidgin_status_box_refresh(status_box);
2423 } 2423 }
2424 2424
2425 static gint 2425 static gint
2426 get_statusbox_index(GtkGaimStatusBox *box, GaimSavedStatus *saved_status) 2426 get_statusbox_index(PidginStatusBox *box, GaimSavedStatus *saved_status)
2427 { 2427 {
2428 gint index; 2428 gint index;
2429 2429
2430 switch (gaim_savedstatus_get_type(saved_status)) 2430 switch (gaim_savedstatus_get_type(saved_status))
2431 { 2431 {
2449 return index; 2449 return index;
2450 } 2450 }
2451 2451
2452 static void imhtml_changed_cb(GtkTextBuffer *buffer, void *data) 2452 static void imhtml_changed_cb(GtkTextBuffer *buffer, void *data)
2453 { 2453 {
2454 GtkGaimStatusBox *status_box = (GtkGaimStatusBox*)data; 2454 PidginStatusBox *status_box = (PidginStatusBox*)data;
2455 if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box))) 2455 if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box)))
2456 { 2456 {
2457 if (status_box->typing != 0) { 2457 if (status_box->typing != 0) {
2458 gtk_gaim_status_box_pulse_typing(status_box); 2458 pidgin_status_box_pulse_typing(status_box);
2459 g_source_remove(status_box->typing); 2459 g_source_remove(status_box->typing);
2460 } 2460 }
2461 status_box->typing = g_timeout_add(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, status_box); 2461 status_box->typing = g_timeout_add(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, status_box);
2462 } 2462 }
2463 gtk_gaim_status_box_refresh(status_box); 2463 pidgin_status_box_refresh(status_box);
2464 } 2464 }
2465 2465
2466 static void imhtml_format_changed_cb(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons, void *data) 2466 static void imhtml_format_changed_cb(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons, void *data)
2467 { 2467 {
2468 imhtml_changed_cb(NULL, data); 2468 imhtml_changed_cb(NULL, data);
2469 } 2469 }
2470 2470
2471 char *gtk_gaim_status_box_get_message(GtkGaimStatusBox *status_box) 2471 char *pidgin_status_box_get_message(PidginStatusBox *status_box)
2472 { 2472 {
2473 if (status_box->imhtml_visible) 2473 if (status_box->imhtml_visible)
2474 return gtk_imhtml_get_markup(GTK_IMHTML(status_box->imhtml)); 2474 return gtk_imhtml_get_markup(GTK_IMHTML(status_box->imhtml));
2475 else 2475 else
2476 return NULL; 2476 return NULL;

mercurial