diff --git a/CASA/gui/CasaMain.cs b/CASA/gui/CasaMain.cs
index 36609cda..1b493a74 100644
--- a/CASA/gui/CasaMain.cs
+++ b/CASA/gui/CasaMain.cs
@@ -100,7 +100,8 @@ namespace Novell.CASA.GUI
checkbuttonMozilla,
checkbuttonGnomeKeyring,
checkbuttonKdeWallet,
- checkbuttonCloseMessage;
+ checkbuttonCloseMessage,
+ checkbuttonRunInTray;
[Glade.Widget]
Gtk.Label label88,
@@ -130,6 +131,10 @@ namespace Novell.CASA.GUI
mmiKopete,
mmiNetworkManager,
mmiGaim;
+
+ [Glade.Widget]
+ Gtk.RadioButton radiobutton1,
+ radiobutton2;
@@ -236,8 +241,11 @@ namespace Novell.CASA.GUI
{
if (!Common.IsArgSet(args, Common.ARG_NO_TRAY_ICON))
{
- if (mCasaTray == null)
- mCasaTray = new CasaTray(this);
+ if (config.GetConfigSetting(Common.CONFIG_RUN_IN_TRAY, true))
+ {
+ if (mCasaTray == null)
+ mCasaTray = new CasaTray(this, config);
+ }
}
}
catch (Exception e)
@@ -1612,17 +1620,76 @@ namespace Novell.CASA.GUI
checkbuttonKdeWallet.Active = Common.IS_KDEWALLET;
checkbuttonFirefox.Sensitive = Common.IS_FIREFOX_AVAILABLE;
checkbuttonKdeWallet.Sensitive = Common.IS_KDEWALLET_AVAILABLE;
- checkbuttonGnomeKeyring.Sensitive = Common.IS_GNOMEKEYRING_AVAILABLE;
+ checkbuttonGnomeKeyring.Sensitive = Common.IS_GNOMEKEYRING_AVAILABLE;
+
+ // options
+ checkbuttonRunInTray.Sensitive = true;
+ checkbuttonRunInTray.Active = config.GetConfigSetting(Common.CONFIG_RUN_IN_TRAY, true);
+ checkbuttonRunInTray.Visible = true;
+
+ radiobutton1.Visible = true;
+ radiobutton2.Visible = true;
+
+ radiobutton1.Sensitive = checkbuttonRunInTray.Active;
+ radiobutton2.Sensitive = checkbuttonRunInTray.Active;
+
+ radiobutton1.Active = config.GetConfigSetting(Common.DISPLAY_CASA_MANAGER, true);
+ radiobutton2.Active = !config.GetConfigSetting(Common.DISPLAY_CASA_MANAGER, true);
+
if (Common.IS_WINDOWS)
{
checkbuttonGnomeKeyring.Sensitive = false;
+ checkbuttonGnomeKeyring.Visible = false;
+
checkbuttonKdeWallet.Sensitive = false;
+ checkbuttonKdeWallet.Visible = false;
}
Logger.DbgLog("GUI:CasaMain.Preferences() - END");
}
+ public void on_checkbuttonRunInTray_clicked(object obj, EventArgs args)
+ {
+
+ Gtk.CheckButton button = (Gtk.CheckButton)obj;
+ if (button.Active)
+ {
+#if W32
+ // start tray icon
+ if (mCasaTray == null)
+ mCasaTray = new CasaTray(this, config);
+#endif
+ radiobutton1.Sensitive = radiobutton2.Sensitive = true;
+ config.SetConfigSetting(Common.CONFIG_RUN_IN_TRAY, true);
+ config.WriteConfig();
+ }
+ else
+ {
+#if W32
+ // stop tray icon
+ if (mCasaTray != null)
+ {
+ mCasaTray.StopRunningInTray();
+ mCasaTray = null;
+ }
+#endif
+ radiobutton1.Sensitive = radiobutton2.Sensitive = false;
+ config.SetConfigSetting(Common.CONFIG_RUN_IN_TRAY, false);
+ config.WriteConfig();
+ }
+ }
+
+ public void on_radiobutton1_clicked(object obj, EventArgs e)
+ {
+ if (radiobutton1.Active)
+ config.SetConfigSetting(Common.DISPLAY_CASA_MANAGER, true);
+ else
+ config.SetConfigSetting(Common.DISPLAY_CASA_MANAGER, false);
+
+ config.WriteConfig();
+ }
+
public void okbuttonPreferences_clicked(object abj, EventArgs args)
{
Logger.DbgLog("GUI:CasaMain.okbuttonPreferences_clicked() - BEGIN");
diff --git a/CASA/gui/CasaTray.cs b/CASA/gui/CasaTray.cs
index fdec2498..a97cd5ed 100644
--- a/CASA/gui/CasaTray.cs
+++ b/CASA/gui/CasaTray.cs
@@ -46,17 +46,23 @@ namespace Novell.CASA.GUI
Egg.TrayIcon icon;
EventBox eb;
private Gtk.Image m_imageLocked = new Image("images/CASA_16.png", IconSize.Menu);
- private static string iconfile = "/usr/share/doc/packages/CASA/images/CASAicons.ico";
+
+ private static string iconfile = "/usr/share/doc/packages/CASA/images/CASA_22.png";
private static Gtk.IconSet iconset = new IconSet(new Gdk.Pixbuf(iconfile));
private static Gtk.Image m_imageUnlocked = new Gtk.Image(iconset, IconSize.Menu);
+ private static string iconfileLocked = "/usr/share/doc/packages/CASA/images/CASA_22_Locked.png";
+ private static Gtk.IconSet iconLocked = new IconSet(new Gdk.Pixbuf(iconfileLocked));
+ private static Gtk.Image m_imageLocked = new Gtk.Image(iconLocked, IconSize.Menu);
#endif
private static CasaMain mCasaMain = null;
+ private static Config m_config = null;
private Menu popupMenu = null;
-
- public CasaTray(CasaMain casaInstance)
+
+ public CasaTray(CasaMain casaInstance, Config config)
{
mCasaMain = casaInstance;
+ m_config = config;
Setup();
}
@@ -127,7 +133,7 @@ namespace Novell.CASA.GUI
#endif
#if LINUX
/* in order to receive signals, we need a eventbox, because Gtk.Image doesn't receive signals */
- eb = new EventBox();
+ eb = new EventBox();
eb.Add(m_imageUnlocked); // using stock icon
// hooking event
eb.ButtonPressEvent += new ButtonPressEventHandler (this.OnImageClick);
@@ -307,10 +313,12 @@ namespace Novell.CASA.GUI
*/
private void notifyIcon_DoubleClick(object sender, EventArgs e)
- {
-
- //menuLockMiCasa_Activated(sender, e);
- menuLaunchGUI_Activated(sender, e);
+ {
+ //menuLockMiCasa_Activated(sender, e);
+ if (m_config.GetConfigSetting(Common.DISPLAY_CASA_MANAGER, true))
+ menuLaunchGUI_Activated(sender, e);
+ else
+ menuLockMiCasa_Activated(sender, e);
}
private void menuDestroyMiCasa_Activated(object sender, EventArgs e)
@@ -333,9 +341,20 @@ namespace Novell.CASA.GUI
notifyIcon.Icon = m_iconNormal;
}
#endif
-
}
+ internal void StopRunningInTray()
+ {
+#if W32
+ notifyIcon.Dispose();
+#endif
+#if LINUX
+ eb.Remove(m_imageUnlocked);
+ //icon.Dispose();
+#endif
+ }
+
+
internal void Destroy()
{
@@ -346,8 +365,7 @@ namespace Novell.CASA.GUI
notifyIcon.Dispose();
#endif
#if LINUX
- // Does not work
- icon.Dispose();
+ eb.Remove(m_imageUnlocked);
#endif
Application.Quit();
diff --git a/CASA/gui/Common.cs b/CASA/gui/Common.cs
index 35cea75d..9be16694 100644
--- a/CASA/gui/Common.cs
+++ b/CASA/gui/Common.cs
@@ -131,6 +131,8 @@ public class Common
public static string ARG_NO_TRAY_ICON = "-notray";
public static string ARG_SHOW_TRAY_ICON = "-tray";
public static string ARG_DEBUG = "-debug";
+
+ public static string CONFIG_RUN_IN_TRAY = "RunInTray";
///#############################################################
diff --git a/CASA/gui/images/casa.glade b/CASA/gui/images/casa.glade
index cf4f9a82..e186ea25 100644
--- a/CASA/gui/images/casa.glade
+++ b/CASA/gui/images/casa.glade
@@ -4298,7 +4298,7 @@ prompted for the Master Password at startup.
GTK_WINDOW_TOPLEVEL
GTK_WIN_POS_CENTER_ON_PARENT
True
- False
+ True
True
CASAicons.ico
True
@@ -4513,6 +4513,179 @@ prompted for the Master Password at startup.
+
+
+ 6
+ True
+ 0
+ 0.5
+ GTK_SHADOW_IN
+
+
+
+ True
+ 0.5
+ 0.5
+ 1
+ 1
+ 0
+ 0
+ 12
+ 0
+
+
+
+ 4
+ True
+ False
+ 0
+
+
+
+ True
+ True
+ Show CASA Manager in notify area
+ True
+ GTK_RELIEF_NORMAL
+ True
+ False
+ False
+ True
+
+
+
+ 0
+ False
+ False
+
+
+
+
+
+ True
+ False
+ 0
+
+
+
+ True
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 0
+ False
+ False
+
+
+
+
+
+ True
+ False
+ 0
+
+
+
+ True
+ True
+ Display CASA Manager when icon is clicked
+ True
+ GTK_RELIEF_NORMAL
+ True
+ False
+ False
+ True
+
+
+
+ 0
+ False
+ False
+
+
+
+
+
+ True
+ True
+ Lock/Unlock secrets when icon is clicked
+ True
+ GTK_RELIEF_NORMAL
+ True
+ False
+ False
+ True
+ radiobutton1
+
+
+
+ 0
+ False
+ False
+
+
+
+
+ 0
+ True
+ True
+
+
+
+
+ 0
+ True
+ True
+
+
+
+
+
+
+
+
+
+ True
+ <b> Options </b>
+ False
+ True
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ label_item
+
+
+
+
+ 0
+ True
+ True
+
+
+
6