[evolution-rss] Bug 632111 - HTML font size display issue



commit 4a03da99bdf2fdae31982e1839846786fe69db11
Author: Lucian Langa <lucilanga gnome org>
Date:   Sun Dec 5 20:17:25 2010 +0200

    Bug 632111 - HTML font size display issue

 src/evolution-rss.schemas.in.in |   14 ++++
 src/rss-config-factory.c        |   86 ++++++++++++++++++++++---
 src/rss-html-rendering.ui       |  132 ++++++++++++++++++++++++++++++---------
 src/rss.c                       |   11 +++
 src/rss.h                       |    2 +
 5 files changed, 205 insertions(+), 40 deletions(-)
---
diff --git a/src/evolution-rss.schemas.in.in b/src/evolution-rss.schemas.in.in
index 16081fe..67ef725 100644
--- a/src/evolution-rss.schemas.in.in
+++ b/src/evolution-rss.schemas.in.in
@@ -74,6 +74,20 @@
     </schema>
 
     <schema>
+      <key>/schemas/apps/evolution/evolution-rss/min_font_size</key>
+      <applyto>/apps/evolution/evolution-rss/min_font_size</applyto>
+      <owner>evolution-rss</owner>
+      <type>float</type>
+      <default>12</default>
+      <locale name="C">
+        <short>Minimum font size</short>
+        <long>
+		The size of the font used in full text preview.
+        </long>
+      </locale>
+    </schema>
+    <schema>
+
       <key>/schemas/apps/evolution/evolution-rss/network_timeout</key>
       <applyto>/apps/evolution/evolution-rss/network_timeout</applyto>
       <owner>evolution-rss</owner>
diff --git a/src/rss-config-factory.c b/src/rss-config-factory.c
index 01326ee..8917ef1 100644
--- a/src/rss-config-factory.c
+++ b/src/rss-config-factory.c
@@ -94,6 +94,7 @@ extern SoupCookieJar *rss_soup_jar;
 typedef struct {
 	GtkBuilder  *xml;
 	GConfClient *gconf;
+	GtkWidget   *minfont;
 	GtkWidget   *combobox;
 	GtkWidget   *check;
 	GtkWidget   *nettimeout;
@@ -2968,11 +2969,11 @@ export_cb (GtkWidget *widget, gpointer data)
 
 
 static void
-network_timeout_cb (GtkWidget *widget, gpointer data)
+spin_update_cb (GtkWidget *widget, gchar *key)
 {
 	gconf_client_set_float (
 		rss_gconf,
-		GCONF_KEY_NETWORK_TIMEOUT,
+		key,
 		gtk_spin_button_get_value((GtkSpinButton*)widget),
 		NULL);
 }
@@ -2989,6 +2990,18 @@ destroy_ui_data (gpointer data)
 	g_free (ui);
 }
 
+void
+font_cb(GtkWidget *widget, GtkWidget *data)
+{
+	gboolean active = 1-gtk_toggle_button_get_active (
+				GTK_TOGGLE_BUTTON (widget));
+	/* Save the new setting to gconf */
+	gconf_client_set_bool (
+		rss_gconf,
+		GCONF_KEY_CUSTOM_FONT, active, NULL);
+	gtk_widget_set_sensitive(data, active);
+}
+
 GtkWidget *e_plugin_lib_get_configure_widget (EPlugin *epl);
 
 GtkWidget *
@@ -3008,6 +3021,7 @@ e_plugin_lib_get_configure_widget (EPlugin *epl)
 	GError* error = NULL;
 	gchar *toplevel[] = {(gchar *)"settingsbox", NULL};
 	GtkAdjustment *adjustment;
+	GtkWidget *widget1, *widget2;
 
 
 	uifile = g_build_filename (EVOLUTION_UIDIR,
@@ -3049,15 +3063,15 @@ e_plugin_lib_get_configure_widget (EPlugin *epl)
 			gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0);
 			break;
 		case 1:
-#ifndef HAVE_WEBKIT
-			gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0);
-			break;
+#ifdef HAVE_WEBKIT
+			gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 1);
 #endif
+			break;
 		case 2:
 #ifndef HAVE_GECKO
-			gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0);
-			break;
+			gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 2);
 #endif
+			break;
 		default:
 			g_print("Selected render not supported! Failling back to default.\n");
 			gtk_combo_box_set_active(GTK_COMBO_BOX(combo), render);
@@ -3089,6 +3103,56 @@ e_plugin_lib_get_configure_widget (EPlugin *epl)
 		FALSE,
 		0);
 
+	widget1 = GTK_WIDGET (
+			gtk_builder_get_object(
+				ui->xml, "fontsize"));
+	widget2 = GTK_WIDGET (
+			gtk_builder_get_object(
+				ui->xml, "fontsetting"));
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget2),
+		1-gconf_client_get_bool (
+			rss_gconf,
+			GCONF_KEY_CUSTOM_FONT, NULL));
+	g_object_set(widget1, "sensitive", (gboolean)1-gtk_toggle_button_get_active (
+			GTK_TOGGLE_BUTTON (widget2)), NULL);
+	g_signal_connect (
+		widget2,
+		"toggled",
+		G_CALLBACK (font_cb),
+		widget1);
+
+	ui->minfont = GTK_WIDGET (
+			gtk_builder_get_object(
+				ui->xml, "minfont"));
+	/*setup the adjustment*/
+	adjustment = (GtkAdjustment *)gtk_adjustment_new(
+			12,	//DEFAULT MIN FONT
+			1,	//DEFAULT MIN FONT
+			100,
+			1,
+			1,
+			0);
+	gtk_spin_button_set_adjustment(
+		(GtkSpinButton *)ui->minfont,
+		adjustment);
+	adj = gconf_client_get_float(
+			rss_gconf,
+			GCONF_KEY_MIN_FONT_SIZE,
+			NULL);
+	if (adj)
+		gtk_spin_button_set_value(
+			(GtkSpinButton *)ui->minfont, adj);
+	g_signal_connect(
+		ui->minfont,
+		"changed",
+		G_CALLBACK(spin_update_cb),
+		(gpointer)GCONF_KEY_MIN_FONT_SIZE);
+	g_signal_connect(
+		ui->minfont,
+		"value-changed",
+		G_CALLBACK(spin_update_cb),
+		(gpointer)GCONF_KEY_MIN_FONT_SIZE);
+
 	ui->check = GTK_WIDGET (
 		gtk_builder_get_object(ui->xml, "enable_java"));
 	gtk_toggle_button_set_active (
@@ -3177,13 +3241,13 @@ e_plugin_lib_get_configure_widget (EPlugin *epl)
 	g_signal_connect(
 		ui->nettimeout,
 		"changed",
-		G_CALLBACK(network_timeout_cb),
-		ui->nettimeout);
+		G_CALLBACK(spin_update_cb),
+		(gpointer)GCONF_KEY_NETWORK_TIMEOUT);
 	g_signal_connect(
 		ui->nettimeout,
 		"value-changed",
-		G_CALLBACK(network_timeout_cb),
-		ui->nettimeout);
+		G_CALLBACK(spin_update_cb),
+		(gpointer)GCONF_KEY_NETWORK_TIMEOUT);
 
 	//feed notification
 	ui->check = GTK_WIDGET (
diff --git a/src/rss-html-rendering.ui b/src/rss-html-rendering.ui
index 501830c..d1590a5 100644
--- a/src/rss-html-rendering.ui
+++ b/src/rss-html-rendering.ui
@@ -1,11 +1,11 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <interface>
+  <!-- interface-requires gtk+ 2.12 -->
   <!-- interface-naming-policy toplevel-contextual -->
   <object class="GtkWindow" id="window1">
     <child>
       <object class="GtkVBox" id="settingsbox">
         <property name="visible">True</property>
-        <property name="orientation">vertical</property>
         <child>
           <object class="GtkFrame" id="html-rendering">
             <property name="visible">True</property>
@@ -18,8 +18,7 @@
                 <child>
                   <object class="GtkVBox" id="vbox1">
                     <property name="visible">True</property>
-                    <property name="orientation">vertical</property>
-                    <property name="homogeneous">True</property>
+                    <property name="spacing">21</property>
                     <child>
                       <object class="GtkHBox" id="hbox1">
                         <property name="visible">True</property>
@@ -47,9 +46,70 @@
                       </packing>
                     </child>
                     <child>
+                      <object class="GtkVBox" id="vbox4">
+                        <property name="visible">True</property>
+                        <child>
+                          <object class="GtkCheckButton" id="fontsetting">
+                            <property name="label" translatable="yes">Use the same fonts as other applications</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="use_action_appearance">False</property>
+                            <property name="draw_indicator">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkHBox" id="fontsize">
+                            <property name="visible">True</property>
+                            <child>
+                              <object class="GtkLabel" id="label6">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">&lt;b&gt;Minimum font size:&lt;/b&gt;</property>
+                                <property name="use_markup">True</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="padding">20</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkSpinButton" id="minfont">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="invisible_char">â??</property>
+                                <property name="invisible_char_set">True</property>
+                                <property name="climb_rate">1</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
                       <object class="GtkVBox" id="vbox2">
                         <property name="visible">True</property>
-                        <property name="orientation">vertical</property>
                         <child>
                           <object class="GtkCheckButton" id="checkbutton1">
                             <property name="label" translatable="yes">Block pop-up windows</property>
@@ -59,6 +119,8 @@
                             <property name="draw_indicator">True</property>
                           </object>
                           <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
                             <property name="position">0</property>
                           </packing>
                         </child>
@@ -72,6 +134,8 @@
                             <property name="draw_indicator">True</property>
                           </object>
                           <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
                             <property name="position">1</property>
                           </packing>
                         </child>
@@ -85,6 +149,8 @@
                             <property name="draw_indicator">True</property>
                           </object>
                           <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
                             <property name="position">2</property>
                           </packing>
                         </child>
@@ -102,6 +168,8 @@
                                 <property name="draw_indicator">True</property>
                               </object>
                               <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
                                 <property name="position">0</property>
                               </packing>
                             </child>
@@ -114,11 +182,15 @@
                                 <property name="use_underline">True</property>
                               </object>
                               <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
                                 <property name="position">1</property>
                               </packing>
                             </child>
                           </object>
                           <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
                             <property name="position">3</property>
                           </packing>
                         </child>
@@ -139,7 +211,9 @@
                         </child>
                       </object>
                       <packing>
-                        <property name="position">1</property>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">2</property>
                       </packing>
                     </child>
                     <child>
@@ -154,6 +228,7 @@
                           </object>
                           <packing>
                             <property name="expand">False</property>
+                            <property name="fill">True</property>
                             <property name="position">0</property>
                           </packing>
                         </child>
@@ -161,11 +236,13 @@
                           <object class="GtkSpinButton" id="nettimeout">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
-                            <property name="invisible_char">&#x25CF;</property>
+                            <property name="invisible_char">â??</property>
+                            <property name="invisible_char_set">True</property>
                             <property name="climb_rate">1</property>
                           </object>
                           <packing>
                             <property name="expand">False</property>
+                            <property name="fill">True</property>
                             <property name="position">1</property>
                           </packing>
                         </child>
@@ -176,14 +253,16 @@
                           </object>
                           <packing>
                             <property name="expand">False</property>
+                            <property name="fill">True</property>
                             <property name="position">2</property>
                           </packing>
                         </child>
                       </object>
                       <packing>
+                        <property name="expand">False</property>
                         <property name="fill">False</property>
                         <property name="padding">2</property>
-                        <property name="position">2</property>
+                        <property name="position">3</property>
                       </packing>
                     </child>
                   </object>
@@ -199,6 +278,8 @@
             </child>
           </object>
           <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
             <property name="position">0</property>
           </packing>
         </child>
@@ -213,7 +294,6 @@
                 <child>
                   <object class="GtkVBox" id="vbox3">
                     <property name="visible">True</property>
-                    <property name="orientation">vertical</property>
                     <child>
                       <object class="GtkCheckButton" id="status_icon">
                         <property name="label" translatable="yes">Show icon in notification area</property>
@@ -224,29 +304,12 @@
                         <property name="draw_indicator">True</property>
                       </object>
                       <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
                         <property name="position">0</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkAlignment" id="alignment3">
-                        <property name="visible">True</property>
-                        <property name="xscale">0.80000001192092896</property>
-                        <child>
-                          <object class="GtkCheckButton" id="blink_icon">
-                            <property name="label" translatable="yes">Blink icon in notification area</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">False</property>
-                            <property name="use_underline">True</property>
-                            <property name="draw_indicator">True</property>
-                          </object>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
-                    <child>
                       <object class="GtkCheckButton" id="feed_icon">
                         <property name="label" translatable="yes">Show feed icon</property>
                         <property name="visible">True</property>
@@ -256,7 +319,9 @@
                         <property name="draw_indicator">True</property>
                       </object>
                       <packing>
-                        <property name="position">2</property>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
                       </packing>
                     </child>
                   </object>
@@ -272,10 +337,19 @@
             </child>
           </object>
           <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
             <property name="position">1</property>
           </packing>
         </child>
       </object>
     </child>
   </object>
+  <object class="GtkAdjustment" id="adjustment1">
+    <property name="lower">1</property>
+    <property name="upper">100</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+    <property name="page_size">10</property>
+  </object>
 </interface>
diff --git a/src/rss.c b/src/rss.c
index 8c06341..ee24ffb 100644
--- a/src/rss.c
+++ b/src/rss.c
@@ -1150,6 +1150,17 @@ webkit_set_preferences(void)
 	agstr = g_strdup_printf("Evolution/%s; Evolution-RSS/%s",
 			EVOLUTION_VERSION_STRING, VERSION);
 	g_object_set (settings, "user-agent", agstr,  NULL);
+	if (gconf_client_get_bool (rss_gconf,
+			GCONF_KEY_CUSTOM_FONT, NULL)) {
+		g_object_set (settings, "minimum-font-size",
+			(gint)gconf_client_get_float(rss_gconf,
+				GCONF_KEY_MIN_FONT_SIZE, NULL),
+			NULL);
+		g_object_set (settings, "minimum-logical-font-size",
+			(gint)gconf_client_get_float(rss_gconf,
+				GCONF_KEY_MIN_FONT_SIZE, NULL),
+			NULL);
+	}
 #if (WEBKIT_VERSION >= 1001022)
 	g_object_set (settings, "enable-page-cache", TRUE, NULL);
 	//g_object_set (settings, "auto-resize-window", TRUE, NULL);
diff --git a/src/rss.h b/src/rss.h
index aa5416a..5a510d1 100644
--- a/src/rss.h
+++ b/src/rss.h
@@ -180,6 +180,8 @@ typedef struct _rssfeed {
 
 #define GCONF_KEY_DISPLAY_SUMMARY "/apps/evolution/evolution-rss/display_summary"
 #define GCONF_KEY_START_CHECK "/apps/evolution/evolution-rss/startup_check"
+#define GCONF_KEY_CUSTOM_FONT "/apps/evolution/evolution-rss/custom_font"
+#define GCONF_KEY_MIN_FONT_SIZE "/apps/evolution/evolution-rss/min_font_size"
 #define GCONF_KEY_REP_CHECK "/apps/evolution/evolution-rss/rep_check"
 #define GCONF_KEY_REP_CHECK_TIMEOUT "/apps/evolution/evolution-rss/rep_check_timeout"
 #define GCONF_KEY_SHOW_COMMENTS "/apps/evolution/evolution-rss/show_comments"



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]