comparison pidgin/gtkstatusbox.c @ 15436:9c0cf4db1f4d

Dialog icon changes
author Sean Egan <seanegan@gmail.com>
date Sat, 27 Jan 2007 11:11:26 +0000
parents e6b40365930c
children 3b45081f6183
comparison
equal deleted inserted replaced
15435:29e443e0613f 15436:9c0cf4db1f4d
516 GdkPixbuf *pixbuf; 516 GdkPixbuf *pixbuf;
517 GtkTreePath *path; 517 GtkTreePath *path;
518 gboolean account_status = FALSE; 518 gboolean account_status = FALSE;
519 GaimAccount *acct = (status_box->token_status_account) ? status_box->token_status_account : status_box->account; 519 GaimAccount *acct = (status_box->token_status_account) ? status_box->token_status_account : status_box->account;
520 520
521 icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_TANGO_EXTRA_SMALL); 521 icon_size = gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL);
522 522
523 style = gtk_widget_get_style(GTK_WIDGET(status_box)); 523 style = gtk_widget_get_style(GTK_WIDGET(status_box));
524 snprintf(aa_color, sizeof(aa_color), "#%02x%02x%02x", 524 snprintf(aa_color, sizeof(aa_color), "#%02x%02x%02x",
525 style->text_aa[GTK_STATE_NORMAL].red >> 8, 525 style->text_aa[GTK_STATE_NORMAL].red >> 8,
526 style->text_aa[GTK_STATE_NORMAL].green >> 8, 526 style->text_aa[GTK_STATE_NORMAL].green >> 8,
594 pixbuf = status_box->connecting_pixbufs[status_box->connecting_index]; 594 pixbuf = status_box->connecting_pixbufs[status_box->connecting_index];
595 else 595 else
596 { 596 {
597 GaimStatusType *status_type; 597 GaimStatusType *status_type;
598 GaimStatusPrimitive prim; 598 GaimStatusPrimitive prim;
599 GtkIconSize icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_TANGO_EXTRA_SMALL); 599 GtkIconSize icon_size = gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL);
600 if (account_status) { 600 if (account_status) {
601 status_type = gaim_status_get_type(gaim_account_get_active_status(acct)); 601 status_type = gaim_status_get_type(gaim_account_get_active_status(acct));
602 prim = gaim_status_type_get_primitive(status_type); 602 prim = gaim_status_type_get_primitive(status_type);
603 } else { 603 } else {
604 prim = gaim_savedstatus_get_type(saved_status); 604 prim = gaim_savedstatus_get_type(saved_status);
605 } 605 }
606 606
607 if (prim == GAIM_STATUS_UNAVAILABLE) 607 if (prim == GAIM_STATUS_UNAVAILABLE)
608 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_BUSY, 608 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), PIDGIN_STOCK_STATUS_BUSY,
609 icon_size, "GtkTreeView"); 609 icon_size, "PidginStatusBox");
610 else if (prim == GAIM_STATUS_AWAY) 610 else if (prim == GAIM_STATUS_AWAY)
611 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_AWAY, 611 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), PIDGIN_STOCK_STATUS_AWAY,
612 icon_size, "GtkTreeView"); 612 icon_size, "PidginStatusBox");
613 else if (prim == GAIM_STATUS_EXTENDED_AWAY) 613 else if (prim == GAIM_STATUS_EXTENDED_AWAY)
614 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_XA, 614 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), PIDGIN_STOCK_STATUS_XA,
615 icon_size, "GtkTreeView"); 615 icon_size, "PidginStatusBox");
616 else if (prim == GAIM_STATUS_OFFLINE) 616 else if (prim == GAIM_STATUS_OFFLINE)
617 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_OFFLINE, 617 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), PIDGIN_STOCK_STATUS_OFFLINE,
618 icon_size, "GtkTreeView"); 618 icon_size, "PidginStatusBox");
619 else 619 else
620 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_AVAILABLE, 620 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), PIDGIN_STOCK_STATUS_AVAILABLE,
621 icon_size, "GtkTreeView"); 621 icon_size, "PidginStatusBox");
622 #if 0 622 #if 0
623 if (account_status) 623 if (account_status)
624 pixbuf = gaim_gtk_create_prpl_icon_with_status(acct, 624 pixbuf = gaim_gtk_create_prpl_icon_with_status(acct,
625 gaim_status_get_type(gaim_account_get_active_status(acct)), 625 gaim_status_get_type(gaim_account_get_active_status(acct)),
626 0.5); 626 0.5);
844 list = gaim_savedstatuses_get_popular(6); 844 list = gaim_savedstatuses_get_popular(6);
845 if (list == NULL) 845 if (list == NULL)
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(GAIM_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 gtk_gaim_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 {
859 859
860 /* Get an appropriate status icon */ 860 /* Get an appropriate status icon */
861 prim = gaim_savedstatus_get_type(saved); 861 prim = gaim_savedstatus_get_type(saved);
862 862
863 if (prim == GAIM_STATUS_UNAVAILABLE) 863 if (prim == GAIM_STATUS_UNAVAILABLE)
864 pixbuf = gtk_widget_render_icon (GTK_WIDGET(statusbox), GAIM_STOCK_STATUS_BUSY, 864 pixbuf = gtk_widget_render_icon (GTK_WIDGET(statusbox), PIDGIN_STOCK_STATUS_BUSY,
865 icon_size, "GtkTreeView"); 865 icon_size, "PidginStatusBox");
866 else if (prim == GAIM_STATUS_AWAY) 866 else if (prim == GAIM_STATUS_AWAY)
867 pixbuf = gtk_widget_render_icon (GTK_WIDGET(statusbox), GAIM_STOCK_STATUS_AWAY, 867 pixbuf = gtk_widget_render_icon (GTK_WIDGET(statusbox), PIDGIN_STOCK_STATUS_AWAY,
868 icon_size, "GtkTreeView"); 868 icon_size, "PidginStatusBox");
869 else if (prim == GAIM_STATUS_EXTENDED_AWAY) 869 else if (prim == GAIM_STATUS_EXTENDED_AWAY)
870 pixbuf = gtk_widget_render_icon (GTK_WIDGET(statusbox), GAIM_STOCK_STATUS_XA, 870 pixbuf = gtk_widget_render_icon (GTK_WIDGET(statusbox), PIDGIN_STOCK_STATUS_XA,
871 icon_size, "GtkTreeView"); 871 icon_size, "PidginStatusBox");
872 else if (prim == GAIM_STATUS_OFFLINE) 872 else if (prim == GAIM_STATUS_OFFLINE)
873 pixbuf = gtk_widget_render_icon (GTK_WIDGET(statusbox), GAIM_STOCK_STATUS_OFFLINE, 873 pixbuf = gtk_widget_render_icon (GTK_WIDGET(statusbox), PIDGIN_STOCK_STATUS_OFFLINE,
874 icon_size, "GtkTreeView"); 874 icon_size, "PidginStatusBox");
875 else 875 else
876 pixbuf = gtk_widget_render_icon (GTK_WIDGET(statusbox), GAIM_STOCK_STATUS_AVAILABLE, 876 pixbuf = gtk_widget_render_icon (GTK_WIDGET(statusbox), PIDGIN_STOCK_STATUS_AVAILABLE,
877 icon_size, "GtkTreeView"); 877 icon_size, "PidginStatusBox");
878 878
879 if (gaim_savedstatus_is_transient(saved)) 879 if (gaim_savedstatus_is_transient(saved))
880 { 880 {
881 /* 881 /*
882 * Transient statuses do not have a title, so the savedstatus 882 * Transient statuses do not have a title, so the savedstatus
978 978
979 for (l = gaim_account_get_status_types(account); l != NULL; l = l->next) 979 for (l = gaim_account_get_status_types(account); l != NULL; l = l->next)
980 { 980 {
981 GaimStatusType *status_type = (GaimStatusType *)l->data; 981 GaimStatusType *status_type = (GaimStatusType *)l->data;
982 GaimStatusPrimitive prim; 982 GaimStatusPrimitive prim;
983 GtkIconSize icon_size = gtk_icon_size_from_name(GAIM_ICON_SIZE_TANGO_EXTRA_SMALL); 983 GtkIconSize icon_size = gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL);
984 984
985 if (!gaim_status_type_is_user_settable(status_type)) 985 if (!gaim_status_type_is_user_settable(status_type))
986 continue; 986 continue;
987 987
988 prim = gaim_status_type_get_primitive(status_type); 988 prim = gaim_status_type_get_primitive(status_type);
989 989
990 if (prim == GAIM_STATUS_UNAVAILABLE) 990 if (prim == GAIM_STATUS_UNAVAILABLE)
991 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_BUSY, 991 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), PIDGIN_STOCK_STATUS_BUSY,
992 icon_size, "GtkTreeView"); 992 icon_size, "PidginStatusBox");
993 else if (prim == GAIM_STATUS_AWAY) 993 else if (prim == GAIM_STATUS_AWAY)
994 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_AWAY, 994 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), PIDGIN_STOCK_STATUS_AWAY,
995 icon_size, "GtkTreeView"); 995 icon_size, "PidginStatusBox");
996 else if (prim == GAIM_STATUS_EXTENDED_AWAY) 996 else if (prim == GAIM_STATUS_EXTENDED_AWAY)
997 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_XA, 997 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), PIDGIN_STOCK_STATUS_XA,
998 icon_size, "GtkTreeView"); 998 icon_size, "PidginStatusBox");
999 else if (prim == GAIM_STATUS_OFFLINE) 999 else if (prim == GAIM_STATUS_OFFLINE)
1000 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_OFFLINE, 1000 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), PIDGIN_STOCK_STATUS_OFFLINE,
1001 icon_size, "GtkTreeView"); 1001 icon_size, "PidginStatusBox");
1002 else 1002 else
1003 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), GAIM_STOCK_STATUS_AVAILABLE, 1003 pixbuf = gtk_widget_render_icon (GTK_WIDGET(status_box), PIDGIN_STOCK_STATUS_AVAILABLE,
1004 icon_size, "GtkTreeView"); 1004 icon_size, "PidginStatusBox");
1005 1005
1006 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), 1006 gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box),
1007 GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE, pixbuf, 1007 GTK_GAIM_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,
1017 gtk_gaim_status_box_regenerate(GtkGaimStatusBox *status_box) 1017 gtk_gaim_status_box_regenerate(GtkGaimStatusBox *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(GAIM_ICON_SIZE_TANGO_EXTRA_SMALL); 1022 icon_size = gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL);
1023 1023
1024 /* Unset the model while clearing it */ 1024 /* Unset the model while clearing it */
1025 gtk_tree_view_set_model(GTK_TREE_VIEW(status_box->tree_view), NULL); 1025 gtk_tree_view_set_model(GTK_TREE_VIEW(status_box->tree_view), NULL);
1026 gtk_list_store_clear(status_box->dropdown_store); 1026 gtk_list_store_clear(status_box->dropdown_store);
1027 /* Don't set the model until the new statuses have been added to the box. 1027 /* Don't set the model until the new statuses have been added to the box.
1029 * if we do this here. */ 1029 * if we do this here. */
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), GAIM_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, "GtkGaimStatusBox");
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);
1041 } else { 1041 } else {
1042 /* Global */ 1042 /* Global */
1043 pixbuf2 = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_AWAY, 1043 pixbuf2 = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), PIDGIN_STOCK_STATUS_AWAY,
1044 icon_size, "GtkGaimStatusBox"); 1044 icon_size, "PidginStatusBox");
1045 pixbuf3 = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_OFFLINE, 1045 pixbuf3 = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), PIDGIN_STOCK_STATUS_OFFLINE,
1046 icon_size, "GtkGaimStatusBox"); 1046 icon_size, "PidginStatusBox");
1047 pixbuf4 = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_INVISIBLE, 1047 pixbuf4 = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), GAIM_STOCK_STATUS_INVISIBLE,
1048 icon_size, "GtkGaimStatusBox"); 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 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));
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 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));
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 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));
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 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));
1147 cache_pixbufs(GtkGaimStatusBox *status_box) 1147 cache_pixbufs(GtkGaimStatusBox *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(GAIM_ICON_SIZE_TANGO_EXTRA_SMALL); 1152 icon_size = gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL);
1153 1153
1154 if (status_box->connecting_pixbufs[0] != NULL) 1154 if (status_box->connecting_pixbufs[0] != NULL)
1155 gdk_pixbuf_unref(status_box->connecting_pixbufs[0]); 1155 gdk_pixbuf_unref(status_box->connecting_pixbufs[0]);
1156 if (status_box->connecting_pixbufs[1] != NULL) 1156 if (status_box->connecting_pixbufs[1] != NULL)
1157 gdk_pixbuf_unref(status_box->connecting_pixbufs[1]); 1157 gdk_pixbuf_unref(status_box->connecting_pixbufs[1]);