]> git.0d.be Git - empathy.git/commitdiff
[darcs-to-svn @ Autostart]
authorXavier Claessens <xclaesse@src.gnome.org>
Wed, 2 May 2007 17:39:27 +0000 (17:39 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Wed, 2 May 2007 17:39:27 +0000 (17:39 +0000)
svn path=/trunk/; revision=27

libempathy-gtk/empathy-main-window.c
libempathy-gtk/empathy-main-window.glade
libempathy-gtk/gossip-presence-chooser.c
libempathy-gtk/gossip-status-presets.c
libempathy-gtk/gossip-status-presets.dtd
libempathy/gossip-presence.c
libempathy/gossip-presence.h
src/Makefile.am
src/empathy-main.c
src/empathy.desktop.in [new file with mode: 0644]

index f293f55c3818b3a8e695eb23879b1e3edd6ec499..563129dc4b63a52f93bdc58e259f4c6d39eefdbd 100644 (file)
@@ -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)
index 3dacc2005dc8eab3fd65d2a33f70bfd4ccc0023c..f2ed665d851d74d258085b6d160c0772ee6658ae 100644 (file)
              <child>
                <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>
@@ -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>
                      <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>
                      <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>
                    </widget>
                  </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>
                      <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>
                      <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>
                      <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>
                      <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>
                      <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>
                      <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>
index 16b411f31b45530a7bc523a42a6f9e388df31e8a..e540c8a4eb54bd2f2127a5cf14e0c9d95fc36605 100644 (file)
@@ -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,
index fce8a08d4fdb852f4ca5b08cf3f9a82ee59dc504..b27238d4fb4b5c4b4ee19289ff7083bb337f4eaf 100644 (file)
@@ -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;
index 49c797b1f73213609763cd837d05c90ad9cde97f..b7acc96207fcbe4aecd2091f0bdf9bc40f5f46dc 100644 (file)
@@ -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>
 
index 1b04abc8fa5281f5d5ffc34ffbbf7d421c489fb1..ab0973d90b2ebaeb0fd359deb760be7d85677bf1 100644 (file)
@@ -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;
index 4aa2aa66818280426db2e5f508953d3ab39cf216..0029906f378cdad6f2db90ee48e5ea8f0639e5b0 100644 (file)
@@ -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
index 4fe517debc024b40c3a8998aed6cef1418e7289a..b9c9ca2e844eb22cd19a64157890e2f8a13b1fee 100644 (file)
@@ -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@
index 15f4c504f263f2b0d0e6fa854b70cf698e07242d..94e29e2b510f5a318c4f9fceaaeb777150a648ce 100644 (file)
@@ -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 (file)
index 0000000..3e0ea16
--- /dev/null
@@ -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
+