diff options
-rw-r--r-- | libempathy-gtk/empathy-main-window.c | 33 | ||||
-rw-r--r-- | libempathy-gtk/empathy-main-window.glade | 85 | ||||
-rw-r--r-- | libempathy-gtk/gossip-presence-chooser.c | 21 | ||||
-rw-r--r-- | libempathy-gtk/gossip-status-presets.c | 25 | ||||
-rw-r--r-- | libempathy-gtk/gossip-status-presets.dtd | 6 | ||||
-rw-r--r-- | libempathy/gossip-presence.c | 36 | ||||
-rw-r--r-- | libempathy/gossip-presence.h | 1 | ||||
-rw-r--r-- | src/Makefile.am | 5 | ||||
-rw-r--r-- | src/empathy-main.c | 39 | ||||
-rw-r--r-- | src/empathy.desktop.in | 11 |
10 files changed, 100 insertions, 162 deletions
diff --git a/libempathy-gtk/empathy-main-window.c b/libempathy-gtk/empathy-main-window.c index f293f55c3..563129dc4 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, @@ -394,24 +379,6 @@ main_window_chat_quit_cb (GtkWidget *widget, } 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 3dacc2005..f2ed665d8 100644 --- a/libempathy-gtk/empathy-main-window.glade +++ b/libempathy-gtk/empathy-main-window.glade @@ -42,52 +42,6 @@ <widget class="GtkMenu" id="chat_menu"> <child> - <widget class="GtkImageMenuItem" id="chat_connect"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Connect</property> - <property name="use_underline">True</property> - - <child internal-child="image"> - <widget class="GtkImage" id="image874"> - <property name="visible">True</property> - <property name="stock">gtk-connect</property> - <property name="icon_size">1</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - </child> - </widget> - </child> - - <child> - <widget class="GtkImageMenuItem" id="chat_disconnect"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Disconnect</property> - <property name="use_underline">True</property> - - <child internal-child="image"> - <widget class="GtkImage" id="image875"> - <property name="visible">True</property> - <property name="stock">gtk-disconnect</property> - <property name="icon_size">1</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - </child> - </widget> - </child> - - <child> - <widget class="GtkSeparatorMenuItem" id="separator1"> - <property name="visible">True</property> - </widget> - </child> - - <child> <widget class="GtkImageMenuItem" id="chat_new_message"> <property name="visible">True</property> <property name="label" translatable="yes">_New Message...</property> @@ -95,7 +49,7 @@ <accelerator key="N" modifiers="GDK_CONTROL_MASK" signal="activate"/> <child internal-child="image"> - <widget class="GtkImage" id="image876"> + <widget class="GtkImage" id="image885"> <property name="visible">True</property> <property name="pixbuf">gossip-message.png</property> <property name="xalign">0.5</property> @@ -115,7 +69,7 @@ <accelerator key="F3" modifiers="0" signal="activate"/> <child internal-child="image"> - <widget class="GtkImage" id="image877"> + <widget class="GtkImage" id="image886"> <property name="visible">True</property> <property name="stock">gtk-justify-left</property> <property name="icon_size">1</property> @@ -141,7 +95,7 @@ <property name="use_underline">True</property> <child internal-child="image"> - <widget class="GtkImage" id="image878"> + <widget class="GtkImage" id="image887"> <property name="visible">True</property> <property name="stock">gtk-add</property> <property name="icon_size">1</property> @@ -155,27 +109,6 @@ </child> <child> - <widget class="GtkImageMenuItem" id="chat_search"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Search</property> - <property name="use_underline">True</property> - <accelerator key="S" modifiers="GDK_CONTROL_MASK" signal="activate"/> - - <child internal-child="image"> - <widget class="GtkImage" id="image879"> - <property name="visible">True</property> - <property name="stock">gtk-find</property> - <property name="icon_size">1</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - </child> - </widget> - </child> - - <child> <widget class="GtkSeparatorMenuItem" id="separator3"> <property name="visible">True</property> </widget> @@ -205,7 +138,7 @@ <accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/> <child internal-child="image"> - <widget class="GtkImage" id="image880"> + <widget class="GtkImage" id="image888"> <property name="visible">True</property> <property name="stock">gtk-quit</property> <property name="icon_size">1</property> @@ -238,7 +171,7 @@ <property name="use_underline">True</property> <child internal-child="image"> - <widget class="GtkImage" id="image881"> + <widget class="GtkImage" id="image889"> <property name="visible">True</property> <property name="stock">gtk-new</property> <property name="icon_size">1</property> @@ -279,7 +212,7 @@ <property name="use_underline">True</property> <child internal-child="image"> - <widget class="GtkImage" id="image882"> + <widget class="GtkImage" id="image890"> <property name="visible">True</property> <property name="pixbuf">gossip-group-message.png</property> <property name="xalign">0.5</property> @@ -348,7 +281,7 @@ <property name="use_underline">True</property> <child internal-child="image"> - <widget class="GtkImage" id="image883"> + <widget class="GtkImage" id="image891"> <property name="visible">True</property> <property name="stock">gtk-preferences</property> <property name="icon_size">1</property> @@ -382,7 +315,7 @@ <accelerator key="F1" modifiers="0" signal="activate"/> <child internal-child="image"> - <widget class="GtkImage" id="image884"> + <widget class="GtkImage" id="image892"> <property name="visible">True</property> <property name="stock">gtk-help</property> <property name="icon_size">1</property> @@ -402,7 +335,7 @@ <property name="use_underline">True</property> <child internal-child="image"> - <widget class="GtkImage" id="image885"> + <widget class="GtkImage" id="image893"> <property name="visible">True</property> <property name="stock">gtk-about</property> <property name="icon_size">1</property> diff --git a/libempathy-gtk/gossip-presence-chooser.c b/libempathy-gtk/gossip-presence-chooser.c index 16b411f31..e540c8a4e 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 fce8a08d4..b27238d4f 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 49c797b1f..b7acc9620 100644 --- a/libempathy-gtk/gossip-status-presets.dtd +++ b/libempathy-gtk/gossip-status-presets.dtd @@ -7,10 +7,8 @@ <!ELEMENT presets ((default?),status*)> <!ELEMENT default (#PCDATA)> -<!ATTLIST default - presence (available|busy|away|ext_away) "available"> +<!ATTLIST default presence CDATA #REQUIRED> <!ELEMENT status (#PCDATA)> -<!ATTLIST status - presence (available|busy|away|ext_away) "available"> +<!ATTLIST status presence CDATA #REQUIRED> diff --git a/libempathy/gossip-presence.c b/libempathy/gossip-presence.c index 1b04abc8f..ab0973d90 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 4aa2aa668..0029906f3 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 4fe517deb..b9c9ca2e8 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 15f4c504f..94e29e2b5 100644 --- a/src/empathy-main.c +++ b/src/empathy-main.c @@ -36,6 +36,7 @@ #include <libempathy/empathy-session.h> #include <libempathy/gossip-debug.h> #include <libempathy-gtk/empathy-main-window.h> +#include <libempathy-gtk/gossip-status-presets.h> #include <libempathy-gtk/gossip-stock.h> #include <libempathy-gtk/gossip-accounts-dialog.h> @@ -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 000000000..3e0ea16b8 --- /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 + |