Mercurial > pidgin.yaz
comparison src/gtksavedstatuses.c @ 13090:0aa231ebbfd5
[gaim-migrate @ 15452]
Changes to some pixbuf stuff.
I added a 'gaim_gtk_create_gaim_icon_with_status()' function to util.c,
and changed 'gaim_gtk_create_prpl_icon_with_status()' to accept a scale
factor because almost everywhere this function was used we would scale
the pixbuf to a smaller size as soon as we got it. So there's a bit less
code duplication.
Also, I think I added some g_object_unref()'s in one or two places where
it was missing.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Wed, 01 Feb 2006 22:38:34 +0000 |
parents | 5efbb0162f86 |
children | 39e7014cb687 |
comparison
equal
deleted
inserted
replaced
13089:b553326bc468 | 13090:0aa231ebbfd5 |
---|---|
919 static void | 919 static void |
920 status_editor_set_account(GtkListStore *store, GaimAccount *account, | 920 status_editor_set_account(GtkListStore *store, GaimAccount *account, |
921 GtkTreeIter *iter, GaimSavedStatusSub *substatus) | 921 GtkTreeIter *iter, GaimSavedStatusSub *substatus) |
922 { | 922 { |
923 GdkPixbuf *pixbuf; | 923 GdkPixbuf *pixbuf; |
924 GdkPixbuf *scale; | |
925 const char *id = NULL, *name = NULL, *message = NULL; | 924 const char *id = NULL, *name = NULL, *message = NULL; |
926 | 925 |
927 scale = NULL; | 926 pixbuf = gaim_gtk_create_prpl_icon(account, 0.5); |
928 | 927 if ((pixbuf != NULL) && !gaim_account_is_connected(account)) |
929 pixbuf = gaim_gtk_create_prpl_icon(account); | 928 { |
930 | 929 gdk_pixbuf_saturate_and_pixelate(pixbuf, pixbuf, 0.0, FALSE); |
931 if (pixbuf != NULL) | |
932 { | |
933 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, GDK_INTERP_BILINEAR); | |
934 | |
935 if (gaim_account_is_disconnected(account)) | |
936 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.0, FALSE); | |
937 } | 930 } |
938 | 931 |
939 if (substatus != NULL) | 932 if (substatus != NULL) |
940 { | 933 { |
941 const GaimStatusType *type; | 934 const GaimStatusType *type; |
948 } | 941 } |
949 | 942 |
950 gtk_list_store_set(store, iter, | 943 gtk_list_store_set(store, iter, |
951 STATUS_EDITOR_COLUMN_ACCOUNT, account, | 944 STATUS_EDITOR_COLUMN_ACCOUNT, account, |
952 STATUS_EDITOR_COLUMN_ENABLE_SUBSTATUS, (substatus != NULL), | 945 STATUS_EDITOR_COLUMN_ENABLE_SUBSTATUS, (substatus != NULL), |
953 STATUS_EDITOR_COLUMN_ICON, scale, | 946 STATUS_EDITOR_COLUMN_ICON, pixbuf, |
954 STATUS_EDITOR_COLUMN_SCREENNAME, gaim_account_get_username(account), | 947 STATUS_EDITOR_COLUMN_SCREENNAME, gaim_account_get_username(account), |
955 STATUS_EDITOR_COLUMN_STATUS_ID, id, | 948 STATUS_EDITOR_COLUMN_STATUS_ID, id, |
956 STATUS_EDITOR_COLUMN_STATUS_NAME, name, | 949 STATUS_EDITOR_COLUMN_STATUS_NAME, name, |
957 STATUS_EDITOR_COLUMN_STATUS_MESSAGE, message, | 950 STATUS_EDITOR_COLUMN_STATUS_MESSAGE, message, |
958 -1); | 951 -1); |
959 | 952 |
960 if (pixbuf != NULL) g_object_unref(G_OBJECT(pixbuf)); | 953 if (pixbuf != NULL) |
961 if (scale != NULL) g_object_unref(G_OBJECT(scale)); | 954 g_object_unref(G_OBJECT(pixbuf)); |
962 } | 955 } |
963 | 956 |
964 static void | 957 static void |
965 status_editor_add_account(StatusEditor *dialog, GaimAccount *account, | 958 status_editor_add_account(StatusEditor *dialog, GaimAccount *account, |
966 GaimSavedStatusSub *substatus) | 959 GaimSavedStatusSub *substatus) |
1457 } | 1450 } |
1458 | 1451 |
1459 for (list = gaim_account_get_status_types(account); list; list = list->next) | 1452 for (list = gaim_account_get_status_types(account); list; list = list->next) |
1460 { | 1453 { |
1461 GaimStatusType *status_type; | 1454 GaimStatusType *status_type; |
1462 GdkPixbuf *pixbuf, *scale = NULL; | 1455 GdkPixbuf *pixbuf; |
1463 const char *id, *name; | 1456 const char *id, *name; |
1464 | 1457 |
1465 status_type = list->data; | 1458 status_type = list->data; |
1466 | 1459 |
1467 /* Only allow users to select statuses that are flagged as "user settable" */ | 1460 /* Only allow users to select statuses that are flagged as "user settable" */ |
1468 if (!gaim_status_type_is_user_settable(status_type)) | 1461 if (!gaim_status_type_is_user_settable(status_type)) |
1469 continue; | 1462 continue; |
1470 | 1463 |
1471 id = gaim_status_type_get_id(status_type); | 1464 id = gaim_status_type_get_id(status_type); |
1472 pixbuf = gaim_gtk_create_prpl_icon_with_status(account, status_type); | 1465 pixbuf = gaim_gtk_create_prpl_icon_with_status(account, status_type, 0.5); |
1473 if (pixbuf != NULL) | |
1474 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, GDK_INTERP_BILINEAR); | |
1475 name = gaim_status_type_get_name(status_type); | 1466 name = gaim_status_type_get_name(status_type); |
1476 | 1467 |
1477 gtk_list_store_append(dialog->model, &iter); | 1468 gtk_list_store_append(dialog->model, &iter); |
1478 gtk_list_store_set(dialog->model, &iter, | 1469 gtk_list_store_set(dialog->model, &iter, |
1479 SUBSTATUS_COLUMN_ACCOUNT, account, | 1470 SUBSTATUS_COLUMN_ACCOUNT, account, |
1480 SUBSTATUS_COLUMN_ICON, scale, | 1471 SUBSTATUS_COLUMN_ICON, pixbuf, |
1481 SUBSTATUS_COLUMN_STATUS_ID, id, | 1472 SUBSTATUS_COLUMN_STATUS_ID, id, |
1482 SUBSTATUS_COLUMN_STATUS_NAME, name, | 1473 SUBSTATUS_COLUMN_STATUS_NAME, name, |
1483 -1); | 1474 -1); |
1475 if (pixbuf != NULL) | |
1476 g_object_unref(pixbuf); | |
1484 if (id && !strcmp(id, gaim_status_type_get_id(status_type))) | 1477 if (id && !strcmp(id, gaim_status_type_get_id(status_type))) |
1485 { | 1478 { |
1486 gtk_combo_box_set_active_iter(GTK_COMBO_BOX(combo), &iter); | 1479 gtk_combo_box_set_active_iter(GTK_COMBO_BOX(combo), &iter); |
1487 select = TRUE; | 1480 select = TRUE; |
1488 } | 1481 } |