From: Xavier Claessens Date: Wed, 2 May 2007 17:39:27 +0000 (+0000) Subject: [darcs-to-svn @ Autostart] X-Git-Url: https://git.0d.be/?p=empathy.git;a=commitdiff_plain;h=563cdc5a284bc85957f60b14048ba6e42a0c7c87 [darcs-to-svn @ Autostart] svn path=/trunk/; revision=27 --- diff --git a/libempathy-gtk/empathy-main-window.c b/libempathy-gtk/empathy-main-window.c index f293f55c..563129dc 100644 --- a/libempathy-gtk/empathy-main-window.c +++ b/libempathy-gtk/empathy-main-window.c @@ -70,9 +70,6 @@ typedef struct { GtkTooltips *tooltips; /* Menu widgets */ - GtkWidget *chat_connect; - GtkWidget *chat_disconnect; - GtkWidget *chat_search; GtkWidget *room; GtkWidget *room_menu; GtkWidget *room_sep; @@ -100,12 +97,6 @@ static void main_window_destroy_cb (GtkWidget static void main_window_favorite_chatroom_menu_setup (void); static void main_window_chat_quit_cb (GtkWidget *widget, EmpathyMainWindow *window); -static void main_window_chat_connect_cb (GtkWidget *widget, - EmpathyMainWindow *window); -static void main_window_chat_disconnect_cb (GtkWidget *widget, - EmpathyMainWindow *window); -static void main_window_chat_search_cb (GtkWidget *widget, - EmpathyMainWindow *window); static void main_window_chat_new_message_cb (GtkWidget *widget, EmpathyMainWindow *window); static void main_window_chat_history_cb (GtkWidget *widget, @@ -192,9 +183,6 @@ empathy_main_window_show (void) NULL, "main_window", &window->window, "main_vbox", &window->main_vbox, - "chat_connect", &window->chat_connect, - "chat_disconnect", &window->chat_disconnect, - "chat_search", &window->chat_search, "chat_show_offline", &show_offline_widget, "room", &window->room, "room_sep", &window->room_sep, @@ -210,9 +198,6 @@ empathy_main_window_show (void) "main_window", "destroy", main_window_destroy_cb, "main_window", "configure_event", main_window_configure_event_cb, "chat_quit", "activate", main_window_chat_quit_cb, - "chat_connect", "activate", main_window_chat_connect_cb, - "chat_disconnect", "activate", main_window_chat_disconnect_cb, - "chat_search", "activate", main_window_chat_search_cb, "chat_new_message", "activate", main_window_chat_new_message_cb, "chat_history", "activate", main_window_chat_history_cb, "room_join_new", "activate", main_window_room_join_new_cb, @@ -393,24 +378,6 @@ main_window_chat_quit_cb (GtkWidget *widget, gtk_widget_destroy (window->window); } -static void -main_window_chat_connect_cb (GtkWidget *widget, - EmpathyMainWindow *window) -{ -} - -static void -main_window_chat_disconnect_cb (GtkWidget *widget, - EmpathyMainWindow *window) -{ -} - -static void -main_window_chat_search_cb (GtkWidget *widget, - EmpathyMainWindow *window) -{ -} - static void main_window_chat_new_message_cb (GtkWidget *widget, EmpathyMainWindow *window) diff --git a/libempathy-gtk/empathy-main-window.glade b/libempathy-gtk/empathy-main-window.glade index 3dacc200..f2ed665d 100644 --- a/libempathy-gtk/empathy-main-window.glade +++ b/libempathy-gtk/empathy-main-window.glade @@ -41,52 +41,6 @@ - - - True - _Connect - True - - - - True - gtk-connect - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - True - _Disconnect - True - - - - True - gtk-disconnect - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - True - - - True @@ -95,7 +49,7 @@ - + True gossip-message.png 0.5 @@ -115,7 +69,7 @@ - + True gtk-justify-left 1 @@ -141,7 +95,7 @@ True - + True gtk-add 1 @@ -154,27 +108,6 @@ - - - True - _Search - True - - - - - True - gtk-find - 1 - 0.5 - 0.5 - 0 - 0 - - - - - True @@ -205,7 +138,7 @@ - + True gtk-quit 1 @@ -238,7 +171,7 @@ True - + True gtk-new 1 @@ -279,7 +212,7 @@ True - + True gossip-group-message.png 0.5 @@ -348,7 +281,7 @@ True - + True gtk-preferences 1 @@ -382,7 +315,7 @@ - + True gtk-help 1 @@ -402,7 +335,7 @@ True - + True gtk-about 1 diff --git a/libempathy-gtk/gossip-presence-chooser.c b/libempathy-gtk/gossip-presence-chooser.c index 16b411f3..e540c8a4 100644 --- a/libempathy-gtk/gossip-presence-chooser.c +++ b/libempathy-gtk/gossip-presence-chooser.c @@ -830,15 +830,16 @@ gossip_presence_chooser_new (void) GtkWidget * gossip_presence_chooser_create_menu (GossipPresenceChooser *chooser) { + const gchar *status; GtkWidget *menu; GtkWidget *item; + GtkWidget *image; guint i; menu = gtk_menu_new (); for (i = 0; i < G_N_ELEMENTS (states); i++) { GList *list, *l; - const gchar *status; status = gossip_presence_state_get_default_status (states[i]); presence_chooser_menu_add_item (chooser, @@ -869,8 +870,24 @@ gossip_presence_chooser_create_menu (GossipPresenceChooser *chooser) gtk_widget_show (item); } - item = gtk_menu_item_new_with_label (_("Clear List...")); + /* Offline to disconnect */ + status = gossip_presence_state_get_default_status (MC_PRESENCE_OFFLINE); + presence_chooser_menu_add_item (chooser, + menu, + status, + MC_PRESENCE_OFFLINE, + FALSE); + /* Separator. */ + item = gtk_menu_item_new (); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + gtk_widget_show (item); + + /* Clear list */ + item = gtk_image_menu_item_new_with_label (_("Clear List...")); + image = gtk_image_new_from_stock (GTK_STOCK_CLEAR, GTK_ICON_SIZE_MENU); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + gtk_widget_show (image); gtk_widget_show (item); g_signal_connect (item, diff --git a/libempathy-gtk/gossip-status-presets.c b/libempathy-gtk/gossip-status-presets.c index fce8a08d..b27238d4 100644 --- a/libempathy-gtk/gossip-status-presets.c +++ b/libempathy-gtk/gossip-status-presets.c @@ -152,7 +152,7 @@ status_presets_file_parse (const gchar *filename) /* Use the default if not set */ if (!default_preset) { - status_presets_set_default (MC_PRESENCE_AVAILABLE, NULL); + status_presets_set_default (MC_PRESENCE_OFFLINE, NULL); } gossip_debug (DEBUG_DOMAIN, "Parsed %d status presets", g_list_length (presets)); @@ -186,23 +186,6 @@ gossip_status_presets_get_all (void) g_free (file_with_path); } -const gchar * -status_presets_get_state_as_str (McPresence state) -{ - switch (state) { - case MC_PRESENCE_AVAILABLE: - return "available"; - case MC_PRESENCE_DO_NOT_DISTURB: - return "busy"; - case MC_PRESENCE_AWAY: - return "away"; - case MC_PRESENCE_EXTENDED_AWAY: - return "ext_away"; - default: - return "unknown"; - } -} - static gboolean status_presets_file_save (void) { @@ -231,7 +214,7 @@ status_presets_file_save (void) xmlNodePtr subnode; xmlChar *state; - state = (gchar*) status_presets_get_state_as_str (default_preset->state); + state = (gchar*) gossip_presence_state_to_str (default_preset->state); subnode = xmlNewTextChild (root, NULL, "default", default_preset->status); @@ -244,7 +227,7 @@ status_presets_file_save (void) xmlChar *state; sp = l->data; - state = (gchar*) status_presets_get_state_as_str (sp->state); + state = (gchar*) gossip_presence_state_to_str (sp->state); count[sp->state]++; if (count[sp->state] > STATUS_PRESETS_MAX_EACH) { @@ -358,7 +341,7 @@ McPresence gossip_status_presets_get_default_state (void) { if (!default_preset) { - return MC_PRESENCE_AVAILABLE; + return MC_PRESENCE_OFFLINE; } return default_preset->state; diff --git a/libempathy-gtk/gossip-status-presets.dtd b/libempathy-gtk/gossip-status-presets.dtd index 49c797b1..b7acc962 100644 --- a/libempathy-gtk/gossip-status-presets.dtd +++ b/libempathy-gtk/gossip-status-presets.dtd @@ -7,10 +7,8 @@ - + - + diff --git a/libempathy/gossip-presence.c b/libempathy/gossip-presence.c index 1b04abc8..ab0973d9 100644 --- a/libempathy/gossip-presence.c +++ b/libempathy/gossip-presence.c @@ -281,8 +281,35 @@ gossip_presence_state_get_default_status (McPresence state) return _("Unavailable"); case MC_PRESENCE_OFFLINE: return _("Offline"); + case MC_PRESENCE_UNSET: + return _("Unset"); default: - return NULL; + g_assert_not_reached (); + } + + return NULL; +} + +const gchar * +gossip_presence_state_to_str (McPresence state) +{ + switch (state) { + case MC_PRESENCE_AVAILABLE: + return "available"; + case MC_PRESENCE_DO_NOT_DISTURB: + return "busy"; + case MC_PRESENCE_AWAY: + return "away"; + case MC_PRESENCE_EXTENDED_AWAY: + return "ext_away"; + case MC_PRESENCE_HIDDEN: + return "hidden"; + case MC_PRESENCE_OFFLINE: + return "offline"; + case MC_PRESENCE_UNSET: + return "unset"; + default: + g_assert_not_reached (); } return NULL; @@ -303,9 +330,10 @@ gossip_presence_state_from_str (const gchar *str) return MC_PRESENCE_HIDDEN; } else if (strcmp (str, "offline") == 0) { return MC_PRESENCE_OFFLINE; - } else if (strcmp (str, "chat") == 0) { - /* We don't support chat, so treat it like available. */ - return MC_PRESENCE_AVAILABLE; + } else if (strcmp (str, "unset") == 0) { + return MC_PRESENCE_UNSET; + } else { + g_assert_not_reached (); } return MC_PRESENCE_AVAILABLE; diff --git a/libempathy/gossip-presence.h b/libempathy/gossip-presence.h index 4aa2aa66..0029906f 100644 --- a/libempathy/gossip-presence.h +++ b/libempathy/gossip-presence.h @@ -58,6 +58,7 @@ void gossip_presence_set_status (GossipPresence *pr gint gossip_presence_sort_func (gconstpointer a, gconstpointer b); const gchar * gossip_presence_state_get_default_status (McPresence state); +const gchar * gossip_presence_state_to_str (McPresence state); McPresence gossip_presence_state_from_str (const gchar *str); G_END_DECLS diff --git a/src/Makefile.am b/src/Makefile.am index 4fe517de..b9c9ca2e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -17,4 +17,7 @@ empathy_LDADD = \ $(top_builddir)/libempathy-gtk/libempathy-gtk.la \ $(EMPATHY_LIBS) - +autostartdir = $(datadir)/gnome/autostart +autostart_in_files = empathy.desktop.in +autostart_DATA = $(autostart_in_files:.desktop.in=.desktop) +@INTLTOOL_DESKTOP_RULE@ diff --git a/src/empathy-main.c b/src/empathy-main.c index 15f4c504..94e29e2b 100644 --- a/src/empathy-main.c +++ b/src/empathy-main.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -85,23 +86,19 @@ start_mission_control (MissionControl *mc) presence = mission_control_get_presence_actual (mc, NULL); - if (presence != MC_PRESENCE_UNSET && - presence != MC_PRESENCE_OFFLINE) { + if (presence > MC_PRESENCE_OFFLINE) { /* MC is already running and online, nothing to do */ return; } gossip_debug (DEBUG_DOMAIN, "Starting Mission Control..."); - /* FIXME: Save/Restore status message */ - mission_control_set_presence (mc, MC_PRESENCE_AVAILABLE, - NULL, + gossip_status_presets_get_all (); + mission_control_set_presence (mc, + gossip_status_presets_get_default_state (), + gossip_status_presets_get_default_status (), (McCallback) error_cb, NULL); - - mission_control_connect_all_with_default_presence (mc, - (McCallback) error_cb, - NULL); } static void @@ -138,6 +135,17 @@ main (int argc, char *argv[]) /* FIXME: This is a horrible hack */ gossip_stock_init (gtk_window_new (GTK_WINDOW_TOPLEVEL)); + /* Setting up MC */ + monitor = mc_account_monitor_new (); + mc = mission_control_new (tp_get_bus ()); + g_signal_connect (monitor, "account-enabled", + G_CALLBACK (account_enabled_cb), + mc); + g_signal_connect (mc, "ServiceEnded", + G_CALLBACK (service_ended_cb), + NULL); + start_mission_control (mc); + /* Setting up the main window */ window = empathy_main_window_show (); g_signal_connect (window, "destroy", @@ -148,7 +156,7 @@ main (int argc, char *argv[]) NULL); /* Setting up the tray icon */ - icon = gtk_status_icon_new_from_stock (GOSSIP_STOCK_AVAILABLE); + icon = gtk_status_icon_new_from_stock (GOSSIP_STOCK_MESSAGE); gtk_status_icon_set_tooltip (icon, "Empathy - click here to show/hide the main window"); gtk_status_icon_set_visible (icon, TRUE); g_signal_connect (icon, "activate", @@ -163,17 +171,6 @@ main (int argc, char *argv[]) gossip_accounts_dialog_show (); } - /* Setting up MC */ - monitor = mc_account_monitor_new (); - mc = mission_control_new (tp_get_bus ()); - g_signal_connect (monitor, "account-enabled", - G_CALLBACK (account_enabled_cb), - mc); - g_signal_connect (mc, "ServiceEnded", - G_CALLBACK (service_ended_cb), - NULL); - start_mission_control (mc); - gtk_main (); g_object_unref (monitor); diff --git a/src/empathy.desktop.in b/src/empathy.desktop.in new file mode 100644 index 00000000..3e0ea16b --- /dev/null +++ b/src/empathy.desktop.in @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +_Name=Empathy +_Comment=Gnome Instant Messaging Client +Icon= +Exec=empathy +Terminal=false +Type=Application +Categories=Internet +OnlyShowIn=GNOME +