From: <the...@us...> - 2006-08-16 06:32:08
|
Revision: 16783 Author: thekingant Date: 2006-08-15 23:31:59 -0700 (Tue, 15 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16783&view=rev Log Message: ----------- Whitespace and warning fixes: gtkaccount.c: In function ?\226?\128?\152icon_select_cb?\226?\128?\153: gtkaccount.c:289: warning: passing argument 1 of ?\226?\128?\152gaim_gtk_buddy_icon_chooser_new?\226?\128?\153 from incompatible pointer type gtkaccount.c:289: warning: passing argument 2 of ?\226?\128?\152gaim_gtk_buddy_icon_chooser_new?\226?\128?\153 from incompatible pointer type gtkstatusbox.c: In function ?\226?\128?\152icon_box_press_cb?\226?\128?\153: gtkstatusbox.c:951: warning: passing argument 2 of ?\226?\128?\152gaim_gtk_buddy_icon_chooser_new?\226?\128?\153 from incompatible pointer type gtkstatusbox.c:951: warning: ISO C90 forbids mixed declarations and code gtkstatusbox.c: In function ?\226?\128?\152icon_box_enter_cb?\226?\128?\153: gtkstatusbox.c:960: warning: passing argument 1 of ?\226?\128?\152gtk_image_set_from_pixbuf?\226?\128?\153 from incompatible pointer type gtkstatusbox.c: In function ?\226?\128?\152icon_box_leave_cb?\226?\128?\153: gtkstatusbox.c:968: warning: passing argument 1 of ?\226?\128?\152gtk_image_set_from_pixbuf?\226?\128?\153 from incompatible pointer type gtkstatusbox.c: In function ?\226?\128?\152gtk_gaim_status_box_size_allocate?\226?\128?\153: gtkstatusbox.c:1183: warning: passing argument 1 of ?\226?\128?\152gtk_image_set_from_pixbuf?\226?\128?\153 from incompatible pointer type gtkstatusbox.c: In function ?\226?\128?\152gtk_gaim_status_box_set_buddy_icon?\226?\128?\153: gtkstatusbox.c:1338: warning: passing argument 1 of ?\226?\128?\152gtk_image_set_from_pixbuf?\226?\128?\153 from incompatible pointer type gtkutils.c: In function ?\226?\128?\152gaim_gtk_convert_buddy_icon?\226?\128?\153: gtkutils.c:2463: warning: ISO C90 forbids mixed declarations and code Modified Paths: -------------- trunk/src/gtkaccount.c trunk/src/gtkstatusbox.c trunk/src/gtkstatusbox.h trunk/src/gtkutils.c Modified: trunk/src/gtkaccount.c =================================================================== --- trunk/src/gtkaccount.c 2006-08-16 06:11:10 UTC (rev 16782) +++ trunk/src/gtkaccount.c 2006-08-16 06:31:59 UTC (rev 16783) @@ -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); } Modified: trunk/src/gtkstatusbox.c =================================================================== --- trunk/src/gtkstatusbox.c 2006-08-16 06:11:10 UTC (rev 16782) +++ trunk/src/gtkstatusbox.c 2006-08-16 06:31:59 UTC (rev 16783) @@ -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); } Modified: trunk/src/gtkstatusbox.h =================================================================== --- trunk/src/gtkstatusbox.h 2006-08-16 06:11:10 UTC (rev 16782) +++ trunk/src/gtkstatusbox.h 2006-08-16 06:31:59 UTC (rev 16783) @@ -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); }; Modified: trunk/src/gtkutils.c =================================================================== --- trunk/src/gtkutils.c 2006-08-16 06:11:10 UTC (rev 16782) +++ trunk/src/gtkutils.c 2006-08-16 06:31:59 UTC (rev 16783) @@ -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,10 +2470,19 @@ 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"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |