Mercurial > pidgin-twitter
changeset 285:15b8e403c7e1
merged a difference.
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Mon, 12 Jan 2009 01:09:30 +0900 |
parents | 2d559555875f (diff) 5036603faa7a (current diff) |
children | 6d0bb66fedc7 |
files | |
diffstat | 5 files changed, 194 insertions(+), 102 deletions(-) [+] |
line wrap: on
line diff
--- a/main.c Wed Dec 24 16:25:57 2008 +0900 +++ b/main.c Mon Jan 12 01:09:30 2009 +0900 @@ -1308,6 +1308,7 @@ purple_prefs_add_bool(OPT_API_BASE_POST, TRUE); purple_prefs_add_int(OPT_API_BASE_GET_INTERVAL, TWITTER_DEFAULT_INTERVAL); + purple_prefs_add_int(OPT_RETRIEVE_COUNT, TWITTER_DEFAULT_RETRIEVE_COUNT); 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);
--- a/pidgin-twitter.h Wed Dec 24 16:25:57 2008 +0900 +++ b/pidgin-twitter.h Mon Jan 12 01:09:30 2009 +0900 @@ -141,6 +141,7 @@ #define OPT_FILTER_IDENTICA OPT_PIDGINTWITTER "/filter_identica" #define OPT_FILTER_JISKO OPT_PIDGINTWITTER "/filter_jisko" #define OPT_STRIP_EXCESS_LF OPT_PIDGINTWITTER "/strip_excess_lf" +#define OPT_RETRIEVE_COUNT OPT_PIDGINTWITTER "/retrieve_count" #ifdef _WIN32 #define OPT_PIDGIN_BLINK_IM PIDGIN_PREFS_ROOT "/win32/blink_im" @@ -180,7 +181,7 @@ /* twitter API specific macros */ #define TWITTER_BASE_URL "http://twitter.com" -#define TWITTER_STATUS_GET "GET /statuses/friends_timeline.xml HTTP/1.1\r\n" \ +#define TWITTER_STATUS_GET "GET /statuses/friends_timeline.xml?count=%d HTTP/1.1\r\n" \ "Host: twitter.com\r\n" \ "User-Agent: pidgin-twitter\r\n" \ "Authorization: Basic %s\r\n" @@ -192,6 +193,7 @@ #define TWITTER_STATUS_FORMAT "status=%s&source=pidgintwitter" #define TWITTER_DEFAULT_INTERVAL (60) #define TWITTER_DEFAULT_ICON_URL "http://static.twitter.com/images/default_profile_bigger.png" +#define TWITTER_DEFAULT_RETRIEVE_COUNT (20) /* wassr specific macros */ #define WASSR_POST_LEN (255)
--- a/prefs.c Wed Dec 24 16:25:57 2008 +0900 +++ b/prefs.c Mon Jan 12 01:09:30 2009 +0900 @@ -236,6 +236,28 @@ interval_prefs_cb, NULL); + /* count spin */ + e = GTK_WIDGET(gtk_builder_get_object (builder, + "account_api_get_count_spin")); + g_object_set_data(G_OBJECT(e), "pref", OPT_RETRIEVE_COUNT); + + spin = GTK_SPIN_BUTTON(e); + + value = purple_prefs_get_int(OPT_RETRIEVE_COUNT); + twitter_debug("spin value = %d\n", value); + + adjust = gtk_adjustment_new(value, 20, 200, 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_RETRIEVE_COUNT; + purple_prefs_set_int(OPT_RETRIEVE_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); + /********************/ /* translation page */
--- a/prefs.ui Wed Dec 24 16:25:57 2008 +0900 +++ b/prefs.ui Mon Jan 12 01:09:30 2009 +0900 @@ -1,7 +1,10 @@ <?xml version="1.0"?> <interface> + <requires lib="gtk+" version="2.14"/> + <!-- interface-naming-policy toplevel-contextual --> <object class="GtkListStore" id="model1"> <columns> + <!-- column-name gchararray --> <column type="gchararray"/> </columns> <data> @@ -64,6 +67,9 @@ </object> </child> </object> + <packing> + <property name="position">0</property> + </packing> </child> <child> <object class="GtkHBox" id="hbox1"> @@ -81,6 +87,9 @@ </object> </child> </object> + <packing> + <property name="position">0</property> + </packing> </child> <child> <object class="GtkAlignment" id="alignment3"> @@ -121,6 +130,9 @@ </object> </child> </object> + <packing> + <property name="position">0</property> + </packing> </child> <child> <object class="GtkAlignment" id="alignment5"> @@ -162,6 +174,9 @@ </object> </child> </object> + <packing> + <property name="position">0</property> + </packing> </child> <child> <object class="GtkAlignment" id="alignment7"> @@ -203,6 +218,9 @@ </object> </child> </object> + <packing> + <property name="position">0</property> + </packing> </child> <child> <object class="GtkAlignment" id="alignment44"> @@ -255,9 +273,10 @@ <property name="left_padding">20</property> <child> <object class="GtkCheckButton" id="account_api"> + <property name="label" translatable="yes">Get/post statuses via API</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Get/post statuses via API</property> + <property name="receives_default">False</property> <property name="draw_indicator">True</property> </object> </child> @@ -301,7 +320,7 @@ </object> <packing> <property name="expand">False</property> - <property name="pack_type">GTK_PACK_END</property> + <property name="pack_type">end</property> <property name="position">1</property> </packing> </child> @@ -316,8 +335,6 @@ <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"> @@ -329,13 +346,13 @@ <packing> <property name="expand">False</property> <property name="fill">False</property> + <property name="position">0</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"> @@ -350,26 +367,25 @@ <packing> <property name="expand">False</property> <property name="fill">False</property> - <property name="pack_type">GTK_PACK_END</property> + <property name="pack_type">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> + <property name="label" translatable="yes">secs </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="pack_type">end</property> <property name="position">1</property> </packing> </child> @@ -379,6 +395,76 @@ <property name="position">8</property> </packing> </child> + <child> + <object class="GtkHBox" id="hbox15"> + <property name="visible">True</property> + <child> + <object class="GtkAlignment" id="alignment69"> + <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="label39"> + <property name="visible">True</property> + <property name="label" translatable="yes">Number of messages to retrieve</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkAlignment" id="alignment70"> + <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_count_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">end</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkAlignment" id="alignment71"> + <property name="visible">True</property> + <property name="bottom_padding">10</property> + <property name="right_padding">8</property> + <child> + <object class="GtkLabel" id="label40"> + <property name="visible">True</property> + <property name="label" translatable="yes">msgs</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="pack_type">end</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="position">9</property> + </packing> + </child> </object> </child> <child type="tab"> @@ -411,6 +497,7 @@ </object> <packing> <property name="expand">False</property> + <property name="position">0</property> </packing> </child> <child> @@ -420,9 +507,10 @@ <property name="left_padding">20</property> <child> <object class="GtkCheckButton" id="translation_recipient"> + <property name="label" translatable="yes">Translate @username to link</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Translate @username to link</property> + <property name="receives_default">False</property> <property name="draw_indicator">True</property> </object> </child> @@ -440,9 +528,10 @@ <property name="left_padding">20</property> <child> <object class="GtkCheckButton" id="translation_sender"> + <property name="label" translatable="yes">Translate sender name to link</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Translate sender name to link</property> + <property name="receives_default">False</property> <property name="draw_indicator">True</property> </object> </child> @@ -460,9 +549,10 @@ <property name="left_padding">20</property> <child> <object class="GtkCheckButton" id="translation_channel"> + <property name="label" translatable="yes">Translate #channel/tag to link</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Translate #channel/tag to link</property> + <property name="receives_default">False</property> <property name="draw_indicator">True</property> </object> </child> @@ -511,6 +601,7 @@ <packing> <property name="expand">False</property> <property name="fill">False</property> + <property name="position">0</property> </packing> </child> <child> @@ -520,9 +611,10 @@ <property name="left_padding">20</property> <child> <object class="GtkCheckButton" id="filter_filter_check"> + <property name="label" translatable="yes">Apply filter</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Apply filter</property> + <property name="receives_default">False</property> <property name="draw_indicator">True</property> </object> </child> @@ -541,9 +633,10 @@ <property name="left_padding">20</property> <child> <object class="GtkCheckButton" id="filter_exclude_reply_check"> + <property name="label" translatable="yes">Exclude reply to me</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Exclude reply to me</property> + <property name="receives_default">False</property> <property name="draw_indicator">True</property> </object> </child> @@ -593,6 +686,9 @@ </object> </child> </object> + <packing> + <property name="position">0</property> + </packing> </child> <child> <object class="GtkAlignment" id="alignment55"> @@ -636,6 +732,9 @@ </object> </child> </object> + <packing> + <property name="position">0</property> + </packing> </child> <child> <object class="GtkAlignment" id="alignment57"> @@ -680,6 +779,9 @@ </object> </child> </object> + <packing> + <property name="position">0</property> + </packing> </child> <child> <object class="GtkAlignment" id="alignment59"> @@ -724,6 +826,9 @@ </object> </child> </object> + <packing> + <property name="position">0</property> + </packing> </child> <child> <object class="GtkAlignment" id="alignment68"> @@ -789,6 +894,7 @@ </object> <packing> <property name="expand">False</property> + <property name="position">0</property> </packing> </child> <child> @@ -797,9 +903,10 @@ <property name="left_padding">20</property> <child> <object class="GtkCheckButton" id="icon_show_icon"> + <property name="label" translatable="yes">Show icons in conversations</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Show icons in conversations</property> + <property name="receives_default">False</property> <property name="draw_indicator">True</property> </object> </child> @@ -814,30 +921,6 @@ <property name="visible">True</property> <property name="n_columns">4</property> <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> <object class="GtkAlignment" id="alignment40"> <property name="visible">True</property> <property name="left_padding">40</property> @@ -951,9 +1034,10 @@ <property name="left_padding">20</property> <child> <object class="GtkCheckButton" id="icon_enable_update"> + <property name="label" translatable="yes">Enable icon update</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Enable icon update</property> + <property name="receives_default">False</property> <property name="draw_indicator">True</property> </object> </child> @@ -968,42 +1052,6 @@ <property name="visible">True</property> <property name="n_columns">6</property> <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> <object class="GtkAlignment" id="alignment52"> <property name="visible">True</property> <property name="right_padding">20</property> @@ -1150,6 +1198,9 @@ </object> </child> </object> + <packing> + <property name="position">0</property> + </packing> </child> <child> <object class="GtkAlignment" id="alignment27"> @@ -1157,9 +1208,10 @@ <property name="left_padding">20</property> <child> <object class="GtkCheckButton" id="sound_recip_check"> + <property name="label" translatable="yes">Play sound on a reply to a specified recipient</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Play sound on a reply to a specified recipient</property> + <property name="receives_default">False</property> <property name="draw_indicator">True</property> </object> </child> @@ -1186,6 +1238,7 @@ <packing> <property name="expand">False</property> <property name="fill">False</property> + <property name="position">0</property> </packing> </child> <child> @@ -1203,7 +1256,7 @@ <packing> <property name="expand">False</property> <property name="fill">False</property> - <property name="pack_type">GTK_PACK_END</property> + <property name="pack_type">end</property> <property name="position">1</property> </packing> </child> @@ -1230,6 +1283,7 @@ <packing> <property name="expand">False</property> <property name="fill">False</property> + <property name="position">0</property> </packing> </child> <child> @@ -1241,20 +1295,18 @@ <child> <object class="GtkComboBox" id="sound_recip_combo"> <property name="visible">True</property> - <property name="add_tearoffs">False</property> - <property name="focus_on_click">True</property> <property name="model">model1</property> <child> <object class="GtkCellRendererText" id="renderer1"/> - <attributes> - <attribute name="text">0</attribute> - </attributes> + <attributes> + <attribute name="text">0</attribute> + </attributes> </child> </object> </child> </object> <packing> - <property name="pack_type">GTK_PACK_END</property> + <property name="pack_type">end</property> <property name="position">1</property> </packing> </child> @@ -1288,9 +1340,10 @@ <property name="left_padding">20</property> <child> <object class="GtkCheckButton" id="sound_send_check"> + <property name="label" translatable="yes">Play sound on a message from a specified sender</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Play sound on a message from a specified sender</property> + <property name="receives_default">False</property> <property name="draw_indicator">True</property> </object> </child> @@ -1317,6 +1370,7 @@ <packing> <property name="expand">False</property> <property name="fill">False</property> + <property name="position">0</property> </packing> </child> <child> @@ -1334,7 +1388,7 @@ <packing> <property name="expand">False</property> <property name="fill">False</property> - <property name="pack_type">GTK_PACK_END</property> + <property name="pack_type">end</property> <property name="position">1</property> </packing> </child> @@ -1362,6 +1416,7 @@ <packing> <property name="expand">False</property> <property name="fill">False</property> + <property name="position">0</property> </packing> </child> <child> @@ -1374,20 +1429,18 @@ <child> <object class="GtkComboBox" id="sound_send_combo"> <property name="visible">True</property> - <property name="add_tearoffs">False</property> - <property name="focus_on_click">True</property> <property name="model">model1</property> <child> - <object class="GtkCellRendererText" id="renderer1"/> - <attributes> - <attribute name="text">0</attribute> - </attributes> + <object class="GtkCellRendererText" id="renderer2"/> + <attributes> + <attribute name="text">0</attribute> + </attributes> </child> </object> </child> </object> <packing> - <property name="pack_type">GTK_PACK_END</property> + <property name="pack_type">end</property> <property name="position">1</property> </packing> </child> @@ -1430,6 +1483,9 @@ </object> </child> </object> + <packing> + <property name="position">0</property> + </packing> </child> <child> <object class="GtkAlignment" id="alignment23"> @@ -1437,9 +1493,10 @@ <property name="left_padding">20</property> <child> <object class="GtkCheckButton" id="utility_counter"> + <property name="label" translatable="yes">Show text counter</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Show text counter</property> + <property name="receives_default">False</property> <property name="draw_indicator">True</property> </object> </child> @@ -1473,9 +1530,10 @@ <property name="left_padding">20</property> <child> <object class="GtkCheckButton" id="utility_pseudo"> + <property name="label" translatable="yes">Escape pseudo command for twitter</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Escape pseudo command for twitter</property> + <property name="receives_default">False</property> <property name="draw_indicator">True</property> </object> </child> @@ -1490,9 +1548,10 @@ <property name="left_padding">20</property> <child> <object class="GtkCheckButton" id="utility_oops"> + <property name="label" translatable="yes">Suppress oops messages</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Suppress oops messages</property> + <property name="receives_default">False</property> <property name="draw_indicator">True</property> </object> </child> @@ -1507,9 +1566,10 @@ <property name="left_padding">20</property> <child> <object class="GtkCheckButton" id="utility_strip_excess_lf"> + <property name="label" translatable="yes">Strip excessive newline characters</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Strip excessive newline characters</property> + <property name="receives_default">False</property> <property name="draw_indicator">True</property> </object> </child> @@ -1524,9 +1584,10 @@ <property name="left_padding">20</property> <child> <object class="GtkCheckButton" id="utility_notify"> + <property name="label" translatable="yes">Do not notify incoming messages (windows only)</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Do not notify incoming messages (windows only)</property> + <property name="receives_default">False</property> <property name="draw_indicator">True</property> </object> </child> @@ -1561,9 +1622,10 @@ <property name="left_padding">20</property> <child> <object class="GtkCheckButton" id="utility_log_output"> + <property name="label" translatable="yes">Enable log output</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Enable log output</property> + <property name="receives_default">False</property> <property name="draw_indicator">True</property> </object> </child>
--- a/twitter_api.c Wed Dec 24 16:25:57 2008 +0900 +++ b/twitter_api.c Mon Jan 12 01:09:30 2009 +0900 @@ -290,11 +290,15 @@ gboolean get_status_with_api(gpointer data) { + twitter_debug("called\n"); + /* fetch friends time line */ char *request, *header; char *basic_auth, *basic_auth_encoded; + gint count = purple_prefs_get_int(OPT_RETRIEVE_COUNT); - twitter_debug("called\n"); + if(count < TWITTER_DEFAULT_RETRIEVE_COUNT) + count = TWITTER_DEFAULT_RETRIEVE_COUNT; /* if disabled, just return */ if(!purple_prefs_get_bool(OPT_API_BASE_POST)) @@ -317,7 +321,8 @@ g_free(basic_auth); /* header */ - header = g_strdup_printf(TWITTER_STATUS_GET, basic_auth_encoded); + + header = g_strdup_printf(TWITTER_STATUS_GET, count, basic_auth_encoded); request = g_strconcat(header, "\r\n", NULL); /* invoke fetch */