[pan2] fix for systray behaviour



commit 52ccea504c0049a27be8a41d9e41337598442615
Author: Heinrich MÃller <henmull src gnome org>
Date:   Mon Oct 1 16:23:38 2012 +0200

    fix for systray behaviour

 configure.in        |    6 +++---
 pan/gui/pan.cc      |   21 ++++++++++++++++-----
 pan/gui/prefs-ui.cc |   21 ++++++++++++++++++---
 3 files changed, 37 insertions(+), 11 deletions(-)
---
diff --git a/configure.in b/configure.in
index 6241367..bc1ab69 100644
--- a/configure.in
+++ b/configure.in
@@ -1,8 +1,8 @@
-AC_INIT([Pan],[0.139],[https://bugzilla.gnome.org/enter_bug.cgi?product=Pan],[pan],[http://pan.rebelbase.com/])
+AC_INIT([Pan],[0.140],[https://bugzilla.gnome.org/enter_bug.cgi?product=Pan],[pan],[http://pan.rebelbase.com/])
 AC_DEFINE(VERSION_MAJOR,0,[Major part of version number])
-AC_DEFINE(VERSION_MINOR,139,[Minor part of version number])
+AC_DEFINE(VERSION_MINOR,140,[Minor part of version number])
 AC_DEFINE(VERSION_REVISION,0,[Revision part of version number])
-AC_DEFINE(VERSION_TITLE,["Sexual Chocolate"],[Release Name])
+AC_DEFINE(VERSION_TITLE,["Chocolate Salty Balls"],[Release Name])
 AC_PREREQ([2.64])
 
 dnl Expanded by export-archive
diff --git a/pan/gui/pan.cc b/pan/gui/pan.cc
index bcc12e5..df380cf 100644
--- a/pan/gui/pan.cc
+++ b/pan/gui/pan.cc
@@ -195,12 +195,23 @@ namespace
 
     GtkWindow * window = GTK_WINDOW(data);
 
-    if (gtk_window_is_active(window))
+    GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET(window));
+    GdkWindow *gdkwindow = gtk_widget_get_window (toplevel);
+    GdkWindowState state = gdk_window_get_state (gdkwindow);
+    gboolean maximized = state & GDK_WINDOW_STATE_MAXIMIZED;
+    gboolean iconified = state & GDK_WINDOW_STATE_ICONIFIED;
+
+//    std::cerr<<(state & GDK_WINDOW_STATE_MAXIMIZED)<<" "
+//    <<(state & GDK_WINDOW_STATE_ICONIFIED)<<" "
+//    <<(state & GDK_WINDOW_STATE_WITHDRAWN)<<" "
+//    <<(state & GDK_WINDOW_STATE_FULLSCREEN)<<"\n" ;
+
+    if (maximized || (maximized && iconified))
     {
       gtk_window_iconify (window);
       gtk_widget_hide (GTK_WIDGET(window));
     }
-    else
+    else if (!maximized || iconified)
     {
       gtk_widget_show (GTK_WIDGET(window));
       gtk_window_deiconify(window);
@@ -506,11 +517,11 @@ namespace
 
     gtk_container_add (GTK_CONTAINER(window), gui.root());
     const bool minimized(prefs.get_flag("start-minimized", false));
-    const bool status_icon(prefs.get_flag("start-minimized", false));
 
-    if (minimized) gtk_window_iconify (window);
+    if (minimized)
+      gtk_window_iconify (window);
 
-    gtk_widget_show (GTK_WIDGET(window));
+    gtk_widget_set_visible (GTK_WIDGET(window), !minimized);
 
     const quarks_t servers (data.get_servers ());
     if (servers.empty())
diff --git a/pan/gui/prefs-ui.cc b/pan/gui/prefs-ui.cc
index 6dd0743..01eeede 100644
--- a/pan/gui/prefs-ui.cc
+++ b/pan/gui/prefs-ui.cc
@@ -501,6 +501,21 @@ namespace pan
     g_free (val);
   }
 
+  GtkWidget* html_previewer_new (Prefs& prefs)
+  {
+    const char * key = "html-previewer";
+//    const std::string editor = prefs.get_string (key, "mutt");
+//    editors.insert (editor);
+    GtkWidget * c = gtk_combo_box_text_new_with_entry ();
+    g_object_set_data_full (G_OBJECT(c), PREFS_KEY, g_strdup(key), g_free);
+//    foreach_const (std::set<std::string>, editors, it)
+//      gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(c), it->c_str());
+//    gtk_combo_box_set_active (GTK_COMBO_BOX(c),
+//                              (int)std::distance (editors.begin(), editors.find(editor)));
+    g_signal_connect (c, "changed", G_CALLBACK(set_prefs_string_from_combo_box_entry), &prefs);
+    return c;
+  }
+
   GtkWidget* editor_new (Prefs& prefs)
   {
     std::set<std::string> editors;
@@ -732,9 +747,7 @@ PrefsDialog :: on_prefs_flag_changed (const StringView& key, bool value)
 {
 
   if (key == "allow-multiple-instances")
-  {
     _prefs.save();
-  }
 }
 
 namespace
@@ -1015,7 +1028,7 @@ PrefsDialog :: PrefsDialog (Prefs& prefs, GtkWindow* parent):
     // systray and notify popup
     HIG :: workarea_add_section_title (t, &row, _("System Tray Behavior"));
     HIG :: workarea_add_section_spacer (t, row, 3);
-    w = new_check_button (_("Hide to system tray"), "status-icon", false, prefs);
+    w = new_check_button (_("Minimize to tray"), "status-icon", false, prefs);
     HIG :: workarea_add_wide_control (t, &row, w);
     w = new_check_button (_("Start Pan minimized"), "start-minimized", false, prefs);
     HIG :: workarea_add_wide_control (t, &row, w);
@@ -1269,6 +1282,8 @@ PrefsDialog :: PrefsDialog (Prefs& prefs, GtkWindow* parent):
     HIG :: workarea_add_row (t, &row, _("_Mail reader:"), w);
     w = editor_new (prefs);
     HIG :: workarea_add_row (t, &row, _("_Text editor:"), w);
+    w = html_previewer_new (prefs);
+    HIG :: workarea_add_row (t, &row, _("_HTML previewer:"), w);
   HIG :: workarea_finish (t, &row);
   gtk_notebook_append_page (GTK_NOTEBOOK(notebook), t, new_label_with_icon(_("_Applications"), _("Applications"), icon_prefs_applications, prefs));
 



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