*** gtktwitter.c.orig Thu Feb 12 15:34:19 2009 --- gtktwitter.c Sun May 2 22:03:47 2010 *************** *** 37,43 **** #define ACCEPT_LETTER_URL "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789;/?:@&=+$,-_.!~*'%" #define ACCEPT_LETTER_NAME "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_" #define ACCEPT_LETTER_REPLY "1234567890" ! #define RELOAD_TIMER_SPAN (60*1000) #define XML_CONTENT(x) (x->children ? (char*)x->children->content : NULL) --- 37,44 ---- #define ACCEPT_LETTER_URL "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789;/?:@&=+$,-_.!~*'%" #define ACCEPT_LETTER_NAME "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_" #define ACCEPT_LETTER_REPLY "1234567890" ! #define DEFAULT_TIMER_SPAN 60 ! #define DEFAULT_ICON_SIZE 48 #define XML_CONTENT(x) (x->children ? (char*)x->children->content : NULL) *************** *** 45,50 **** --- 46,52 ---- static GdkCursor* regular_cursor = NULL; static GdkCursor* watch_cursor = NULL; + static guint icon_size = DEFAULT_ICON_SIZE; typedef struct _PIXBUF_CACHE { char* id; GdkPixbuf* pixbuf; *************** *** 61,66 **** --- 63,69 ---- * timer register */ static guint timer_tag = 0; + static guint reload_timer_span = DEFAULT_TIMER_SPAN; static void start_reload_timer(GtkWidget* toplevel); static void stop_reload_timer(GtkWidget* toplevel); static void reset_reload_timer(GtkWidget* toplevel); *************** *** 385,390 **** --- 388,394 ---- */ static GdkPixbuf* url2pixbuf(const char* url, GError** error) { GdkPixbuf* pixbuf = NULL; + GdkPixbuf* iconbuf = NULL; GdkPixbufLoader* loader = NULL; GdkPixbufFormat* format = NULL; GError* _error = NULL; *************** *** 423,432 **** _error = g_error_new_literal(G_FILE_ERROR, res, curl_easy_strerror(res)); } /* cleanup callback data */ terminate_http_response(); if (error && _error) *error = _error; ! return pixbuf; } /** --- 427,442 ---- _error = g_error_new_literal(G_FILE_ERROR, res, curl_easy_strerror(res)); } + /* resize icon */ + if (pixbuf) { + iconbuf = icon_size ? gdk_pixbuf_scale_simple(pixbuf, icon_size, icon_size, GDK_INTERP_BILINEAR) : NULL; + g_object_unref(pixbuf); + } + /* cleanup callback data */ terminate_http_response(); if (error && _error) *error = _error; ! return iconbuf; } /** *************** *** 1437,1443 **** static void start_reload_timer(GtkWidget* toplevel) { stop_reload_timer(toplevel); ! timer_tag = g_timeout_add(RELOAD_TIMER_SPAN, (GSourceFunc)reload_timer, toplevel); } static void reset_reload_timer(GtkWidget* toplevel) { --- 1447,1453 ---- static void start_reload_timer(GtkWidget* toplevel) { stop_reload_timer(toplevel); ! timer_tag = reload_timer_span ? g_timeout_add(reload_timer_span * 1000, (GSourceFunc)reload_timer, toplevel) : 0; } static void reset_reload_timer(GtkWidget* toplevel) { *************** *** 1470,1475 **** --- 1480,1490 ---- g_object_set_data(G_OBJECT(window), "mail", g_strdup(line+5)); if (!strncmp(line, "pass=", 5)) g_object_set_data(G_OBJECT(window), "pass", g_strdup(line+5)); + if (!strncmp(line, "reload=", 7)) + reload_timer_span = atoi(line + 7); + + if (!strncmp(line, "iconsize=", 9)) + icon_size = atoi(line + 9); } fclose(fp); return 0; *************** *** 1491,1496 **** --- 1506,1513 ---- if (!fp) return -1; fprintf(fp, "mail=%s\n", mail ? mail : ""); fprintf(fp, "pass=%s\n", pass ? pass : ""); + fprintf(fp, "reload=%d\n", reload_timer_span); + fprintf(fp, "iconsize=%d\n", icon_size); fclose(fp); return 0; }