aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-main-window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/empathy-main-window.c')
-rw-r--r--src/empathy-main-window.c89
1 files changed, 61 insertions, 28 deletions
diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c
index 9015a5d25..5830d2b71 100644
--- a/src/empathy-main-window.c
+++ b/src/empathy-main-window.c
@@ -15,9 +15,9 @@
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ *
* Authors: Xavier Claessens <xclaesse@gmail.com>
*/
@@ -57,8 +57,10 @@
#include "empathy-about-dialog.h"
#include "empathy-debug-dialog.h"
#include "empathy-new-chatroom-dialog.h"
+#include "empathy-map-view.h"
#include "empathy-chatrooms-window.h"
#include "empathy-event-manager.h"
+#include "empathy-ft-manager.h"
#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
#include <libempathy/empathy-debug.h>
@@ -93,7 +95,7 @@ typedef struct {
GtkWidget *errors_vbox;
GtkUIManager *ui_manager;
- GtkAction *chat_history;
+ GtkAction *view_history;
GtkAction *room_join_favorites;
GtkWidget *room_menu;
GtkWidget *room_separator;
@@ -133,7 +135,7 @@ main_window_flash_foreach (GtkTreeModel *model,
GtkTreeIter *iter,
gpointer user_data)
{
- FlashForeachData *data = (FlashForeachData*) user_data;
+ FlashForeachData *data = (FlashForeachData *) user_data;
EmpathyContact *contact;
const gchar *icon_name;
GtkTreePath *parent_path = NULL;
@@ -165,7 +167,7 @@ main_window_flash_foreach (GtkTreeModel *model,
/* To make sure the parent is shown correctly, we emit
* the row-changed signal on the parent so it prompts
- * it to be refreshed by the filter func.
+ * it to be refreshed by the filter func.
*/
if (gtk_tree_model_iter_parent (model, &parent_iter, iter)) {
parent_path = gtk_tree_model_get_path (model, &parent_iter);
@@ -562,8 +564,8 @@ main_window_connection_changed_cb (EmpathyAccountManager *manager,
static void
main_window_contact_presence_changed_cb (EmpathyContactMonitor *monitor,
EmpathyContact *contact,
- McPresence current,
- McPresence previous,
+ TpConnectionPresenceType current,
+ TpConnectionPresenceType previous,
EmpathyMainWindow *window)
{
McAccount *account;
@@ -576,18 +578,25 @@ main_window_contact_presence_changed_cb (EmpathyContactMonitor *monitor,
return;
}
- if (previous < MC_PRESENCE_AVAILABLE && current > MC_PRESENCE_OFFLINE) {
- /* someone is logging in */
- empathy_sound_play (GTK_WIDGET (window->window),
- EMPATHY_SOUND_CONTACT_CONNECTED);
- return;
- }
-
- if (previous > MC_PRESENCE_OFFLINE && current < MC_PRESENCE_AVAILABLE) {
- /* someone is logging off */
- empathy_sound_play (GTK_WIDGET (window->window),
- EMPATHY_SOUND_CONTACT_DISCONNECTED);
- }
+ if (tp_connection_presence_type_cmp_availability (previous,
+ TP_CONNECTION_PRESENCE_TYPE_OFFLINE) > 0)
+ {
+ /* contact was online */
+ if (tp_connection_presence_type_cmp_availability (current,
+ TP_CONNECTION_PRESENCE_TYPE_OFFLINE) <= 0)
+ /* someone is logging off */
+ empathy_sound_play (GTK_WIDGET (window->window),
+ EMPATHY_SOUND_CONTACT_DISCONNECTED);
+ }
+ else
+ {
+ /* contact was offline */
+ if (tp_connection_presence_type_cmp_availability (current,
+ TP_CONNECTION_PRESENCE_TYPE_OFFLINE) > 0)
+ /* someone is logging in */
+ empathy_sound_play (GTK_WIDGET (window->window),
+ EMPATHY_SOUND_CONTACT_CONNECTED);
+ }
}
static void
@@ -663,7 +672,7 @@ main_window_chat_quit_cb (GtkAction *action,
}
static void
-main_window_chat_history_cb (GtkAction *action,
+main_window_view_history_cb (GtkAction *action,
EmpathyMainWindow *window)
{
empathy_log_window_show (NULL, NULL, FALSE, GTK_WINDOW (window->window));
@@ -684,7 +693,14 @@ main_window_chat_add_contact_cb (GtkAction *action,
}
static void
-main_window_chat_show_offline_cb (GtkToggleAction *action,
+main_window_view_show_ft_manager (GtkAction *action,
+ EmpathyMainWindow *window)
+{
+ empathy_ft_manager_show ();
+}
+
+static void
+main_window_view_show_offline_cb (GtkToggleAction *action,
EmpathyMainWindow *window)
{
gboolean current;
@@ -701,6 +717,15 @@ main_window_chat_show_offline_cb (GtkToggleAction *action,
}
static void
+main_window_view_show_map_cb (GtkCheckMenuItem *item,
+ EmpathyMainWindow *window)
+{
+#if HAVE_LIBCHAMPLAIN
+ empathy_map_view_show ();
+#endif
+}
+
+static void
main_window_favorite_chatroom_join (EmpathyChatroom *chatroom)
{
EmpathyAccountManager *manager;
@@ -986,7 +1011,7 @@ main_window_account_created_or_deleted_cb (EmpathyAccountManager *manager,
McAccount *account,
EmpathyMainWindow *window)
{
- gtk_action_set_sensitive (window->chat_history,
+ gtk_action_set_sensitive (window->view_history,
empathy_account_manager_get_count (manager) > 0);
}
@@ -1046,7 +1071,7 @@ main_window_notify_sort_criterium_cb (EmpathyConf *conf,
g_free (str);
if (enum_value) {
- empathy_contact_list_store_set_sort_criterium (window->list_store,
+ empathy_contact_list_store_set_sort_criterium (window->list_store,
enum_value->value);
}
}
@@ -1090,6 +1115,7 @@ empathy_main_window_show (void)
GtkWidget *sw;
GtkToggleAction *show_offline_widget;
GtkWidget *ebox;
+ GtkAction *show_map_widget;
GtkToolItem *item;
gboolean show_offline;
gboolean show_avatars;
@@ -1112,8 +1138,9 @@ empathy_main_window_show (void)
"main_vbox", &window->main_vbox,
"errors_vbox", &window->errors_vbox,
"ui_manager", &window->ui_manager,
- "chat_show_offline", &show_offline_widget,
- "chat_history", &window->chat_history,
+ "view_show_offline", &show_offline_widget,
+ "view_history", &window->view_history,
+ "view_show_map", &show_map_widget,
"room_join_favorites", &window->room_join_favorites,
"presence_toolbar", &window->presence_toolbar,
"roster_scrolledwindow", &sw,
@@ -1125,12 +1152,14 @@ empathy_main_window_show (void)
"main_window", "configure_event", main_window_configure_event_cb,
"chat_quit", "activate", main_window_chat_quit_cb,
"chat_new_message", "activate", main_window_chat_new_message_cb,
- "chat_history", "activate", main_window_chat_history_cb,
+ "view_history", "activate", main_window_view_history_cb,
"room_join_new", "activate", main_window_room_join_new_cb,
"room_join_favorites", "activate", main_window_room_join_favorites_cb,
"room_manage_favorites", "activate", main_window_room_manage_favorites_cb,
"chat_add_contact", "activate", main_window_chat_add_contact_cb,
- "chat_show_offline", "toggled", main_window_chat_show_offline_cb,
+ "view_show_ft_manager", "activate", main_window_view_show_ft_manager,
+ "view_show_offline", "toggled", main_window_view_show_offline_cb,
+ "view_show_map", "activate", main_window_view_show_map_cb,
"edit", "activate", main_window_edit_cb,
"edit_accounts", "activate", main_window_edit_accounts_cb,
"edit_personal_information", "activate", main_window_edit_personal_information_cb,
@@ -1146,6 +1175,10 @@ empathy_main_window_show (void)
g_object_ref (window->ui_manager);
g_object_unref (gui);
+#if !HAVE_LIBCHAMPLAIN
+ gtk_action_set_visible (show_map_widget, FALSE);
+#endif
+
window->mc = empathy_mission_control_dup_singleton ();
window->account_manager = empathy_account_manager_dup_singleton ();