changeset 155:0921655b4ae1

added UI for configuring retrieve interval.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Fri, 25 Jul 2008 21:23:18 +0900
parents d6ecbdee0afa
children e65f81211340
files pidgin-twitter.c prefs.ui
diffstat 2 files changed, 132 insertions(+), 52 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin-twitter.c	Fri Jul 25 18:39:19 2008 +0900
+++ b/pidgin-twitter.c	Fri Jul 25 21:23:18 2008 +0900
@@ -2581,14 +2581,19 @@
 
     gtk_container_remove(GTK_CONTAINER(window), notebook);
 
+    /* it may cause crash when dispose configure window --yaz */
+    /* xxx find the better way */
 //    g_signal_connect(notebook, "destroy",
 //                     G_CALLBACK(gtk_widget_destroyed), &notebook);
 
 
+    /***********************/
     /* 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);
@@ -2632,7 +2637,34 @@
     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);
+
+
+
+    /*********************/
     /* translation page */
+    /*********************/
     e = GTK_WIDGET(gtk_builder_get_object (builder, "translation_recipient"));
     g_object_set_data(G_OBJECT(e), "pref", OPT_TRANSLATE_RECIPIENT);
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e),
@@ -2656,8 +2688,9 @@
 
 
 
-
+    /**************/
     /* 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),
@@ -2665,7 +2698,7 @@
     g_signal_connect(e, "toggled",
                      G_CALLBACK(bool_toggled_cb), &e);
 
-    /* setup spin */
+    /* 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);
 
@@ -2674,7 +2707,7 @@
     value = purple_prefs_get_int(OPT_ICON_SIZE);
     twitter_debug("spin value = %d\n", value);
 
-	adjust = gtk_adjustment_new(value, 16, 128, 4, 1, 1);
+	adjust = gtk_adjustment_new(value, 16, 128, 4, 4, 4);
     gtk_spin_button_set_adjustment(spin, GTK_ADJUSTMENT(adjust));
     gtk_widget_set_size_request(GTK_WIDGET(spin), 50, -1);
 
@@ -2696,7 +2729,7 @@
     g_signal_connect(e, "toggled",
                      G_CALLBACK(bool_toggled_cb), &e);
 
-    /* setup count spin */
+    /* max 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);
 
@@ -2718,7 +2751,7 @@
                      G_CALLBACK(spin_changed_cb), &e);
 
 
-    /* setup days spin */
+    /* max 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);
 
@@ -2741,8 +2774,9 @@
 
 
 
-
+    /***************/
     /* sound page */
+    /***************/
     e = GTK_WIDGET(gtk_builder_get_object (builder, "sound_recip_check"));
     g_object_set_data(G_OBJECT(e), "pref", OPT_PLAYSOUND_RECIPIENT);
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e),
@@ -2757,7 +2791,7 @@
     g_signal_connect(e, "changed",
                      G_CALLBACK(text_changed_cb), &e);
 
-    /* setup combobox */
+    /* recipient combobox */
     e = GTK_WIDGET(gtk_builder_get_object (builder, "sound_recip_combo"));
     gtk_combo_box_set_active(GTK_COMBO_BOX(e),
                              purple_prefs_get_int(OPT_SOUNDID_RECIPIENT));
@@ -2781,7 +2815,7 @@
     g_signal_connect(e, "changed",
                      G_CALLBACK(text_changed_cb), &e);
 
-    /* setup combobox */
+    /* sender combobox */
     e = GTK_WIDGET(gtk_builder_get_object (builder, "sound_send_combo"));
     gtk_combo_box_set_active(GTK_COMBO_BOX(e),
                              purple_prefs_get_int(OPT_SOUNDID_RECIPIENT));
@@ -2792,8 +2826,9 @@
 
 
 
-
+    /****************/
     /* 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),
@@ -2825,8 +2860,7 @@
                      G_CALLBACK(bool_toggled_cb), &e);
 
 
-
-
+    /* all done */
     gtk_widget_show_all(notebook);
     return notebook;
 }
--- a/prefs.ui	Fri Jul 25 18:39:19 2008 +0900
+++ b/prefs.ui	Fri Jul 25 21:23:18 2008 +0900
@@ -158,7 +158,6 @@
                         <property name="visible">True</property>
                         <property name="xalign">0</property>
                         <property name="label" translatable="yes">identi.ca</property>
-                        <property name="justify">GTK_JUSTIFY_CENTER</property>
                         <property name="max_width_chars">10</property>
                       </object>
                     </child>
@@ -233,22 +232,24 @@
                 <child>
                   <object class="GtkAlignment" id="alignment10">
                     <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="bottom_padding">10</property>
-                    <property name="left_padding">20</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="bottom_padding">10</property>
+                    <property name="xalign">1</property>
                     <property name="right_padding">4</property>
                     <child>
                       <object class="GtkEntry" id="account_api_password">
@@ -260,13 +261,81 @@
                   </object>
                   <packing>
                     <property name="expand">False</property>
+                    <property name="pack_type">GTK_PACK_END</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="position">6</property>
+                <property name="expand">False</property>
+                <property name="position">7</property>
               </packing>
             </child>
           </object>
@@ -388,8 +457,8 @@
             <child>
               <object class="GtkAlignment" id="alignment12">
                 <property name="visible">True</property>
-                <property name="top_padding">8</property>
-                <property name="bottom_padding">8</property>
+                <property name="top_padding">12</property>
+                <property name="bottom_padding">4</property>
                 <property name="left_padding">4</property>
                 <child>
                   <object class="GtkLabel" id="label23">
@@ -526,18 +595,13 @@
                 <property name="position">4</property>
               </packing>
             </child>
-
-
             <child>
               <object class="GtkHBox" id="hbox11">
                 <property name="visible">True</property>
-
-
-
-
                 <child>
                   <object class="GtkAlignment" id="alignment43">
                     <property name="visible">True</property>
+                    <property name="xalign">0</property>
                     <property name="left_padding">40</property>
                     <child>
                       <object class="GtkLabel" id="label25">
@@ -549,19 +613,16 @@
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">False</property>
+                    <property name="pack_type">GTK_PACK_START</property>
                     <property name="position">0</property>
                   </packing>
                 </child>
-
-
-
-
-
                 <child>
                   <object class="GtkAlignment" id="alignment44">
                     <property name="visible">True</property>
-                    <property name="left_padding">30</property>
-                    <property name="right_padding">4</property>
+                    <property name="xalign">1</property>
+                    <property name="left_padding">40</property>
+                    <property name="right_padding">0</property>
                     <child>
                       <object class="GtkSpinButton" id="icon_max_count_spin">
                         <property name="visible">True</property>
@@ -575,22 +636,19 @@
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">False</property>
+                    <property name="pack_type">GTK_PACK_START</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
-
-
-
-
                 <child>
                   <object class="GtkAlignment" id="alignment19">
                     <property name="visible">True</property>
-                    <property name="left_padding">4</property>
+                    <property name="left_padding">0</property>
                     <property name="right_padding">4</property>
                     <child>
                       <object class="GtkLabel" id="label3">
                         <property name="visible">True</property>
-                        <property name="label" translatable="yes">times or</property>
+                        <property name="label" translatable="yes">times  or</property>
                       </object>
                     </child>
                   </object>
@@ -601,10 +659,6 @@
                     <property name="position">2</property>
                   </packing>
                 </child>
-
-
-
-
                 <child>
                   <object class="GtkAlignment" id="alignment16">
                     <property name="visible">True</property>
@@ -626,10 +680,6 @@
                     <property name="position">1</property>
                   </packing>
                 </child>
-
-
-
-
                 <child>
                   <object class="GtkAlignment" id="alignment18">
                     <property name="visible">True</property>
@@ -649,10 +699,6 @@
                     <property name="position">0</property>
                   </packing>
                 </child>
-
-
-
-
               </object>
               <packing>
                 <property name="expand">False</property>