gtk/gtkstatusbox.c

changeset 14865
533ea832c97c
parent 14864
a1cbdeffee69
child 15064
da02544e8fe6
equal deleted inserted replaced
14864:a1cbdeffee69 14865:533ea832c97c
81 static void gtk_gaim_status_box_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data); 81 static void gtk_gaim_status_box_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data);
82 82
83 static void do_colorshift (GdkPixbuf *dest, GdkPixbuf *src, int shift); 83 static void do_colorshift (GdkPixbuf *dest, GdkPixbuf *src, int shift);
84 static void icon_choose_cb(const char *filename, gpointer data); 84 static void icon_choose_cb(const char *filename, gpointer data);
85 85
86 static void (*combo_box_size_request)(GtkWidget *widget, GtkRequisition *requisition);
87 static void (*combo_box_size_allocate)(GtkWidget *widget, GtkAllocation *allocation);
88 static void (*combo_box_forall) (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data);
89
86 enum { 90 enum {
87 /** A GtkGaimStatusBoxItemType */ 91 /** A GtkGaimStatusBoxItemType */
88 TYPE_COLUMN, 92 TYPE_COLUMN,
89 93
90 /** 94 /**
116 PROP_0, 120 PROP_0,
117 PROP_ACCOUNT, 121 PROP_ACCOUNT,
118 PROP_ICON_SEL, 122 PROP_ICON_SEL,
119 }; 123 };
120 124
121 GtkContainer *parent_class = NULL; 125 GtkComboBoxClass *parent_class = NULL;
122 126
123 static void gtk_gaim_status_box_class_init (GtkGaimStatusBoxClass *klass); 127 static void gtk_gaim_status_box_class_init (GtkGaimStatusBoxClass *klass);
124 static void gtk_gaim_status_box_init (GtkGaimStatusBox *status_box); 128 static void gtk_gaim_status_box_init (GtkGaimStatusBox *status_box);
125 129
126 GType 130 GType
142 0, 146 0,
143 (GInstanceInitFunc) gtk_gaim_status_box_init, 147 (GInstanceInitFunc) gtk_gaim_status_box_init,
144 NULL /* value_table */ 148 NULL /* value_table */
145 }; 149 };
146 150
147 status_box_type = g_type_register_static(GTK_TYPE_CONTAINER, 151 status_box_type = g_type_register_static(GTK_TYPE_COMBO_BOX,
148 "GtkGaimStatusBox", 152 "GtkGaimStatusBox",
149 &status_box_info, 153 &status_box_info,
150 0); 154 0);
151 } 155 }
152 156
153 return status_box_type; 157 return status_box_type;
193 break; 197 break;
194 } 198 }
195 199
196 if (status_no != -1) { 200 if (status_no != -1) {
197 gtk_widget_set_sensitive(GTK_WIDGET(status_box), FALSE); 201 gtk_widget_set_sensitive(GTK_WIDGET(status_box), FALSE);
198 // gtk_combo_box_set_active(GTK_COMBO_BOX(status_box), status_no); 202 gtk_combo_box_set_active(GTK_COMBO_BOX(status_box), status_no);
199 203
200 message = gaim_status_get_attr_string(newstatus, "message"); 204 message = gaim_status_get_attr_string(newstatus, "message");
201 205
202 if (!message || !*message) 206 if (!message || !*message)
203 { 207 {
420 424
421 static void 425 static void
422 gtk_gaim_status_box_class_init (GtkGaimStatusBoxClass *klass) 426 gtk_gaim_status_box_class_init (GtkGaimStatusBoxClass *klass)
423 { 427 {
424 GObjectClass *object_class; 428 GObjectClass *object_class;
429 GtkComboBoxClass *combo_class;
425 GtkWidgetClass *widget_class; 430 GtkWidgetClass *widget_class;
426 GtkContainerClass *container_class = (GtkContainerClass*)klass; 431 GtkContainerClass *container_class = (GtkContainerClass*)klass;
427 432
428 parent_class = g_type_class_peek_parent(klass); 433 parent_class = g_type_class_peek_parent(klass);
429 434
435 combo_class = (GtkComboBoxClass*)klass;
436 combo_class->changed = gtk_gaim_status_box_changed;
437
430 widget_class = (GtkWidgetClass*)klass; 438 widget_class = (GtkWidgetClass*)klass;
439 combo_box_size_request = widget_class->size_request;
431 widget_class->size_request = gtk_gaim_status_box_size_request; 440 widget_class->size_request = gtk_gaim_status_box_size_request;
441 combo_box_size_allocate = widget_class->size_allocate;
432 widget_class->size_allocate = gtk_gaim_status_box_size_allocate; 442 widget_class->size_allocate = gtk_gaim_status_box_size_allocate;
433 widget_class->expose_event = gtk_gaim_status_box_expose_event; 443 widget_class->expose_event = gtk_gaim_status_box_expose_event;
434 444
445 combo_box_forall = container_class->forall;
435 container_class->forall = gtk_gaim_status_box_forall; 446 container_class->forall = gtk_gaim_status_box_forall;
436 container_class->remove = NULL; 447 container_class->remove = NULL;
437 448
438 object_class = (GObjectClass *)klass; 449 object_class = (GObjectClass *)klass;
439 450
505 GtkTreeIter iter; 516 GtkTreeIter iter;
506 GtkGaimStatusBoxItemType type; 517 GtkGaimStatusBoxItemType type;
507 gpointer data; 518 gpointer data;
508 519
509 /* Primary (get the status selected in the dropdown) */ 520 /* Primary (get the status selected in the dropdown) */
510 // gtk_combo_box_get_active_iter(GTK_COMBO_BOX(status_box), &iter); 521 gtk_combo_box_get_active_iter(GTK_COMBO_BOX(status_box), &iter);
511 // gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter, 522 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter,
512 // TYPE_COLUMN, &type, 523 TYPE_COLUMN, &type,
513 // DATA_COLUMN, &data, 524 DATA_COLUMN, &data,
514 // -1); 525 -1);
515 // if (type == GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE) 526 if (type == GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE)
516 // primary = g_strdup(gaim_primitive_get_name_from_type(GPOINTER_TO_INT(data))); 527 primary = g_strdup(gaim_primitive_get_name_from_type(GPOINTER_TO_INT(data)));
517 // else 528 else
518 // /* This should never happen, but just in case... */ 529 /* This should never happen, but just in case... */
519 // primary = g_strdup("New status"); 530 primary = g_strdup("New status");
520 primary = g_strdup("Available");
521 } 531 }
522 else if (account_status) 532 else if (account_status)
523 primary = g_strdup(gaim_status_get_name(gaim_account_get_active_status(acct))); 533 primary = g_strdup(gaim_status_get_name(gaim_account_get_active_status(acct)));
524 else if (gaim_savedstatus_is_transient(saved_status)) 534 else if (gaim_savedstatus_is_transient(saved_status))
525 primary = g_strdup(gaim_primitive_get_name_from_type(gaim_savedstatus_get_type(saved_status))); 535 primary = g_strdup(gaim_primitive_get_name_from_type(gaim_savedstatus_get_type(saved_status)));
615 g_object_unref(pixbuf); 625 g_object_unref(pixbuf);
616 g_free(text); 626 g_free(text);
617 627
618 /* Make sure to activate the only row in the tree view */ 628 /* Make sure to activate the only row in the tree view */
619 path = gtk_tree_path_new_from_string("0"); 629 path = gtk_tree_path_new_from_string("0");
620 // gtk_cell_view_set_displayed_row(GTK_CELL_VIEW(status_box->cell_view), path); 630 gtk_cell_view_set_displayed_row(GTK_CELL_VIEW(status_box->cell_view), path);
621 gtk_tree_path_free(path); 631 gtk_tree_path_free(path);
622 632
623 update_size(status_box); 633 update_size(status_box);
624 } 634 }
625 635
681 ((primitive == GAIM_STATUS_AVAILABLE) || (primitive == GAIM_STATUS_AWAY) || 691 ((primitive == GAIM_STATUS_AVAILABLE) || (primitive == GAIM_STATUS_AWAY) ||
682 (primitive == GAIM_STATUS_INVISIBLE) || (primitive == GAIM_STATUS_OFFLINE)) && 692 (primitive == GAIM_STATUS_INVISIBLE) || (primitive == GAIM_STATUS_OFFLINE)) &&
683 (!gaim_savedstatus_has_substatuses(saved_status))) 693 (!gaim_savedstatus_has_substatuses(saved_status)))
684 { 694 {
685 index = get_statusbox_index(status_box, saved_status); 695 index = get_statusbox_index(status_box, saved_status);
686 // gtk_combo_box_set_active(GTK_COMBO_BOX(status_box), index); 696 gtk_combo_box_set_active(GTK_COMBO_BOX(status_box), index);
687 } 697 }
688 else 698 else
689 { 699 {
690 GtkTreeIter iter; 700 GtkTreeIter iter;
691 GtkGaimStatusBoxItemType type; 701 GtkGaimStatusBoxItemType type;
692 gpointer data; 702 gpointer data;
693 703
694 /* Unset the active item */ 704 /* Unset the active item */
695 // gtk_combo_box_set_active(GTK_COMBO_BOX(status_box), -1); 705 gtk_combo_box_set_active(GTK_COMBO_BOX(status_box), -1);
696 706
697 /* If this saved status is in the list store, then set it as the active item */ 707 /* If this saved status is in the list store, then set it as the active item */
698 if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(status_box->dropdown_store), &iter)) 708 if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(status_box->dropdown_store), &iter))
699 { 709 {
700 do 710 do
718 728
719 if (!gaim_savedstatus_has_substatuses(saved_status) 729 if (!gaim_savedstatus_has_substatuses(saved_status)
720 || !strcmp(name, acct_status_name)) 730 || !strcmp(name, acct_status_name))
721 { 731 {
722 /* Found! */ 732 /* Found! */
723 // gtk_combo_box_set_active_iter(GTK_COMBO_BOX(status_box), &iter); 733 gtk_combo_box_set_active_iter(GTK_COMBO_BOX(status_box), &iter);
724 g_free(name); 734 g_free(name);
725 break; 735 break;
726 } 736 }
727 g_free(name); 737 g_free(name);
728 } 738 }
729 else if ((type == GTK_GAIM_STATUS_BOX_TYPE_POPULAR) && 739 else if ((type == GTK_GAIM_STATUS_BOX_TYPE_POPULAR) &&
730 (GPOINTER_TO_INT(data) == gaim_savedstatus_get_creation_time(saved_status))) 740 (GPOINTER_TO_INT(data) == gaim_savedstatus_get_creation_time(saved_status)))
731 { 741 {
732 /* Found! */ 742 /* Found! */
733 // gtk_combo_box_set_active_iter(GTK_COMBO_BOX(status_box), &iter); 743 gtk_combo_box_set_active_iter(GTK_COMBO_BOX(status_box), &iter);
734 break; 744 break;
735 } 745 }
736 } 746 }
737 while (gtk_tree_model_iter_next(GTK_TREE_MODEL(status_box->dropdown_store), &iter)); 747 while (gtk_tree_model_iter_next(GTK_TREE_MODEL(status_box->dropdown_store), &iter));
738 } 748 }
914 NULL, 924 NULL,
915 GINT_TO_POINTER(gaim_status_type_get_primitive(status_type))); 925 GINT_TO_POINTER(gaim_status_type_get_primitive(status_type)));
916 if (tmp != NULL) 926 if (tmp != NULL)
917 g_object_unref(tmp); 927 g_object_unref(tmp);
918 } 928 }
919 // gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), GTK_TREE_MODEL(status_box->dropdown_store)); 929 gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), GTK_TREE_MODEL(status_box->dropdown_store));
920 } 930 }
921 931
922 static void 932 static void
923 gtk_gaim_status_box_regenerate(GtkGaimStatusBox *status_box) 933 gtk_gaim_status_box_regenerate(GtkGaimStatusBox *status_box)
924 { 934 {
931 icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_STATUS); 941 icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_STATUS);
932 else 942 else
933 icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_STATUS_SMALL); 943 icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_STATUS_SMALL);
934 944
935 /* Unset the model while clearing it */ 945 /* Unset the model while clearing it */
936 // gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), NULL); 946 gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), NULL);
937 gtk_list_store_clear(status_box->dropdown_store); 947 gtk_list_store_clear(status_box->dropdown_store);
938 /* Don't set the model until the new statuses have been added to the box. 948 /* Don't set the model until the new statuses have been added to the box.
939 * What is presumably a bug in Gtk < 2.4 causes things to get all confused 949 * What is presumably a bug in Gtk < 2.4 causes things to get all confused
940 * if we do this here. */ 950 * if we do this here. */
941 /* gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), GTK_TREE_MODEL(status_box->dropdown_store)); */ 951 /* gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), GTK_TREE_MODEL(status_box->dropdown_store)); */
973 gtk_gaim_status_box_add_separator(GTK_GAIM_STATUS_BOX(status_box)); 983 gtk_gaim_status_box_add_separator(GTK_GAIM_STATUS_BOX(status_box));
974 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_CUSTOM, pixbuf, _("New..."), NULL, NULL); 984 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_CUSTOM, pixbuf, _("New..."), NULL, NULL);
975 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_SAVED, pixbuf, _("Saved..."), NULL, NULL); 985 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), GTK_GAIM_STATUS_BOX_TYPE_SAVED, pixbuf, _("Saved..."), NULL, NULL);
976 if (pixbuf) g_object_unref(G_OBJECT(pixbuf)); 986 if (pixbuf) g_object_unref(G_OBJECT(pixbuf));
977 987
978 // gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), GTK_TREE_MODEL(status_box->dropdown_store)); 988 gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), GTK_TREE_MODEL(status_box->dropdown_store));
979 status_menu_refresh_iter(status_box); 989 status_menu_refresh_iter(status_box);
980 990
981 } else { 991 } else {
982 add_account_statuses(status_box, status_box->account, show_buddy_icons); 992 add_account_statuses(status_box, status_box->account, show_buddy_icons);
983 update_to_reflect_account_status(status_box, status_box->account, 993 update_to_reflect_account_status(status_box, status_box->account,
1175 #endif 1185 #endif
1176 1186
1177 static void 1187 static void
1178 toggled_cb(GtkWidget *widget, GtkGaimStatusBox *box) 1188 toggled_cb(GtkWidget *widget, GtkGaimStatusBox *box)
1179 { 1189 {
1180 // gtk_combo_box_popup(GTK_COMBO_BOX(box)); 1190 gtk_combo_box_popup(GTK_COMBO_BOX(box));
1181 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(box->toggle_button), FALSE); 1191 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(box->toggle_button), FALSE);
1182 } 1192 }
1183 1193
1184 static void 1194 static void
1185 buddy_icon_set_cb(const char *filename, gpointer data) 1195 buddy_icon_set_cb(const char *filename, gpointer data)
1260 status_box->vsep = gtk_vseparator_new(); 1270 status_box->vsep = gtk_vseparator_new();
1261 status_box->arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE); 1271 status_box->arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
1262 1272
1263 status_box->store = gtk_list_store_new(NUM_COLUMNS, G_TYPE_INT, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER); 1273 status_box->store = gtk_list_store_new(NUM_COLUMNS, G_TYPE_INT, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER);
1264 status_box->dropdown_store = gtk_list_store_new(NUM_COLUMNS, G_TYPE_INT, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER); 1274 status_box->dropdown_store = gtk_list_store_new(NUM_COLUMNS, G_TYPE_INT, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER);
1265 // gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), GTK_TREE_MODEL(status_box->dropdown_store)); 1275 gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), GTK_TREE_MODEL(status_box->dropdown_store));
1266 gtk_cell_view_set_model(GTK_CELL_VIEW(status_box->cell_view), GTK_TREE_MODEL(status_box->store)); 1276 gtk_cell_view_set_model(GTK_CELL_VIEW(status_box->cell_view), GTK_TREE_MODEL(status_box->store));
1267 // gtk_combo_box_set_wrap_width(GTK_COMBO_BOX(status_box), 0); 1277 gtk_combo_box_set_wrap_width(GTK_COMBO_BOX(status_box), 0);
1268 gtk_list_store_append(status_box->store, &(status_box->iter)); 1278 gtk_list_store_append(status_box->store, &(status_box->iter));
1269 1279
1270 gtk_container_add(GTK_CONTAINER(status_box->toggle_button), status_box->hbox); 1280 gtk_container_add(GTK_CONTAINER(status_box->toggle_button), status_box->hbox);
1271 gtk_box_pack_start(GTK_BOX(status_box->hbox), status_box->cell_view, TRUE, TRUE, 0); 1281 gtk_box_pack_start(GTK_BOX(status_box->hbox), status_box->cell_view, TRUE, TRUE, 0);
1272 gtk_box_pack_start(GTK_BOX(status_box->hbox), status_box->vsep, FALSE, FALSE, 0); 1282 gtk_box_pack_start(GTK_BOX(status_box->hbox), status_box->vsep, FALSE, FALSE, 0);
1276 gtk_button_set_focus_on_click(GTK_BUTTON(status_box->toggle_button), FALSE); 1286 gtk_button_set_focus_on_click(GTK_BUTTON(status_box->toggle_button), FALSE);
1277 #endif 1287 #endif
1278 1288
1279 text_rend = gtk_cell_renderer_text_new(); 1289 text_rend = gtk_cell_renderer_text_new();
1280 icon_rend = gtk_cell_renderer_pixbuf_new(); 1290 icon_rend = gtk_cell_renderer_pixbuf_new();
1281 // gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box), icon_rend, FALSE); 1291 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box), icon_rend, FALSE);
1282 // gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box), text_rend, TRUE); 1292 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box), text_rend, TRUE);
1283 // gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(status_box), icon_rend, "pixbuf", ICON_COLUMN, NULL); 1293 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(status_box), icon_rend, "pixbuf", ICON_COLUMN, NULL);
1284 // gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(status_box), text_rend, "markup", TEXT_COLUMN, NULL); 1294 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(status_box), text_rend, "markup", TEXT_COLUMN, NULL);
1285 #if GTK_CHECK_VERSION(2, 6, 0) 1295 #if GTK_CHECK_VERSION(2, 6, 0)
1286 g_object_set(text_rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL); 1296 g_object_set(text_rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
1287 #endif 1297 #endif
1288 1298
1289 status_box->icon_rend = gtk_cell_renderer_pixbuf_new(); 1299 status_box->icon_rend = gtk_cell_renderer_pixbuf_new();
1290 status_box->text_rend = gtk_cell_renderer_text_new(); 1300 status_box->text_rend = gtk_cell_renderer_text_new();
1291 // gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box->cell_view), status_box->icon_rend, FALSE); 1301 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box->cell_view), status_box->icon_rend, FALSE);
1292 // gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box->cell_view), status_box->text_rend, TRUE); 1302 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(status_box->cell_view), status_box->text_rend, TRUE);
1293 // gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(status_box->cell_view), status_box->icon_rend, "pixbuf", ICON_COLUMN, NULL); 1303 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(status_box->cell_view), status_box->icon_rend, "pixbuf", ICON_COLUMN, NULL);
1294 // gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(status_box->cell_view), status_box->text_rend, "markup", TEXT_COLUMN, NULL); 1304 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(status_box->cell_view), status_box->text_rend, "markup", TEXT_COLUMN, NULL);
1295 #if GTK_CHECK_VERSION(2, 6, 0) 1305 #if GTK_CHECK_VERSION(2, 6, 0)
1296 g_object_set(status_box->text_rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL); 1306 g_object_set(status_box->text_rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
1297 #endif 1307 #endif
1298 1308
1299 status_box->vbox = gtk_vbox_new(0, FALSE); 1309 status_box->vbox = gtk_vbox_new(0, FALSE);
1329 g_signal_connect(G_OBJECT(status_box), "scroll_event", G_CALLBACK(combo_box_scroll_event_cb), NULL); 1339 g_signal_connect(G_OBJECT(status_box), "scroll_event", G_CALLBACK(combo_box_scroll_event_cb), NULL);
1330 g_signal_connect(G_OBJECT(status_box->imhtml), "scroll_event", 1340 g_signal_connect(G_OBJECT(status_box->imhtml), "scroll_event",
1331 G_CALLBACK(imhtml_scroll_event_cb), status_box->imhtml); 1341 G_CALLBACK(imhtml_scroll_event_cb), status_box->imhtml);
1332 1342
1333 #if GTK_CHECK_VERSION(2,6,0) 1343 #if GTK_CHECK_VERSION(2,6,0)
1334 // gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(status_box), dropdown_store_row_separator_func, NULL, NULL); 1344 gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(status_box), dropdown_store_row_separator_func, NULL, NULL);
1335 #endif 1345 #endif
1336 1346
1337 status_box->token_status_account = check_active_accounts_for_identical_statuses(); 1347 status_box->token_status_account = check_active_accounts_for_identical_statuses();
1338 1348
1339 cache_pixbufs(status_box); 1349 cache_pixbufs(status_box);
1364 static void 1374 static void
1365 gtk_gaim_status_box_size_request(GtkWidget *widget, 1375 gtk_gaim_status_box_size_request(GtkWidget *widget,
1366 GtkRequisition *requisition) 1376 GtkRequisition *requisition)
1367 { 1377 {
1368 GtkRequisition box_req; 1378 GtkRequisition box_req;
1369 gtk_widget_size_request(GTK_GAIM_STATUS_BOX(widget)->toggle_button, requisition); 1379 combo_box_size_request(widget, requisition);
1370 requisition->height += 3; 1380 requisition->height += 3;
1371 1381
1372 /* If the gtkimhtml is visible, then add some additional padding */ 1382 /* If the gtkimhtml is visible, then add some additional padding */
1373 gtk_widget_size_request(GTK_GAIM_STATUS_BOX(widget)->vbox, &box_req); 1383 gtk_widget_size_request(GTK_GAIM_STATUS_BOX(widget)->vbox, &box_req);
1374 if (box_req.height > 1) 1384 if (box_req.height > 1)
1426 GtkGaimStatusBox *status_box = GTK_GAIM_STATUS_BOX(widget); 1436 GtkGaimStatusBox *status_box = GTK_GAIM_STATUS_BOX(widget);
1427 GtkRequisition req = {0,0}; 1437 GtkRequisition req = {0,0};
1428 GtkAllocation parent_alc, box_alc, icon_alc; 1438 GtkAllocation parent_alc, box_alc, icon_alc;
1429 gint border_width = GTK_CONTAINER (widget)->border_width; 1439 gint border_width = GTK_CONTAINER (widget)->border_width;
1430 1440
1431 gtk_widget_size_request(GTK_GAIM_STATUS_BOX(widget)->toggle_button, &req); 1441 combo_box_size_request(widget, &req);
1432 1442
1433 box_alc = *allocation; 1443 box_alc = *allocation;
1434 1444
1435 box_alc.width -= (border_width * 2); 1445 box_alc.width -= (border_width * 2);
1436 box_alc.height = MAX(1, ((allocation->height - req.height) - (border_width*2))); 1446 box_alc.height = MAX(1, ((allocation->height - req.height) - (border_width*2)));
1465 gtk_gaim_status_box_redisplay_buddy_icon(status_box); 1475 gtk_gaim_status_box_redisplay_buddy_icon(status_box);
1466 } 1476 }
1467 gtk_widget_size_allocate(status_box->icon_box, &icon_alc); 1477 gtk_widget_size_allocate(status_box->icon_box, &icon_alc);
1468 } 1478 }
1469 1479
1480 combo_box_size_allocate(widget, &parent_alc);
1470 gtk_widget_size_allocate(status_box->toggle_button, &parent_alc); 1481 gtk_widget_size_allocate(status_box->toggle_button, &parent_alc);
1471 widget->allocation = *allocation; 1482 widget->allocation = *allocation;
1472 } 1483 }
1473 1484
1474 static gboolean 1485 static gboolean
1498 (* callback) (status_box->arrow, callback_data); 1509 (* callback) (status_box->arrow, callback_data);
1499 if (status_box->icon_box) 1510 if (status_box->icon_box)
1500 (* callback) (status_box->icon_box, callback_data); 1511 (* callback) (status_box->icon_box, callback_data);
1501 } 1512 }
1502 1513
1503 // combo_box_forall(container, include_internals, callback, callback_data); 1514 combo_box_forall(container, include_internals, callback, callback_data);
1504 } 1515 }
1505 1516
1506 GtkWidget * 1517 GtkWidget *
1507 gtk_gaim_status_box_new() 1518 gtk_gaim_status_box_new()
1508 { 1519 {
1711 GtkTreeIter iter; 1722 GtkTreeIter iter;
1712 char *message; 1723 char *message;
1713 GaimSavedStatus *saved_status = NULL; 1724 GaimSavedStatus *saved_status = NULL;
1714 gboolean changed = TRUE; 1725 gboolean changed = TRUE;
1715 1726
1716 // if (!gtk_combo_box_get_active_iter(GTK_COMBO_BOX(status_box), &iter)) 1727 if (!gtk_combo_box_get_active_iter(GTK_COMBO_BOX(status_box), &iter))
1717 // return; 1728 return;
1718 1729
1719 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter, 1730 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter,
1720 TYPE_COLUMN, &type, 1731 TYPE_COLUMN, &type,
1721 DATA_COLUMN, &data, 1732 DATA_COLUMN, &data,
1722 -1); 1733 -1);
1951 gpointer data; 1962 gpointer data;
1952 GList *accounts = NULL, *node; 1963 GList *accounts = NULL, *node;
1953 1964
1954 status_box = GTK_GAIM_STATUS_BOX(box); 1965 status_box = GTK_GAIM_STATUS_BOX(box);
1955 1966
1956 // if (!gtk_combo_box_get_active_iter(GTK_COMBO_BOX(status_box), &iter)) 1967 if (!gtk_combo_box_get_active_iter(GTK_COMBO_BOX(status_box), &iter))
1957 // return; 1968 return;
1958 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter, 1969 gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter,
1959 TYPE_COLUMN, &type, 1970 TYPE_COLUMN, &type,
1960 DATA_COLUMN, &data, 1971 DATA_COLUMN, &data,
1961 -1); 1972 -1);
1962 if (status_box->typing != 0) 1973 if (status_box->typing != 0)

mercurial