aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--libempathy-gtk/empathy-group-chat.c5
-rw-r--r--libempathy-gtk/empathy-status-icon.c38
-rw-r--r--libempathy/empathy-tp-chatroom.c8
4 files changed, 40 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index db6de6048..0423e6ecb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-10-19 Xavier Claessens <xclaesse@gmail.com>
+
+ * libempathy-gtk/empathy-group-chat.c:
+ * libempathy/empathy-tp-chatroom.c:Don't accept invitation if we are
+ not invited.
+
+ * libempathy-gtk/empathy-status-icon.c: Correctly toggle visibility
+ with ALT-F4 on the main windows.
+
2007-10-18 Xavier Claessens <xclaesse@gmail.com>
* libempathy/empathy-log-manager.c:
diff --git a/libempathy-gtk/empathy-group-chat.c b/libempathy-gtk/empathy-group-chat.c
index f3c8e8a20..778c08f1d 100644
--- a/libempathy-gtk/empathy-group-chat.c
+++ b/libempathy-gtk/empathy-group-chat.c
@@ -523,8 +523,9 @@ group_chat_set_tp_chat (EmpathyChat *chat,
priv->tp_chat = g_object_ref (tp_chat);
- /* FIXME: Ask the user before accepting */
- empathy_tp_chatroom_accept_invitation (priv->tp_chat);
+ if (empathy_tp_chatroom_get_invitation (priv->tp_chat, NULL, NULL)) {
+ empathy_tp_chatroom_accept_invitation (priv->tp_chat);
+ }
/* Create contact list */
priv->store = empathy_contact_list_store_new (EMPATHY_CONTACT_LIST (priv->tp_chat));
diff --git a/libempathy-gtk/empathy-status-icon.c b/libempathy-gtk/empathy-status-icon.c
index 39c4bcfe6..16a678dcd 100644
--- a/libempathy-gtk/empathy-status-icon.c
+++ b/libempathy-gtk/empathy-status-icon.c
@@ -100,6 +100,8 @@ static void status_icon_message_received_cb (EmpathyTpChat *tp_ch
static void status_icon_idle_notify_cb (EmpathyStatusIcon *icon);
static void status_icon_update_tooltip (EmpathyStatusIcon *icon);
static void status_icon_set_from_state (EmpathyStatusIcon *icon);
+static void status_icon_set_visibility (EmpathyStatusIcon *icon,
+ gboolean visible);
static void status_icon_toggle_visibility (EmpathyStatusIcon *icon);
static void status_icon_activate_cb (GtkStatusIcon *status_icon,
EmpathyStatusIcon *icon);
@@ -230,7 +232,6 @@ empathy_status_icon_new (GtkWindow *window)
EmpathyStatusIconPriv *priv;
EmpathyStatusIcon *icon;
gboolean should_hide;
- gboolean visible;
g_return_val_if_fail (GTK_IS_WINDOW (window), NULL);
@@ -246,11 +247,8 @@ empathy_status_icon_new (GtkWindow *window)
empathy_conf_get_bool (empathy_conf_get (),
EMPATHY_PREFS_UI_MAIN_WINDOW_HIDDEN,
&should_hide);
- visible = empathy_window_get_is_visible (window);
- if ((!should_hide && !visible) || (should_hide && visible)) {
- status_icon_toggle_visibility (icon);
- }
+ status_icon_set_visibility (icon, !should_hide);
return icon;
}
@@ -391,16 +389,14 @@ status_icon_set_from_state (EmpathyStatusIcon *icon)
}
static void
-status_icon_toggle_visibility (EmpathyStatusIcon *icon)
+status_icon_set_visibility (EmpathyStatusIcon *icon,
+ gboolean visible)
{
EmpathyStatusIconPriv *priv;
- gboolean visible;
priv = GET_PRIV (icon);
- visible = gtk_window_has_toplevel_focus (GTK_WINDOW (priv->window));
-
- if (visible) {
+ if (!visible) {
empathy_window_iconify (priv->window, priv->icon);
empathy_conf_set_bool (empathy_conf_get (),
EMPATHY_PREFS_UI_MAIN_WINDOW_HIDDEN, TRUE);
@@ -424,6 +420,16 @@ status_icon_toggle_visibility (EmpathyStatusIcon *icon)
}
static void
+status_icon_toggle_visibility (EmpathyStatusIcon *icon)
+{
+ EmpathyStatusIconPriv *priv = GET_PRIV (icon);
+ gboolean visible;
+
+ visible = gtk_window_is_active (priv->window);
+ status_icon_set_visibility (icon, !visible);
+}
+
+static void
status_icon_activate_cb (GtkStatusIcon *status_icon,
EmpathyStatusIcon *icon)
{
@@ -446,7 +452,7 @@ status_icon_delete_event_cb (GtkWidget *widget,
GdkEvent *event,
EmpathyStatusIcon *icon)
{
- status_icon_toggle_visibility (icon);
+ status_icon_set_visibility (icon, FALSE);
return TRUE;
}
@@ -505,14 +511,11 @@ status_icon_create_menu (EmpathyStatusIcon *icon)
empathy_glade_connect (glade,
icon,
+ "tray_show_list", "toggled", status_icon_show_hide_window_cb,
"tray_new_message", "activate", status_icon_new_message_cb,
"tray_quit", "activate", status_icon_quit_cb,
NULL);
- g_signal_connect (priv->show_window_item, "toggled",
- G_CALLBACK (status_icon_show_hide_window_cb),
- icon);
-
g_object_unref (glade);
}
@@ -538,7 +541,10 @@ static void
status_icon_show_hide_window_cb (GtkWidget *widget,
EmpathyStatusIcon *icon)
{
- status_icon_toggle_visibility (icon);
+ gboolean visible;
+
+ visible = gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget));
+ status_icon_set_visibility (icon, visible);
}
static void
diff --git a/libempathy/empathy-tp-chatroom.c b/libempathy/empathy-tp-chatroom.c
index 60e0dd7cd..13b43ba37 100644
--- a/libempathy/empathy-tp-chatroom.c
+++ b/libempathy/empathy-tp-chatroom.c
@@ -183,10 +183,10 @@ empathy_tp_chatroom_get_invitation (EmpathyTpChatroom *chatroom,
priv = GET_PRIV (chatroom);
- if (*contact) {
+ if (contact) {
*contact = priv->invitor;
}
- if (*message) {
+ if (message) {
*message = priv->invit_message;
}
@@ -203,6 +203,10 @@ empathy_tp_chatroom_accept_invitation (EmpathyTpChatroom *chatroom)
priv = GET_PRIV (chatroom);
+ if (!priv->is_invited) {
+ return;
+ }
+
/* Clear invitation data */
priv->is_invited = FALSE;
if (priv->invitor) {