From: <sea...@us...> - 2006-09-13 18:02:14
|
Revision: 17266 http://svn.sourceforge.net/gaim/?rev=17266&view=rev Author: seanegan Date: 2006-09-13 11:02:08 -0700 (Wed, 13 Sep 2006) Log Message: ----------- There's a horizontal separator between the imhtml and the imhtml toolbar. Before we weren't hiding he separator if we hid the toolbar which resulted in a stray horizontal line. This kills that. Modified Paths: -------------- trunk/gtk/gtkutils.c Modified: trunk/gtk/gtkutils.c =================================================================== --- trunk/gtk/gtkutils.c 2006-09-12 23:56:25 UTC (rev 17265) +++ trunk/gtk/gtkutils.c 2006-09-13 18:02:08 UTC (rev 17266) @@ -124,6 +124,8 @@ sep = gtk_hseparator_new(); gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); + g_signal_connect_swapped(G_OBJECT(toolbar), "show", G_CALLBACK(gtk_widget_show), sep); + g_signal_connect_swapped(G_OBJECT(toolbar), "hide", G_CALLBACK(gtk_widget_hide), sep); gtk_widget_show(sep); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nos...@us...> - 2006-09-29 20:49:37
|
Revision: 17401 http://svn.sourceforge.net/gaim/?rev=17401&view=rev Author: nosnilmot Date: 2006-09-29 13:49:33 -0700 (Fri, 29 Sep 2006) Log Message: ----------- unleak Modified Paths: -------------- trunk/gtk/gtkutils.c Modified: trunk/gtk/gtkutils.c =================================================================== --- trunk/gtk/gtkutils.c 2006-09-29 20:48:45 UTC (rev 17400) +++ trunk/gtk/gtkutils.c 2006-09-29 20:49:33 UTC (rev 17401) @@ -2561,12 +2561,14 @@ g_free(random); g_free(filename); + g_free(contents); #if GTK_CHECK_VERSION(2,2,0) && !GTK_CHECK_VERSION(2,4,0) g_object_unref(G_OBJECT(pixbuf)); #endif return NULL; } fclose(image); + g_free(contents); #if GTK_CHECK_VERSION(2,2,0) && !GTK_CHECK_VERSION(2,4,0) g_object_unref(G_OBJECT(pixbuf)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nos...@us...> - 2006-09-30 02:48:35
|
Revision: 17404 http://svn.sourceforge.net/gaim/?rev=17404&view=rev Author: nosnilmot Date: 2006-09-29 19:48:29 -0700 (Fri, 29 Sep 2006) Log Message: ----------- Make things "go" with gtk 2.0. hopefully all those still using 2.0 dont't really care all that much for graphics and stuff as they're probably quite old now. Modified Paths: -------------- trunk/gtk/gtkutils.c Modified: trunk/gtk/gtkutils.c =================================================================== --- trunk/gtk/gtkutils.c 2006-09-30 02:44:03 UTC (rev 17403) +++ trunk/gtk/gtkutils.c 2006-09-30 02:48:29 UTC (rev 17404) @@ -2458,13 +2458,13 @@ char * gaim_gtk_convert_buddy_icon(GaimPlugin *plugin, const char *path) { + GaimPluginProtocolInfo *prpl_info; + char **prpl_formats; #if GTK_CHECK_VERSION(2,2,0) int width, height; char **pixbuf_formats = NULL; GdkPixbufFormat *format; GdkPixbuf *pixbuf; - GaimPluginProtocolInfo *prpl_info; - char **prpl_formats; #if !GTK_CHECK_VERSION(2,4,0) GdkPixbufLoader *loader; FILE *file; @@ -2694,7 +2694,12 @@ height = info->height; } +#if GTK_CHECK_VERSION(2,2,0) /* 2.0 users are going to have very strangely sized things */ gdk_pixbuf_loader_set_size (loader, width, height); +#else +#warning nosnilmot could not be bothered to fix this properly for you +#warning ... good luck ... your images may end up strange sizes +#endif } GdkPixbuf * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-12-13 08:44:13
|
Revision: 17981 http://svn.sourceforge.net/gaim/?rev=17981&view=rev Author: thekingant Date: 2006-12-13 00:44:10 -0800 (Wed, 13 Dec 2006) Log Message: ----------- Fix a memleak when using gtk 2.0 and ~/.gaim/icons/ doesn't exist and it can't be created for whatever reason. Extremely minor. Modified Paths: -------------- trunk/gtk/gtkutils.c Modified: trunk/gtk/gtkutils.c =================================================================== --- trunk/gtk/gtkutils.c 2006-12-13 02:11:14 UTC (rev 17980) +++ trunk/gtk/gtkutils.c 2006-12-13 08:44:10 UTC (rev 17981) @@ -2492,9 +2492,7 @@ gaim_debug_error("buddyicon", "Unable to create directory %s: %s\n", dirname, strerror(errno)); -#if GTK_CHECK_VERSION(2,2,0) g_strfreev(prpl_formats); -#endif g_free(random); g_free(filename); return NULL; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-12-17 19:17:42
|
Revision: 18017 http://svn.sourceforge.net/gaim/?rev=18017&view=rev Author: thekingant Date: 2006-12-17 11:17:36 -0800 (Sun, 17 Dec 2006) Log Message: ----------- Print an error and don't set the icon if the file is too big Modified Paths: -------------- trunk/gtk/gtkutils.c Modified: trunk/gtk/gtkutils.c =================================================================== --- trunk/gtk/gtkutils.c 2006-12-17 13:07:25 UTC (rev 18016) +++ trunk/gtk/gtkutils.c 2006-12-17 19:17:36 UTC (rev 18017) @@ -2455,13 +2455,12 @@ } #endif -/* TODO: Use icon_spec.filesize */ char * gaim_gtk_convert_buddy_icon(GaimPlugin *plugin, const char *path) { GaimPluginProtocolInfo *prpl_info; +#if GTK_CHECK_VERSION(2,2,0) char **prpl_formats; -#if GTK_CHECK_VERSION(2,2,0) int width, height; char **pixbuf_formats = NULL; GdkPixbufFormat *format; @@ -2475,16 +2474,13 @@ const char *dirname; char *random; char *filename; + struct stat st; 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"); @@ -2492,16 +2488,16 @@ gaim_debug_error("buddyicon", "Unable to create directory %s: %s\n", dirname, strerror(errno)); - g_strfreev(prpl_formats); - g_free(random); - g_free(filename); return NULL; } } + random = g_strdup_printf("%x", g_random_int()); + filename = g_build_filename(dirname, random, NULL); + #if GTK_CHECK_VERSION(2,2,0) #if GTK_CHECK_VERSION(2,4,0) - format = gdk_pixbuf_get_file_info (path, &width, &height); + format = gdk_pixbuf_get_file_info(path, &width, &height); #else loader = gdk_pixbuf_loader_new(); if (g_file_get_contents(path, &contents, &length, NULL)) { @@ -2517,8 +2513,9 @@ #endif if (format == NULL) return NULL; - pixbuf_formats = gdk_pixbuf_format_get_extensions(format); + pixbuf_formats = gdk_pixbuf_format_get_extensions(format); + prpl_formats = g_strsplit(prpl_info->icon_spec.format,",",0); if (str_array_match(pixbuf_formats, prpl_formats) && /* This is an acceptable format AND */ (!(prpl_info->icon_spec.scale_rules & GAIM_ICON_SCALE_SEND) || /* The prpl doesn't scale before it sends OR */ (prpl_info->icon_spec.min_width <= width && @@ -2568,9 +2565,6 @@ #if GTK_CHECK_VERSION(2,2,0) && !GTK_CHECK_VERSION(2,4,0) g_object_unref(G_OBJECT(pixbuf)); #endif - - g_free(filename); - return random; } #if GTK_CHECK_VERSION(2,2,0) else @@ -2578,9 +2572,19 @@ int i; GError *error = NULL; GdkPixbuf *scale; + g_strfreev(pixbuf_formats); + pixbuf = gdk_pixbuf_new_from_file(path, &error); - g_strfreev(pixbuf_formats); - if (!error && (prpl_info->icon_spec.scale_rules & GAIM_ICON_SCALE_SEND) && + if (error) { + gaim_debug_error("buddyicon", "Could not open icon for conversion: %s\n", error->message); + g_error_free(error); + g_free(random); + g_free(filename); + g_strfreev(prpl_formats); + return NULL; + } + + if ((prpl_info->icon_spec.scale_rules & GAIM_ICON_SCALE_SEND) && (width < prpl_info->icon_spec.min_width || width > prpl_info->icon_spec.max_width || height < prpl_info->icon_spec.min_height || @@ -2591,42 +2595,79 @@ gaim_buddy_icon_get_scale_size(&prpl_info->icon_spec, &new_width, &new_height); - scale = gdk_pixbuf_scale_simple (pixbuf, new_width, new_height, + scale = gdk_pixbuf_scale_simple(pixbuf, new_width, new_height, GDK_INTERP_HYPER); g_object_unref(G_OBJECT(pixbuf)); pixbuf = scale; } - if (error) { - g_free(random); - g_free(filename); - gaim_debug_error("buddyicon", "Could not open icon for conversion: %s\n", error->message); - g_error_free(error); - g_strfreev(prpl_formats); - return NULL; - } for (i = 0; prpl_formats[i]; i++) { gaim_debug_info("buddyicon", "Converting buddy icon to %s as %s\n", prpl_formats[i], filename); - if (gdk_pixbuf_save(pixbuf, filename, prpl_formats[i], &error, NULL)) + if (strcmp(prpl_formats[i], "png") == 0) { + if (gdk_pixbuf_save(pixbuf, filename, prpl_formats[i], + &error, "compression", "9", NULL)) /* Success! */ break; + } else if (gdk_pixbuf_save(pixbuf, filename, prpl_formats[i], + &error, NULL)) { + /* Success! */ + break; + } gaim_debug_warning("buddyicon", "Could not convert to %s: %s\n", prpl_formats[i], error->message); g_error_free(error); error = NULL; } g_strfreev(prpl_formats); - if (!error) { - g_object_unref(G_OBJECT(pixbuf)); - g_free(filename); - return random; - } else { + g_object_unref(G_OBJECT(pixbuf)); + if (error) { gaim_debug_error("buddyicon", "Could not convert icon to usable format: %s\n", error->message); g_error_free(error); + g_free(random); + g_free(filename); + return NULL; } + } + + if (g_stat(filename, &st) != 0) { + gaim_debug_error("buddyicon", + "Could not stat '%s', which we just wrote to disk: %s\n", + filename, strerror(errno)); g_free(random); g_free(filename); - g_object_unref(G_OBJECT(pixbuf)); + return NULL; } + + /* Check the file size */ + /* + * TODO: If the file is too big, it would be cool if we checked if + * the prpl supported jpeg, and then we could convert to that + * and use a lower quality setting. + */ + if (st.st_size > prpl_info->icon_spec.max_filesize) + { + gchar *tmp; + tmp = g_strdup_printf(_("The file '%s' is too large for %s. Please try a smaller image.\n"), + path, plugin->info->name); + gaim_notify_error(NULL, _("Icon Error"), + _("Could not set icon"), tmp); + gaim_debug_info("buddyicon", + "'%s' was converted to an image which is %" G_GSIZE_FORMAT + " bytes, but the maximum icon size for %s is %" G_GSIZE_FORMAT + " bytes\n", path, st.st_size, plugin->info->name, + prpl_info->icon_spec.max_filesize); + g_free(tmp); + g_free(random); + g_free(filename); + return NULL; + } + + g_free(filename); + return random; +#else + /* + * The chosen icon wasn't the right size, and we're using + * GTK+ 2.0 so we can't scale it. + */ return NULL; #endif } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-12-20 09:35:28
|
Revision: 18030 http://svn.sourceforge.net/gaim/?rev=18030&view=rev Author: thekingant Date: 2006-12-20 01:35:24 -0800 (Wed, 20 Dec 2006) Log Message: ----------- Fix a rather large oversight on my part: I wasn't allowing people to set icons at all for protocols that didn't have a max icon file size. Modified Paths: -------------- trunk/gtk/gtkutils.c Modified: trunk/gtk/gtkutils.c =================================================================== --- trunk/gtk/gtkutils.c 2006-12-20 09:31:11 UTC (rev 18029) +++ trunk/gtk/gtkutils.c 2006-12-20 09:35:24 UTC (rev 18030) @@ -2646,7 +2646,8 @@ * the prpl supported jpeg, and then we could convert to that * and use a lower quality setting. */ - if (st.st_size > prpl_info->icon_spec.max_filesize) + if ((prpl_info->icon_spec.max_filesize != 0) && + (st.st_size > prpl_info->icon_spec.max_filesize)) { gchar *tmp; tmp = g_strdup_printf(_("The file '%s' is too large for %s. Please try a smaller image.\n"), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2007-03-06 07:22:23
|
Revision: 18198 http://svn.sourceforge.net/gaim/?rev=18198&view=rev Author: thekingant Date: 2007-03-05 23:22:23 -0800 (Mon, 05 Mar 2007) Log Message: ----------- Don't save pngs using compression in older versions of gdk_pixbuf which don't support it. This change is from Sean. Modified Paths: -------------- trunk/gtk/gtkutils.c Modified: trunk/gtk/gtkutils.c =================================================================== --- trunk/gtk/gtkutils.c 2007-03-03 19:25:26 UTC (rev 18197) +++ trunk/gtk/gtkutils.c 2007-03-06 07:22:23 UTC (rev 18198) @@ -2606,7 +2606,11 @@ for (i = 0; prpl_formats[i]; i++) { gaim_debug_info("buddyicon", "Converting buddy icon to %s as %s\n", prpl_formats[i], filename); - if (strcmp(prpl_formats[i], "png") == 0) { + /* The "compression" param wasn't supported until gdk-pixbuf 2.8. + * Using it in previous versions causes the save to fail (and an assert message). */ + if ((gdk_pixbuf_major_version > 2 || (gdk_pixbuf_major_version == 2 + && gdk_pixbuf_minor_version >= 8)) + && strcmp(prpl_formats[i], "png") == 0) { if (gdk_pixbuf_save(pixbuf, filename, prpl_formats[i], &error, "compression", "9", NULL)) /* Success! */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |