[Xfce4-commits] <xfce4-weather-plugin:master> Handle events for configuration of scrollbox animation.

Harald Judt noreply at xfce.org
Tue Nov 27 16:46:21 CET 2012


Updating branch refs/heads/master
         to 87011e617fdabce2bba8385c75925693730d25a0 (commit)
       from 69440915aa431f3f905eb8d7c60ef1a9bb8d642e (commit)

commit 87011e617fdabce2bba8385c75925693730d25a0
Author: Harald Judt <h.judt at gmx.at>
Date:   Sat Nov 24 12:12:27 2012 +0100

    Handle events for configuration of scrollbox animation.

 panel-plugin/weather-config.c |   14 +++++++++++++-
 panel-plugin/weather-debug.c  |   11 ++++++++---
 panel-plugin/weather.c        |   13 ++++++-------
 panel-plugin/weather.h        |    2 +-
 4 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/panel-plugin/weather-config.c b/panel-plugin/weather-config.c
index 7d5417d..89e7d81 100644
--- a/panel-plugin/weather-config.c
+++ b/panel-plugin/weather-config.c
@@ -941,6 +941,16 @@ spin_scrollbox_lines_value_changed(const GtkWidget *spin,
 }
 
 
+static void
+check_scrollbox_animate_toggled(GtkWidget *button,
+                                gpointer user_data)
+{
+    xfceweather_dialog *dialog = (xfceweather_dialog *) user_data;
+    dialog->wd->scrollbox_animate =
+        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
+}
+
+
 static GtkWidget *
 create_scrollbox_page(xfceweather_dialog *dialog)
 {
@@ -1062,9 +1072,11 @@ create_scrollbox_page(xfceweather_dialog *dialog)
         gtk_check_button_new_with_mnemonic(_("Animate _transitions between labels"));
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
                                  (dialog->check_scrollbox_animate),
-                                 dialog->wd->animation_transitions);
+                                 dialog->wd->scrollbox_animate);
     gtk_box_pack_start(GTK_BOX(page), dialog->check_scrollbox_animate,
                        FALSE, FALSE, 0);
+    g_signal_connect(dialog->check_scrollbox_animate, "toggled",
+                     G_CALLBACK(check_scrollbox_animate_toggled), dialog);
 
     g_object_unref(G_OBJECT(sg_misc));
     g_object_unref(G_OBJECT(sg_button));
diff --git a/panel-plugin/weather-debug.c b/panel-plugin/weather-debug.c
index 353536b..22fb330 100644
--- a/panel-plugin/weather-debug.c
+++ b/panel-plugin/weather-debug.c
@@ -407,8 +407,11 @@ weather_dump_plugindata(const xfceweather_data *data)
                            "  location name: %s\n"
                            "  night time: %s\n"
                            "  --------------------------------------------\n"
-                           "  animation transitions: %s\n"
                            "  forecast days: %d\n"
+                           "  --------------------------------------------\n"
+                           "  show scrollbox: %s\n"
+                           "  scrollbox lines: %d\n"
+                           "  animate scrollbox: %s\n"
                            "  --------------------------------------------",
                            data->panel_size,
                            data->size,
@@ -421,8 +424,10 @@ weather_dump_plugindata(const xfceweather_data *data)
                            data->lon,
                            data->location_name,
                            YESNO(data->night_time),
-                           YESNO(data->animation_transitions),
-                           data->forecast_days);
+                           data->forecast_days,
+                           YESNO(data->show_scrollbox),
+                           data->scrollbox_lines,
+                           YESNO(data->scrollbox_animate));
     g_free(last_astro_update);
     g_free(last_data_update);
     g_free(last_conditions_update);
diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
index 75f354e..40b5a53 100644
--- a/panel-plugin/weather.c
+++ b/panel-plugin/weather.c
@@ -543,11 +543,6 @@ xfceweather_read_config(XfcePanelPlugin *plugin,
     data->forecast_days =
         (val > 0 && val <= MAX_FORECAST_DAYS) ? val : DEFAULT_FORECAST_DAYS;
 
-    data->animation_transitions =
-        xfce_rc_read_bool_entry(rc, "animation_transitions", TRUE);
-    gtk_scrollbox_set_animate(GTK_SCROLLBOX(data->scrollbox),
-                              data->animation_transitions);
-
     value = xfce_rc_read_entry(rc, "theme_dir", NULL);
     if (data->icon_theme)
         icon_theme_free(data->icon_theme);
@@ -560,6 +555,11 @@ xfceweather_read_config(XfcePanelPlugin *plugin,
         data->scrollbox_lines > MAX_SCROLLBOX_LINES)
         data->scrollbox_lines = 1;
 
+    data->scrollbox_animate =
+        xfce_rc_read_bool_entry(rc, "scrollbox_animate", TRUE);
+    gtk_scrollbox_set_animate(GTK_SCROLLBOX(data->scrollbox),
+                              data->scrollbox_animate);
+
     data->labels = labels_clear(data->labels);
     val = 0;
     while (val != -1) {
@@ -620,8 +620,7 @@ xfceweather_write_config(XfcePanelPlugin *plugin,
 
     xfce_rc_write_int_entry(rc, "forecast_days", data->forecast_days);
 
-    xfce_rc_write_bool_entry(rc, "animation_transitions",
-                             data->animation_transitions);
+    xfce_rc_write_bool_entry(rc, "scrollbox_animate", data->scrollbox_animate);
 
     if (data->icon_theme && data->icon_theme->dir)
         xfce_rc_write_entry(rc, "theme_dir", data->icon_theme->dir);
diff --git a/panel-plugin/weather.h b/panel-plugin/weather.h
index 3cdf4e0..d2e54bd 100644
--- a/panel-plugin/weather.h
+++ b/panel-plugin/weather.h
@@ -56,6 +56,7 @@ typedef struct {
     GtkWidget *scrollbox;
     gboolean show_scrollbox;
     guint scrollbox_lines;
+    gboolean scrollbox_animate;
     GArray *labels;
 
     icon_theme *icon_theme;
@@ -73,7 +74,6 @@ typedef struct {
     xml_astro *astrodata;
     gboolean night_time;
 
-    gboolean animation_transitions;
     gint forecast_days;
 } xfceweather_data;
 


More information about the Xfce4-commits mailing list