Mercurial > pidgin-twitter
changeset 176:7affa10c1f0e multiaccounts
removed some global preferences that was replaced preferences per conversation
author | mikanbako <maoutwo@gmail.com> |
---|---|
date | Sat, 02 Aug 2008 22:09:41 +0900 |
parents | c4a8afde91c0 |
children | 0339b4abe290 |
files | pidgin-twitter.c pidgin-twitter.h prefs.ui |
diffstat | 3 files changed, 4 insertions(+), 416 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin-twitter.c Sat Aug 02 12:15:05 2008 +0900 +++ b/pidgin-twitter.c Sat Aug 02 22:09:41 2008 +0900 @@ -2435,14 +2435,6 @@ } } -static void -api_base_post_cb(const char *name, PurplePrefType type, gconstpointer value, - gpointer data) -{ - signed_on_cb(NULL); - get_status_with_api((gpointer)(source.conv)); -} - static gboolean load_plugin(PurplePlugin *plugin) { @@ -2631,21 +2623,6 @@ } static void -interval_prefs_cb(const char *name, PurplePrefType type, - gconstpointer val, gpointer data) -{ - /* remove idle func */ - g_source_remove_by_user_data((gpointer)(source.conv)); - - /* add idle func */ - if(purple_prefs_get_bool(OPT_API_BASE_POST)) { - source.id = g_timeout_add_seconds( - purple_prefs_get_int(OPT_API_BASE_GET_INTERVAL), - get_status_with_api, (gpointer)(source.conv)); - } -} - -static void text_changed_cb(gpointer *data) { const gchar *text; @@ -2735,78 +2712,6 @@ /* 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); - text = purple_prefs_get_string(OPT_SCREEN_NAME_TWITTER); - gtk_entry_set_text(GTK_ENTRY(e), text); - g_signal_connect(e, "changed", - G_CALLBACK(text_changed_cb), &e); - - e = GTK_WIDGET(gtk_builder_get_object (builder, "account_wassr")); - g_object_set_data(G_OBJECT(e), "pref", OPT_SCREEN_NAME_WASSR); - text = purple_prefs_get_string(OPT_SCREEN_NAME_WASSR); - gtk_entry_set_text(GTK_ENTRY(e), text); - g_signal_connect(e, "changed", - G_CALLBACK(text_changed_cb), &e); - - e = GTK_WIDGET(gtk_builder_get_object (builder, "account_identica")); - g_object_set_data(G_OBJECT(e), "pref", OPT_SCREEN_NAME_IDENTICA); - text = purple_prefs_get_string(OPT_SCREEN_NAME_IDENTICA); - gtk_entry_set_text(GTK_ENTRY(e), text); - g_signal_connect(e, "changed", - G_CALLBACK(text_changed_cb), &e); - - e = GTK_WIDGET(gtk_builder_get_object (builder, "account_api")); - g_object_set_data(G_OBJECT(e), "pref", OPT_API_BASE_POST); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e), - purple_prefs_get_bool(OPT_API_BASE_POST)); - g_signal_connect(e, "toggled", - G_CALLBACK(bool_toggled_cb), &e); - purple_prefs_connect_callback(plugin, OPT_API_BASE_POST, /* xxx divide? */ - api_base_post_cb, NULL); - - e = GTK_WIDGET(gtk_builder_get_object (builder, "account_api_password")); - g_object_set_data(G_OBJECT(e), "pref", OPT_PASSWORD_TWITTER); - - gtk_entry_set_visibility(GTK_ENTRY(e), FALSE); - if (gtk_entry_get_invisible_char(GTK_ENTRY(e)) == '*') - gtk_entry_set_invisible_char(GTK_ENTRY(e), PIDGIN_INVISIBLE_CHAR); - - text = purple_prefs_get_string(OPT_PASSWORD_TWITTER); - gtk_entry_set_text(GTK_ENTRY(e), text); - g_signal_connect(e, "changed", - G_CALLBACK(text_changed_cb), &e); - - - /* interval spin */ - e = GTK_WIDGET(gtk_builder_get_object (builder, - "account_api_get_interval_spin")); - g_object_set_data(G_OBJECT(e), "pref", OPT_API_BASE_GET_INTERVAL); - - spin = GTK_SPIN_BUTTON(e); - - value = purple_prefs_get_int(OPT_API_BASE_GET_INTERVAL); - twitter_debug("spin value = %d\n", value); - - adjust = gtk_adjustment_new(value, 40, 3600, 10, 100, 100); - gtk_spin_button_set_adjustment(spin, GTK_ADJUSTMENT(adjust)); - gtk_widget_set_size_request(GTK_WIDGET(spin), 50, -1); - - if(value == 0) { - value = TWITTER_DEFAULT_INTERVAL; - purple_prefs_set_int(OPT_API_BASE_GET_INTERVAL, value); - } - gtk_spin_button_set_value(GTK_SPIN_BUTTON(e), (gdouble)value); - g_signal_connect(e, "value-changed", - G_CALLBACK(spin_changed_cb), &e); - purple_prefs_connect_callback(plugin, OPT_API_BASE_GET_INTERVAL, - interval_prefs_cb, NULL); - - - /********************/ /* translation page */ /********************/ @@ -3311,7 +3216,7 @@ g_source_remove_by_user_data((gpointer)(source.conv)); /* add idle func */ - if(purple_prefs_get_bool(OPT_API_BASE_POST)) { + if(service_account_get_bool(account, conv_name, OPT_API_BASE_POST, FALSE)) { source.id = g_timeout_add_seconds( service_account_get_int(account, conv_name, @@ -3508,13 +3413,6 @@ purple_prefs_add_bool(OPT_SUPPRESS_OOPS, TRUE); purple_prefs_add_bool(OPT_PREVENT_NOTIFICATION, FALSE); - 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_string(OPT_SCREEN_NAME_WASSR, EMPTY); - purple_prefs_add_string(OPT_SCREEN_NAME_IDENTICA, EMPTY); - 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);
--- a/pidgin-twitter.h Sat Aug 02 12:15:05 2008 +0900 +++ b/pidgin-twitter.h Sat Aug 02 22:09:41 2008 +0900 @@ -105,22 +105,18 @@ #define OPT_SUPPRESS_OOPS OPT_PIDGINTWITTER "/suppress_oops" #define OPT_PREVENT_NOTIFICATION OPT_PIDGINTWITTER "/prevent_notification" #define OPT_ICON_DIR OPT_PIDGINTWITTER "/icon_dir" -#define OPT_API_BASE_POST OPT_PIDGINTWITTER "/api_base_post" -#define OPT_SCREEN_NAME_TWITTER OPT_PIDGINTWITTER "/screen_name_twitter" -#define OPT_SCREEN_NAME_WASSR OPT_PIDGINTWITTER "/screen_name_wassr" -#define OPT_SCREEN_NAME_IDENTICA OPT_PIDGINTWITTER "/screen_name_identica" -#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" #define OPT_LOG_OUTPUT OPT_PIDGINTWITTER "/log_output" -/* options depend on service account */ +/* options depend on a conversation */ #define OPT_SCREEN_NAME OPT_PIDGINTWITTER "/screen_name" +#define OPT_API_BASE_POST OPT_PIDGINTWITTER "/api_base_post" #define OPT_API_BASE_PASSWORD OPT_PIDGINTWITTER "/api_base_password" +#define OPT_API_BASE_GET_INTERVAL OPT_PIDGINTWITTER "/api_base_get_interval" /* conversation's name */ #define CONV_NAME_TWITTER "twitter@twitter.com"
--- a/prefs.ui Sat Aug 02 12:15:05 2008 +0900 +++ b/prefs.ui Sat Aug 02 22:09:41 2008 +0900 @@ -46,312 +46,6 @@ <property name="visible">True</property> <property name="can_focus">True</property> <child> - <object class="GtkVBox" id="vbox2"> - <property name="visible">True</property> - <child> - <object class="GtkAlignment" id="alignment1"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="top_padding">4</property> - <property name="bottom_padding">4</property> - <property name="left_padding">4</property> - <child> - <object class="GtkLabel" id="label10"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes"><b>Screen Name</b></property> - <property name="use_markup">True</property> - </object> - </child> - </object> - </child> - <child> - <object class="GtkHBox" id="hbox1"> - <property name="visible">True</property> - <child> - <object class="GtkAlignment" id="alignment2"> - <property name="visible">True</property> - <property name="left_padding">20</property> - <child> - <object class="GtkLabel" id="label5"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">twitter</property> - <property name="max_width_chars">10</property> - </object> - </child> - </object> - </child> - <child> - <object class="GtkAlignment" id="alignment3"> - <property name="visible">True</property> - <property name="xalign">1</property> - <property name="right_padding">4</property> - <child> - <object class="GtkEntry" id="account_twitter"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="width_chars">20</property> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkHBox" id="hbox2"> - <property name="visible">True</property> - <child> - <object class="GtkAlignment" id="alignment4"> - <property name="visible">True</property> - <property name="left_padding">20</property> - <child> - <object class="GtkLabel" id="label6"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">wassr</property> - </object> - </child> - </object> - </child> - <child> - <object class="GtkAlignment" id="alignment5"> - <property name="visible">True</property> - <property name="xalign">1</property> - <property name="right_padding">4</property> - <child> - <object class="GtkEntry" id="account_wassr"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="width_chars">20</property> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkHBox" id="hbox3"> - <property name="visible">True</property> - <child> - <object class="GtkAlignment" id="alignment6"> - <property name="visible">True</property> - <property name="left_padding">20</property> - <child> - <object class="GtkLabel" id="label7"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">identi.ca</property> - <property name="max_width_chars">10</property> - </object> - </child> - </object> - </child> - <child> - <object class="GtkAlignment" id="alignment7"> - <property name="visible">True</property> - <property name="xalign">1</property> - <property name="right_padding">4</property> - <child> - <object class="GtkEntry" id="account_identica"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="width_chars">20</property> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="position">3</property> - </packing> - </child> - <child> - <object class="GtkAlignment" id="alignment8"> - <property name="visible">True</property> - <property name="top_padding">8</property> - <property name="bottom_padding">4</property> - <property name="left_padding">4</property> - <child> - <object class="GtkLabel" id="label11"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes"><b>API Based Twitter Access</b></property> - <property name="use_markup">True</property> - <property name="width_chars">40</property> - </object> - </child> - </object> - <packing> - <property name="position">4</property> - </packing> - </child> - <child> - <object class="GtkAlignment" id="alignment9"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="left_padding">20</property> - <child> - <object class="GtkCheckButton" id="account_api"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Get/post statuses via API</property> - <property name="response_id">0</property> - <property name="draw_indicator">True</property> - </object> - </child> - </object> - <packing> - <property name="position">5</property> - </packing> - </child> - <child> - <object class="GtkHBox" id="hbox4"> - <property name="visible">True</property> - <child> - <object class="GtkAlignment" id="alignment10"> - <property name="visible">True</property> - <property name="left_padding">40</property> - <child> - <object class="GtkLabel" id="label9"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Password</property> - <property name="max_width_chars">10</property> - </object> - </child> - </object> - <packing> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkAlignment" id="alignment11"> - <property name="visible">True</property> - <property name="xalign">1</property> - <property name="right_padding">4</property> - <child> - <object class="GtkEntry" id="account_api_password"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="width_chars">20</property> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="pack_type">GTK_PACK_END</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="position">6</property> - </packing> - </child> - <child> - <object class="GtkHBox" id="hbox5"> - <property name="visible">True</property> - <child> - <object class="GtkAlignment" id="alignment46"> - <property name="visible">True</property> - <property name="top_padding">2</property> - <property name="bottom_padding">10</property> - <property name="left_padding">40</property> - <child> - <object class="GtkLabel" id="label28"> - <property name="visible">True</property> - <property name="label" translatable="yes">Retrieve interval</property> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - <child> - <object class="GtkAlignment" id="alignment47"> - <property name="visible">True</property> - <property name="top_padding">2</property> - <property name="bottom_padding">10</property> - <property name="right_padding">4</property> - <child> - <object class="GtkSpinButton" id="account_api_get_interval_spin"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="climb_rate">1</property> - <property name="snap_to_ticks">True</property> - <property name="numeric">True</property> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="pack_type">GTK_PACK_END</property> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkAlignment" id="alignment48"> - <property name="visible">True</property> - <property name="bottom_padding">10</property> - <property name="right_padding">8</property> - <child> - <object class="GtkLabel" id="label29"> - <property name="visible">True</property> - <property name="label" translatable="yes">sec</property> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="pack_type">GTK_PACK_END</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="position">7</property> - </packing> - </child> - </object> - </child> - <child type="tab"> - <object class="GtkLabel" id="label1"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Account</b></property> - <property name="use_markup">True</property> - </object> - <packing> - <property name="tab_fill">False</property> - </packing> - </child> - <child> <object class="GtkVBox" id="vbox3"> <property name="visible">True</property> <child>