[Xfce4-commits] <xfce4-weather-plugin:master> Summary window: Remember last selected tab.

Harald Judt noreply at xfce.org
Tue Dec 18 17:14:05 CET 2012


Updating branch refs/heads/master
         to 3b5268908ea1690cb1e69219e9ba8326069e7e27 (commit)
       from c4aff7b8e4b6ec35bca6df7c50bbf262aab7de9d (commit)

commit 3b5268908ea1690cb1e69219e9ba8326069e7e27
Author: Harald Judt <h.judt at gmx.at>
Date:   Sun Dec 16 13:28:20 2012 +0100

    Summary window: Remember last selected tab.
    
    This setting is not preserved across restarts.

 panel-plugin/weather-summary.c |   18 ++++++++++++++++--
 panel-plugin/weather.h         |    1 +
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/panel-plugin/weather-summary.c b/panel-plugin/weather-summary.c
index e827a55..5b01319 100644
--- a/panel-plugin/weather-summary.c
+++ b/panel-plugin/weather-summary.c
@@ -25,7 +25,6 @@
 #include "weather-parsers.h"
 #include "weather-data.h"
 #include "weather.h"
-
 #include "weather-summary.h"
 #include "weather-translate.h"
 #include "weather-icon.h"
@@ -785,6 +784,18 @@ summary_dialog_response(const GtkWidget *dlg,
 }
 
 
+static void
+cb_notebook_page_switched(GtkNotebook *notebook,
+                          GtkNotebookPage *page,
+                          guint page_num,
+                          gpointer user_data)
+{
+    plugin_data *data = (plugin_data *) user_data;
+
+    data->summary_remember_tab = page_num;
+}
+
+
 GtkWidget *
 create_summary_window(plugin_data *data)
 {
@@ -841,8 +852,11 @@ create_summary_window(plugin_data *data)
         gtk_notebook_append_page(GTK_NOTEBOOK(notebook),
                                  create_summary_tab(data),
                                  gtk_label_new_with_mnemonic(_("_Details")));
-
         gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);
+        gtk_widget_show_all(GTK_WIDGET(notebook));
+        gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), data->summary_remember_tab);
+        g_signal_connect(GTK_NOTEBOOK(notebook), "switch-page",
+                         G_CALLBACK(cb_notebook_page_switched), data);
     }
 
     g_signal_connect(G_OBJECT(window), "response",
diff --git a/panel-plugin/weather.h b/panel-plugin/weather.h
index c0a94b0..5d2425e 100644
--- a/panel-plugin/weather.h
+++ b/panel-plugin/weather.h
@@ -69,6 +69,7 @@ typedef struct {
     GtkWidget *summary_window;
     summary_details *summary_details;
     guint config_remember_tab;
+    guint summary_remember_tab;
 
     gint panel_size;
     gint size;


More information about the Xfce4-commits mailing list