changeset 168:56e3873e58a8

made log output configurable.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Wed, 30 Jul 2008 15:25:10 +0900
parents 10516b7b05a9
children 9e3d1d731176
files pidgin-twitter.c pidgin-twitter.h prefs.ui
diffstat 3 files changed, 52 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin-twitter.c	Tue Jul 29 19:20:20 2008 +0900
+++ b/pidgin-twitter.c	Wed Jul 30 15:25:10 2008 +0900
@@ -2891,6 +2891,13 @@
     g_signal_connect(e, "toggled",
                      G_CALLBACK(bool_toggled_cb), &e);
 
+    e = GTK_WIDGET(gtk_builder_get_object (builder, "utility_log_output"));
+    g_object_set_data(G_OBJECT(e), "pref", OPT_LOG_OUTPUT);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e),
+                                 purple_prefs_get_bool(OPT_LOG_OUTPUT));
+    g_signal_connect(e, "toggled",
+                     G_CALLBACK(bool_toggled_cb), &e);
+
 
     /* all done */
     gtk_widget_show_all(notebook);
@@ -2972,6 +2979,7 @@
     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_prefs_add_bool(OPT_LOG_OUTPUT, FALSE);
 }
 
 PURPLE_INIT_PLUGIN(pidgin_twitter, init_plugin, info)
--- a/pidgin-twitter.h	Tue Jul 29 19:20:20 2008 +0900
+++ b/pidgin-twitter.h	Wed Jul 30 15:25:10 2008 +0900
@@ -116,6 +116,7 @@
 #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"
 
 /* formats and templates */
 #define RECIPIENT_FORMAT_TWITTER "@<a href='http://twitter.com/%s'>%s</a>"
@@ -167,8 +168,8 @@
 #define DAYS_TO_SECONDS(d) ((d) * 86400)
 
 /* debug macros */
-#define twitter_debug(fmt, ...)	purple_debug(PURPLE_DEBUG_INFO, PLUGIN_NAME, "%s():%4d:  " fmt, __FUNCTION__, (int)__LINE__, ## __VA_ARGS__);
-#define twitter_error(fmt, ...)	purple_debug(PURPLE_DEBUG_ERROR, PLUGIN_NAME, "%s():%4d:  " fmt, __FUNCTION__, (int)__LINE__, ## __VA_ARGS__);
+#define twitter_debug(fmt, ...)	do { if(purple_prefs_get_bool(OPT_LOG_OUTPUT)) purple_debug(PURPLE_DEBUG_INFO, PLUGIN_NAME, "%s():%4d:  " fmt, __FUNCTION__, (int)__LINE__, ## __VA_ARGS__); } while(0);
+#define twitter_error(fmt, ...)	do { if(purple_prefs_get_bool(OPT_LOG_OUTPUT)) purple_debug(PURPLE_DEBUG_ERROR, PLUGIN_NAME, "%s():%4d:  " fmt, __FUNCTION__, (int)__LINE__, ## __VA_ARGS__); } while(0);
 
 /* prototypes */
 static void escape(gchar **str);
--- a/prefs.ui	Tue Jul 29 19:20:20 2008 +0900
+++ b/prefs.ui	Wed Jul 30 15:25:10 2008 +0900
@@ -262,6 +262,7 @@
                   <packing>
                     <property name="expand">False</property>
                     <property name="pack_type">GTK_PACK_END</property>
+                    <property name="position">1</property>
                   </packing>
                 </child>
               </object>
@@ -599,6 +600,27 @@
               <object class="GtkHBox" id="hbox11">
                 <property name="visible">True</property>
                 <child>
+                  <object class="GtkAlignment" id="alignment44">
+                    <property name="visible">True</property>
+                    <property name="xalign">1</property>
+                    <property name="left_padding">40</property>
+                    <child>
+                      <object class="GtkSpinButton" id="icon_max_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="position">1</property>
+                  </packing>
+                </child>
+                <child>
                   <object class="GtkAlignment" id="alignment43">
                     <property name="visible">True</property>
                     <property name="xalign">0</property>
@@ -613,37 +635,11 @@
                   <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="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>
-                        <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_START</property>
-                    <property name="position">1</property>
                   </packing>
                 </child>
                 <child>
                   <object class="GtkAlignment" id="alignment19">
                     <property name="visible">True</property>
-                    <property name="left_padding">0</property>
                     <property name="right_padding">4</property>
                     <child>
                       <object class="GtkLabel" id="label3">
@@ -696,7 +692,6 @@
                     <property name="expand">False</property>
                     <property name="fill">False</property>
                     <property name="pack_type">GTK_PACK_END</property>
-                    <property name="position">0</property>
                   </packing>
                 </child>
               </object>
@@ -1098,7 +1093,6 @@
             <child>
               <object class="GtkAlignment" id="alignment25">
                 <property name="visible">True</property>
-                <property name="bottom_padding">10</property>
                 <property name="left_padding">20</property>
                 <child>
                   <object class="GtkCheckButton" id="utility_notify">
@@ -1114,6 +1108,25 @@
                 <property name="position">5</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkAlignment" id="alignment49">
+                <property name="visible">True</property>
+                <property name="bottom_padding">10</property>
+                <property name="left_padding">20</property>
+                <child>
+                  <object class="GtkCheckButton" id="utility_log_output">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="label" translatable="yes">Output log messages</property>
+                    <property name="response_id">0</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="position">6</property>
+              </packing>
+            </child>
           </object>
           <packing>
             <property name="position">4</property>