comparison src/gtkstatusbox.c @ 12286:255e6912607b

[gaim-migrate @ 14590] Mostly whitespace, but a couple small typo fixes, and an A;B -> B;A; swap to be consistent in plugins/notify.c committer: Tailor Script <tailor@pidgin.im>
author Etan Reisner <pidgin@unreliablesource.net>
date Thu, 01 Dec 2005 21:13:48 +0000
parents 0d6aeb831975
children d6b5373948f9
comparison
equal deleted inserted replaced
12285:af257d8679fe 12286:255e6912607b
139 } 139 }
140 140
141 if (status_no != -1) { 141 if (status_no != -1) {
142 gtk_widget_set_sensitive(GTK_WIDGET(status_box), FALSE); 142 gtk_widget_set_sensitive(GTK_WIDGET(status_box), FALSE);
143 gtk_combo_box_set_active(GTK_COMBO_BOX(status_box), status_no); 143 gtk_combo_box_set_active(GTK_COMBO_BOX(status_box), status_no);
144 144
145 message = gaim_status_get_attr_string(newstatus, "message"); 145 message = gaim_status_get_attr_string(newstatus, "message");
146 146
147 if (!message || !*message) 147 if (!message || !*message)
148 { 148 {
149 gtk_widget_hide_all(status_box->vbox); 149 gtk_widget_hide_all(status_box->vbox);
185 if (statusbox->status_changed_signal) { 185 if (statusbox->status_changed_signal) {
186 gaim_signal_disconnect(gaim_accounts_get_handle(), "account-status-changed", 186 gaim_signal_disconnect(gaim_accounts_get_handle(), "account-status-changed",
187 statusbox, GAIM_CALLBACK(account_status_changed_cb)); 187 statusbox, GAIM_CALLBACK(account_status_changed_cb));
188 statusbox->status_changed_signal = 0; 188 statusbox->status_changed_signal = 0;
189 } 189 }
190 190
191 if (statusbox->account) 191 if (statusbox->account)
192 statusbox->status_changed_signal = gaim_signal_connect(gaim_accounts_get_handle(), "account-status-changed", 192 statusbox->status_changed_signal = gaim_signal_connect(gaim_accounts_get_handle(), "account-status-changed",
193 statusbox, GAIM_CALLBACK(account_status_changed_cb), 193 statusbox, GAIM_CALLBACK(account_status_changed_cb),
194 statusbox); 194 statusbox);
195 gtk_gaim_status_box_regenerate(statusbox); 195 gtk_gaim_status_box_regenerate(statusbox);
395 395
396 /* Unset the model while clearing it */ 396 /* Unset the model while clearing it */
397 gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), NULL); 397 gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), NULL);
398 gtk_list_store_clear(status_box->dropdown_store); 398 gtk_list_store_clear(status_box->dropdown_store);
399 gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), GTK_TREE_MODEL(status_box->dropdown_store)); 399 gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), GTK_TREE_MODEL(status_box->dropdown_store));
400 400
401 account = GTK_GAIM_STATUS_BOX(status_box)->account; 401 account = GTK_GAIM_STATUS_BOX(status_box)->account;
402 if (account == NULL) 402 if (account == NULL)
403 { 403 {
404 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_ONLINE, 404 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_ONLINE,
405 icon_size, "GtkGaimStatusBox"); 405 icon_size, "GtkGaimStatusBox");
496 update_to_reflect_current_status(box); 496 update_to_reflect_current_status(box);
497 } 497 }
498 498
499 static gboolean button_released_cb(GtkWidget *widget, GdkEventButton *event, GtkGaimStatusBox *box) 499 static gboolean button_released_cb(GtkWidget *widget, GdkEventButton *event, GtkGaimStatusBox *box)
500 { 500 {
501 501
502 if (event->button != 1) 502 if (event->button != 1)
503 return FALSE; 503 return FALSE;
504 gtk_combo_box_popdown(GTK_COMBO_BOX(box)); 504 gtk_combo_box_popdown(GTK_COMBO_BOX(box));
505 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(box->toggle_button), FALSE); 505 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(box->toggle_button), FALSE);
506 if (!box->imhtml_visible) 506 if (!box->imhtml_visible)
540 status_box->toggle_button = gtk_toggle_button_new(); 540 status_box->toggle_button = gtk_toggle_button_new();
541 status_box->hbox = gtk_hbox_new(FALSE, 6); 541 status_box->hbox = gtk_hbox_new(FALSE, 6);
542 status_box->cell_view = gtk_cell_view_new(); 542 status_box->cell_view = gtk_cell_view_new();
543 status_box->vsep = gtk_vseparator_new(); 543 status_box->vsep = gtk_vseparator_new();
544 status_box->arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE); 544 status_box->arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
545 545
546 status_box->store = gtk_list_store_new(NUM_COLUMNS, G_TYPE_INT, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); 546 status_box->store = gtk_list_store_new(NUM_COLUMNS, G_TYPE_INT, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
547 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); 547 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);
548 gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), GTK_TREE_MODEL(status_box->dropdown_store)); 548 gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), GTK_TREE_MODEL(status_box->dropdown_store));
549 gtk_cell_view_set_model(GTK_CELL_VIEW(status_box->cell_view), GTK_TREE_MODEL(status_box->store)); 549 gtk_cell_view_set_model(GTK_CELL_VIEW(status_box->cell_view), GTK_TREE_MODEL(status_box->store));
550 gtk_combo_box_set_wrap_width(GTK_COMBO_BOX(status_box), 0); 550 gtk_combo_box_set_wrap_width(GTK_COMBO_BOX(status_box), 0);
581 vbox = gtk_vbox_new(0,FALSE); 581 vbox = gtk_vbox_new(0,FALSE);
582 status_box->imhtml = gtk_imhtml_new(NULL, NULL); 582 status_box->imhtml = gtk_imhtml_new(NULL, NULL);
583 status_box->toolbar = gtk_imhtmltoolbar_new(); 583 status_box->toolbar = gtk_imhtmltoolbar_new();
584 gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(status_box->toolbar), status_box->imhtml); 584 gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(status_box->toolbar), status_box->imhtml);
585 status_box->hsep = gtk_hseparator_new(); 585 status_box->hsep = gtk_hseparator_new();
586 586
587 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(status_box->imhtml)); 587 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(status_box->imhtml));
588 g_signal_connect(G_OBJECT(status_box->toggle_button), "button-press-event", 588 g_signal_connect(G_OBJECT(status_box->toggle_button), "button-press-event",
589 G_CALLBACK(button_pressed_cb), status_box); 589 G_CALLBACK(button_pressed_cb), status_box);
590 g_signal_connect(G_OBJECT(status_box->toggle_button), "button-release-event", 590 g_signal_connect(G_OBJECT(status_box->toggle_button), "button-release-event",
591 G_CALLBACK(button_released_cb), status_box); 591 G_CALLBACK(button_released_cb), status_box);
605 gtk_box_pack_start(GTK_BOX(vbox), status_box->hsep, FALSE, FALSE, 0); 605 gtk_box_pack_start(GTK_BOX(vbox), status_box->hsep, FALSE, FALSE, 0);
606 gtk_box_pack_start(GTK_BOX(vbox), status_box->imhtml, TRUE, TRUE, 0); 606 gtk_box_pack_start(GTK_BOX(vbox), status_box->imhtml, TRUE, TRUE, 0);
607 607
608 gtk_box_pack_start(GTK_BOX(status_box->vbox), status_box->sw, TRUE, TRUE, 0); 608 gtk_box_pack_start(GTK_BOX(status_box->vbox), status_box->sw, TRUE, TRUE, 0);
609 609
610 g_signal_connect(G_OBJECT(status_box->imhtml), "scroll_event", 610 g_signal_connect(G_OBJECT(status_box->imhtml), "scroll_event",
611 G_CALLBACK(scroll_event_cb), status_box->imhtml); 611 G_CALLBACK(scroll_event_cb), status_box->imhtml);
612
613 612
614 #if GTK_CHECK_VERSION(2,6,0) 613 #if GTK_CHECK_VERSION(2,6,0)
615 gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(status_box), dropdown_store_row_separator_func, NULL, NULL); 614 gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(status_box), dropdown_store_row_separator_func, NULL, NULL);
616 #endif 615 #endif
617 616
656 requisition->height += 6; 655 requisition->height += 6;
657 656
658 gtk_widget_size_request(GTK_GAIM_STATUS_BOX(widget)->vbox, &box_req); 657 gtk_widget_size_request(GTK_GAIM_STATUS_BOX(widget)->vbox, &box_req);
659 if (box_req.height > 1) 658 if (box_req.height > 1)
660 requisition->height = requisition->height + box_req.height + 6; 659 requisition->height = requisition->height + box_req.height + 6;
661 660
662 if (GTK_GAIM_STATUS_BOX(widget)->typing) { 661 if (GTK_GAIM_STATUS_BOX(widget)->typing) {
663 gtk_widget_size_request(GTK_GAIM_STATUS_BOX(widget)->toolbar, &box_req); 662 gtk_widget_size_request(GTK_GAIM_STATUS_BOX(widget)->toolbar, &box_req);
664 requisition->height = requisition->height + box_req.height; 663 requisition->height = requisition->height + box_req.height;
665 } 664 }
666 665
667 requisition->width = 1; 666 requisition->width = 1;
668
669 } 667 }
670 668
671 static void 669 static void
672 gtk_gaim_status_box_size_allocate(GtkWidget *widget, 670 gtk_gaim_status_box_size_allocate(GtkWidget *widget,
673 GtkAllocation *allocation) 671 GtkAllocation *allocation)
682 box_alc.height = MAX(1, ((allocation->height) - (req.height) - (12))); 680 box_alc.height = MAX(1, ((allocation->height) - (req.height) - (12)));
683 box_alc.y = box_alc.y + req.height + 9; 681 box_alc.y = box_alc.y + req.height + 9;
684 682
685 box_alc.width -= 6; 683 box_alc.width -= 6;
686 box_alc.x += 3; 684 box_alc.x += 3;
687
688 685
689 gtk_widget_size_allocate((GTK_GAIM_STATUS_BOX(widget))->vbox, &box_alc); 686 gtk_widget_size_allocate((GTK_GAIM_STATUS_BOX(widget))->vbox, &box_alc);
690 687
691 parent_alc.height = MAX(1,req.height); 688 parent_alc.height = MAX(1,req.height);
692 parent_alc.width -= 6; 689 parent_alc.width -= 6;
695 692
696 combo_box_size_allocate(widget, &parent_alc); 693 combo_box_size_allocate(widget, &parent_alc);
697 gtk_widget_size_allocate((GTK_GAIM_STATUS_BOX(widget))->toggle_button, &parent_alc); 694 gtk_widget_size_allocate((GTK_GAIM_STATUS_BOX(widget))->toggle_button, &parent_alc);
698 widget->allocation = *allocation; 695 widget->allocation = *allocation;
699 } 696 }
700
701 697
702 static gboolean 698 static gboolean
703 gtk_gaim_status_box_expose_event(GtkWidget *widget, 699 gtk_gaim_status_box_expose_event(GtkWidget *widget,
704 GdkEventExpose *event) 700 GdkEventExpose *event)
705 { 701 {