aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-status-icon.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2007-05-10 17:54:08 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2007-05-10 17:54:08 +0800
commit57ba29d727cac36a4cb5bf30b3f8815ad5568a0c (patch)
tree7b9dff36e384a58a768079c2800d20b7cac65839 /libempathy-gtk/empathy-status-icon.c
parent14ee3b9c392059b1e46fede3818c021d3449aa70 (diff)
downloadgsoc2013-empathy-57ba29d727cac36a4cb5bf30b3f8815ad5568a0c.tar
gsoc2013-empathy-57ba29d727cac36a4cb5bf30b3f8815ad5568a0c.tar.gz
gsoc2013-empathy-57ba29d727cac36a4cb5bf30b3f8815ad5568a0c.tar.bz2
gsoc2013-empathy-57ba29d727cac36a4cb5bf30b3f8815ad5568a0c.tar.lz
gsoc2013-empathy-57ba29d727cac36a4cb5bf30b3f8815ad5568a0c.tar.xz
gsoc2013-empathy-57ba29d727cac36a4cb5bf30b3f8815ad5568a0c.tar.zst
gsoc2013-empathy-57ba29d727cac36a4cb5bf30b3f8815ad5568a0c.zip
[darcs-to-svn @ Show/Hide main window on delete event]
svn path=/trunk/; revision=45
Diffstat (limited to 'libempathy-gtk/empathy-status-icon.c')
-rw-r--r--libempathy-gtk/empathy-status-icon.c63
1 files changed, 43 insertions, 20 deletions
diff --git a/libempathy-gtk/empathy-status-icon.c b/libempathy-gtk/empathy-status-icon.c
index ca6d4c5f3..e22156a00 100644
--- a/libempathy-gtk/empathy-status-icon.c
+++ b/libempathy-gtk/empathy-status-icon.c
@@ -34,9 +34,11 @@
#include <libempathy/gossip-debug.h>
#include <libempathy/gossip-utils.h>
+#include <libempathy/gossip-conf.h>
#include "empathy-status-icon.h"
#include "gossip-presence-chooser.h"
+#include "gossip-preferences.h"
#include "gossip-ui-utils.h"
#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
@@ -55,26 +57,29 @@ struct _EmpathyStatusIconPriv {
GtkWidget *status_item;
};
-static void empathy_status_icon_class_init (EmpathyStatusIconClass *klass);
-static void empathy_status_icon_init (EmpathyStatusIcon *icon);
-static void status_icon_finalize (GObject *object);
-static void status_icon_presence_changed_cb (MissionControl *mc,
- McPresence state,
- EmpathyStatusIcon *icon);
-static void status_icon_toggle_visibility (EmpathyStatusIcon *icon);
-static void status_icon_activate_cb (GtkStatusIcon *status_icon,
- EmpathyStatusIcon *icon);
-static void status_icon_popup_menu_cb (GtkStatusIcon *status_icon,
- guint button,
- guint activate_time,
- EmpathyStatusIcon *icon);
-static void status_icon_create_menu (EmpathyStatusIcon *icon);
-static void status_icon_new_message_cb (GtkWidget *widget,
- EmpathyStatusIcon *icon);
-static void status_icon_quit_cb (GtkWidget *window,
- EmpathyStatusIcon *icon);
-static void status_icon_show_hide_window_cb (GtkWidget *widget,
- EmpathyStatusIcon *icon);
+static void empathy_status_icon_class_init (EmpathyStatusIconClass *klass);
+static void empathy_status_icon_init (EmpathyStatusIcon *icon);
+static void status_icon_finalize (GObject *object);
+static void status_icon_presence_changed_cb (MissionControl *mc,
+ McPresence state,
+ EmpathyStatusIcon *icon);
+static void status_icon_toggle_visibility (EmpathyStatusIcon *icon);
+static void status_icon_activate_cb (GtkStatusIcon *status_icon,
+ EmpathyStatusIcon *icon);
+static gboolean status_icon_delete_event_cb (GtkWidget *widget,
+ GdkEvent *event,
+ EmpathyStatusIcon *icon);
+static void status_icon_popup_menu_cb (GtkStatusIcon *status_icon,
+ guint button,
+ guint activate_time,
+ EmpathyStatusIcon *icon);
+static void status_icon_create_menu (EmpathyStatusIcon *icon);
+static void status_icon_new_message_cb (GtkWidget *widget,
+ EmpathyStatusIcon *icon);
+static void status_icon_quit_cb (GtkWidget *window,
+ EmpathyStatusIcon *icon);
+static void status_icon_show_hide_window_cb (GtkWidget *widget,
+ EmpathyStatusIcon *icon);
G_DEFINE_TYPE (EmpathyStatusIcon, empathy_status_icon, G_TYPE_OBJECT);
@@ -146,6 +151,10 @@ empathy_status_icon_new (GtkWindow *window)
priv->window = g_object_ref (window);
+ g_signal_connect (priv->window, "delete-event",
+ G_CALLBACK (status_icon_delete_event_cb),
+ icon);
+
return icon;
}
@@ -193,8 +202,12 @@ status_icon_toggle_visibility (EmpathyStatusIcon *icon)
if (visible) {
gtk_widget_hide (GTK_WIDGET (priv->window));
+ gossip_conf_set_bool (gossip_conf_get (),
+ GOSSIP_PREFS_UI_MAIN_WINDOW_HIDDEN, TRUE);
} else {
gossip_window_present (GTK_WINDOW (priv->window), TRUE);
+ gossip_conf_set_bool (gossip_conf_get (),
+ GOSSIP_PREFS_UI_MAIN_WINDOW_HIDDEN, FALSE);
}
}
@@ -205,6 +218,16 @@ status_icon_activate_cb (GtkStatusIcon *status_icon,
status_icon_toggle_visibility (icon);
}
+static gboolean
+status_icon_delete_event_cb (GtkWidget *widget,
+ GdkEvent *event,
+ EmpathyStatusIcon *icon)
+{
+ status_icon_toggle_visibility (icon);
+
+ return TRUE;
+}
+
static void
status_icon_popup_menu_cb (GtkStatusIcon *status_icon,
guint button,