diff options
author | Xavier Claessens <xclaesse@gmail.com> | 2007-10-19 17:34:22 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2007-10-19 17:34:22 +0800 |
commit | fb7cd00dd189d63114185facb9f161375301ca40 (patch) | |
tree | 3c2b71a079fb09c6e475126d28c9b6e220c2a9b9 /libempathy-gtk | |
parent | 7ff8c4bb2cf473890a854582335da5ddeba78e55 (diff) | |
download | gsoc2013-empathy-fb7cd00dd189d63114185facb9f161375301ca40.tar gsoc2013-empathy-fb7cd00dd189d63114185facb9f161375301ca40.tar.gz gsoc2013-empathy-fb7cd00dd189d63114185facb9f161375301ca40.tar.bz2 gsoc2013-empathy-fb7cd00dd189d63114185facb9f161375301ca40.tar.lz gsoc2013-empathy-fb7cd00dd189d63114185facb9f161375301ca40.tar.xz gsoc2013-empathy-fb7cd00dd189d63114185facb9f161375301ca40.tar.zst gsoc2013-empathy-fb7cd00dd189d63114185facb9f161375301ca40.zip |
Don't accept invitation if we are not invited.
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.
svn path=/trunk/; revision=378
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-group-chat.c | 5 | ||||
-rw-r--r-- | libempathy-gtk/empathy-status-icon.c | 38 |
2 files changed, 25 insertions, 18 deletions
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 |