[SF#485]Fix font in the weather plugin to use panel settings.
authorAndriy Grytsenko <andrej@rep.kiev.ua>
Fri, 21 Nov 2014 19:56:13 +0000 (21:56 +0200)
committerAndriy Grytsenko <andrej@rep.kiev.ua>
Fri, 21 Nov 2014 19:56:13 +0000 (21:56 +0200)
ChangeLog
plugins/weather/weather.c
plugins/weather/weatherwidget.c
plugins/weather/weatherwidget.h

index aa3caa0..bda37c4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -65,6 +65,7 @@
     Also 'Size' setting of it doesn't include border width.
 * Allowed default alarmCommand on 'batt' plugin be translated.
 * Implemented sorting plugins in Add plugin window in alphabetic order.
+* Fixed font in the weather plugin to use panel settings.
 
 0.7.2
 -------------------------------------------------------------------------
index 20c6f9e..0f87d7c 100644 (file)
@@ -40,6 +40,7 @@ typedef struct
   gint iMyId_;
   GtkWidget *pWeather_;
   config_setting_t *pConfig_;
+  LXPanel *pPanel_;
 } WeatherPluginPrivate;
 
 
@@ -81,6 +82,7 @@ weather_constructor(LXPanel *pPanel, config_setting_t *pConfig)
   WeatherPluginPrivate * pPriv = g_new0(WeatherPluginPrivate, 1);
 
   pPriv->pConfig_ = pConfig;
+  pPriv->pPanel_ = pPanel;
 
   /* There is one more now... */
   ++g_iCount;
@@ -259,6 +261,24 @@ void weather_save_configuration(GtkWidget * pWeather, LocationInfo * pLocation)
 
 }
 
+void weather_set_label_text(GtkWidget * pWeather, GtkWidget * label, const gchar * text)
+{
+  GtkWidget * pWidget = gtk_widget_get_parent(pWeather);
+  WeatherPluginPrivate * pPriv = NULL;
+
+  if (pWidget)
+    {
+      pPriv = (WeatherPluginPrivate *) lxpanel_plugin_get_data(pWidget);
+    }
+  if (pPriv == NULL)
+    {
+      LXW_LOG(LXW_ERROR, "Weather: weather_set_label_text() for invalid widget");
+      return;
+    }
+
+  lxpanel_draw_label_text(pPriv->pPanel_, label, text, TRUE, 1, TRUE);
+}
+
 /**
  * Weather Plugin configuration change callback.
  *
index f35b429..3205bdd 100644 (file)
@@ -512,7 +512,7 @@ gtk_weather_render(GtkWeather * weather)
                                             forecast->iTemperature_,
                                             forecast->units_.pcTemperature_);
 
-      gtk_label_set_text(GTK_LABEL(priv->label), temperature);
+      weather_set_label_text(GTK_WIDGET(weather), priv->label, temperature);
 
       //gtk_widget_show_all(priv->hbox);
 
@@ -533,9 +533,9 @@ gtk_weather_render(GtkWeather * weather)
                                    GTK_STOCK_DIALOG_ERROR, 
                                    GTK_ICON_SIZE_BUTTON);
         }
-      
-      gtk_label_set_text(GTK_LABEL(priv->label), 
-                         GTK_WEATHER_NOT_AVAILABLE_LABEL);
+
+      weather_set_label_text(GTK_WIDGET(weather), priv->label,
+                             GTK_WEATHER_NOT_AVAILABLE_LABEL);
     }
 
   /* update tooltip with proper data... */
index bf0f0a9..8fcc2f9 100644 (file)
@@ -64,8 +64,10 @@ void        gtk_weather_run_conditions_dialog(GtkWidget * widget);
 gchar *     gtk_weather_get_tooltip_text(GtkWidget * widget);
 GtkWidget * gtk_weather_create_preferences_dialog(GtkWidget * widget);
 
-/* if USE_STANDALONE is used then application should provide this function */
+/* if USE_STANDALONE is used then application should provide these functions */
 void weather_save_configuration(GtkWidget * pWeather, LocationInfo * pLocation);
+void weather_set_label_text(GtkWidget * pWeather, GtkWidget * label,
+                            const gchar * text);
 
 G_END_DECLS