# HG changeset patch # User Yoshiki Yazawa # Date 1216972423 -32400 # Node ID 07cedffb1c6375f3523e157bd9cfa588a82fed5f # Parent 588da540685ad809b9e06dc3058f7f9c31d2bda3 implemented UI for configuring icon update. diff -r 588da540685a -r 07cedffb1c63 pidgin-twitter.c --- a/pidgin-twitter.c Fri Jul 25 07:05:04 2008 +0900 +++ b/pidgin-twitter.c Fri Jul 25 16:53:43 2008 +0900 @@ -1809,7 +1809,7 @@ size = purple_prefs_get_int(OPT_ICON_SIZE); if(size == 0) - size = 48; /* twitter icon size */ + size = DEFAULT_ICON_SIZE; dest = gdk_pixbuf_scale_simple(src, size, size, GDK_INTERP_HYPER); gdk_pixbuf_unref (src); @@ -2562,6 +2562,9 @@ gchar *filename; GtkWidget *window, *notebook, *e; const gchar *text; + GtkSpinButton *spin; + GtkObject *adjust; + gint value; builder = gtk_builder_new(); @@ -2587,11 +2590,13 @@ gtk_container_remove(GTK_CONTAINER(window), notebook); - g_signal_connect(notebook, "destroy", - G_CALLBACK(gtk_widget_destroyed), ¬ebook); +// g_signal_connect(notebook, "destroy", +// G_CALLBACK(gtk_widget_destroyed), ¬ebook); + /* connect to signals */ + /* account page */ e = GTK_WIDGET(gtk_builder_get_object (builder, "account_twitter")); g_object_set_data(G_OBJECT(e), "pref", OPT_SCREEN_NAME_TWITTER); @@ -2658,8 +2663,11 @@ g_signal_connect(e, "toggled", G_CALLBACK(bool_toggled_cb), &e); - /* utility page */ - e = GTK_WIDGET(gtk_builder_get_object (builder, "utility_show_icon")); + + + + /* icon page */ + e = GTK_WIDGET(gtk_builder_get_object (builder, "icon_show_icon")); g_object_set_data(G_OBJECT(e), "pref", OPT_SHOW_ICON); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), purple_prefs_get_bool(OPT_SHOW_ICON)); @@ -2667,15 +2675,15 @@ G_CALLBACK(bool_toggled_cb), &e); /* setup spin */ - e = GTK_WIDGET(gtk_builder_get_object (builder, "utility_icon_size_spin")); + e = GTK_WIDGET(gtk_builder_get_object (builder, "icon_icon_size_spin")); g_object_set_data(G_OBJECT(e), "pref", OPT_ICON_SIZE); - GtkSpinButton *spin = GTK_SPIN_BUTTON(e); - - int value = purple_prefs_get_int(OPT_ICON_SIZE); + spin = GTK_SPIN_BUTTON(e); + + value = purple_prefs_get_int(OPT_ICON_SIZE); twitter_debug("spin value = %d\n", value); - GtkObject *adjust = gtk_adjustment_new(value, 16, 128, 4, 1, 1); + adjust = gtk_adjustment_new(value, 16, 128, 4, 1, 1); gtk_spin_button_set_adjustment(spin, GTK_ADJUSTMENT(adjust)); gtk_widget_set_size_request(GTK_WIDGET(spin), 50, -1); @@ -2689,37 +2697,58 @@ purple_prefs_connect_callback(plugin, OPT_ICON_SIZE, icon_size_prefs_cb, NULL); - - - e = GTK_WIDGET(gtk_builder_get_object (builder, "utility_counter")); - g_object_set_data(G_OBJECT(e), "pref", OPT_COUNTER); + /* enable update */ + e = GTK_WIDGET(gtk_builder_get_object (builder, "icon_enable_update")); + g_object_set_data(G_OBJECT(e), "pref", OPT_UPDATE_ICON); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), - purple_prefs_get_bool(OPT_COUNTER)); + purple_prefs_get_bool(OPT_UPDATE_ICON)); g_signal_connect(e, "toggled", G_CALLBACK(bool_toggled_cb), &e); - purple_prefs_connect_callback(plugin, OPT_COUNTER, /* xxx */ - counter_prefs_cb, NULL); - - e = GTK_WIDGET(gtk_builder_get_object (builder, "utility_pseudo")); - g_object_set_data(G_OBJECT(e), "pref", OPT_ESCAPE_PSEUDO); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), - purple_prefs_get_bool(OPT_ESCAPE_PSEUDO)); - g_signal_connect(e, "toggled", - G_CALLBACK(bool_toggled_cb), &e); - - e = GTK_WIDGET(gtk_builder_get_object (builder, "utility_oops")); - g_object_set_data(G_OBJECT(e), "pref", OPT_SUPPRESS_OOPS); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), - purple_prefs_get_bool(OPT_SUPPRESS_OOPS)); - g_signal_connect(e, "toggled", - G_CALLBACK(bool_toggled_cb), &e); - - e = GTK_WIDGET(gtk_builder_get_object (builder, "utility_notify")); - g_object_set_data(G_OBJECT(e), "pref", OPT_PREVENT_NOTIFICATION); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), - purple_prefs_get_bool(OPT_PREVENT_NOTIFICATION)); - g_signal_connect(e, "toggled", - G_CALLBACK(bool_toggled_cb), &e); + + /* setup count spin */ + e = GTK_WIDGET(gtk_builder_get_object (builder, "icon_max_count_spin")); + g_object_set_data(G_OBJECT(e), "pref", OPT_ICON_MAX_COUNT); + + spin = GTK_SPIN_BUTTON(e); + + value = purple_prefs_get_int(OPT_ICON_MAX_COUNT); + twitter_debug("spin value = %d\n", value); + + adjust = gtk_adjustment_new(value, 2, 10000, 1, 10, 10); + gtk_spin_button_set_adjustment(spin, GTK_ADJUSTMENT(adjust)); + gtk_widget_set_size_request(GTK_WIDGET(spin), 50, -1); + + if(value == 0) { + value = DEFAULT_ICON_MAX_COUNT; + purple_prefs_set_int(OPT_ICON_MAX_COUNT, value); + } + gtk_spin_button_set_value(GTK_SPIN_BUTTON(e), (gdouble)value); + g_signal_connect(e, "value-changed", + G_CALLBACK(spin_changed_cb), &e); + + + /* setup days spin */ + e = GTK_WIDGET(gtk_builder_get_object (builder, "icon_max_days_spin")); + g_object_set_data(G_OBJECT(e), "pref", OPT_ICON_MAX_DAYS); + + spin = GTK_SPIN_BUTTON(e); + + value = purple_prefs_get_int(OPT_ICON_MAX_DAYS); + twitter_debug("spin value = %d\n", value); + + adjust = gtk_adjustment_new(value, 1, 180, 1, 10, 10); + gtk_spin_button_set_adjustment(spin, GTK_ADJUSTMENT(adjust)); + gtk_widget_set_size_request(GTK_WIDGET(spin), 50, -1); + + if(value == 0) { + value = DEFAULT_ICON_MAX_DAYS; + purple_prefs_set_int(OPT_ICON_MAX_DAYS, value); + } + gtk_spin_button_set_value(GTK_SPIN_BUTTON(e), (gdouble)value); + g_signal_connect(e, "value-changed", + G_CALLBACK(spin_changed_cb), &e); + + /* sound page */ @@ -2770,6 +2799,43 @@ G_CALLBACK(combo_changed_cb), &e); + + + + /* utility page */ + e = GTK_WIDGET(gtk_builder_get_object (builder, "utility_counter")); + g_object_set_data(G_OBJECT(e), "pref", OPT_COUNTER); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), + purple_prefs_get_bool(OPT_COUNTER)); + g_signal_connect(e, "toggled", + G_CALLBACK(bool_toggled_cb), &e); + purple_prefs_connect_callback(plugin, OPT_COUNTER, /* xxx */ + counter_prefs_cb, NULL); + + e = GTK_WIDGET(gtk_builder_get_object (builder, "utility_pseudo")); + g_object_set_data(G_OBJECT(e), "pref", OPT_ESCAPE_PSEUDO); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), + purple_prefs_get_bool(OPT_ESCAPE_PSEUDO)); + g_signal_connect(e, "toggled", + G_CALLBACK(bool_toggled_cb), &e); + + e = GTK_WIDGET(gtk_builder_get_object (builder, "utility_oops")); + g_object_set_data(G_OBJECT(e), "pref", OPT_SUPPRESS_OOPS); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), + purple_prefs_get_bool(OPT_SUPPRESS_OOPS)); + g_signal_connect(e, "toggled", + G_CALLBACK(bool_toggled_cb), &e); + + e = GTK_WIDGET(gtk_builder_get_object (builder, "utility_notify")); + g_object_set_data(G_OBJECT(e), "pref", OPT_PREVENT_NOTIFICATION); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), + purple_prefs_get_bool(OPT_PREVENT_NOTIFICATION)); + g_signal_connect(e, "toggled", + G_CALLBACK(bool_toggled_cb), &e); + + + + gtk_widget_show_all(notebook); return notebook; } @@ -2836,20 +2902,19 @@ purple_prefs_add_bool(OPT_COUNTER, TRUE); purple_prefs_add_bool(OPT_SUPPRESS_OOPS, TRUE); purple_prefs_add_bool(OPT_PREVENT_NOTIFICATION, FALSE); - purple_prefs_add_bool(OPT_SHOW_ICON, TRUE); purple_prefs_add_bool(OPT_API_BASE_POST, FALSE); + purple_prefs_add_int(OPT_API_BASE_GET_INTERVAL, TWITTER_DEFAULT_INTERVAL); purple_prefs_add_string(OPT_SCREEN_NAME_TWITTER, EMPTY); purple_prefs_add_string(OPT_PASSWORD_TWITTER, EMPTY); - - purple_prefs_add_int(OPT_ICON_SIZE, DEFAULT_ICON_SIZE); purple_prefs_add_string(OPT_SCREEN_NAME_WASSR, EMPTY); purple_prefs_add_string(OPT_SCREEN_NAME_IDENTICA, EMPTY); - purple_prefs_add_int(OPT_API_BASE_GET_INTERVAL, TWITTER_DEFAULT_INTERVAL); - + + purple_prefs_add_bool(OPT_SHOW_ICON, TRUE); + purple_prefs_add_int(OPT_ICON_SIZE, DEFAULT_ICON_SIZE); + purple_prefs_add_bool(OPT_UPDATE_ICON, TRUE); purple_prefs_add_int(OPT_ICON_MAX_COUNT, DEFAULT_ICON_MAX_COUNT); purple_prefs_add_int(OPT_ICON_MAX_DAYS, DEFAULT_ICON_MAX_DAYS); - } PURPLE_INIT_PLUGIN(pidgin_twitter, init_plugin, info) diff -r 588da540685a -r 07cedffb1c63 pidgin-twitter.h --- a/pidgin-twitter.h Fri Jul 25 07:05:04 2008 +0900 +++ b/pidgin-twitter.h Fri Jul 25 16:53:43 2008 +0900 @@ -112,6 +112,7 @@ #define OPT_PASSWORD_TWITTER OPT_PIDGINTWITTER "/password_twitter" #define OPT_SHOW_ICON OPT_PIDGINTWITTER "/show_icon" #define OPT_ICON_SIZE OPT_PIDGINTWITTER "/icon_size" +#define OPT_UPDATE_ICON OPT_PIDGINTWITTER "/update_icon" #define OPT_ICON_MAX_COUNT OPT_PIDGINTWITTER "/icon_max_count" #define OPT_ICON_MAX_DAYS OPT_PIDGINTWITTER "/icon_max_days" #define OPT_API_BASE_GET_INTERVAL OPT_PIDGINTWITTER "/api_base_get_interval" diff -r 588da540685a -r 07cedffb1c63 prefs.ui --- a/prefs.ui Fri Jul 25 07:05:04 2008 +0900 +++ b/prefs.ui Fri Jul 25 16:53:43 2008 +0900 @@ -218,6 +218,7 @@ True True Get/post statuses via API + 0 True @@ -273,7 +274,8 @@ True - Account + <b>Account</b> + True False @@ -311,6 +313,7 @@ True True Translate @username to link + 0 True @@ -331,6 +334,7 @@ True True Translate sender name to link + 0 True @@ -351,6 +355,7 @@ True True Translate #channel name to link (wassr only) + 0 True @@ -369,7 +374,8 @@ True - Translation + <b>Translation</b> + True 1 @@ -377,16 +383,16 @@ - + True - + True - 4 - 4 + 8 + 8 4 - + True 0 <b>Icon</b> @@ -394,35 +400,40 @@ + + False + - + True 20 - + True True Show icon in conversation + 0 True + False 1 - + True - + True - 20 + 40 - + True - Icon size in pixel + Icon size @@ -432,11 +443,174 @@ - + + True + 4 + + + True + True + 1 + True + True + + + + + False + False + GTK_PACK_END + 2 + + + + True 20 - + + True + pixel + + + + + False + False + GTK_PACK_END + 1 + + + + + False + 2 + + + + + True + 12 + 8 + 4 + + + True + 0 + <b>Icon Update</b> + True + + + + + False + 3 + + + + + True + 20 + + + True + True + Enable icon update + 0 + True + + + + + False + 4 + + + + + + + True + + + + + + + True + 40 + + + True + Update every + + + + + False + False + 0 + + + + + + + + + + True + 30 + 4 + + + True + True + 1 + True + True + + + + + False + False + 1 + + + + + + + + + True + 4 + 4 + + + True + times or + + + + + False + False + GTK_PACK_END + 2 + + + + + + + + + True + 4 + + True True 1 @@ -452,130 +626,52 @@ 1 - - - 2 - - - - - True - 8 - 4 - 4 + + + + - + True - 0 - <b>Counter</b> - True + 4 + 20 + + + True + days + + + + False + False + GTK_PACK_END + 0 + - - - 3 - - - - - True - 20 - - - True - True - Show text counter widget - True - - + + + + - 4 - - - - - True - 8 - 4 - 4 - - - True - 0 - <b>Misc</b> - True - - - - + False 5 - - - True - 20 - - - True - True - Escape pseudo command in twitter - True - - - - - 6 - - - - - True - 20 - - - True - True - Suppress oops message - True - - - - - 7 - - - - - True - 10 - 20 - - - True - True - Do not notify incoming message - True - - - - - 8 - - 2 - + True - Utility + <b>Icon</b> + True - 2 + 4 False @@ -607,6 +703,7 @@ True True Play sound on a reply to a recipient in the list + 0 True @@ -738,6 +835,7 @@ True True Play sound if the sender of the message is in the list + 0 True @@ -851,13 +949,141 @@ True - Sound + <b>Sound</b> + True 3 False + + + True + + + True + 8 + 4 + 4 + + + True + 0 + <b>Counter</b> + True + + + + + + + True + 20 + + + True + True + Show text counter widget + 0 + True + + + + + 1 + + + + + True + 8 + 4 + 4 + + + True + 0 + <b>Misc</b> + True + + + + + 2 + + + + + True + 20 + + + True + True + Escape pseudo command in twitter + 0 + True + + + + + 3 + + + + + True + 20 + + + True + True + Suppress oops message + 0 + True + + + + + 4 + + + + + True + 10 + 20 + + + True + True + Do not notify incoming message + 0 + True + + + + + 5 + + + + + 4 + + + + + True + <b>Utility</b> + True + + + 4 + False + +