Mercurial > pidgin.yaz
changeset 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 | ee80f766b7e3 |
children | 89d043d547cc |
files | src/gtkaccount.c src/gtkstatusbox.c src/gtkstatusbox.h src/gtkutils.c |
diffstat | 4 files changed, 53 insertions(+), 37 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gtkaccount.c Wed Aug 16 06:11:10 2006 +0000 +++ b/src/gtkaccount.c Wed Aug 16 06:31:59 2006 +0000 @@ -271,22 +271,26 @@ } static void -icon_filesel_choose_cb(const char *filename, AccountPrefsDialog *dialog) +icon_filesel_choose_cb(const char *filename, gpointer data) { + AccountPrefsDialog *dialog; + + dialog = data; + if (filename) { g_free(dialog->icon_path); dialog->icon_path = gaim_gtk_convert_buddy_icon(dialog->plugin, filename); set_dialog_icon(dialog); gtk_widget_show(dialog->icon_entry); } - + dialog->icon_filesel = NULL; } static void icon_select_cb(GtkWidget *button, AccountPrefsDialog *dialog) { - dialog->icon_filesel = gaim_gtk_buddy_icon_chooser_new(dialog->window, icon_filesel_choose_cb, dialog); + dialog->icon_filesel = gaim_gtk_buddy_icon_chooser_new(GTK_WINDOW(dialog->window), icon_filesel_choose_cb, dialog); gtk_widget_show_all(dialog->icon_filesel); }
--- a/src/gtkstatusbox.c Wed Aug 16 06:11:10 2006 +0000 +++ b/src/gtkstatusbox.c Wed Aug 16 06:31:59 2006 +0000 @@ -267,10 +267,10 @@ g_object_unref(G_OBJECT(statusbox->buddy_icon)); g_object_unref(G_OBJECT(statusbox->buddy_icon_hover)); - + if (statusbox->buddy_icon_sel) gtk_widget_destroy(statusbox->buddy_icon_sel); - + g_free(statusbox->buddy_icon_path); G_OBJECT_CLASS(parent_class)->finalize(obj); @@ -920,8 +920,12 @@ } static void -icon_choose_cb(const char *filename, GtkGaimStatusBox *box) +icon_choose_cb(const char *filename, gpointer data) { + GtkGaimStatusBox *box; + + box = data; + if (filename) { GList *accounts; for (accounts = gaim_accounts_get_all(); accounts != NULL; accounts = accounts->next) { @@ -936,19 +940,21 @@ } gtk_gaim_status_box_set_buddy_icon(box, filename); } - + box->buddy_icon_sel = NULL; } static gboolean icon_box_press_cb(GtkWidget *widget, GdkEventButton *event, GtkGaimStatusBox *box) { + GtkWidget *filesel; + if (box->buddy_icon_sel) { gtk_window_present(GTK_WINDOW(box->buddy_icon_sel)); return FALSE; } - GtkWidget *filesel = gaim_gtk_buddy_icon_chooser_new(NULL, icon_choose_cb, box); + filesel = gaim_gtk_buddy_icon_chooser_new(NULL, icon_choose_cb, box); gtk_widget_show_all(filesel); return FALSE; } @@ -957,7 +963,7 @@ icon_box_enter_cb(GtkWidget *widget, GdkEventCrossing *event, GtkGaimStatusBox *box) { gdk_window_set_cursor(widget->window, box->hand_cursor); - gtk_image_set_from_pixbuf(box->icon, box->buddy_icon_hover); + gtk_image_set_from_pixbuf(GTK_IMAGE(box->icon), box->buddy_icon_hover); return FALSE; } @@ -965,7 +971,7 @@ icon_box_leave_cb(GtkWidget *widget, GdkEventCrossing *event, GtkGaimStatusBox *box) { gdk_window_set_cursor(widget->window, box->arrow_cursor); - gtk_image_set_from_pixbuf(box->icon, box->buddy_icon) ; + gtk_image_set_from_pixbuf(GTK_IMAGE(box->icon), box->buddy_icon) ; return FALSE; } @@ -1172,15 +1178,15 @@ icon_alc.width = icon_alc.height; icon_alc.x = allocation->width - icon_alc.width; icon_alc.y += 3; - + if (status_box->icon_size != icon_alc.height) { - scaled = gdk_pixbuf_new_from_file_at_scale(status_box->buddy_icon_path, + scaled = gdk_pixbuf_new_from_file_at_scale(status_box->buddy_icon_path, icon_alc.height, icon_alc.width, FALSE, NULL); status_box->buddy_icon_hover = gdk_pixbuf_copy(scaled); do_colorshift(status_box->buddy_icon_hover, status_box->buddy_icon_hover, 30); g_object_unref(status_box->buddy_icon); status_box->buddy_icon = scaled; - gtk_image_set_from_pixbuf(status_box->icon, status_box->buddy_icon); + gtk_image_set_from_pixbuf(GTK_IMAGE(status_box->icon), status_box->buddy_icon); status_box->icon_size = icon_alc.height; } gtk_widget_size_allocate((GTK_GAIM_STATUS_BOX(widget))->icon_box, &icon_alc); @@ -1329,14 +1335,14 @@ g_free(box->buddy_icon_path); box->buddy_icon_path = g_strdup(filename); - scaled = gdk_pixbuf_new_from_file_at_scale(filename, + scaled = gdk_pixbuf_new_from_file_at_scale(filename, box->icon_size, box->icon_size, FALSE, NULL); box->buddy_icon_hover = gdk_pixbuf_copy(scaled); do_colorshift(box->buddy_icon_hover, box->buddy_icon_hover, 30); g_object_unref(box->buddy_icon); box->buddy_icon = scaled; - gtk_image_set_from_pixbuf(box->icon, box->buddy_icon); - + gtk_image_set_from_pixbuf(GTK_IMAGE(box->icon), box->buddy_icon); + gaim_prefs_set_string("/gaim/gtk/accounts/buddyicon", filename); }
--- a/src/gtkstatusbox.h Wed Aug 16 06:11:10 2006 +0000 +++ b/src/gtkstatusbox.h Wed Aug 16 06:31:59 2006 +0000 @@ -85,14 +85,14 @@ GtkWidget *imhtml; char *buddy_icon_path; - GdkPixbuf *buddy_icon; - GdkPixbuf *buddy_icon_hover; + GdkPixbuf *buddy_icon; + GdkPixbuf *buddy_icon_hover; GtkWidget *buddy_icon_sel; - GtkWidget *icon; + GtkWidget *icon; GtkWidget *icon_box; GdkCursor *hand_cursor; GdkCursor *arrow_cursor; - int icon_size; + int icon_size; gboolean imhtml_visible; @@ -128,16 +128,16 @@ struct _GtkGaimStatusBoxClass { - GtkComboBoxClass parent_class; + GtkComboBoxClass parent_class; - /* signals */ - void (* changed) (GtkComboBox *combo_box); + /* signals */ + void (* changed) (GtkComboBox *combo_box); - /* Padding for future expansion */ - void (*_gtk_reserved0) (void); - void (*_gtk_reserved1) (void); - void (*_gtk_reserved2) (void); - void (*_gtk_reserved3) (void); + /* Padding for future expansion */ + void (*_gtk_reserved0) (void); + void (*_gtk_reserved1) (void); + void (*_gtk_reserved2) (void); + void (*_gtk_reserved3) (void); };
--- a/src/gtkutils.c Wed Aug 16 06:11:10 2006 +0000 +++ b/src/gtkutils.c Wed Aug 16 06:31:59 2006 +0000 @@ -2358,14 +2358,13 @@ } -GtkWidget *gaim_gtk_buddy_icon_chooser_new(GtkWindow *parent, void(*callback)(const char*,gpointer), gpointer data) { +GtkWidget *gaim_gtk_buddy_icon_chooser_new(GtkWindow *parent, void(*callback)(const char *, gpointer), gpointer data) { struct _icon_chooser *dialog = g_new0(struct _icon_chooser, 1); #if !GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */ GtkWidget *hbox; GtkWidget *tv; GtkTreeSelection *sel; - #endif /* FILECHOOSER */ const char *current_folder; @@ -2457,15 +2456,13 @@ char* gaim_gtk_convert_buddy_icon(GaimPlugin *plugin, const char *path) { - g_return_val_if_fail(GAIM_PLUGIN_PROTOCOL_INFO(plugin)->icon_spec.format != NULL, NULL); - #if GTK_CHECK_VERSION(2,2,0) int width, height; char **pixbuf_formats = NULL; GdkPixbufFormat *format; GdkPixbuf *pixbuf; - GaimPluginProtocolInfo *prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(plugin); - char **prpl_formats = g_strsplit (prpl_info->icon_spec.format,",",0); + GaimPluginProtocolInfo *prpl_info; + char **prpl_formats; #if !GTK_CHECK_VERSION(2,4,0) GdkPixbufLoader *loader; FILE *file; @@ -2473,9 +2470,18 @@ void *data = NULL; #endif #endif - const char *dirname = gaim_buddy_icons_get_cache_dir(); - char *random = g_strdup_printf("%x", g_random_int()); - char *filename = g_build_filename(dirname, random, NULL); + const char *dirname; + char *random; + char *filename; + + prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(plugin); + + g_return_val_if_fail(prpl_info->icon_spec.format != NULL, NULL); + + prpl_formats = g_strsplit(prpl_info->icon_spec.format,",",0); + dirname = gaim_buddy_icons_get_cache_dir(); + random = g_strdup_printf("%x", g_random_int()); + filename = g_build_filename(dirname, random, NULL); if (!g_file_test(dirname, G_FILE_TEST_IS_DIR)) { gaim_debug_info("buddyicon", "Creating icon cache directory.\n");