comparison src/gtkstatusbox.c @ 14141:5f656a0a82b7

[gaim-migrate @ 16783] Whitespace and warning fixes: gtkaccount.c: In function ¡Æicon_select_cb¡Ç: gtkaccount.c:289: warning: passing argument 1 of ¡Ægaim_gtk_buddy_icon_chooser_new¡Ç from incompatible pointer type gtkaccount.c:289: warning: passing argument 2 of ¡Ægaim_gtk_buddy_icon_chooser_new¡Ç from incompatible pointer type gtkstatusbox.c: In function ¡Æicon_box_press_cb¡Ç: gtkstatusbox.c:951: warning: passing argument 2 of ¡Ægaim_gtk_buddy_icon_chooser_new¡Ç from incompatible pointer type gtkstatusbox.c:951: warning: ISO C90 forbids mixed declarations and code gtkstatusbox.c: In function ¡Æicon_box_enter_cb¡Ç: gtkstatusbox.c:960: warning: passing argument 1 of ¡Ægtk_image_set_from_pixbuf¡Ç from incompatible pointer type gtkstatusbox.c: In function ¡Æicon_box_leave_cb¡Ç: gtkstatusbox.c:968: warning: passing argument 1 of ¡Ægtk_image_set_from_pixbuf¡Ç from incompatible pointer type gtkstatusbox.c: In function ¡Ægtk_gaim_status_box_size_allocate¡Ç: gtkstatusbox.c:1183: warning: passing argument 1 of ¡Ægtk_image_set_from_pixbuf¡Ç from incompatible pointer type gtkstatusbox.c: In function ¡Ægtk_gaim_status_box_set_buddy_icon¡Ç: gtkstatusbox.c:1338: warning: passing argument 1 of ¡Ægtk_image_set_from_pixbuf¡Ç from incompatible pointer type gtkutils.c: In function ¡Ægaim_gtk_convert_buddy_icon¡Ç: gtkutils.c:2463: warning: ISO C90 forbids mixed declarations and code committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 16 Aug 2006 06:31:59 +0000
parents 4006d3dc2871
children 11394a70de37
comparison
equal deleted inserted replaced
14140:ee80f766b7e3 14141:5f656a0a82b7
265 gdk_cursor_unref(statusbox->hand_cursor); 265 gdk_cursor_unref(statusbox->hand_cursor);
266 gdk_cursor_unref(statusbox->arrow_cursor); 266 gdk_cursor_unref(statusbox->arrow_cursor);
267 267
268 g_object_unref(G_OBJECT(statusbox->buddy_icon)); 268 g_object_unref(G_OBJECT(statusbox->buddy_icon));
269 g_object_unref(G_OBJECT(statusbox->buddy_icon_hover)); 269 g_object_unref(G_OBJECT(statusbox->buddy_icon_hover));
270 270
271 if (statusbox->buddy_icon_sel) 271 if (statusbox->buddy_icon_sel)
272 gtk_widget_destroy(statusbox->buddy_icon_sel); 272 gtk_widget_destroy(statusbox->buddy_icon_sel);
273 273
274 g_free(statusbox->buddy_icon_path); 274 g_free(statusbox->buddy_icon_path);
275 275
276 G_OBJECT_CLASS(parent_class)->finalize(obj); 276 G_OBJECT_CLASS(parent_class)->finalize(obj);
277 } 277 }
278 278
918 gtk_combo_box_popup(GTK_COMBO_BOX(box)); 918 gtk_combo_box_popup(GTK_COMBO_BOX(box));
919 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(box->toggle_button), FALSE); 919 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(box->toggle_button), FALSE);
920 } 920 }
921 921
922 static void 922 static void
923 icon_choose_cb(const char *filename, GtkGaimStatusBox *box) 923 icon_choose_cb(const char *filename, gpointer data)
924 { 924 {
925 GtkGaimStatusBox *box;
926
927 box = data;
928
925 if (filename) { 929 if (filename) {
926 GList *accounts; 930 GList *accounts;
927 for (accounts = gaim_accounts_get_all(); accounts != NULL; accounts = accounts->next) { 931 for (accounts = gaim_accounts_get_all(); accounts != NULL; accounts = accounts->next) {
928 GaimAccount *account = accounts->data; 932 GaimAccount *account = accounts->data;
929 if (gaim_account_get_ui_bool(account, GAIM_GTK_UI, "use-global-buddy-icon", TRUE) && 933 if (gaim_account_get_ui_bool(account, GAIM_GTK_UI, "use-global-buddy-icon", TRUE) &&
934 g_free(icon); 938 g_free(icon);
935 } 939 }
936 } 940 }
937 gtk_gaim_status_box_set_buddy_icon(box, filename); 941 gtk_gaim_status_box_set_buddy_icon(box, filename);
938 } 942 }
939 943
940 box->buddy_icon_sel = NULL; 944 box->buddy_icon_sel = NULL;
941 } 945 }
942 946
943 static gboolean 947 static gboolean
944 icon_box_press_cb(GtkWidget *widget, GdkEventButton *event, GtkGaimStatusBox *box) 948 icon_box_press_cb(GtkWidget *widget, GdkEventButton *event, GtkGaimStatusBox *box)
945 { 949 {
950 GtkWidget *filesel;
951
946 if (box->buddy_icon_sel) { 952 if (box->buddy_icon_sel) {
947 gtk_window_present(GTK_WINDOW(box->buddy_icon_sel)); 953 gtk_window_present(GTK_WINDOW(box->buddy_icon_sel));
948 return FALSE; 954 return FALSE;
949 } 955 }
950 956
951 GtkWidget *filesel = gaim_gtk_buddy_icon_chooser_new(NULL, icon_choose_cb, box); 957 filesel = gaim_gtk_buddy_icon_chooser_new(NULL, icon_choose_cb, box);
952 gtk_widget_show_all(filesel); 958 gtk_widget_show_all(filesel);
953 return FALSE; 959 return FALSE;
954 } 960 }
955 961
956 static gboolean 962 static gboolean
957 icon_box_enter_cb(GtkWidget *widget, GdkEventCrossing *event, GtkGaimStatusBox *box) 963 icon_box_enter_cb(GtkWidget *widget, GdkEventCrossing *event, GtkGaimStatusBox *box)
958 { 964 {
959 gdk_window_set_cursor(widget->window, box->hand_cursor); 965 gdk_window_set_cursor(widget->window, box->hand_cursor);
960 gtk_image_set_from_pixbuf(box->icon, box->buddy_icon_hover); 966 gtk_image_set_from_pixbuf(GTK_IMAGE(box->icon), box->buddy_icon_hover);
961 return FALSE; 967 return FALSE;
962 } 968 }
963 969
964 static gboolean 970 static gboolean
965 icon_box_leave_cb(GtkWidget *widget, GdkEventCrossing *event, GtkGaimStatusBox *box) 971 icon_box_leave_cb(GtkWidget *widget, GdkEventCrossing *event, GtkGaimStatusBox *box)
966 { 972 {
967 gdk_window_set_cursor(widget->window, box->arrow_cursor); 973 gdk_window_set_cursor(widget->window, box->arrow_cursor);
968 gtk_image_set_from_pixbuf(box->icon, box->buddy_icon) ; 974 gtk_image_set_from_pixbuf(GTK_IMAGE(box->icon), box->buddy_icon) ;
969 return FALSE; 975 return FALSE;
970 } 976 }
971 977
972 static void 978 static void
973 gtk_gaim_status_box_init (GtkGaimStatusBox *status_box) 979 gtk_gaim_status_box_init (GtkGaimStatusBox *status_box)
1170 icon_alc = *allocation; 1176 icon_alc = *allocation;
1171 icon_alc.height = MAX(1,req.height); 1177 icon_alc.height = MAX(1,req.height);
1172 icon_alc.width = icon_alc.height; 1178 icon_alc.width = icon_alc.height;
1173 icon_alc.x = allocation->width - icon_alc.width; 1179 icon_alc.x = allocation->width - icon_alc.width;
1174 icon_alc.y += 3; 1180 icon_alc.y += 3;
1175 1181
1176 if (status_box->icon_size != icon_alc.height) { 1182 if (status_box->icon_size != icon_alc.height) {
1177 scaled = gdk_pixbuf_new_from_file_at_scale(status_box->buddy_icon_path, 1183 scaled = gdk_pixbuf_new_from_file_at_scale(status_box->buddy_icon_path,
1178 icon_alc.height, icon_alc.width, FALSE, NULL); 1184 icon_alc.height, icon_alc.width, FALSE, NULL);
1179 status_box->buddy_icon_hover = gdk_pixbuf_copy(scaled); 1185 status_box->buddy_icon_hover = gdk_pixbuf_copy(scaled);
1180 do_colorshift(status_box->buddy_icon_hover, status_box->buddy_icon_hover, 30); 1186 do_colorshift(status_box->buddy_icon_hover, status_box->buddy_icon_hover, 30);
1181 g_object_unref(status_box->buddy_icon); 1187 g_object_unref(status_box->buddy_icon);
1182 status_box->buddy_icon = scaled; 1188 status_box->buddy_icon = scaled;
1183 gtk_image_set_from_pixbuf(status_box->icon, status_box->buddy_icon); 1189 gtk_image_set_from_pixbuf(GTK_IMAGE(status_box->icon), status_box->buddy_icon);
1184 status_box->icon_size = icon_alc.height; 1190 status_box->icon_size = icon_alc.height;
1185 } 1191 }
1186 gtk_widget_size_allocate((GTK_GAIM_STATUS_BOX(widget))->icon_box, &icon_alc); 1192 gtk_widget_size_allocate((GTK_GAIM_STATUS_BOX(widget))->icon_box, &icon_alc);
1187 1193
1188 1194
1327 { 1333 {
1328 GdkPixbuf *scaled; 1334 GdkPixbuf *scaled;
1329 g_free(box->buddy_icon_path); 1335 g_free(box->buddy_icon_path);
1330 box->buddy_icon_path = g_strdup(filename); 1336 box->buddy_icon_path = g_strdup(filename);
1331 1337
1332 scaled = gdk_pixbuf_new_from_file_at_scale(filename, 1338 scaled = gdk_pixbuf_new_from_file_at_scale(filename,
1333 box->icon_size, box->icon_size, FALSE, NULL); 1339 box->icon_size, box->icon_size, FALSE, NULL);
1334 box->buddy_icon_hover = gdk_pixbuf_copy(scaled); 1340 box->buddy_icon_hover = gdk_pixbuf_copy(scaled);
1335 do_colorshift(box->buddy_icon_hover, box->buddy_icon_hover, 30); 1341 do_colorshift(box->buddy_icon_hover, box->buddy_icon_hover, 30);
1336 g_object_unref(box->buddy_icon); 1342 g_object_unref(box->buddy_icon);
1337 box->buddy_icon = scaled; 1343 box->buddy_icon = scaled;
1338 gtk_image_set_from_pixbuf(box->icon, box->buddy_icon); 1344 gtk_image_set_from_pixbuf(GTK_IMAGE(box->icon), box->buddy_icon);
1339 1345
1340 gaim_prefs_set_string("/gaim/gtk/accounts/buddyicon", filename); 1346 gaim_prefs_set_string("/gaim/gtk/accounts/buddyicon", filename);
1341 } 1347 }
1342 1348
1343 const char* 1349 const char*
1344 gtk_gaim_status_box_get_buddy_icon(GtkGaimStatusBox *box) 1350 gtk_gaim_status_box_get_buddy_icon(GtkGaimStatusBox *box)