Mercurial > pidgin.yaz
comparison pidgin/gtkstatusbox.c @ 16255:4e01fc165b28
use the invisible icon
author | Richard Nelson <wabz@pidgin.im> |
---|---|
date | Thu, 19 Apr 2007 01:22:55 +0000 |
parents | fde43bac6f23 |
children | ae8a326b091f |
comparison
equal
deleted
inserted
replaced
16254:c3052de39110 | 16255:4e01fc165b28 |
---|---|
538 G_PARAM_READWRITE | 538 G_PARAM_READWRITE |
539 ) | 539 ) |
540 ); | 540 ); |
541 } | 541 } |
542 | 542 |
543 static GdkPixbuf * | |
544 pidgin_status_box_get_pixbuf(PidginStatusBox *status_box, PurpleStatusPrimitive prim) | |
545 { | |
546 GdkPixbuf *pixbuf; | |
547 GtkIconSize icon_size = gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL); | |
548 if (prim == PURPLE_STATUS_UNAVAILABLE) | |
549 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), PIDGIN_STOCK_STATUS_BUSY, | |
550 icon_size, "PidginStatusBox"); | |
551 else if (prim == PURPLE_STATUS_AWAY) | |
552 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), PIDGIN_STOCK_STATUS_AWAY, | |
553 icon_size, "PidginStatusBox"); | |
554 else if (prim == PURPLE_STATUS_EXTENDED_AWAY) | |
555 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), PIDGIN_STOCK_STATUS_XA, | |
556 icon_size, "PidginStatusBox"); | |
557 else if (prim == PURPLE_STATUS_INVISIBLE) | |
558 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), PIDGIN_STOCK_STATUS_INVISIBLE, | |
559 icon_size, "PidginStatusBox"); | |
560 else if (prim == PURPLE_STATUS_OFFLINE) | |
561 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), PIDGIN_STOCK_STATUS_OFFLINE, | |
562 icon_size, "PidginStatusBox"); | |
563 else | |
564 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), PIDGIN_STOCK_STATUS_AVAILABLE, | |
565 icon_size, "PidginStatusBox"); | |
566 return pixbuf; | |
567 } | |
568 | |
543 /** | 569 /** |
544 * This updates the text displayed on the status box so that it shows | 570 * This updates the text displayed on the status box so that it shows |
545 * the current status. This is the only function in this file that | 571 * the current status. This is the only function in this file that |
546 * should modify status_box->store | 572 * should modify status_box->store |
547 */ | 573 */ |
634 pixbuf = status_box->connecting_pixbufs[status_box->connecting_index]; | 660 pixbuf = status_box->connecting_pixbufs[status_box->connecting_index]; |
635 else | 661 else |
636 { | 662 { |
637 PurpleStatusType *status_type; | 663 PurpleStatusType *status_type; |
638 PurpleStatusPrimitive prim; | 664 PurpleStatusPrimitive prim; |
639 GtkIconSize icon_size = gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL); | |
640 if (account_status) { | 665 if (account_status) { |
641 status_type = purple_status_get_type(purple_account_get_active_status(acct)); | 666 status_type = purple_status_get_type(purple_account_get_active_status(acct)); |
642 prim = purple_status_type_get_primitive(status_type); | 667 prim = purple_status_type_get_primitive(status_type); |
643 } else { | 668 } else { |
644 prim = purple_savedstatus_get_type(saved_status); | 669 prim = purple_savedstatus_get_type(saved_status); |
645 } | 670 } |
646 | 671 |
647 if (prim == PURPLE_STATUS_UNAVAILABLE) | 672 pixbuf = pidgin_status_box_get_pixbuf(status_box, prim); |
648 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), PIDGIN_STOCK_STATUS_BUSY, | |
649 icon_size, "PidginStatusBox"); | |
650 else if (prim == PURPLE_STATUS_AWAY) | |
651 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), PIDGIN_STOCK_STATUS_AWAY, | |
652 icon_size, "PidginStatusBox"); | |
653 else if (prim == PURPLE_STATUS_EXTENDED_AWAY) | |
654 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), PIDGIN_STOCK_STATUS_XA, | |
655 icon_size, "PidginStatusBox"); | |
656 else if (prim == PURPLE_STATUS_OFFLINE) | |
657 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), PIDGIN_STOCK_STATUS_OFFLINE, | |
658 icon_size, "PidginStatusBox"); | |
659 else | |
660 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), PIDGIN_STOCK_STATUS_AVAILABLE, | |
661 icon_size, "PidginStatusBox"); | |
662 #if 0 | 673 #if 0 |
663 if (account_status) | 674 if (account_status) |
664 pixbuf = pidgin_create_prpl_icon_with_status(acct, | 675 pixbuf = pidgin_create_prpl_icon_with_status(acct, |
665 purple_status_get_type(purple_account_get_active_status(acct)), | 676 purple_status_get_type(purple_account_get_active_status(acct)), |
666 0.5); | 677 0.5); |
874 } | 885 } |
875 | 886 |
876 static void | 887 static void |
877 add_popular_statuses(PidginStatusBox *statusbox) | 888 add_popular_statuses(PidginStatusBox *statusbox) |
878 { | 889 { |
879 GtkIconSize icon_size; | |
880 GList *list, *cur; | 890 GList *list, *cur; |
881 GdkPixbuf *pixbuf; | 891 GdkPixbuf *pixbuf; |
882 | 892 |
883 list = purple_savedstatuses_get_popular(6); | 893 list = purple_savedstatuses_get_popular(6); |
884 if (list == NULL) | 894 if (list == NULL) |
885 /* Odd... oh well, nothing we can do about it. */ | 895 /* Odd... oh well, nothing we can do about it. */ |
886 return; | 896 return; |
887 | 897 |
888 icon_size = gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL); | |
889 | |
890 pidgin_status_box_add_separator(statusbox); | 898 pidgin_status_box_add_separator(statusbox); |
891 | 899 |
892 for (cur = list; cur != NULL; cur = cur->next) | 900 for (cur = list; cur != NULL; cur = cur->next) |
893 { | 901 { |
894 PurpleSavedStatus *saved = cur->data; | 902 PurpleSavedStatus *saved = cur->data; |
897 PurpleStatusPrimitive prim; | 905 PurpleStatusPrimitive prim; |
898 | 906 |
899 /* Get an appropriate status icon */ | 907 /* Get an appropriate status icon */ |
900 prim = purple_savedstatus_get_type(saved); | 908 prim = purple_savedstatus_get_type(saved); |
901 | 909 |
902 if (prim == PURPLE_STATUS_UNAVAILABLE) | 910 |
903 pixbuf = gtk_widget_render_icon (GTK_WIDGET(statusbox), | 911 pixbuf = pidgin_status_box_get_pixbuf(statusbox, prim); |
904 PIDGIN_STOCK_STATUS_BUSY, icon_size, "PidginStatusBox"); | |
905 else if (prim == PURPLE_STATUS_AWAY) | |
906 pixbuf = gtk_widget_render_icon (GTK_WIDGET(statusbox), | |
907 PIDGIN_STOCK_STATUS_AWAY, icon_size, "PidginStatusBox"); | |
908 else if (prim == PURPLE_STATUS_EXTENDED_AWAY) | |
909 pixbuf = gtk_widget_render_icon (GTK_WIDGET(statusbox), | |
910 PIDGIN_STOCK_STATUS_XA, icon_size, "PidginStatusBox"); | |
911 else if (prim == PURPLE_STATUS_OFFLINE) | |
912 pixbuf = gtk_widget_render_icon (GTK_WIDGET(statusbox), | |
913 PIDGIN_STOCK_STATUS_OFFLINE, icon_size, "PidginStatusBox"); | |
914 else | |
915 pixbuf = gtk_widget_render_icon (GTK_WIDGET(statusbox), | |
916 PIDGIN_STOCK_STATUS_AVAILABLE, icon_size, "PidginStatusBox"); | |
917 | 912 |
918 if (purple_savedstatus_is_transient(saved)) | 913 if (purple_savedstatus_is_transient(saved)) |
919 { | 914 { |
920 /* | 915 /* |
921 * Transient statuses do not have a title, so the savedstatus | 916 * Transient statuses do not have a title, so the savedstatus |
1017 | 1012 |
1018 for (l = purple_account_get_status_types(account); l != NULL; l = l->next) | 1013 for (l = purple_account_get_status_types(account); l != NULL; l = l->next) |
1019 { | 1014 { |
1020 PurpleStatusType *status_type = (PurpleStatusType *)l->data; | 1015 PurpleStatusType *status_type = (PurpleStatusType *)l->data; |
1021 PurpleStatusPrimitive prim; | 1016 PurpleStatusPrimitive prim; |
1022 GtkIconSize icon_size = gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL); | |
1023 | 1017 |
1024 if (!purple_status_type_is_user_settable(status_type)) | 1018 if (!purple_status_type_is_user_settable(status_type)) |
1025 continue; | 1019 continue; |
1026 | 1020 |
1027 prim = purple_status_type_get_primitive(status_type); | 1021 prim = purple_status_type_get_primitive(status_type); |
1028 | 1022 |
1029 if (prim == PURPLE_STATUS_UNAVAILABLE) | 1023 pixbuf = pidgin_status_box_get_pixbuf(status_box, prim); |
1030 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), PIDGIN_STOCK_STATUS_BUSY, | |
1031 icon_size, "PidginStatusBox"); | |
1032 else if (prim == PURPLE_STATUS_AWAY) | |
1033 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), PIDGIN_STOCK_STATUS_AWAY, | |
1034 icon_size, "PidginStatusBox"); | |
1035 else if (prim == PURPLE_STATUS_EXTENDED_AWAY) | |
1036 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), PIDGIN_STOCK_STATUS_XA, | |
1037 icon_size, "PidginStatusBox"); | |
1038 else if (prim == PURPLE_STATUS_OFFLINE) | |
1039 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), PIDGIN_STOCK_STATUS_OFFLINE, | |
1040 icon_size, "PidginStatusBox"); | |
1041 else | |
1042 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), PIDGIN_STOCK_STATUS_AVAILABLE, | |
1043 icon_size, "PidginStatusBox"); | |
1044 | 1024 |
1045 pidgin_status_box_add(PIDGIN_STATUS_BOX(status_box), | 1025 pidgin_status_box_add(PIDGIN_STATUS_BOX(status_box), |
1046 PIDGIN_STATUS_BOX_TYPE_PRIMITIVE, pixbuf, | 1026 PIDGIN_STATUS_BOX_TYPE_PRIMITIVE, pixbuf, |
1047 purple_status_type_get_name(status_type), | 1027 purple_status_type_get_name(status_type), |
1048 NULL, | 1028 NULL, |