aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/Makefile.am42
-rw-r--r--libempathy-gtk/empathy-account-chooser.c20
-rw-r--r--libempathy-gtk/empathy-account-chooser.h8
-rw-r--r--libempathy-gtk/empathy-account-widget-irc.c4
-rw-r--r--libempathy-gtk/empathy-account-widget-sip.c6
-rw-r--r--libempathy-gtk/empathy-account-widget.c49
-rw-r--r--libempathy-gtk/empathy-account-widget.h8
-rw-r--r--libempathy-gtk/empathy-audio-sink.h2
-rw-r--r--libempathy-gtk/empathy-audio-src.h2
-rw-r--r--libempathy-gtk/empathy-avatar-chooser.c8
-rw-r--r--libempathy-gtk/empathy-avatar-chooser.h4
-rw-r--r--libempathy-gtk/empathy-avatar-image.c4
-rw-r--r--libempathy-gtk/empathy-avatar-image.h4
-rw-r--r--libempathy-gtk/empathy-cell-renderer-activatable.c2
-rw-r--r--libempathy-gtk/empathy-cell-renderer-expander.c10
-rw-r--r--libempathy-gtk/empathy-cell-renderer-expander.h6
-rw-r--r--libempathy-gtk/empathy-cell-renderer-text.c6
-rw-r--r--libempathy-gtk/empathy-cell-renderer-text.h6
-rw-r--r--libempathy-gtk/empathy-chat-text-view.c18
-rw-r--r--libempathy-gtk/empathy-chat-text-view.h6
-rw-r--r--libempathy-gtk/empathy-chat-view.c24
-rw-r--r--libempathy-gtk/empathy-chat-view.h6
-rw-r--r--libempathy-gtk/empathy-chat.c85
-rw-r--r--libempathy-gtk/empathy-chat.h4
-rw-r--r--libempathy-gtk/empathy-conf.c4
-rw-r--r--libempathy-gtk/empathy-conf.h11
-rw-r--r--libempathy-gtk/empathy-contact-dialogs.c4
-rw-r--r--libempathy-gtk/empathy-contact-list-store.c72
-rw-r--r--libempathy-gtk/empathy-contact-list-store.h7
-rw-r--r--libempathy-gtk/empathy-contact-list-view.c108
-rw-r--r--libempathy-gtk/empathy-contact-list-view.h4
-rw-r--r--libempathy-gtk/empathy-contact-menu.c58
-rw-r--r--libempathy-gtk/empathy-contact-menu.h5
-rw-r--r--libempathy-gtk/empathy-contact-selector.c4
-rw-r--r--libempathy-gtk/empathy-contact-widget.c252
-rw-r--r--libempathy-gtk/empathy-contact-widget.h1
-rw-r--r--libempathy-gtk/empathy-contact-widget.ui62
-rw-r--r--libempathy-gtk/empathy-geometry.c4
-rw-r--r--libempathy-gtk/empathy-geometry.h4
-rw-r--r--libempathy-gtk/empathy-images.h3
-rw-r--r--libempathy-gtk/empathy-irc-network-dialog.c4
-rw-r--r--libempathy-gtk/empathy-location-manager.c662
-rw-r--r--libempathy-gtk/empathy-location-manager.h57
-rw-r--r--libempathy-gtk/empathy-log-window.c10
-rw-r--r--libempathy-gtk/empathy-log-window.h6
-rw-r--r--libempathy-gtk/empathy-new-message-dialog.c10
-rw-r--r--libempathy-gtk/empathy-presence-chooser.c110
-rw-r--r--libempathy-gtk/empathy-presence-chooser.h4
-rw-r--r--libempathy-gtk/empathy-profile-chooser.c4
-rw-r--r--libempathy-gtk/empathy-smiley-manager.c11
-rw-r--r--libempathy-gtk/empathy-smiley-manager.h2
-rw-r--r--libempathy-gtk/empathy-spell-dialog.c264
-rw-r--r--libempathy-gtk/empathy-spell-dialog.h39
-rw-r--r--libempathy-gtk/empathy-spell-dialog.ui131
-rw-r--r--libempathy-gtk/empathy-spell.c4
-rw-r--r--libempathy-gtk/empathy-spell.h4
-rw-r--r--libempathy-gtk/empathy-status-preset-dialog.c69
-rw-r--r--libempathy-gtk/empathy-status-preset-dialog.h4
-rw-r--r--libempathy-gtk/empathy-theme-boxes.c8
-rw-r--r--libempathy-gtk/empathy-theme-boxes.h4
-rw-r--r--libempathy-gtk/empathy-theme-irc.c6
-rw-r--r--libempathy-gtk/empathy-theme-irc.h4
-rw-r--r--libempathy-gtk/empathy-theme-manager.c8
-rw-r--r--libempathy-gtk/empathy-theme-manager.h4
-rw-r--r--libempathy-gtk/empathy-ui-utils.c187
-rw-r--r--libempathy-gtk/empathy-ui-utils.h13
-rw-r--r--libempathy-gtk/empathy-video-src.c6
-rw-r--r--libempathy-gtk/empathy-video-src.h2
-rw-r--r--libempathy-gtk/empathy-video-widget.c4
-rw-r--r--libempathy-gtk/empathy-video-widget.h5
70 files changed, 1695 insertions, 888 deletions
diff --git a/libempathy-gtk/Makefile.am b/libempathy-gtk/Makefile.am
index 63bcf5ae3..4fd0fa562 100644
--- a/libempathy-gtk/Makefile.am
+++ b/libempathy-gtk/Makefile.am
@@ -1,3 +1,5 @@
+include $(top_srcdir)/tools/shave.mk
+
AM_CPPFLAGS = \
-I. \
-I$(top_srcdir) \
@@ -5,6 +7,8 @@ AM_CPPFLAGS = \
-DPKGDATADIR=\""$(pkgdatadir)"\" \
$(LIBEMPATHYGTK_CFLAGS) \
$(ENCHANT_CFLAGS) \
+ $(LIBCHAMPLAIN_CFLAGS) \
+ $(GEOCLUE_CFLAGS) \
$(WARN_CFLAGS) \
$(DISABLE_DEPRECATED)
@@ -17,7 +21,7 @@ BUILT_SOURCES = \
lib_LTLIBRARIES = libempathy-gtk.la
-libempathy_gtk_la_SOURCES = \
+libempathy_gtk_handwritten_source = \
empathy-account-chooser.c \
empathy-account-widget.c \
empathy-account-widget-irc.c \
@@ -49,12 +53,14 @@ libempathy_gtk_la_SOURCES = \
empathy-profile-chooser.c \
empathy-smiley-manager.c \
empathy-spell.c \
- empathy-spell-dialog.c \
empathy-status-preset-dialog.c \
empathy-theme-boxes.c \
empathy-theme-irc.c \
empathy-theme-manager.c \
- empathy-ui-utils.c \
+ empathy-ui-utils.c
+
+libempathy_gtk_la_SOURCES = \
+ $(libempathy_gtk_handwritten_source) \
totem-subtitle-encoding.c totem-subtitle-encoding.h
# do not distribute generated files
@@ -64,6 +70,8 @@ nodist_libempathy_gtk_la_SOURCES =\
libempathy_gtk_la_LIBADD = \
$(LIBEMPATHYGTK_LIBS) \
$(ENCHANT_LIBS) \
+ $(LIBCHAMPLAIN_LIBS) \
+ $(GEOCLUE_LIBS) \
$(top_builddir)/libempathy/libempathy.la
libempathy_gtk_la_LDFLAGS = \
@@ -103,13 +111,26 @@ libempathy_gtk_headers = \
empathy-profile-chooser.h \
empathy-smiley-manager.h \
empathy-spell.h \
- empathy-spell-dialog.h \
empathy-status-preset-dialog.h \
empathy-theme-boxes.h \
empathy-theme-irc.h \
empathy-theme-manager.h \
empathy-ui-utils.h
+if HAVE_GEOCLUE
+libempathy_gtk_handwritten_source += \
+ empathy-location-manager.c
+
+libempathy_gtk_headers += \
+ empathy-location-manager.h
+endif
+
+check_c_sources = \
+ $(libempathy_gtk_handwritten_source) \
+ $(libempathy_gtk_headers)
+include $(top_srcdir)/tools/check-coding-style.mk
+check-local: check-coding-style
+
libempathy_gtk_includedir = $(includedir)/libempathy-gtk/
libempathy_gtk_include_HEADERS = \
$(libempathy_gtk_headers) \
@@ -129,14 +150,13 @@ ui_DATA = \
empathy-account-widget-yahoo.ui \
empathy-account-widget-groupwise.ui \
empathy-account-widget-aim.ui \
- empathy-spell-dialog.ui \
empathy-status-preset-dialog.ui \
empathy-log-window.ui \
empathy-chat.ui \
empathy-new-message-dialog.ui
empathy-gtk-marshal.list: $(libempathy_gtk_la_SOURCES) Makefile.am
- ( cd $(srcdir) && \
+ $(QUIET_GEN)( cd $(srcdir) && \
sed -n -e 's/.*empathy_gtk_marshal_\([[:upper:][:digit:]]*__[[:upper:][:digit:]_]*\).*/\1/p' \
$(libempathy_gtk_la_SOURCES) ) \
| sed -e 's/__/:/' -e 'y/_/,/' | sort -u > $@.tmp
@@ -147,16 +167,16 @@ empathy-gtk-marshal.list: $(libempathy_gtk_la_SOURCES) Makefile.am
fi
%-marshal.h: %-marshal.list Makefile
- $(GLIB_GENMARSHAL) --header --prefix=_$(subst -,_,$*)_marshal $< > $*-marshal.h
+ $(QUIET_GEN)$(GLIB_GENMARSHAL) --header --prefix=_$(subst -,_,$*)_marshal $< > $*-marshal.h
%-marshal.c: %-marshal.list Makefile
- echo "#include \"empathy-gtk-marshal.h\"" > $@ && \
+ $(QUIET_GEN)echo "#include \"empathy-gtk-marshal.h\"" > $@ && \
$(GLIB_GENMARSHAL) --body --prefix=_$(subst -,_,$*)_marshal $< >> $*-marshal.c
empathy-gtk-enum-types.h: stamp-empathy-gtk-enum-types.h
- @true
+ $(QUIET_GEN)true
stamp-empathy-gtk-enum-types.h: Makefile $(libempathy_gtk_headers)
- (cd $(srcdir) \
+ $(QUIET_GEN)(cd $(srcdir) \
&& glib-mkenums \
--fhead "#ifndef __LIBEMPATHY_GTK_ENUM_TYPES_H__\n" \
--fhead "#define __LIBEMPATHY_GTK_ENUM_TYPES_H__ 1\n\n" \
@@ -173,7 +193,7 @@ stamp-empathy-gtk-enum-types.h: Makefile $(libempathy_gtk_headers)
&& echo timestamp > $(@F)
empathy-gtk-enum-types.c: Makefile $(libempathy_gtk_headers)
- (cd $(srcdir) \
+ $(QUIET_GEN)(cd $(srcdir) \
&& glib-mkenums \
--fhead "#include <config.h>\n" \
--fhead "#include <glib-object.h>\n" \
diff --git a/libempathy-gtk/empathy-account-chooser.c b/libempathy-gtk/empathy-account-chooser.c
index 5d11e8e1e..915b37b23 100644
--- a/libempathy-gtk/empathy-account-chooser.c
+++ b/libempathy-gtk/empathy-account-chooser.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: Martyn Russell <martyn@imendio.com>
* Xavier Claessens <xclaesse@gmail.com>
*/
@@ -401,22 +401,22 @@ empathy_account_chooser_set_has_all_option (EmpathyAccountChooser *chooser,
*/
if (has_all_option) {
- gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (chooser),
+ gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (chooser),
(GtkTreeViewRowSeparatorFunc)
account_chooser_separator_func,
- chooser,
+ chooser,
NULL);
gtk_list_store_prepend (store, &iter);
- gtk_list_store_set (store, &iter,
+ gtk_list_store_set (store, &iter,
COL_ACCOUNT_TEXT, NULL,
COL_ACCOUNT_ENABLED, TRUE,
COL_ACCOUNT_POINTER, NULL,
-1);
gtk_list_store_prepend (store, &iter);
- gtk_list_store_set (store, &iter,
- COL_ACCOUNT_TEXT, _("All"),
+ gtk_list_store_set (store, &iter,
+ COL_ACCOUNT_TEXT, _("All"),
COL_ACCOUNT_ENABLED, TRUE,
COL_ACCOUNT_POINTER, NULL,
-1);
@@ -427,10 +427,10 @@ empathy_account_chooser_set_has_all_option (EmpathyAccountChooser *chooser,
}
}
- gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (chooser),
+ gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (chooser),
(GtkTreeViewRowSeparatorFunc)
NULL,
- NULL,
+ NULL,
NULL);
}
diff --git a/libempathy-gtk/empathy-account-chooser.h b/libempathy-gtk/empathy-account-chooser.h
index 98d568bcc..004a3e87f 100644
--- a/libempathy-gtk/empathy-account-chooser.h
+++ b/libempathy-gtk/empathy-account-chooser.h
@@ -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: Martyn Russell <martyn@imendio.com>
* Xavier Claessens <xclaesse@gmail.com>
*/
@@ -68,7 +68,7 @@ void empathy_account_chooser_set_has_all_option (EmpathyAccountChooser
void empathy_account_chooser_set_filter (EmpathyAccountChooser *chooser,
EmpathyAccountChooserFilterFunc filter,
gpointer user_data);
-gboolean empathy_account_chooser_filter_is_connected(McAccount *account,
+gboolean empathy_account_chooser_filter_is_connected (McAccount *account,
gpointer user_data);
G_END_DECLS
diff --git a/libempathy-gtk/empathy-account-widget-irc.c b/libempathy-gtk/empathy-account-widget-irc.c
index cc86a5aaa..1306f517f 100644
--- a/libempathy-gtk/empathy-account-widget-irc.c
+++ b/libempathy-gtk/empathy-account-widget-irc.c
@@ -465,7 +465,7 @@ empathy_account_widget_irc_new (McAccount *account)
/* Fill the networks combobox */
store = gtk_list_store_new (2, G_TYPE_OBJECT, G_TYPE_STRING);
- gtk_cell_layout_clear (GTK_CELL_LAYOUT (settings->combobox_network));
+ gtk_cell_layout_clear (GTK_CELL_LAYOUT (settings->combobox_network));
renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (settings->combobox_network),
renderer, TRUE);
@@ -499,5 +499,7 @@ empathy_account_widget_irc_new (McAccount *account)
"combobox_network", "changed", account_widget_irc_combobox_network_changed_cb,
NULL);
+ empathy_account_widget_set_default_focus (gui, "entry_nick");
+
return empathy_builder_unref_and_keep_widget (gui, settings->vbox_settings);
}
diff --git a/libempathy-gtk/empathy-account-widget-sip.c b/libempathy-gtk/empathy-account-widget-sip.c
index 2d4944779..da6082495 100644
--- a/libempathy-gtk/empathy-account-widget-sip.c
+++ b/libempathy-gtk/empathy-account-widget-sip.c
@@ -63,8 +63,8 @@ account_widget_sip_discover_stun_toggled_cb (
gboolean active;
active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox));
- gtk_widget_set_sensitive(settings->entry_stun_server, !active);
- gtk_widget_set_sensitive(settings->spinbutton_stun_part, !active);
+ gtk_widget_set_sensitive (settings->entry_stun_server, !active);
+ gtk_widget_set_sensitive (settings->spinbutton_stun_part, !active);
}
/**
@@ -115,5 +115,7 @@ empathy_account_widget_sip_new (McAccount *account)
"checkbutton_discover-stun", "toggled", account_widget_sip_discover_stun_toggled_cb,
NULL);
+ empathy_account_widget_set_default_focus (gui, "entry_userid");
+
return empathy_builder_unref_and_keep_widget (gui, settings->vbox_settings);
}
diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c
index f20c47c3f..669869a4d 100644
--- a/libempathy-gtk/empathy-account-widget.c
+++ b/libempathy-gtk/empathy-account-widget.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>
* Martyn Russell <martyn@imendio.com>
*/
@@ -40,7 +40,7 @@
#define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT
#include <libempathy/empathy-debug.h>
-static gboolean
+static gboolean
account_widget_entry_focus_cb (GtkWidget *widget,
GdkEventFocus *event,
McAccount *account)
@@ -107,7 +107,7 @@ account_widget_int_changed_cb (GtkWidget *widget,
}
}
-static void
+static void
account_widget_checkbutton_toggled_cb (GtkWidget *widget,
McAccount *account)
{
@@ -157,7 +157,7 @@ account_widget_password_changed_cb (GtkWidget *entry,
gtk_widget_set_sensitive (button, !EMP_STR_EMPTY (str));
}
-static void
+static void
account_widget_jabber_ssl_toggled_cb (GtkWidget *checkbutton_ssl,
GtkWidget *spinbutton_port)
{
@@ -187,9 +187,9 @@ account_widget_setup_widget (GtkWidget *widget,
McAccount *account,
const gchar *param_name)
{
- g_object_set_data_full (G_OBJECT (widget), "param_name",
+ g_object_set_data_full (G_OBJECT (widget), "param_name",
g_strdup (param_name), g_free);
- g_object_set_data_full (G_OBJECT (widget), "account",
+ g_object_set_data_full (G_OBJECT (widget), "account",
g_object_ref (account), g_object_unref);
if (GTK_IS_SPIN_BUTTON (widget)) {
@@ -270,7 +270,7 @@ accounts_widget_generic_setup (McAccount *account,
if (!protocol) {
/* The CM is not installed, MC shouldn't list them
* see SF bug #1688779
- * FIXME: We should display something asking the user to
+ * FIXME: We should display something asking the user to
* install the CM
*/
g_object_unref (profile);
@@ -313,6 +313,11 @@ accounts_widget_generic_setup (McAccount *account,
gtk_widget_show (widget);
widget = gtk_entry_new ();
+ if (strcmp (param->name, "account") == 0) {
+ g_signal_connect (widget, "realize",
+ G_CALLBACK (gtk_widget_grab_focus),
+ NULL);
+ }
gtk_table_attach (GTK_TABLE (table_settings),
widget,
1, 2,
@@ -459,6 +464,18 @@ empathy_account_widget_add_forget_button (McAccount *account,
button_forget);
}
+void
+empathy_account_widget_set_default_focus (GtkBuilder *gui,
+ const gchar *entry)
+{
+ GObject *default_focus_entry;
+
+ default_focus_entry = gtk_builder_get_object (gui, entry);
+ g_signal_connect (default_focus_entry, "realize",
+ G_CALLBACK (gtk_widget_grab_focus),
+ NULL);
+}
+
GtkWidget *
empathy_account_widget_generic_new (McAccount *account)
{
@@ -507,6 +524,8 @@ empathy_account_widget_salut_new (McAccount *account)
"entry_jid", "jid",
NULL);
+ empathy_account_widget_set_default_focus (gui, "entry_nickname");
+
return empathy_builder_unref_and_keep_widget (gui, widget);
}
@@ -535,6 +554,8 @@ empathy_account_widget_msn_new (McAccount *account)
"button_forget",
"entry_password");
+ empathy_account_widget_set_default_focus (gui, "entry_id");
+
return empathy_builder_unref_and_keep_widget (gui, widget);
}
@@ -572,6 +593,8 @@ empathy_account_widget_jabber_new (McAccount *account)
"button_forget",
"entry_password");
+ empathy_account_widget_set_default_focus (gui, "entry_id");
+
g_signal_connect (checkbutton_ssl, "toggled",
G_CALLBACK (account_widget_jabber_ssl_toggled_cb),
spinbutton_port);
@@ -607,6 +630,8 @@ empathy_account_widget_icq_new (McAccount *account)
"button_forget",
"entry_password");
+ empathy_account_widget_set_default_focus (gui, "entry_uin");
+
return empathy_builder_unref_and_keep_widget (gui, widget);
}
@@ -637,6 +662,8 @@ empathy_account_widget_aim_new (McAccount *account)
"button_forget",
"entry_password");
+ empathy_account_widget_set_default_focus (gui, "entry_screenname");
+
return empathy_builder_unref_and_keep_widget (gui, widget);
}
@@ -669,6 +696,8 @@ empathy_account_widget_yahoo_new (McAccount *account)
"button_forget",
"entry_password");
+ empathy_account_widget_set_default_focus (gui, "entry_id");
+
return empathy_builder_unref_and_keep_widget (gui, widget);
}
@@ -697,6 +726,8 @@ empathy_account_widget_groupwise_new (McAccount *account)
"button_forget",
"entry_password");
+ empathy_account_widget_set_default_focus (gui, "entry_id");
+
return empathy_builder_unref_and_keep_widget (gui, widget);
}
diff --git a/libempathy-gtk/empathy-account-widget.h b/libempathy-gtk/empathy-account-widget.h
index 038439ee5..7287f5675 100644
--- a/libempathy-gtk/empathy-account-widget.h
+++ b/libempathy-gtk/empathy-account-widget.h
@@ -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>
* Martyn Russell <martyn@imendio.com>
*/
@@ -39,6 +39,8 @@ void empathy_account_widget_add_forget_button (McAccount *account,
GtkBuilder *gui,
const gchar *button,
const gchar *entry);
+void empathy_account_widget_set_default_focus (GtkBuilder *gui,
+ const gchar *entry);
GtkWidget *empathy_account_widget_generic_new (McAccount *account);
GtkWidget *empathy_account_widget_salut_new (McAccount *account);
GtkWidget *empathy_account_widget_msn_new (McAccount *account);
diff --git a/libempathy-gtk/empathy-audio-sink.h b/libempathy-gtk/empathy-audio-sink.h
index 57579dc3e..21ebf2b5a 100644
--- a/libempathy-gtk/empathy-audio-sink.h
+++ b/libempathy-gtk/empathy-audio-sink.h
@@ -41,7 +41,7 @@ GType empathy_audio_sink_get_type (void);
/* TYPE MACROS */
#define EMPATHY_TYPE_GST_AUDIO_SINK \
- (empathy_audio_sink_get_type())
+ (empathy_audio_sink_get_type ())
#define EMPATHY_GST_AUDIO_SINK(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), EMPATHY_TYPE_GST_AUDIO_SINK, \
EmpathyGstAudioSink))
diff --git a/libempathy-gtk/empathy-audio-src.h b/libempathy-gtk/empathy-audio-src.h
index 4f48fe1f7..4bca31b61 100644
--- a/libempathy-gtk/empathy-audio-src.h
+++ b/libempathy-gtk/empathy-audio-src.h
@@ -41,7 +41,7 @@ GType empathy_audio_src_get_type (void);
/* TYPE MACROS */
#define EMPATHY_TYPE_GST_AUDIO_SRC \
- (empathy_audio_src_get_type())
+ (empathy_audio_src_get_type ())
#define EMPATHY_GST_AUDIO_SRC(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), EMPATHY_TYPE_GST_AUDIO_SRC, \
EmpathyGstAudioSrc))
diff --git a/libempathy-gtk/empathy-avatar-chooser.c b/libempathy-gtk/empathy-avatar-chooser.c
index c86b85d25..0f4311e07 100644
--- a/libempathy-gtk/empathy-avatar-chooser.c
+++ b/libempathy-gtk/empathy-avatar-chooser.c
@@ -14,8 +14,8 @@
*
* You should have received a copy of the GNU General Public
* License along with this library; 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: Based on Novell's e-image-chooser.
* Xavier Claessens <xclaesse@gmail.com>
@@ -798,7 +798,7 @@ avatar_chooser_drag_data_received_cb (GtkWidget *widget,
gchar *uri;
uri = g_strndup (selection_data->data,
- nl - (gchar*) selection_data->data);
+ nl - (gchar *) selection_data->data);
file = g_file_new_for_uri (uri);
g_free (uri);
@@ -1000,7 +1000,7 @@ avatar_chooser_clicked_cb (GtkWidget *button,
gtk_file_chooser_add_filter (chooser_dialog, filter);
filter = gtk_file_filter_new ();
gtk_file_filter_set_name (filter, _("All Files"));
- gtk_file_filter_add_pattern(filter, "*");
+ gtk_file_filter_add_pattern (filter, "*");
gtk_file_chooser_add_filter (chooser_dialog, filter);
/* Setup response */
diff --git a/libempathy-gtk/empathy-avatar-chooser.h b/libempathy-gtk/empathy-avatar-chooser.h
index 564c1f37d..f4e40a8b0 100644
--- a/libempathy-gtk/empathy-avatar-chooser.h
+++ b/libempathy-gtk/empathy-avatar-chooser.h
@@ -14,8 +14,8 @@
*
* You should have received a copy of the GNU General Public
* License along with this library; 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: Based on Novell's e-image-chooser.
* Xavier Claessens <xclaesse@gmail.com>
diff --git a/libempathy-gtk/empathy-avatar-image.c b/libempathy-gtk/empathy-avatar-image.c
index e5513231b..d430c0fa6 100644
--- a/libempathy-gtk/empathy-avatar-image.c
+++ b/libempathy-gtk/empathy-avatar-image.c
@@ -15,8 +15,8 @@
*
* 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>
*/
diff --git a/libempathy-gtk/empathy-avatar-image.h b/libempathy-gtk/empathy-avatar-image.h
index 8969c1227..ddb446a60 100644
--- a/libempathy-gtk/empathy-avatar-image.h
+++ b/libempathy-gtk/empathy-avatar-image.h
@@ -15,8 +15,8 @@
*
* 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>
*/
diff --git a/libempathy-gtk/empathy-cell-renderer-activatable.c b/libempathy-gtk/empathy-cell-renderer-activatable.c
index fc218e88b..2883c4ded 100644
--- a/libempathy-gtk/empathy-cell-renderer-activatable.c
+++ b/libempathy-gtk/empathy-cell-renderer-activatable.c
@@ -93,7 +93,7 @@ cell_renderer_activatable_activate (GtkCellRenderer *cell,
activatable = EMPATHY_CELL_RENDERER_ACTIVATABLE (cell);
- if (!GTK_IS_TREE_VIEW (widget) || event == NULL ||
+ if (!GTK_IS_TREE_VIEW (widget) || event == NULL ||
event->type != GDK_BUTTON_PRESS) {
return FALSE;
}
diff --git a/libempathy-gtk/empathy-cell-renderer-expander.c b/libempathy-gtk/empathy-cell-renderer-expander.c
index fc9189d2d..09fe8bd4f 100644
--- a/libempathy-gtk/empathy-cell-renderer-expander.c
+++ b/libempathy-gtk/empathy-cell-renderer-expander.c
@@ -14,9 +14,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: Kristian Rietveld <kris@imendio.com>
*/
@@ -253,7 +253,7 @@ empathy_cell_renderer_expander_get_size (GtkCellRenderer *cell,
EmpathyCellRendererExpander *expander;
EmpathyCellRendererExpanderPriv *priv;
- expander = (EmpathyCellRendererExpander*) cell;
+ expander = (EmpathyCellRendererExpander *) cell;
priv = GET_PRIV (expander);
if (cell_area) {
@@ -295,7 +295,7 @@ empathy_cell_renderer_expander_render (GtkCellRenderer *cell,
GtkExpanderStyle expander_style;
gint x_offset, y_offset;
- expander = (EmpathyCellRendererExpander*) cell;
+ expander = (EmpathyCellRendererExpander *) cell;
priv = GET_PRIV (expander);
if (priv->animation_node) {
diff --git a/libempathy-gtk/empathy-cell-renderer-expander.h b/libempathy-gtk/empathy-cell-renderer-expander.h
index d052612bf..fc569ded2 100644
--- a/libempathy-gtk/empathy-cell-renderer-expander.h
+++ b/libempathy-gtk/empathy-cell-renderer-expander.h
@@ -14,9 +14,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: Kristian Rietveld <kris@imendio.com>
*/
diff --git a/libempathy-gtk/empathy-cell-renderer-text.c b/libempathy-gtk/empathy-cell-renderer-text.c
index 567a1d9d3..e3dd27d30 100644
--- a/libempathy-gtk/empathy-cell-renderer-text.c
+++ b/libempathy-gtk/empathy-cell-renderer-text.c
@@ -14,9 +14,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: Mikael Hallendal <micke@imendio.com>
*/
diff --git a/libempathy-gtk/empathy-cell-renderer-text.h b/libempathy-gtk/empathy-cell-renderer-text.h
index 7de8b2d08..540c2ebb9 100644
--- a/libempathy-gtk/empathy-cell-renderer-text.h
+++ b/libempathy-gtk/empathy-cell-renderer-text.h
@@ -14,9 +14,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: Mikael Hallendal <micke@imendio.com>
*/
diff --git a/libempathy-gtk/empathy-chat-text-view.c b/libempathy-gtk/empathy-chat-text-view.c
index fbe40120a..8874b7ace 100644
--- a/libempathy-gtk/empathy-chat-text-view.c
+++ b/libempathy-gtk/empathy-chat-text-view.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: Mikael Hallendal <micke@imendio.com>
* Richard Hult <richard@imendio.com>
* Martyn Russell <martyn@imendio.com>
@@ -113,7 +113,7 @@ chat_text_view_url_event_cb (GtkTextTag *tag,
&start,
&end,
FALSE);
-
+
empathy_url_show (GTK_WIDGET (view), str);
g_free (str);
}
@@ -591,7 +591,7 @@ empathy_chat_text_view_class_init (EmpathyChatTextViewClass *klass)
object_class->set_property = chat_text_view_set_property;
widget_class->size_allocate = chat_text_view_size_allocate;
- widget_class->drag_motion = chat_text_view_drag_motion;
+ widget_class->drag_motion = chat_text_view_drag_motion;
g_object_class_install_property (object_class,
PROP_LAST_CONTACT,
@@ -688,7 +688,7 @@ chat_text_view_scroll_down (EmpathyChatView *view)
if (priv->scroll_time) {
g_timer_reset (priv->scroll_time);
} else {
- priv->scroll_time = g_timer_new();
+ priv->scroll_time = g_timer_new ();
}
if (!priv->scroll_timeout) {
priv->scroll_timeout = g_timeout_add (SCROLL_DELAY,
@@ -894,7 +894,7 @@ chat_text_view_find_previous (EmpathyChatView *view,
if (!new_search && !priv->find_wrapped) {
priv->find_wrapped = TRUE;
result = chat_text_view_find_previous (view,
- search_criteria,
+ search_criteria,
FALSE);
priv->find_wrapped = FALSE;
}
@@ -1008,8 +1008,8 @@ chat_text_view_find_next (EmpathyChatView *view,
/* Here we wrap around. */
if (!new_search && !priv->find_wrapped) {
priv->find_wrapped = TRUE;
- result = chat_text_view_find_next (view,
- search_criteria,
+ result = chat_text_view_find_next (view,
+ search_criteria,
FALSE);
priv->find_wrapped = FALSE;
}
diff --git a/libempathy-gtk/empathy-chat-text-view.h b/libempathy-gtk/empathy-chat-text-view.h
index 120d370f1..7c4ff3430 100644
--- a/libempathy-gtk/empathy-chat-text-view.h
+++ b/libempathy-gtk/empathy-chat-text-view.h
@@ -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: Mikael Hallendal <micke@imendio.com>
* Richard Hult <richard@imendio.com>
* Martyn Russell <martyn@imendio.com>
diff --git a/libempathy-gtk/empathy-chat-view.c b/libempathy-gtk/empathy-chat-view.c
index 23877a275..e0a7905df 100644
--- a/libempathy-gtk/empathy-chat-view.c
+++ b/libempathy-gtk/empathy-chat-view.c
@@ -14,9 +14,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>
*/
@@ -66,7 +66,7 @@ empathy_chat_view_append_message (EmpathyChatView *view,
g_return_if_fail (EMPATHY_IS_CHAT_VIEW (view));
if (EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->append_message) {
- EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->append_message (view,
+ EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->append_message (view,
msg);
}
}
@@ -90,7 +90,7 @@ empathy_chat_view_scroll (EmpathyChatView *view,
g_return_if_fail (EMPATHY_IS_CHAT_VIEW (view));
if (EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->scroll) {
- EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->scroll (view,
+ EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->scroll (view,
allow_scrolling);
}
}
@@ -134,8 +134,8 @@ empathy_chat_view_find_previous (EmpathyChatView *view,
g_return_val_if_fail (EMPATHY_IS_CHAT_VIEW (view), FALSE);
if (EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->find_previous) {
- return EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->find_previous (view,
- search_criteria,
+ return EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->find_previous (view,
+ search_criteria,
new_search);
}
return FALSE;
@@ -149,8 +149,8 @@ empathy_chat_view_find_next (EmpathyChatView *view,
g_return_val_if_fail (EMPATHY_IS_CHAT_VIEW (view), FALSE);
if (EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->find_next) {
- return EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->find_next (view,
- search_criteria,
+ return EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->find_next (view,
+ search_criteria,
new_search);
}
return FALSE;
@@ -166,9 +166,9 @@ empathy_chat_view_find_abilities (EmpathyChatView *view,
g_return_if_fail (EMPATHY_IS_CHAT_VIEW (view));
if (EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->find_abilities) {
- EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->find_abilities (view,
- search_criteria,
- can_do_previous,
+ EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->find_abilities (view,
+ search_criteria,
+ can_do_previous,
can_do_next);
}
}
diff --git a/libempathy-gtk/empathy-chat-view.h b/libempathy-gtk/empathy-chat-view.h
index 08fba1508..893cf83e4 100644
--- a/libempathy-gtk/empathy-chat-view.h
+++ b/libempathy-gtk/empathy-chat-view.h
@@ -14,9 +14,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>
*/
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index 985eaa4cf..248fd116d 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.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: Mikael Hallendal <micke@imendio.com>
* Richard Hult <richard@imendio.com>
* Martyn Russell <martyn@imendio.com>
@@ -45,7 +45,6 @@
#include "empathy-chat.h"
#include "empathy-conf.h"
#include "empathy-spell.h"
-#include "empathy-spell-dialog.h"
#include "empathy-contact-list-store.h"
#include "empathy-contact-list-view.h"
#include "empathy-contact-menu.h"
@@ -283,7 +282,7 @@ chat_composing_stop (EmpathyChat *chat)
TP_CHANNEL_CHAT_STATE_ACTIVE);
}
-static void
+static void
chat_sent_message_add (EmpathyChat *chat,
const gchar *str)
{
@@ -595,7 +594,7 @@ chat_property_changed_cb (EmpathyTpChat *tp_chat,
static void
chat_input_text_buffer_changed_cb (GtkTextBuffer *buffer,
- EmpathyChat *chat)
+ EmpathyChat *chat)
{
EmpathyChatPriv *priv;
GtkTextIter start, end;
@@ -611,8 +610,8 @@ chat_input_text_buffer_changed_cb (GtkTextBuffer *buffer,
}
empathy_conf_get_bool (empathy_conf_get (),
- EMPATHY_PREFS_CHAT_SPELL_CHECKER_ENABLED,
- &spell_checker);
+ EMPATHY_PREFS_CHAT_SPELL_CHECKER_ENABLED,
+ &spell_checker);
gtk_text_buffer_get_start_iter (buffer, &start);
@@ -685,8 +684,8 @@ chat_input_key_press_event_cb (GtkWidget *widget,
priv = GET_PRIV (chat);
/* Catch ctrl+up/down so we can traverse messages we sent */
- if ((event->state & GDK_CONTROL_MASK) &&
- (event->keyval == GDK_Up ||
+ if ((event->state & GDK_CONTROL_MASK) &&
+ (event->keyval == GDK_Up ||
event->keyval == GDK_Down)) {
GtkTextBuffer *buffer;
const gchar *str;
@@ -699,15 +698,15 @@ chat_input_key_press_event_cb (GtkWidget *widget,
str = chat_sent_message_get_last (chat);
}
- g_signal_handlers_block_by_func (buffer,
+ g_signal_handlers_block_by_func (buffer,
chat_input_text_buffer_changed_cb,
chat);
gtk_text_buffer_set_text (buffer, str ? str : "", -1);
- g_signal_handlers_unblock_by_func (buffer,
+ g_signal_handlers_unblock_by_func (buffer,
chat_input_text_buffer_changed_cb,
chat);
- return TRUE;
+ return TRUE;
}
/* Catch enter but not ctrl/shift-enter */
@@ -931,13 +930,42 @@ chat_spell_free (EmpathyChatSpell *chat_spell)
}
static void
-chat_text_check_word_spelling_cb (GtkMenuItem *menuitem,
- EmpathyChatSpell *chat_spell)
+chat_spelling_menu_activate_cb (GtkMenuItem *menu_item,
+ EmpathyChatSpell *chat_spell)
{
- empathy_spell_dialog_show (chat_spell->chat,
- &chat_spell->start,
- &chat_spell->end,
- chat_spell->word);
+ empathy_chat_correct_word (chat_spell->chat,
+ &(chat_spell->start),
+ &(chat_spell->end),
+ gtk_menu_item_get_label (menu_item));
+}
+
+static GtkWidget *
+chat_spelling_build_menu (EmpathyChatSpell *chat_spell)
+{
+ GtkWidget *menu, *menu_item;
+ GList *suggestions, *l;
+
+ menu = gtk_menu_new ();
+ suggestions = empathy_spell_get_suggestions (chat_spell->word);
+ if (suggestions == NULL) {
+ menu_item = gtk_menu_item_new_with_label (_("(No Suggestions)"));
+ gtk_widget_set_sensitive (menu_item, FALSE);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
+ } else {
+ for (l = suggestions; l; l = l->next) {
+ menu_item = gtk_menu_item_new_with_label (l->data);
+ g_signal_connect (G_OBJECT (menu_item),
+ "activate",
+ G_CALLBACK (chat_spelling_menu_activate_cb),
+ chat_spell);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
+ }
+ }
+ empathy_spell_free_suggestions (suggestions);
+
+ gtk_widget_show_all (menu);
+
+ return menu;
}
static void
@@ -960,7 +988,8 @@ chat_input_populate_popup_cb (GtkTextView *view,
GtkTextIter iter, start, end;
GtkWidget *item;
gchar *str = NULL;
- EmpathyChatSpell *chat_spell;
+ EmpathyChatSpell *chat_spell;
+ GtkWidget *spell_menu;
EmpathySmileyManager *smiley_manager;
GtkWidget *smiley_menu;
GtkWidget *image;
@@ -1025,14 +1054,14 @@ chat_input_populate_popup_cb (GtkTextView *view,
gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), item);
gtk_widget_show (item);
- item = gtk_image_menu_item_new_with_mnemonic (_("_Check Word Spelling..."));
+ item = gtk_image_menu_item_new_with_mnemonic (_("_Spelling Suggestions"));
image = gtk_image_new_from_icon_name (GTK_STOCK_SPELL_CHECK,
GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
- g_signal_connect (item,
- "activate",
- G_CALLBACK (chat_text_check_word_spelling_cb),
- chat_spell);
+
+ spell_menu = chat_spelling_build_menu (chat_spell);
+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), spell_menu);
+
gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), item);
gtk_widget_show (item);
}
@@ -1284,7 +1313,7 @@ chat_create_ui (EmpathyChat *chat)
{
EmpathyChatPriv *priv = GET_PRIV (chat);
GtkBuilder *gui;
- GList *list = NULL;
+ GList *list = NULL;
gchar *filename;
GtkTextBuffer *buffer;
@@ -1381,7 +1410,7 @@ chat_size_request (GtkWidget *widget,
if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
{
GtkRequisition child_requisition;
-
+
gtk_widget_size_request (bin->child, &child_requisition);
requisition->width += child_requisition.width;
@@ -1395,7 +1424,7 @@ chat_size_allocate (GtkWidget *widget,
{
GtkBin *bin = GTK_BIN (widget);
GtkAllocation child_allocation;
-
+
widget->allocation = *allocation;
if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
diff --git a/libempathy-gtk/empathy-chat.h b/libempathy-gtk/empathy-chat.h
index f61ce4154..74d7e0681 100644
--- a/libempathy-gtk/empathy-chat.h
+++ b/libempathy-gtk/empathy-chat.h
@@ -15,8 +15,8 @@
*
* 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: Mikael Hallendal <micke@imendio.com>
* Richard Hult <richard@imendio.com>
diff --git a/libempathy-gtk/empathy-conf.c b/libempathy-gtk/empathy-conf.c
index fae2c37db..62efa60c6 100644
--- a/libempathy-gtk/empathy-conf.c
+++ b/libempathy-gtk/empathy-conf.c
@@ -14,8 +14,8 @@
*
* 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: Richard Hult <richard@imendio.com>
*/
diff --git a/libempathy-gtk/empathy-conf.h b/libempathy-gtk/empathy-conf.h
index 2051a7f38..07026df5c 100644
--- a/libempathy-gtk/empathy-conf.h
+++ b/libempathy-gtk/empathy-conf.h
@@ -14,8 +14,8 @@
*
* 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
*/
#ifndef __EMPATHY_CONF_H__
@@ -77,8 +77,13 @@ struct _EmpathyConfClass {
#define EMPATHY_PREFS_AUTOCONNECT EMPATHY_PREFS_PATH "/autoconnect"
#define EMPATHY_PREFS_IMPORT_ASKED EMPATHY_PREFS_PATH "/import_asked"
#define EMPATHY_PREFS_FILE_TRANSFER_DEFAULT_FOLDER EMPATHY_PREFS_PATH "/file_transfer/default_folder"
+#define EMPATHY_PREFS_LOCATION_PUBLISH EMPATHY_PREFS_PATH "/location/publish"
+#define EMPATHY_PREFS_LOCATION_RESOURCE_NETWORK EMPATHY_PREFS_PATH "/location/resource_network"
+#define EMPATHY_PREFS_LOCATION_RESOURCE_CELL EMPATHY_PREFS_PATH "/location/resource_cell"
+#define EMPATHY_PREFS_LOCATION_RESOURCE_GPS EMPATHY_PREFS_PATH "/location/resource_gps"
+#define EMPATHY_PREFS_LOCATION_REDUCE_ACCURACY EMPATHY_PREFS_PATH "/location/reduce_accuracy"
-typedef void (*EmpathyConfNotifyFunc) (EmpathyConf *conf,
+typedef void (*EmpathyConfNotifyFunc) (EmpathyConf *conf,
const gchar *key,
gpointer user_data);
diff --git a/libempathy-gtk/empathy-contact-dialogs.c b/libempathy-gtk/empathy-contact-dialogs.c
index 056ec2d85..307b0fbb3 100644
--- a/libempathy-gtk/empathy-contact-dialogs.c
+++ b/libempathy-gtk/empathy-contact-dialogs.c
@@ -190,6 +190,7 @@ empathy_contact_information_dialog_show (EmpathyContact *contact,
/* Contact info widget */
contact_widget = empathy_contact_widget_new (contact,
+ EMPATHY_CONTACT_WIDGET_SHOW_LOCATION |
EMPATHY_CONTACT_WIDGET_EDIT_NONE);
gtk_container_set_border_width (GTK_CONTAINER (contact_widget), 8);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
@@ -364,8 +365,7 @@ new_contact_response_cb (GtkDialog *dialog,
if (contact && response == GTK_RESPONSE_OK) {
empathy_contact_list_add (EMPATHY_CONTACT_LIST (manager),
- contact,
- _("I would like to add you to my contact list."));
+ contact, "");
}
new_contact_dialog = NULL;
diff --git a/libempathy-gtk/empathy-contact-list-store.c b/libempathy-gtk/empathy-contact-list-store.c
index e7982f3aa..261b2cc60 100644
--- a/libempathy-gtk/empathy-contact-list-store.c
+++ b/libempathy-gtk/empathy-contact-list-store.c
@@ -15,8 +15,8 @@
*
* 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: Mikael Hallendal <micke@imendio.com>
* Martyn Russell <martyn@imendio.com>
@@ -707,7 +707,7 @@ empathy_contact_list_store_search_equal_func (GtkTreeModel *model,
name_folded = g_utf8_casefold (name, -1);
key_folded = g_utf8_casefold (key, -1);
- if (name_folded && key_folded &&
+ if (name_folded && key_folded &&
strstr (name_folded, key_folded)) {
ret = FALSE;
} else {
@@ -736,7 +736,8 @@ contact_list_store_setup (EmpathyContactListStore *store)
G_TYPE_BOOLEAN, /* Is active */
G_TYPE_BOOLEAN, /* Is online */
G_TYPE_BOOLEAN, /* Is separator */
- G_TYPE_BOOLEAN}; /* Can VoIP */
+ G_TYPE_BOOLEAN, /* Can make audio calls */
+ G_TYPE_BOOLEAN}; /* Can make video calls */
priv = GET_PRIV (store);
@@ -870,7 +871,12 @@ contact_list_store_add_contact (EmpathyContactListStore *store,
EMPATHY_CONTACT_LIST_STORE_COL_CONTACT, contact,
EMPATHY_CONTACT_LIST_STORE_COL_IS_GROUP, FALSE,
EMPATHY_CONTACT_LIST_STORE_COL_IS_SEPARATOR, FALSE,
- EMPATHY_CONTACT_LIST_STORE_COL_CAN_VOIP, empathy_contact_can_voip (contact),
+ EMPATHY_CONTACT_LIST_STORE_COL_CAN_AUDIO_CALL,
+ empathy_contact_get_capabilities (contact) &
+ EMPATHY_CAPABILITIES_AUDIO,
+ EMPATHY_CONTACT_LIST_STORE_COL_CAN_VIDEO_CALL,
+ empathy_contact_get_capabilities (contact) &
+ EMPATHY_CAPABILITIES_VIDEO,
-1);
}
@@ -887,7 +893,12 @@ contact_list_store_add_contact (EmpathyContactListStore *store,
EMPATHY_CONTACT_LIST_STORE_COL_CONTACT, contact,
EMPATHY_CONTACT_LIST_STORE_COL_IS_GROUP, FALSE,
EMPATHY_CONTACT_LIST_STORE_COL_IS_SEPARATOR, FALSE,
- EMPATHY_CONTACT_LIST_STORE_COL_CAN_VOIP, empathy_contact_can_voip (contact),
+ EMPATHY_CONTACT_LIST_STORE_COL_CAN_AUDIO_CALL,
+ empathy_contact_get_capabilities (contact) &
+ EMPATHY_CAPABILITIES_AUDIO,
+ EMPATHY_CONTACT_LIST_STORE_COL_CAN_VIDEO_CALL,
+ empathy_contact_get_capabilities (contact) &
+ EMPATHY_CAPABILITIES_VIDEO,
-1);
g_free (l->data);
}
@@ -920,7 +931,7 @@ contact_list_store_remove_contact (EmpathyContactListStore *store,
/* NOTE: it is only <= 2 here because we have
* separators after the group name, otherwise it
- * should be 1.
+ * should be 1.
*/
if (gtk_tree_model_iter_parent (model, &parent, l->data) &&
gtk_tree_model_iter_n_children (model, &parent) <= 2) {
@@ -1056,7 +1067,12 @@ contact_list_store_contact_update (EmpathyContactListStore *store,
EMPATHY_CONTACT_LIST_STORE_COL_IS_GROUP, FALSE,
EMPATHY_CONTACT_LIST_STORE_COL_IS_ONLINE, now_online,
EMPATHY_CONTACT_LIST_STORE_COL_IS_SEPARATOR, FALSE,
- EMPATHY_CONTACT_LIST_STORE_COL_CAN_VOIP, empathy_contact_can_voip (contact),
+ EMPATHY_CONTACT_LIST_STORE_COL_CAN_AUDIO_CALL,
+ empathy_contact_get_capabilities (contact) &
+ EMPATHY_CAPABILITIES_AUDIO,
+ EMPATHY_CONTACT_LIST_STORE_COL_CAN_VIDEO_CALL,
+ empathy_contact_get_capabilities (contact) &
+ EMPATHY_CAPABILITIES_VIDEO,
-1);
}
@@ -1138,7 +1154,7 @@ contact_list_store_contact_active_new (EmpathyContactListStore *store,
ShowActiveData *data;
DEBUG ("Contact:'%s' now active, and %s be removed",
- empathy_contact_get_name (contact),
+ empathy_contact_get_name (contact),
remove ? "WILL" : "WILL NOT");
data = g_slice_new0 (ShowActiveData);
@@ -1259,7 +1275,7 @@ contact_list_store_get_group (EmpathyContactListStore *store,
}
gtk_tree_store_append (GTK_TREE_STORE (store),
- &iter_separator,
+ &iter_separator,
&iter_group);
gtk_tree_store_set (GTK_TREE_STORE (store), &iter_separator,
EMPATHY_CONTACT_LIST_STORE_COL_IS_SEPARATOR, TRUE,
@@ -1293,28 +1309,6 @@ contact_list_store_get_group (EmpathyContactListStore *store,
}
}
-static guint
-contact_list_store_ordered_presence (McPresence state)
-{
- switch (state) {
- case MC_PRESENCE_UNSET:
- case MC_PRESENCE_OFFLINE:
- return 5;
- case MC_PRESENCE_AVAILABLE:
- return 0;
- case MC_PRESENCE_AWAY:
- return 2;
- case MC_PRESENCE_EXTENDED_AWAY:
- return 3;
- case MC_PRESENCE_HIDDEN:
- return 4;
- case MC_PRESENCE_DO_NOT_DISTURB:
- return 1;
- default:
- g_return_val_if_reached (6);
- }
-}
-
static gint
contact_list_store_state_sort_func (GtkTreeModel *model,
GtkTreeIter *iter_a,
@@ -1325,7 +1319,6 @@ contact_list_store_state_sort_func (GtkTreeModel *model,
gchar *name_a, *name_b;
gboolean is_separator_a, is_separator_b;
EmpathyContact *contact_a, *contact_b;
- guint presence_a, presence_b;
gtk_tree_model_get (model, iter_a,
EMPATHY_CONTACT_LIST_STORE_COL_NAME, &name_a,
@@ -1361,16 +1354,11 @@ contact_list_store_state_sort_func (GtkTreeModel *model,
/* If we managed to get this far, we can start looking at
* the presences.
*/
- presence_a = empathy_contact_get_presence (EMPATHY_CONTACT (contact_a));
- presence_a = contact_list_store_ordered_presence (presence_a);
- presence_b = empathy_contact_get_presence (EMPATHY_CONTACT (contact_b));
- presence_b = contact_list_store_ordered_presence (presence_b);
+ ret_val = -tp_connection_presence_type_cmp_availability (
+ empathy_contact_get_presence (EMPATHY_CONTACT (contact_a)),
+ empathy_contact_get_presence (EMPATHY_CONTACT (contact_b)));
- if (presence_a < presence_b) {
- ret_val = -1;
- } else if (presence_a > presence_b) {
- ret_val = 1;
- } else {
+ if (ret_val == 0) {
/* Fallback: compare by name */
ret_val = g_utf8_collate (name_a, name_b);
}
diff --git a/libempathy-gtk/empathy-contact-list-store.h b/libempathy-gtk/empathy-contact-list-store.h
index 10354ff11..13ea099b3 100644
--- a/libempathy-gtk/empathy-contact-list-store.h
+++ b/libempathy-gtk/empathy-contact-list-store.h
@@ -15,8 +15,8 @@
*
* 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: Mikael Hallendal <micke@imendio.com>
* Martyn Russell <martyn@imendio.com>
@@ -60,7 +60,8 @@ typedef enum {
EMPATHY_CONTACT_LIST_STORE_COL_IS_ACTIVE,
EMPATHY_CONTACT_LIST_STORE_COL_IS_ONLINE,
EMPATHY_CONTACT_LIST_STORE_COL_IS_SEPARATOR,
- EMPATHY_CONTACT_LIST_STORE_COL_CAN_VOIP,
+ EMPATHY_CONTACT_LIST_STORE_COL_CAN_AUDIO_CALL,
+ EMPATHY_CONTACT_LIST_STORE_COL_CAN_VIDEO_CALL,
EMPATHY_CONTACT_LIST_STORE_COL_COUNT
} EmpathyContactListStoreCol;
diff --git a/libempathy-gtk/empathy-contact-list-view.c b/libempathy-gtk/empathy-contact-list-view.c
index ca224f526..c106653b1 100644
--- a/libempathy-gtk/empathy-contact-list-view.c
+++ b/libempathy-gtk/empathy-contact-list-view.c
@@ -15,8 +15,8 @@
*
* 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: Mikael Hallendal <micke@imendio.com>
* Martyn Russell <martyn@imendio.com>
@@ -169,7 +169,8 @@ contact_list_view_query_tooltip_cb (EmpathyContactListView *view,
if (!priv->tooltip_widget) {
priv->tooltip_widget = empathy_contact_widget_new (contact,
- EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP);
+ EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP |
+ EMPATHY_CONTACT_WIDGET_SHOW_LOCATION);
g_object_ref (priv->tooltip_widget);
g_signal_connect (priv->tooltip_widget, "destroy",
G_CALLBACK (contact_list_view_tooltip_destroy_cb),
@@ -488,7 +489,7 @@ contact_list_view_drag_data_get (GtkWidget *widget,
switch (info) {
case DND_DRAG_TYPE_CONTACT_ID:
gtk_selection_data_set (selection, drag_atoms_source[info], 8,
- (guchar*)str, strlen (str) + 1);
+ (guchar *) str, strlen (str) + 1);
break;
}
@@ -615,9 +616,10 @@ contact_list_view_row_activated (GtkTreeView *view,
}
static void
-contact_list_view_voip_activated_cb (EmpathyCellRendererActivatable *cell,
- const gchar *path_string,
- EmpathyContactListView *view)
+contact_list_start_voip_call (EmpathyCellRendererActivatable *cell,
+ const gchar *path_string,
+ EmpathyContactListView *view,
+ gboolean with_video)
{
EmpathyContactListViewPriv *priv = GET_PRIV (view);
GtkTreeModel *model;
@@ -639,15 +641,32 @@ contact_list_view_voip_activated_cb (EmpathyCellRendererActivatable *cell,
if (contact) {
EmpathyCallFactory *factory;
-
factory = empathy_call_factory_get ();
- empathy_call_factory_new_call (factory, contact);
-
+ empathy_call_factory_new_call_with_streams (factory, contact,
+ TRUE, with_video);
g_object_unref (contact);
}
}
static void
+contact_list_view_video_call_activated_cb (
+ EmpathyCellRendererActivatable *cell,
+ const gchar *path_string,
+ EmpathyContactListView *view)
+{
+ contact_list_start_voip_call (cell, path_string, view, TRUE);
+}
+
+
+static void
+contact_list_view_audio_call_activated_cb (EmpathyCellRendererActivatable *cell,
+ const gchar *path_string,
+ EmpathyContactListView *view)
+{
+ contact_list_start_voip_call (cell, path_string, view, FALSE);
+}
+
+static void
contact_list_view_cell_set_background (EmpathyContactListView *view,
GtkCellRenderer *cell,
gboolean is_group,
@@ -708,7 +727,8 @@ contact_list_view_pixbuf_cell_data_func (GtkTreeViewColumn *tree_column,
}
static void
-contact_list_view_voip_cell_data_func (GtkTreeViewColumn *tree_column,
+contact_list_view_audio_call_cell_data_func (
+ GtkTreeViewColumn *tree_column,
GtkCellRenderer *cell,
GtkTreeModel *model,
GtkTreeIter *iter,
@@ -721,7 +741,7 @@ contact_list_view_voip_cell_data_func (GtkTreeViewColumn *tree_column,
gtk_tree_model_get (model, iter,
EMPATHY_CONTACT_LIST_STORE_COL_IS_GROUP, &is_group,
EMPATHY_CONTACT_LIST_STORE_COL_IS_ACTIVE, &is_active,
- EMPATHY_CONTACT_LIST_STORE_COL_CAN_VOIP, &can_voip,
+ EMPATHY_CONTACT_LIST_STORE_COL_CAN_AUDIO_CALL, &can_voip,
-1);
g_object_set (cell,
@@ -733,6 +753,33 @@ contact_list_view_voip_cell_data_func (GtkTreeViewColumn *tree_column,
}
static void
+contact_list_view_video_call_cell_data_func (
+ GtkTreeViewColumn *tree_column,
+ GtkCellRenderer *cell,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ EmpathyContactListView *view)
+{
+ gboolean is_group;
+ gboolean is_active;
+ gboolean can_voip;
+
+ gtk_tree_model_get (model, iter,
+ EMPATHY_CONTACT_LIST_STORE_COL_IS_GROUP, &is_group,
+ EMPATHY_CONTACT_LIST_STORE_COL_IS_ACTIVE, &is_active,
+ EMPATHY_CONTACT_LIST_STORE_COL_CAN_VIDEO_CALL, &can_voip,
+ -1);
+
+ g_object_set (cell,
+ "visible", !is_group && can_voip,
+ "icon-name", EMPATHY_IMAGE_VIDEO_CALL,
+ NULL);
+
+ contact_list_view_cell_set_background (view, cell, is_group, is_active);
+}
+
+
+static void
contact_list_view_avatar_cell_data_func (GtkTreeViewColumn *tree_column,
GtkCellRenderer *cell,
GtkTreeModel *model,
@@ -948,12 +995,12 @@ contact_list_view_setup (EmpathyContactListView *view)
gtk_tree_view_column_add_attribute (col, cell,
"is_group", EMPATHY_CONTACT_LIST_STORE_COL_IS_GROUP);
- /* Voip Capability Icon */
+ /* Audio Call Icon */
cell = empathy_cell_renderer_activatable_new ();
gtk_tree_view_column_pack_start (col, cell, FALSE);
gtk_tree_view_column_set_cell_data_func (
col, cell,
- (GtkTreeCellDataFunc) contact_list_view_voip_cell_data_func,
+ (GtkTreeCellDataFunc) contact_list_view_audio_call_cell_data_func,
view, NULL);
g_object_set (cell,
@@ -961,7 +1008,23 @@ contact_list_view_setup (EmpathyContactListView *view)
NULL);
g_signal_connect (cell, "path-activated",
- G_CALLBACK (contact_list_view_voip_activated_cb),
+ G_CALLBACK (contact_list_view_audio_call_activated_cb),
+ view);
+
+ /* Video Call Icon */
+ cell = empathy_cell_renderer_activatable_new ();
+ gtk_tree_view_column_pack_start (col, cell, FALSE);
+ gtk_tree_view_column_set_cell_data_func (
+ col, cell,
+ (GtkTreeCellDataFunc) contact_list_view_video_call_cell_data_func,
+ view, NULL);
+
+ g_object_set (cell,
+ "visible", FALSE,
+ NULL);
+
+ g_signal_connect (cell, "path-activated",
+ G_CALLBACK (contact_list_view_video_call_activated_cb),
view);
/* Avatar */
@@ -1181,7 +1244,7 @@ empathy_contact_list_view_init (EmpathyContactListView *view)
/* Get saved group states. */
empathy_contact_groups_get_all ();
- gtk_tree_view_set_row_separator_func (GTK_TREE_VIEW (view),
+ gtk_tree_view_set_row_separator_func (GTK_TREE_VIEW (view),
empathy_contact_list_store_row_separator_func,
NULL, NULL);
@@ -1275,8 +1338,8 @@ empathy_contact_list_view_get_selected_group (EmpathyContactListView *view)
}
static gboolean
-contact_list_view_remove_dialog_show (GtkWindow *parent,
- const gchar *message,
+contact_list_view_remove_dialog_show (GtkWindow *parent,
+ const gchar *message,
const gchar *secondary_text)
{
GtkWidget *dialog;
@@ -1291,9 +1354,9 @@ contact_list_view_remove_dialog_show (GtkWindow *parent,
NULL);
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
"%s", secondary_text);
-
+
gtk_widget_show (dialog);
-
+
res = gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
@@ -1387,7 +1450,7 @@ contact_list_view_remove_activate_cb (GtkMenuItem *menuitem,
contact = empathy_contact_list_view_dup_selected (view);
if (contact) {
- gchar *text;
+ gchar *text;
GtkWindow *parent;
parent = empathy_get_toplevel_window (GTK_WIDGET (view));
@@ -1397,8 +1460,7 @@ contact_list_view_remove_activate_cb (GtkMenuItem *menuitem,
EmpathyContactList *list;
list = empathy_contact_list_store_get_list_iface (priv->store);
- empathy_contact_list_remove (list, contact,
- _("Sorry, I don't want you in my contact list anymore."));
+ empathy_contact_list_remove (list, contact, "");
}
g_free (text);
diff --git a/libempathy-gtk/empathy-contact-list-view.h b/libempathy-gtk/empathy-contact-list-view.h
index bb6766c4a..0c48764c4 100644
--- a/libempathy-gtk/empathy-contact-list-view.h
+++ b/libempathy-gtk/empathy-contact-list-view.h
@@ -15,8 +15,8 @@
*
* 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: Mikael Hallendal <micke@imendio.com>
* Martyn Russell <martyn@imendio.com>
diff --git a/libempathy-gtk/empathy-contact-menu.c b/libempathy-gtk/empathy-contact-menu.c
index a3cf1da26..fdd9c34a1 100644
--- a/libempathy-gtk/empathy-contact-menu.c
+++ b/libempathy-gtk/empathy-contact-menu.c
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Authors: Xavier Claessens <xclaesse@gmail.com>
*/
@@ -62,9 +62,14 @@ empathy_contact_menu_new (EmpathyContact *contact,
gtk_widget_show (item);
}
- /* Call */
if (features & EMPATHY_CONTACT_FEATURE_CALL) {
- item = empathy_contact_call_menu_item_new (contact);
+ /* Audio Call */
+ item = empathy_contact_audio_call_menu_item_new (contact);
+ gtk_menu_shell_append (shell, item);
+ gtk_widget_show (item);
+
+ /* Video Call */
+ item = empathy_contact_video_call_menu_item_new (contact);
gtk_menu_shell_append (shell, item);
gtk_widget_show (item);
}
@@ -141,24 +146,24 @@ empathy_contact_chat_menu_item_new (EmpathyContact *contact)
}
static void
-empathy_contact_call_menu_item_activated (GtkMenuItem *item,
+empathy_contact_audio_call_menu_item_activated (GtkMenuItem *item,
EmpathyContact *contact)
{
EmpathyCallFactory *factory;
factory = empathy_call_factory_get ();
- empathy_call_factory_new_call (factory, contact);
+ empathy_call_factory_new_call_with_streams (factory, contact, TRUE, FALSE);
}
GtkWidget *
-empathy_contact_call_menu_item_new (EmpathyContact *contact)
+empathy_contact_audio_call_menu_item_new (EmpathyContact *contact)
{
GtkWidget *item;
GtkWidget *image;
g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);
- item = gtk_image_menu_item_new_with_mnemonic (C_("menu item", "_Call"));
+ item = gtk_image_menu_item_new_with_mnemonic (C_("menu item", "_Audio Call"));
image = gtk_image_new_from_icon_name (EMPATHY_IMAGE_VOIP,
GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
@@ -166,9 +171,41 @@ empathy_contact_call_menu_item_new (EmpathyContact *contact)
gtk_widget_show (image);
g_signal_connect (item, "activate",
- G_CALLBACK (empathy_contact_call_menu_item_activated),
+ G_CALLBACK (empathy_contact_audio_call_menu_item_activated),
contact);
-
+
+ return item;
+}
+
+static void
+empathy_contact_video_call_menu_item_activated (GtkMenuItem *item,
+ EmpathyContact *contact)
+{
+ EmpathyCallFactory *factory;
+
+ factory = empathy_call_factory_get ();
+ empathy_call_factory_new_call_with_streams (factory, contact, TRUE, TRUE);
+}
+
+GtkWidget *
+empathy_contact_video_call_menu_item_new (EmpathyContact *contact)
+{
+ GtkWidget *item;
+ GtkWidget *image;
+
+ g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);
+
+ item = gtk_image_menu_item_new_with_mnemonic (C_("menu item", "_Video Call"));
+ image = gtk_image_new_from_icon_name (EMPATHY_IMAGE_VIDEO_CALL,
+ GTK_ICON_SIZE_MENU);
+ gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
+ gtk_widget_set_sensitive (item, empathy_contact_can_voip (contact));
+ gtk_widget_show (image);
+
+ g_signal_connect (item, "activate",
+ G_CALLBACK (empathy_contact_video_call_menu_item_activated),
+ contact);
+
return item;
}
@@ -301,7 +338,6 @@ room_sub_menu_data_new (EmpathyContact *contact,
data = g_slice_new (RoomSubMenuData);
data->contact = g_object_ref (contact);
data->chatroom = g_object_ref (chatroom);
-
return data;
}
@@ -381,7 +417,7 @@ empathy_contact_invite_menu_item_new (EmpathyContact *contact)
submenu = gtk_menu_new ();
room_item = create_room_sub_menu (contact, chatroom);
- gtk_menu_shell_append ((GtkMenuShell*)submenu, room_item);
+ gtk_menu_shell_append ((GtkMenuShell *) submenu, room_item);
gtk_widget_show (room_item);
}
}
diff --git a/libempathy-gtk/empathy-contact-menu.h b/libempathy-gtk/empathy-contact-menu.h
index fddc40c49..8126a8e59 100644
--- a/libempathy-gtk/empathy-contact-menu.h
+++ b/libempathy-gtk/empathy-contact-menu.h
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Authors: Xavier Claessens <xclaesse@gmail.com>
*/
@@ -41,7 +41,8 @@ typedef enum {
GtkWidget * empathy_contact_menu_new (EmpathyContact *contact,
EmpathyContactFeatureFlags features);
GtkWidget * empathy_contact_chat_menu_item_new (EmpathyContact *contact);
-GtkWidget * empathy_contact_call_menu_item_new (EmpathyContact *contact);
+GtkWidget * empathy_contact_audio_call_menu_item_new (EmpathyContact *contact);
+GtkWidget * empathy_contact_video_call_menu_item_new (EmpathyContact *contact);
GtkWidget * empathy_contact_log_menu_item_new (EmpathyContact *contact);
GtkWidget * empathy_contact_info_menu_item_new (EmpathyContact *contact);
GtkWidget * empathy_contact_edit_menu_item_new (EmpathyContact *contact);
diff --git a/libempathy-gtk/empathy-contact-selector.c b/libempathy-gtk/empathy-contact-selector.c
index f4a302c5b..8aa02fa6d 100644
--- a/libempathy-gtk/empathy-contact-selector.c
+++ b/libempathy-gtk/empathy-contact-selector.c
@@ -202,7 +202,7 @@ contact_selector_constructor (GType type,
GtkCellLayout *cell_layout;
GtkCellRenderer *renderer;
- object = G_OBJECT_CLASS (empathy_contact_selector_parent_class)->constructor
+ object = G_OBJECT_CLASS (empathy_contact_selector_parent_class)->constructor
(type, n_construct_params, construct_params);
priv = GET_PRIV (object);
contact_selector = EMPATHY_CONTACT_SELECTOR (object);
@@ -422,7 +422,7 @@ contact_selector_filter_visible_func (GtkTreeModel *model,
if (contact != NULL)
{
- visible = data->func(contact, data->user_data);
+ visible = data->func (contact, data->user_data);
g_object_unref (contact);
}
diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c
index 0821066fa..6c1015364 100644
--- a/libempathy-gtk/empathy-contact-widget.c
+++ b/libempathy-gtk/empathy-contact-widget.c
@@ -27,12 +27,19 @@
#include <gtk/gtk.h>
#include <glib/gi18n-lib.h>
+#if HAVE_LIBCHAMPLAIN
+#include <champlain/champlain.h>
+#include <champlain-gtk/champlain-gtk.h>
+#endif
+
#include <libmissioncontrol/mc-account.h>
#include <telepathy-glib/util.h>
#include <libempathy/empathy-tp-contact-factory.h>
#include <libempathy/empathy-contact-manager.h>
#include <libempathy/empathy-contact-list.h>
+#include <libempathy/empathy-location.h>
+#include <libempathy/empathy-time.h>
#include <libempathy/empathy-utils.h>
#include "empathy-contact-widget.h"
@@ -90,6 +97,17 @@ typedef struct
GtkWidget *table_contact;
GtkWidget *vbox_avatar;
+ /* Location */
+ GtkWidget *vbox_location;
+ GtkWidget *subvbox_location;
+ GtkWidget *table_location;
+ GtkWidget *label_location;
+#if HAVE_LIBCHAMPLAIN
+ GtkWidget *viewport_map;
+ GtkWidget *map_view_embed;
+ ClutterActor *map_view;
+#endif
+
/* Groups */
GtkWidget *vbox_groups;
GtkWidget *entry_group;
@@ -161,6 +179,7 @@ static void contact_widget_details_setup (EmpathyContactWidget *information);
static void contact_widget_details_update (EmpathyContactWidget *information);
static void contact_widget_client_setup (EmpathyContactWidget *information);
static void contact_widget_client_update (EmpathyContactWidget *information);
+static void contact_widget_location_update (EmpathyContactWidget *information);
enum
{
@@ -203,6 +222,12 @@ empathy_contact_widget_new (EmpathyContact *contact,
"label_status", &information->label_status,
"table_contact", &information->table_contact,
"vbox_avatar", &information->vbox_avatar,
+ "vbox_location", &information->vbox_location,
+ "subvbox_location", &information->subvbox_location,
+ "label_location", &information->label_location,
+#if HAVE_LIBCHAMPLAIN
+ "viewport_map", &information->viewport_map,
+#endif
"vbox_groups", &information->vbox_groups,
"entry_group", &information->entry_group,
"button_group", &information->button_group,
@@ -222,6 +247,7 @@ empathy_contact_widget_new (EmpathyContact *contact,
"entry_group", "activate", contact_widget_entry_group_activate_cb,
"button_group", "clicked", contact_widget_button_group_clicked_cb,
NULL);
+ information->table_location = NULL;
g_object_set_data (G_OBJECT (information->vbox_contact_widget),
"EmpathyContactWidget",
@@ -317,7 +343,7 @@ empathy_contact_widget_set_account_filter (
if (chooser)
empathy_account_chooser_set_filter (chooser, filter, user_data);
}
-
+
static void
contact_widget_destroy_cb (GtkWidget *widget,
EmpathyContactWidget *information)
@@ -331,7 +357,7 @@ contact_widget_destroy_cb (GtkWidget *widget,
if (information->manager)
{
g_object_unref (information->manager);
- }
+ }
g_slice_free (EmpathyContactWidget, information);
}
@@ -379,6 +405,7 @@ contact_widget_set_contact (EmpathyContactWidget *information,
contact_widget_groups_update (information);
contact_widget_details_update (information);
contact_widget_client_update (information);
+ contact_widget_location_update (information);
}
static gboolean
@@ -393,7 +420,7 @@ contact_widget_id_changed_cb (GtkEntry *entry,
EmpathyContactWidget *self)
{
if (self->widget_id_timeout != 0)
- {
+ {
g_source_remove (self->widget_id_timeout);
}
@@ -465,7 +492,7 @@ save_avatar_menu_activate_cb (GtkWidget *widget,
GtkWidget *dialog;
dialog = gtk_message_dialog_new (NULL, 0,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
_("Unable to save avatar"));
gtk_message_dialog_format_secondary_text (
@@ -519,7 +546,7 @@ popup_avatar_menu (EmpathyContactWidget *information,
}
gtk_menu_attach_to_widget (GTK_MENU (menu), parent, NULL);
- gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
+ gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
button, event_time);
}
@@ -1203,3 +1230,218 @@ contact_widget_client_update (EmpathyContactWidget *information)
{
/* FIXME: Needs new telepathy spec */
}
+
+/* Converts the Location's GHashTable's key to a user readable string */
+static const gchar *
+location_key_to_label (const gchar *key)
+{
+ if (tp_strdiff (key, EMPATHY_LOCATION_COUNTRY_CODE) == FALSE)
+ return _("Country ISO Code:");
+ else if (tp_strdiff (key, EMPATHY_LOCATION_COUNTRY) == FALSE)
+ return _("Country:");
+ else if (tp_strdiff (key, EMPATHY_LOCATION_REGION) == FALSE)
+ return _("State:");
+ else if (tp_strdiff (key, EMPATHY_LOCATION_LOCALITY) == FALSE)
+ return _("City:");
+ else if (tp_strdiff (key, EMPATHY_LOCATION_AREA) == FALSE)
+ return _("Area:");
+ else if (tp_strdiff (key, EMPATHY_LOCATION_POSTAL_CODE) == FALSE)
+ return _("Postal Code:");
+ else if (tp_strdiff (key, EMPATHY_LOCATION_STREET) == FALSE)
+ return _("Street:");
+ else if (tp_strdiff (key, EMPATHY_LOCATION_BUILDING) == FALSE)
+ return _("Building:");
+ else if (tp_strdiff (key, EMPATHY_LOCATION_FLOOR) == FALSE)
+ return _("Floor:");
+ else if (tp_strdiff (key, EMPATHY_LOCATION_ROOM) == FALSE)
+ return _("Room:");
+ else if (tp_strdiff (key, EMPATHY_LOCATION_TEXT) == FALSE)
+ return _("Text:");
+ else if (tp_strdiff (key, EMPATHY_LOCATION_DESCRIPTION) == FALSE)
+ return _("Description:");
+ else if (tp_strdiff (key, EMPATHY_LOCATION_URI) == FALSE)
+ return _("URI:");
+ else if (tp_strdiff (key, EMPATHY_LOCATION_ACCURACY_LEVEL) == FALSE)
+ return _("Accuracy Level:");
+ else if (tp_strdiff (key, EMPATHY_LOCATION_ERROR) == FALSE)
+ return _("Error:");
+ else if (tp_strdiff (key, EMPATHY_LOCATION_VERTICAL_ERROR_M) == FALSE)
+ return _("Vertical Error (meters):");
+ else if (tp_strdiff (key, EMPATHY_LOCATION_HORIZONTAL_ERROR_M) == FALSE)
+ return _("Horizontal Error (meters):");
+ else if (tp_strdiff (key, EMPATHY_LOCATION_SPEED) == FALSE)
+ return _("Speed:");
+ else if (tp_strdiff (key, EMPATHY_LOCATION_BEARING) == FALSE)
+ return _("Bearing:");
+ else if (tp_strdiff (key, EMPATHY_LOCATION_CLIMB) == FALSE)
+ return _("Climb Speed:");
+ else if (tp_strdiff (key, EMPATHY_LOCATION_TIMESTAMP) == FALSE)
+ return _("Last Updated on:");
+ else if (tp_strdiff (key, EMPATHY_LOCATION_LON) == FALSE)
+ return _("Longitude:");
+ else if (tp_strdiff (key, EMPATHY_LOCATION_LAT) == FALSE)
+ return _("Latitude:");
+ else if (tp_strdiff (key, EMPATHY_LOCATION_ALT) == FALSE)
+ return _("Altitude:");
+ else
+ {
+ DEBUG ("Unexpected Location key: %s", key);
+ return key;
+ }
+}
+
+static void
+contact_widget_location_update (EmpathyContactWidget *information)
+{
+ GHashTable *location;
+ GValue *value;
+ gdouble lat = 0.0, lon = 0.0;
+ gboolean has_position = TRUE;
+ GtkWidget *label;
+ guint row = 0;
+ GHashTableIter iter;
+ gpointer key, pvalue;
+
+ if (!(information->flags & EMPATHY_CONTACT_WIDGET_SHOW_LOCATION))
+ {
+ gtk_widget_hide (information->vbox_location);
+ return;
+ }
+
+ location = empathy_contact_get_location (information->contact);
+ if (location == NULL || g_hash_table_size (location) == 0)
+ {
+ gtk_widget_hide (information->vbox_location);
+ return;
+ }
+
+ value = g_hash_table_lookup (location, EMPATHY_LOCATION_LAT);
+ if (value == NULL)
+ has_position = FALSE;
+ else
+ lat = g_value_get_double (value);
+
+ value = g_hash_table_lookup (location, EMPATHY_LOCATION_LON);
+ if (value == NULL)
+ has_position = FALSE;
+ else
+ lon = g_value_get_double (value);
+
+ value = g_hash_table_lookup (location, EMPATHY_LOCATION_TIMESTAMP);
+ if (value == NULL)
+ gtk_label_set_markup (GTK_LABEL (information->label_location), _("<b>Location</b>"));
+ else
+ {
+ gchar *user_date;
+ gchar *text;
+ gint64 stamp;
+ time_t time;
+
+ stamp = g_value_get_int64 (value);
+ time = stamp;
+
+ user_date = empathy_time_to_string_relative (time);
+
+ text = g_strconcat ( _("<b>Location</b>, "), user_date, NULL);
+ gtk_label_set_markup (GTK_LABEL (information->label_location), text);
+ g_free (text);
+ }
+
+
+ /* Prepare the location information table */
+ if (information->table_location != NULL)
+ {
+ gtk_widget_destroy (information->table_location);
+ }
+
+ information->table_location = gtk_table_new (1, 2, FALSE);
+ gtk_box_pack_start (GTK_BOX (information->subvbox_location),
+ information->table_location, FALSE, FALSE, 5);
+
+ g_hash_table_iter_init (&iter, location);
+ while (g_hash_table_iter_next (&iter, &key, &pvalue))
+ {
+ const gchar *skey;
+ const gchar* user_label;
+ GValue *gvalue;
+ char *svalue = NULL;
+
+ skey = (const gchar *) key;
+
+ user_label = location_key_to_label (skey);
+ gvalue = (GValue *) pvalue;
+
+ label = gtk_label_new (user_label);
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+ gtk_table_attach (GTK_TABLE (information->table_location),
+ label, 0, 1, row, row + 1, GTK_FILL, GTK_FILL, 10, 0);
+ gtk_widget_show (label);
+
+ if (G_VALUE_TYPE (gvalue) == G_TYPE_DOUBLE)
+ {
+ gdouble dvalue;
+ dvalue = g_value_get_double (gvalue);
+ svalue = g_strdup_printf ("%f", dvalue);
+ }
+ else if (G_VALUE_TYPE (gvalue) == G_TYPE_STRING)
+ {
+ svalue = g_value_dup_string (gvalue);
+ }
+ else if (G_VALUE_TYPE (gvalue) == G_TYPE_INT64)
+ {
+ time_t time;
+
+ time = g_value_get_int64 (value);
+ svalue = empathy_time_to_string_utc (time, _("%B %e, %Y at %R UTC"));
+ }
+
+ if (svalue != NULL)
+ {
+ label = gtk_label_new (svalue);
+ gtk_table_attach_defaults (GTK_TABLE (information->table_location),
+ label, 1, 2, row, row + 1);
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
+ gtk_widget_show (label);
+ }
+
+ g_free (svalue);
+ row++;
+ }
+
+ gtk_widget_show (information->table_location);
+
+#if HAVE_LIBCHAMPLAIN
+ /* Cannot be displayed in tooltips until Clutter-Gtk can deal with such
+ * windows
+ */
+ if (has_position &&
+ !(information->flags & EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP))
+ {
+ ClutterActor *marker;
+ ChamplainLayer *layer;
+
+ information->map_view = champlain_view_new ();
+ information->map_view_embed = champlain_view_embed_new (
+ CHAMPLAIN_VIEW (information->map_view));
+
+ gtk_container_add (GTK_CONTAINER (information->viewport_map),
+ information->map_view_embed);
+ g_object_set (G_OBJECT (information->map_view), "show-license", FALSE,
+ "scroll-mode", CHAMPLAIN_SCROLL_MODE_KINETIC,
+ NULL);
+
+ layer = champlain_layer_new ();
+ champlain_view_add_layer (CHAMPLAIN_VIEW (information->map_view), layer);
+
+ marker = champlain_marker_new_with_text (
+ empathy_contact_get_name (information->contact), NULL, NULL, NULL);
+ champlain_base_marker_set_position (CHAMPLAIN_BASE_MARKER (marker), lat, lon);
+ clutter_container_add (CLUTTER_CONTAINER (layer), marker, NULL);
+
+ champlain_view_center_on (CHAMPLAIN_VIEW(information->map_view), lat, lon);
+ gtk_widget_show_all (information->viewport_map);
+ }
+#endif
+
+ gtk_widget_show (information->vbox_location);
+}
diff --git a/libempathy-gtk/empathy-contact-widget.h b/libempathy-gtk/empathy-contact-widget.h
index 0da5580a3..b010578ad 100644
--- a/libempathy-gtk/empathy-contact-widget.h
+++ b/libempathy-gtk/empathy-contact-widget.h
@@ -59,6 +59,7 @@ typedef enum
EMPATHY_CONTACT_WIDGET_EDIT_ID = 1 << 3,
EMPATHY_CONTACT_WIDGET_EDIT_GROUPS = 1 << 4,
EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP = 1 << 5,
+ EMPATHY_CONTACT_WIDGET_SHOW_LOCATION = 1 << 6,
} EmpathyContactWidgetFlags;
GtkWidget * empathy_contact_widget_new (EmpathyContact *contact,
diff --git a/libempathy-gtk/empathy-contact-widget.ui b/libempathy-gtk/empathy-contact-widget.ui
index 1f53f765c..a46b2c6a0 100644
--- a/libempathy-gtk/empathy-contact-widget.ui
+++ b/libempathy-gtk/empathy-contact-widget.ui
@@ -162,6 +162,62 @@
</packing>
</child>
<child>
+ <object class="GtkVBox" id="vbox_location">
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label_location">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">&lt;b&gt;Location&lt;/b&gt; at (date) </property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkVBox" id="subvbox_location">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">5</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <object class="GtkViewport" id="viewport_map">
+ <property name="height_request">150</property>
+ <property name="resize_mode">queue</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkVBox" id="vbox_groups">
<property name="orientation">vertical</property>
<property name="spacing">6</property>
@@ -267,7 +323,7 @@
</child>
</object>
<packing>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
@@ -411,7 +467,7 @@
</object>
<packing>
<property name="expand">False</property>
- <property name="position">2</property>
+ <property name="position">3</property>
</packing>
</child>
<child>
@@ -578,7 +634,7 @@
</object>
<packing>
<property name="expand">False</property>
- <property name="position">3</property>
+ <property name="position">4</property>
</packing>
</child>
</object>
diff --git a/libempathy-gtk/empathy-geometry.c b/libempathy-gtk/empathy-geometry.c
index b3bd09ca1..882e15aa9 100644
--- a/libempathy-gtk/empathy-geometry.c
+++ b/libempathy-gtk/empathy-geometry.c
@@ -15,8 +15,8 @@
*
* 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: Martyn Russell <martyn@imendio.com>
* Xavier Claessens <xclaesse@gmail.com>
diff --git a/libempathy-gtk/empathy-geometry.h b/libempathy-gtk/empathy-geometry.h
index 1b711c2ec..b7bd86bc2 100644
--- a/libempathy-gtk/empathy-geometry.h
+++ b/libempathy-gtk/empathy-geometry.h
@@ -15,8 +15,8 @@
*
* 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: Martyn Russell <martyn@imendio.com>
* Xavier Claessens <xclaesse@gmail.com>
diff --git a/libempathy-gtk/empathy-images.h b/libempathy-gtk/empathy-images.h
index 6abd2e8ad..c714f047d 100644
--- a/libempathy-gtk/empathy-images.h
+++ b/libempathy-gtk/empathy-images.h
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Authors: Xavier Claessens <xclaesse@gmail.com>
*/
@@ -38,6 +38,7 @@ G_BEGIN_DECLS
#define EMPATHY_IMAGE_CONTACT_INFORMATION "gtk-info"
#define EMPATHY_IMAGE_GROUP_MESSAGE "system-users"
#define EMPATHY_IMAGE_VOIP "audio-input-microphone"
+#define EMPATHY_IMAGE_VIDEO_CALL "camera-web"
#define EMPATHY_IMAGE_LOG "document-open-recent"
#define EMPATHY_IMAGE_DOCUMENT_SEND "document-send"
diff --git a/libempathy-gtk/empathy-irc-network-dialog.c b/libempathy-gtk/empathy-irc-network-dialog.c
index 8f7f47bda..63222badc 100644
--- a/libempathy-gtk/empathy-irc-network-dialog.c
+++ b/libempathy-gtk/empathy-irc-network-dialog.c
@@ -256,7 +256,7 @@ irc_network_dialog_network_update_buttons (EmpathyIrcNetworkDialog *dialog)
can_remove = TRUE;
can_move_up = selected > 0;
- can_move_down =
+ can_move_down =
selected < gtk_tree_model_iter_n_children (model, NULL) - 1;
gtk_tree_path_free (path);
@@ -515,7 +515,7 @@ empathy_irc_network_dialog_show (EmpathyIrcNetwork *network,
1, 10, 0);
renderer = gtk_cell_renderer_spin_new ();
g_object_set (renderer,
- "editable", TRUE,
+ "editable", TRUE,
"adjustment", adjustment,
NULL);
g_signal_connect (renderer, "edited",
diff --git a/libempathy-gtk/empathy-location-manager.c b/libempathy-gtk/empathy-location-manager.c
new file mode 100644
index 000000000..fb804315c
--- /dev/null
+++ b/libempathy-gtk/empathy-location-manager.c
@@ -0,0 +1,662 @@
+/*
+ * Copyright (C) 2009 Collabora Ltd.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * 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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ *
+ * Authors: Pierre-Luc Beaudoin <pierre-luc.beaudoin@collabora.co.uk>
+ */
+
+#include "config.h"
+
+#include <string.h>
+#include <time.h>
+
+#include <glib/gi18n.h>
+
+#include <telepathy-glib/util.h>
+
+#include <geoclue/geoclue-master.h>
+
+#include <extensions/extensions.h>
+
+#include "empathy-location-manager.h"
+#include "empathy-conf.h"
+
+#include "libempathy/empathy-account-manager.h"
+#include "libempathy/empathy-enum-types.h"
+#include "libempathy/empathy-location.h"
+#include "libempathy/empathy-tp-contact-factory.h"
+#include "libempathy/empathy-utils.h"
+
+#define DEBUG_FLAG EMPATHY_DEBUG_LOCATION
+#include "libempathy/empathy-debug.h"
+
+/* Seconds before updating the location */
+#define TIMEOUT 10
+static EmpathyLocationManager *location_manager = NULL;
+
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyLocationManager)
+typedef struct {
+ gboolean geoclue_is_setup;
+ /* Contains the location to be sent to accounts. Geoclue is used
+ * to populate it. This HashTable uses Telepathy's style (string,
+ * GValue). Keys are defined in empathy-location.h
+ */
+ GHashTable *location;
+
+ GeoclueResourceFlags resources;
+ GeoclueMasterClient *gc_client;
+ GeocluePosition *gc_position;
+ GeoclueAddress *gc_address;
+
+ gboolean reduce_accuracy;
+ gdouble reduce_value;
+ EmpathyAccountManager *account_manager;
+
+ /* The idle id for publish_on_idle func */
+ guint timeout_id;
+} EmpathyLocationManagerPriv;
+
+G_DEFINE_TYPE (EmpathyLocationManager, empathy_location_manager, G_TYPE_OBJECT);
+
+static GObject *
+location_manager_constructor (GType type,
+ guint n_construct_params,
+ GObjectConstructParam *construct_params)
+{
+ GObject *retval;
+
+ if (location_manager == NULL)
+ {
+ retval = G_OBJECT_CLASS (empathy_location_manager_parent_class)->constructor
+ (type, n_construct_params, construct_params);
+
+ location_manager = EMPATHY_LOCATION_MANAGER (retval);
+ g_object_add_weak_pointer (retval, (gpointer) &location_manager);
+ }
+ else
+ {
+ retval = g_object_ref (location_manager);
+ }
+
+ return retval;
+}
+
+static void
+location_manager_dispose (GObject *object)
+{
+ EmpathyLocationManagerPriv *priv = GET_PRIV (object);
+
+ if (priv->account_manager != NULL)
+ {
+ g_object_unref (priv->account_manager);
+ priv->account_manager = NULL;
+ }
+
+ if (priv->gc_client != NULL)
+ {
+ g_object_unref (priv->gc_client);
+ priv->gc_client = NULL;
+ }
+
+ if (priv->gc_position != NULL)
+ {
+ g_object_unref (priv->gc_position);
+ priv->gc_position = NULL;
+ }
+
+ if (priv->gc_address != NULL)
+ {
+ g_object_unref (priv->gc_address);
+ priv->gc_address = NULL;
+ }
+
+ if (priv->location != NULL)
+ {
+ g_hash_table_unref (priv->location);
+ priv->location = NULL;
+ }
+
+ G_OBJECT_CLASS (empathy_location_manager_parent_class)->finalize (object);
+}
+
+static void
+location_manager_get_property (GObject *object,
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ /*EmpathyLocationManagerPriv *priv = GET_PRIV (object); */
+
+ switch (param_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ break;
+ };
+}
+
+static void
+location_manager_set_property (GObject *object,
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ /* EmpathyLocationManagerPriv *priv = GET_PRIV (object); */
+
+ switch (param_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ break;
+ };
+}
+
+static void
+empathy_location_manager_class_init (EmpathyLocationManagerClass *class)
+{
+ GObjectClass *object_class;
+
+ object_class = G_OBJECT_CLASS (class);
+
+ object_class->constructor = location_manager_constructor;
+ object_class->dispose = location_manager_dispose;
+ object_class->get_property = location_manager_get_property;
+ object_class->set_property = location_manager_set_property;
+
+ g_type_class_add_private (object_class, sizeof (EmpathyLocationManagerPriv));
+}
+
+static void
+publish_location (EmpathyLocationManager *location_manager,
+ TpConnection *conn,
+ gboolean force_publication)
+{
+ EmpathyLocationManagerPriv *priv = GET_PRIV (location_manager);
+ guint connection_status = -1;
+ gboolean can_publish;
+ EmpathyConf *conf = empathy_conf_get ();
+ EmpathyTpContactFactory *factory;
+
+ if (!conn)
+ return;
+
+ if (force_publication == FALSE)
+ {
+ if (!empathy_conf_get_bool (conf, EMPATHY_PREFS_LOCATION_PUBLISH,
+ &can_publish))
+ return;
+
+ if (can_publish == FALSE)
+ return;
+ }
+
+ connection_status = tp_connection_get_status (conn, NULL);
+
+ if (connection_status != TP_CONNECTION_STATUS_CONNECTED)
+ return;
+
+ DEBUG ("Publishing %s location to connection %p",
+ (g_hash_table_size (priv->location) == 0 ? "empty" : ""),
+ conn);
+
+ factory = empathy_tp_contact_factory_dup_singleton (conn);
+ empathy_tp_contact_factory_set_location (factory, priv->location);
+ g_object_unref (factory);
+}
+
+static void
+publish_to_all_connections (EmpathyLocationManager *location_manager,
+ gboolean force_publication)
+{
+ EmpathyLocationManagerPriv *priv = GET_PRIV (location_manager);
+ GList *connections = NULL, *l;
+
+ connections = empathy_account_manager_dup_connections (priv->account_manager);
+ for (l = connections; l; l = l->next)
+ {
+ publish_location (location_manager, l->data, force_publication);
+ g_object_unref (l->data);
+ }
+ g_list_free (connections);
+
+}
+
+static gboolean
+publish_on_idle (gpointer user_data)
+{
+ EmpathyLocationManager *manager = EMPATHY_LOCATION_MANAGER (user_data);
+ EmpathyLocationManagerPriv *priv = GET_PRIV (manager);
+
+ priv->timeout_id = 0;
+ publish_to_all_connections (manager, TRUE);
+ return FALSE;
+}
+
+static void
+new_connection_cb (EmpathyAccountManager *manager,
+ TpConnection *conn,
+ gpointer *location_manager)
+{
+ EmpathyLocationManagerPriv *priv = GET_PRIV (location_manager);
+ DEBUG ("New connection %p", conn);
+
+ /* Don't publish if it is already planned (ie startup) */
+ if (priv->timeout_id == 0)
+ {
+ publish_location (EMPATHY_LOCATION_MANAGER (location_manager), conn,
+ FALSE);
+ }
+}
+
+static void
+update_timestamp (EmpathyLocationManager *location_manager)
+{
+ EmpathyLocationManagerPriv *priv= GET_PRIV (location_manager);
+ GValue *new_value;
+ gint64 stamp64;
+ time_t timestamp;
+
+ timestamp = time (NULL);
+ stamp64 = (gint64) timestamp;
+ new_value = tp_g_value_slice_new_int64 (stamp64);
+ g_hash_table_insert (priv->location, g_strdup (EMPATHY_LOCATION_TIMESTAMP),
+ new_value);
+ DEBUG ("\t - Timestamp: %" G_GINT64_FORMAT, stamp64);
+}
+
+static void
+address_changed_cb (GeoclueAddress *address,
+ int timestamp,
+ GHashTable *details,
+ GeoclueAccuracy *accuracy,
+ gpointer location_manager)
+{
+ GeoclueAccuracyLevel level;
+ EmpathyLocationManagerPriv *priv = GET_PRIV (location_manager);
+ GHashTableIter iter;
+ gpointer key, value;
+
+ geoclue_accuracy_get_details (accuracy, &level, NULL, NULL);
+ DEBUG ("New address (accuracy level %d):", level);
+ /* FIXME: Publish accuracy level also considering the position's */
+
+ g_hash_table_remove (priv->location, EMPATHY_LOCATION_STREET);
+ g_hash_table_remove (priv->location, EMPATHY_LOCATION_AREA);
+ g_hash_table_remove (priv->location, EMPATHY_LOCATION_REGION);
+ g_hash_table_remove (priv->location, EMPATHY_LOCATION_COUNTRY);
+ g_hash_table_remove (priv->location, EMPATHY_LOCATION_COUNTRY_CODE);
+ g_hash_table_remove (priv->location, EMPATHY_LOCATION_POSTAL_CODE);
+
+ if (g_hash_table_size (details) == 0)
+ return;
+
+ g_hash_table_iter_init (&iter, details);
+ while (g_hash_table_iter_next (&iter, &key, &value))
+ {
+ GValue *new_value;
+ /* Discard street information if reduced accuracy is on */
+ if (priv->reduce_accuracy && strcmp (key, EMPATHY_LOCATION_STREET) == 0)
+ continue;
+
+ new_value = tp_g_value_slice_new_string (value);
+ g_hash_table_insert (priv->location, g_strdup (key), new_value);
+
+ DEBUG ("\t - %s: %s", (gchar *) key, (gchar *) value);
+ }
+
+ update_timestamp (location_manager);
+ if (priv->timeout_id == 0)
+ priv->timeout_id = g_timeout_add_seconds (TIMEOUT, publish_on_idle, location_manager);
+}
+
+static void
+initial_address_cb (GeoclueAddress *address,
+ int timestamp,
+ GHashTable *details,
+ GeoclueAccuracy *accuracy,
+ GError *error,
+ gpointer location_manager)
+{
+ if (error)
+ {
+ DEBUG ("Error: %s", error->message);
+ g_error_free (error);
+ }
+ else
+ {
+ address_changed_cb (address, timestamp, details, accuracy, location_manager);
+ }
+}
+
+static void
+position_changed_cb (GeocluePosition *position,
+ GeocluePositionFields fields,
+ int timestamp,
+ double latitude,
+ double longitude,
+ double altitude,
+ GeoclueAccuracy *accuracy,
+ gpointer location_manager)
+{
+ EmpathyLocationManagerPriv *priv = GET_PRIV (location_manager);
+ GeoclueAccuracyLevel level;
+ gdouble mean, horizontal, vertical;
+ GValue *new_value;
+
+
+ geoclue_accuracy_get_details (accuracy, &level, &horizontal, &vertical);
+ DEBUG ("New position (accuracy level %d)", level);
+ if (level == GEOCLUE_ACCURACY_LEVEL_NONE)
+ return;
+
+ if (fields & GEOCLUE_POSITION_FIELDS_LONGITUDE)
+ {
+ longitude += priv->reduce_value;
+ new_value = tp_g_value_slice_new_double (longitude);
+ g_hash_table_insert (priv->location, g_strdup (EMPATHY_LOCATION_LON),
+ new_value);
+ DEBUG ("\t - Longitude: %f", longitude);
+ }
+ else
+ {
+ g_hash_table_remove (priv->location, EMPATHY_LOCATION_LON);
+ }
+
+ if (fields & GEOCLUE_POSITION_FIELDS_LATITUDE)
+ {
+ latitude += priv->reduce_value;
+ new_value = tp_g_value_slice_new_double (latitude);
+ g_hash_table_replace (priv->location, g_strdup (EMPATHY_LOCATION_LAT),
+ new_value);
+ DEBUG ("\t - Latitude: %f", latitude);
+ }
+ else
+ {
+ g_hash_table_remove (priv->location, EMPATHY_LOCATION_LAT);
+ }
+
+ if (fields & GEOCLUE_POSITION_FIELDS_ALTITUDE)
+ {
+ new_value = tp_g_value_slice_new_double (altitude);
+ g_hash_table_replace (priv->location, g_strdup (EMPATHY_LOCATION_ALT),
+ new_value);
+ DEBUG ("\t - Altitude: %f", altitude);
+ }
+ else
+ {
+ g_hash_table_remove (priv->location, EMPATHY_LOCATION_ALT);
+ }
+
+ if (level == GEOCLUE_ACCURACY_LEVEL_DETAILED)
+ {
+ mean = (horizontal + vertical) / 2.0;
+ new_value = tp_g_value_slice_new_double (mean);
+ g_hash_table_replace (priv->location,
+ g_strdup (EMPATHY_LOCATION_ACCURACY), new_value);
+ DEBUG ("\t - Accuracy: %f", mean);
+ }
+ else
+ {
+ g_hash_table_remove (priv->location, EMPATHY_LOCATION_ACCURACY);
+ }
+
+ update_timestamp (location_manager);
+ if (priv->timeout_id == 0)
+ priv->timeout_id = g_timeout_add_seconds (TIMEOUT, publish_on_idle, location_manager);
+}
+
+static void
+initial_position_cb (GeocluePosition *position,
+ GeocluePositionFields fields,
+ int timestamp,
+ double latitude,
+ double longitude,
+ double altitude,
+ GeoclueAccuracy *accuracy,
+ GError *error,
+ gpointer location_manager)
+{
+ if (error)
+ {
+ DEBUG ("Error: %s", error->message);
+ g_error_free (error);
+ }
+ else
+ {
+ position_changed_cb (position, fields, timestamp, latitude, longitude,
+ altitude, accuracy, location_manager);
+ }
+}
+
+static void
+update_resources (EmpathyLocationManager *location_manager)
+{
+ EmpathyLocationManagerPriv *priv = GET_PRIV (location_manager);
+
+ DEBUG ("Updating resources %d", priv->resources);
+
+ if (!geoclue_master_client_set_requirements (priv->gc_client,
+ GEOCLUE_ACCURACY_LEVEL_NONE, 0, TRUE, priv->resources,
+ NULL))
+ {
+ DEBUG ("set_requirements failed");
+ return;
+ }
+
+ if (!priv->geoclue_is_setup)
+ return;
+
+ geoclue_address_get_address_async (priv->gc_address,
+ initial_address_cb, location_manager);
+ geoclue_position_get_position_async (priv->gc_position,
+ initial_position_cb, location_manager);
+}
+
+static void
+setup_geoclue (EmpathyLocationManager *location_manager)
+{
+ EmpathyLocationManagerPriv *priv = GET_PRIV (location_manager);
+
+ GeoclueMaster *master;
+ GError *error = NULL;
+
+ DEBUG ("Setting up Geoclue");
+ master = geoclue_master_get_default ();
+ priv->gc_client = geoclue_master_create_client (master, NULL, NULL);
+ g_object_unref (master);
+
+ update_resources (location_manager);
+
+ /* Get updated when the position is changes */
+ priv->gc_position = geoclue_master_client_create_position (
+ priv->gc_client, &error);
+ if (priv->gc_position == NULL)
+ {
+ DEBUG ("Failed to create GeocluePosition: %s", error->message);
+ g_error_free (error);
+ return;
+ }
+
+ g_signal_connect (G_OBJECT (priv->gc_position), "position-changed",
+ G_CALLBACK (position_changed_cb), location_manager);
+
+ /* Get updated when the address changes */
+ priv->gc_address = geoclue_master_client_create_address (
+ priv->gc_client, &error);
+ if (priv->gc_address == NULL)
+ {
+ DEBUG ("Failed to create GeoclueAddress: %s", error->message);
+ g_error_free (error);
+ return;
+ }
+
+ g_signal_connect (G_OBJECT (priv->gc_address), "address-changed",
+ G_CALLBACK (address_changed_cb), location_manager);
+
+ priv->geoclue_is_setup = TRUE;
+}
+
+static void
+publish_cb (EmpathyConf *conf,
+ const gchar *key,
+ gpointer user_data)
+{
+ EmpathyLocationManager *manager = EMPATHY_LOCATION_MANAGER (user_data);
+ EmpathyLocationManagerPriv *priv = GET_PRIV (manager);
+ gboolean can_publish;
+
+ DEBUG ("Publish Conf changed");
+
+
+ if (empathy_conf_get_bool (conf, key, &can_publish) == FALSE)
+ return;
+
+ if (can_publish == TRUE)
+ {
+ if (priv->geoclue_is_setup == FALSE)
+ setup_geoclue (manager);
+ /* if still not setup than the init failed */
+ if (priv->geoclue_is_setup == FALSE)
+ return;
+
+ geoclue_address_get_address_async (priv->gc_address,
+ initial_address_cb, manager);
+ geoclue_position_get_position_async (priv->gc_position,
+ initial_position_cb, manager);
+ }
+ else
+ {
+ /* As per XEP-0080: send an empty location to have remove current
+ * location from the servers
+ */
+ g_hash_table_remove_all (priv->location);
+ publish_to_all_connections (manager, TRUE);
+ }
+
+}
+
+static void
+resource_cb (EmpathyConf *conf,
+ const gchar *key,
+ gpointer user_data)
+{
+ EmpathyLocationManager *manager = EMPATHY_LOCATION_MANAGER (user_data);
+ EmpathyLocationManagerPriv *priv = GET_PRIV (manager);
+ GeoclueResourceFlags resource = 0;
+ gboolean resource_enabled;
+
+ DEBUG ("%s changed", key);
+
+ if (!empathy_conf_get_bool (conf, key, &resource_enabled))
+ return;
+
+ if (strcmp (key, EMPATHY_PREFS_LOCATION_RESOURCE_NETWORK) == 0)
+ resource = GEOCLUE_RESOURCE_NETWORK;
+ if (strcmp (key, EMPATHY_PREFS_LOCATION_RESOURCE_CELL) == 0)
+ resource = GEOCLUE_RESOURCE_CELL;
+ if (strcmp (key, EMPATHY_PREFS_LOCATION_RESOURCE_GPS) == 0)
+ resource = GEOCLUE_RESOURCE_GPS;
+
+ if (resource_enabled)
+ priv->resources |= resource;
+ else
+ priv->resources &= ~resource;
+
+ if (priv->geoclue_is_setup)
+ update_resources (manager);
+}
+
+static void
+accuracy_cb (EmpathyConf *conf,
+ const gchar *key,
+ gpointer user_data)
+{
+ EmpathyLocationManager *manager = EMPATHY_LOCATION_MANAGER (user_data);
+ EmpathyLocationManagerPriv *priv = GET_PRIV (manager);
+
+ gboolean enabled;
+
+ DEBUG ("%s changed", key);
+
+ if (!empathy_conf_get_bool (conf, key, &enabled))
+ return;
+ priv->reduce_accuracy = enabled;
+
+ if (enabled)
+ {
+ GRand *rand = g_rand_new_with_seed (time (NULL));
+ priv->reduce_value = g_rand_double_range (rand, -0.25, 0.25);
+ g_rand_free (rand);
+ }
+ else
+ {
+ priv->reduce_value = 0.0;
+ }
+
+ if (!priv->geoclue_is_setup)
+ return;
+
+ geoclue_address_get_address_async (priv->gc_address,
+ initial_address_cb, manager);
+ geoclue_position_get_position_async (priv->gc_position,
+ initial_position_cb, manager);
+}
+
+static void
+empathy_location_manager_init (EmpathyLocationManager *location_manager)
+{
+ EmpathyConf *conf;
+ EmpathyLocationManagerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (location_manager,
+ EMPATHY_TYPE_LOCATION_MANAGER, EmpathyLocationManagerPriv);
+
+ location_manager->priv = priv;
+ priv->geoclue_is_setup = FALSE;
+ priv->location = g_hash_table_new_full (g_direct_hash, g_direct_equal,
+ g_free, (GDestroyNotify) tp_g_value_slice_free);
+
+ /* Setup account status callbacks */
+ priv->account_manager = empathy_account_manager_dup_singleton ();
+ g_signal_connect (priv->account_manager,
+ "new-connection",
+ G_CALLBACK (new_connection_cb), location_manager);
+
+ /* Setup settings status callbacks */
+ conf = empathy_conf_get ();
+ empathy_conf_notify_add (conf, EMPATHY_PREFS_LOCATION_PUBLISH, publish_cb,
+ location_manager);
+ empathy_conf_notify_add (conf, EMPATHY_PREFS_LOCATION_RESOURCE_NETWORK,
+ resource_cb, location_manager);
+ empathy_conf_notify_add (conf, EMPATHY_PREFS_LOCATION_RESOURCE_CELL,
+ resource_cb, location_manager);
+ empathy_conf_notify_add (conf, EMPATHY_PREFS_LOCATION_RESOURCE_GPS,
+ resource_cb, location_manager);
+ empathy_conf_notify_add (conf, EMPATHY_PREFS_LOCATION_REDUCE_ACCURACY,
+ accuracy_cb, location_manager);
+
+ resource_cb (conf, EMPATHY_PREFS_LOCATION_RESOURCE_NETWORK, location_manager);
+ resource_cb (conf, EMPATHY_PREFS_LOCATION_RESOURCE_CELL, location_manager);
+ resource_cb (conf, EMPATHY_PREFS_LOCATION_RESOURCE_GPS, location_manager);
+ accuracy_cb (conf, EMPATHY_PREFS_LOCATION_REDUCE_ACCURACY, location_manager);
+ publish_cb (conf, EMPATHY_PREFS_LOCATION_PUBLISH, location_manager);
+}
+
+EmpathyLocationManager *
+empathy_location_manager_dup_singleton (void)
+{
+ return EMPATHY_LOCATION_MANAGER (g_object_new (EMPATHY_TYPE_LOCATION_MANAGER,
+ NULL));
+}
diff --git a/libempathy-gtk/empathy-location-manager.h b/libempathy-gtk/empathy-location-manager.h
new file mode 100644
index 000000000..092ef0809
--- /dev/null
+++ b/libempathy-gtk/empathy-location-manager.h
@@ -0,0 +1,57 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2009 Collabora Ltd.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * 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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ *
+ * Authors: Pierre-Luc Beaudoin <pierre-luc.beaudoin@collabora.co.uk>
+ */
+
+#ifndef __EMPATHY_LOCATION_MANAGER_H__
+#define __EMPATHY_LOCATION_MANAGER_H__
+
+#include <glib-object.h>
+
+
+G_BEGIN_DECLS
+
+#define EMPATHY_TYPE_LOCATION_MANAGER (empathy_location_manager_get_type ())
+#define EMPATHY_LOCATION_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EMPATHY_TYPE_LOCATION_MANAGER, EmpathyLocationManager))
+#define EMPATHY_LOCATION_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), EMPATHY_TYPE_LOCATION_MANAGER, EmpathyLocationManagerClass))
+#define EMPATHY_IS_LOCATION_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_LOCATION_MANAGER))
+#define EMPATHY_IS_LOCATION_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_LOCATION_MANAGER))
+#define EMPATHY_LOCATION_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_LOCATION_MANAGER, EmpathyLocationManagerClass))
+
+typedef struct _EmpathyLocationManager EmpathyLocationManager;
+typedef struct _EmpathyLocationManagerClass EmpathyLocationManagerClass;
+
+struct _EmpathyLocationManager
+{
+ GObject parent;
+ gpointer priv;
+};
+
+struct _EmpathyLocationManagerClass
+{
+ GObjectClass parent_class;
+};
+
+GType empathy_location_manager_get_type (void) G_GNUC_CONST;
+EmpathyLocationManager * empathy_location_manager_dup_singleton (void);
+
+G_END_DECLS
+
+#endif /* __EMPATHY_LOCATION_MANAGER_H__ */
diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c
index 13d9bcbd3..dc2efa332 100644
--- a/libempathy-gtk/empathy-log-window.c
+++ b/libempathy-gtk/empathy-log-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: Martyn Russell <martyn@imendio.com>
* Xavier Claessens <xclaesse@gmail.com>
*/
@@ -287,8 +287,8 @@ log_window_entry_find_changed_cb (GtkWidget *entry,
str = gtk_entry_get_text (GTK_ENTRY (window->entry_find));
is_sensitive &= !EMP_STR_EMPTY (str);
- is_sensitive &=
- !window->last_find ||
+ is_sensitive &=
+ !window->last_find ||
(window->last_find && strcmp (window->last_find, str) != 0);
gtk_widget_set_sensitive (window->button_find, is_sensitive);
diff --git a/libempathy-gtk/empathy-log-window.h b/libempathy-gtk/empathy-log-window.h
index 266e0c30c..6dd8c0303 100644
--- a/libempathy-gtk/empathy-log-window.h
+++ b/libempathy-gtk/empathy-log-window.h
@@ -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: Martyn Russell <martyn@imendio.com>
* Xavier Claessens <xclaesse@gmail.com>
*/
diff --git a/libempathy-gtk/empathy-new-message-dialog.c b/libempathy-gtk/empathy-new-message-dialog.c
index 3e6e3f11d..512cd1ba3 100644
--- a/libempathy-gtk/empathy-new-message-dialog.c
+++ b/libempathy-gtk/empathy-new-message-dialog.c
@@ -195,7 +195,7 @@ new_message_dialog_call_got_contact_cb (EmpathyTpContactFactory *factory,
return;
}
- call_factory = empathy_call_factory_get();
+ call_factory = empathy_call_factory_get ();
empathy_call_factory_new_call (call_factory, contact);
}
@@ -232,7 +232,7 @@ new_message_dialog_response_cb (GtkWidget *widget,
static void
new_message_change_state_button_cb (GtkEditable *editable,
- EmpathyNewMessageDialog *dialog)
+ EmpathyNewMessageDialog *dialog)
{
const gchar *id;
gboolean sensitive;
@@ -302,8 +302,8 @@ empathy_new_message_dialog_show (GtkWindow *parent)
g_signal_connect (completion, "match-selected",
G_CALLBACK (new_message_dialog_match_selected_cb),
dialog);
- g_object_unref(completion);
- g_object_unref(model);
+ g_object_unref (completion);
+ g_object_unref (model);
empathy_builder_connect (gui, dialog,
"new_message_dialog", "destroy", new_message_dialog_destroy_cb,
@@ -326,7 +326,7 @@ empathy_new_message_dialog_show (GtkWindow *parent)
gtk_widget_show (dialog->account_chooser);
new_message_dialog_account_changed_cb (dialog->account_chooser, dialog);
- g_signal_connect (dialog->account_chooser, "changed",
+ g_signal_connect (dialog->account_chooser, "changed",
G_CALLBACK (new_message_dialog_account_changed_cb),
dialog);
diff --git a/libempathy-gtk/empathy-presence-chooser.c b/libempathy-gtk/empathy-presence-chooser.c
index f4a325b51..9f8c568c5 100644
--- a/libempathy-gtk/empathy-presence-chooser.c
+++ b/libempathy-gtk/empathy-presence-chooser.c
@@ -15,8 +15,8 @@
*
* 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: Richard Hult <richard@imendio.com>
* Martyn Russell <martyn@imendio.com>
@@ -34,7 +34,6 @@
#include <gdk/gdkkeysyms.h>
#include <telepathy-glib/util.h>
-#include <libmissioncontrol/mc-enum-types.h>
#include <libempathy/empathy-idle.h>
#include <libempathy/empathy-utils.h>
@@ -105,36 +104,40 @@ typedef struct {
int block_changed;
guint focus_out_idle_source;
- McPresence state;
+ TpConnectionPresenceType state;
PresenceChooserEntryType previous_type;
- McPresence flash_state_1;
- McPresence flash_state_2;
+ TpConnectionPresenceType flash_state_1;
+ TpConnectionPresenceType flash_state_2;
guint flash_timeout_id;
} EmpathyPresenceChooserPriv;
/* States to be listed in the menu.
* Each state has a boolean telling if it can have custom message */
-static guint states[] = {MC_PRESENCE_AVAILABLE, TRUE,
- MC_PRESENCE_DO_NOT_DISTURB, TRUE,
- MC_PRESENCE_AWAY, TRUE,
- MC_PRESENCE_HIDDEN, FALSE,
- MC_PRESENCE_OFFLINE, FALSE};
+static struct { TpConnectionPresenceType state;
+ gboolean customisable;
+} states[] = { { TP_CONNECTION_PRESENCE_TYPE_AVAILABLE, TRUE } ,
+ { TP_CONNECTION_PRESENCE_TYPE_BUSY, TRUE },
+ { TP_CONNECTION_PRESENCE_TYPE_AWAY, TRUE },
+ { TP_CONNECTION_PRESENCE_TYPE_HIDDEN, FALSE },
+ { TP_CONNECTION_PRESENCE_TYPE_OFFLINE, FALSE},
+ { TP_CONNECTION_PRESENCE_TYPE_UNSET, },
+ };
static void presence_chooser_finalize (GObject *object);
static void presence_chooser_presence_changed_cb (EmpathyPresenceChooser *chooser);
static gboolean presence_chooser_flash_timeout_cb (EmpathyPresenceChooser *chooser);
static void presence_chooser_flash_start (EmpathyPresenceChooser *chooser,
- McPresence state_1,
- McPresence state_2);
+ TpConnectionPresenceType state_1,
+ TpConnectionPresenceType state_2);
static void presence_chooser_flash_stop (EmpathyPresenceChooser *chooser,
- McPresence state);
+ TpConnectionPresenceType state);
static void presence_chooser_menu_add_item (GtkWidget *menu,
const gchar *str,
- McPresence state);
+ TpConnectionPresenceType state);
static void presence_chooser_noncustom_activate_cb (GtkWidget *item,
gpointer user_data);
-static void presence_chooser_set_state (McPresence state,
+static void presence_chooser_set_state (TpConnectionPresenceType state,
const gchar *status);
static void presence_chooser_custom_activate_cb (GtkWidget *item,
gpointer user_data);
@@ -160,7 +163,7 @@ presence_chooser_create_model (EmpathyPresenceChooser *self)
store = gtk_list_store_new (N_COLUMNS,
G_TYPE_STRING, /* COL_STATE_ICON_NAME */
- MC_TYPE_PRESENCE, /* COL_STATE */
+ G_TYPE_UINT, /* COL_STATE */
G_TYPE_STRING, /* COL_STATUS_TEXT */
G_TYPE_STRING, /* COL_DISPLAY_MARKUP */
G_TYPE_BOOLEAN, /* COL_STATUS_CUSTOMISABLE */
@@ -168,26 +171,25 @@ presence_chooser_create_model (EmpathyPresenceChooser *self)
custom_message = g_strdup_printf ("<i>%s</i>", _("Custom Message..."));
- for (i = 0; i < G_N_ELEMENTS (states); i += 2) {
+ for (i = 0; states[i].state != TP_CONNECTION_PRESENCE_TYPE_UNSET; i++) {
GList *list, *l;
const char *status, *icon_name;
- status = empathy_presence_get_default_message (states[i]);
- icon_name = empathy_icon_name_for_presence (states[i]);
+ status = empathy_presence_get_default_message (states[i].state);
+ icon_name = empathy_icon_name_for_presence (states[i].state);
gtk_list_store_insert_with_values (store, NULL, -1,
COL_STATE_ICON_NAME, icon_name,
- COL_STATE, states[i],
+ COL_STATE, states[i].state,
COL_STATUS_TEXT, status,
COL_DISPLAY_MARKUP, status,
- COL_STATUS_CUSTOMISABLE, states[i+1],
+ COL_STATUS_CUSTOMISABLE, states[i].customisable,
COL_TYPE, ENTRY_TYPE_BUILTIN,
-1);
- if (states[i+1]) {
-
+ if (states[i].customisable) {
/* Set custom messages if wanted */
- list = empathy_status_presets_get (states[i], -1);
+ list = empathy_status_presets_get (states[i].state, -1);
list = g_list_sort (list, (GCompareFunc) g_utf8_collate);
for (l = list; l; l = l->next) {
gtk_list_store_insert_with_values (store,
@@ -245,7 +247,7 @@ presence_chooser_popup_shown_cb (GObject *self,
return;
}
- /* see presence_chooser_entry_focus_out_cb() for what this does */
+ /* see presence_chooser_entry_focus_out_cb () for what this does */
if (priv->focus_out_idle_source != 0) {
g_source_remove (priv->focus_out_idle_source);
priv->focus_out_idle_source = 0;
@@ -279,7 +281,7 @@ static gboolean
presence_chooser_is_preset (EmpathyPresenceChooser *self)
{
EmpathyPresenceChooserPriv *priv = GET_PRIV (self);
- McPresence state;
+ TpConnectionPresenceType state;
const char *status;
GList *presets, *l;
gboolean match = FALSE;
@@ -383,7 +385,7 @@ presence_chooser_set_status_editing (EmpathyPresenceChooser *self,
gtk_window_set_focus (GTK_WINDOW (window), NULL);
}
- /* see presence_chooser_entry_focus_out_cb()
+ /* see presence_chooser_entry_focus_out_cb ()
* for what this does */
if (priv->focus_out_idle_source != 0) {
g_source_remove (priv->focus_out_idle_source);
@@ -407,17 +409,14 @@ mc_set_custom_state (EmpathyPresenceChooser *self)
/* update the status with MC */
status = gtk_entry_get_text (GTK_ENTRY (entry));
- DEBUG ("Sending state to MC-> %s (%s)\n",
- g_enum_get_value (g_type_class_peek (MC_TYPE_PRESENCE),
- priv->state)->value_name,
- status);
+ DEBUG ("Sending state to MC-> %d (%s)\n", priv->state, status);
empathy_idle_set_presence (priv->idle, priv->state, status);
}
static void
ui_set_custom_state (EmpathyPresenceChooser *self,
- McPresence state,
+ TpConnectionPresenceType state,
const char *status)
{
EmpathyPresenceChooserPriv *priv = GET_PRIV (self);
@@ -433,7 +432,7 @@ ui_set_custom_state (EmpathyPresenceChooser *self,
gtk_entry_set_icon_from_icon_name (GTK_ENTRY (entry),
GTK_ENTRY_ICON_PRIMARY,
icon_name);
- gtk_entry_set_text (GTK_ENTRY (entry), status);
+ gtk_entry_set_text (GTK_ENTRY (entry), status == NULL ? "" : status);
presence_chooser_set_favorite_icon (self);
priv->block_changed--;
@@ -462,7 +461,7 @@ presence_chooser_entry_icon_release_cb (EmpathyPresenceChooser *self,
}
else {
PresenceChooserEntryType type;
- McPresence state;
+ TpConnectionPresenceType state;
const char *status;
type = presence_chooser_get_entry_type (self);
@@ -554,7 +553,7 @@ presence_chooser_changed_cb (GtkComboBox *self, gpointer user_data)
EmpathyPresenceChooserPriv *priv = GET_PRIV (self);
GtkTreeIter iter;
char *icon_name;
- McPresence new_state;
+ TpConnectionPresenceType new_state;
gboolean customisable = TRUE;
PresenceChooserEntryType type = -1;
GtkWidget *entry;
@@ -627,6 +626,9 @@ presence_chooser_changed_cb (GtkComboBox *self, gpointer user_data)
presence_chooser_set_status_editing (
EMPATHY_PRESENCE_CHOOSER (self),
FALSE);
+ gtk_entry_set_icon_from_icon_name (GTK_ENTRY (entry),
+ GTK_ENTRY_ICON_PRIMARY,
+ icon_name);
gtk_tree_model_get (model, &iter,
COL_STATUS_TEXT, &status,
@@ -820,8 +822,8 @@ static void
presence_chooser_presence_changed_cb (EmpathyPresenceChooser *chooser)
{
EmpathyPresenceChooserPriv *priv;
- McPresence state;
- McPresence flash_state;
+ TpConnectionPresenceType state;
+ TpConnectionPresenceType flash_state;
const gchar *status;
GtkTreeModel *model;
GtkTreeIter iter;
@@ -843,7 +845,7 @@ presence_chooser_presence_changed_cb (EmpathyPresenceChooser *chooser)
valid;
valid = gtk_tree_model_iter_next (model, &iter)) {
int m_type;
- McPresence m_state;
+ TpConnectionPresenceType m_state;
char *m_status;
gtk_tree_model_get (model, &iter,
@@ -871,7 +873,7 @@ presence_chooser_presence_changed_cb (EmpathyPresenceChooser *chooser)
COL_STATUS_TEXT, &m_status,
-1);
- match = !strcmp (status, m_status);
+ match = !tp_strdiff (status, m_status);
g_free (m_status);
@@ -889,7 +891,7 @@ presence_chooser_presence_changed_cb (EmpathyPresenceChooser *chooser)
ui_set_custom_state (chooser, state, status);
}
- if (flash_state != MC_PRESENCE_UNSET) {
+ if (flash_state != TP_CONNECTION_PRESENCE_TYPE_UNSET) {
presence_chooser_flash_start (chooser, state, flash_state);
}
else {
@@ -901,7 +903,7 @@ static gboolean
presence_chooser_flash_timeout_cb (EmpathyPresenceChooser *chooser)
{
EmpathyPresenceChooserPriv *priv;
- McPresence state;
+ TpConnectionPresenceType state;
static gboolean on = FALSE;
GtkWidget *entry;
@@ -926,8 +928,8 @@ presence_chooser_flash_timeout_cb (EmpathyPresenceChooser *chooser)
static void
presence_chooser_flash_start (EmpathyPresenceChooser *chooser,
- McPresence state_1,
- McPresence state_2)
+ TpConnectionPresenceType state_1,
+ TpConnectionPresenceType state_2)
{
EmpathyPresenceChooserPriv *priv;
@@ -947,7 +949,7 @@ presence_chooser_flash_start (EmpathyPresenceChooser *chooser,
static void
presence_chooser_flash_stop (EmpathyPresenceChooser *chooser,
- McPresence state)
+ TpConnectionPresenceType state)
{
EmpathyPresenceChooserPriv *priv = GET_PRIV (chooser);
GtkWidget *entry;
@@ -981,21 +983,21 @@ empathy_presence_chooser_create_menu (void)
menu = gtk_menu_new ();
- for (i = 0; i < G_N_ELEMENTS (states); i += 2) {
+ for (i = 0; states[i].state != TP_CONNECTION_PRESENCE_TYPE_UNSET; i++) {
GList *list, *l;
- status = empathy_presence_get_default_message (states[i]);
+ status = empathy_presence_get_default_message (states[i].state);
presence_chooser_menu_add_item (menu,
status,
- states[i]);
+ states[i].state);
- if (states[i+1]) {
+ if (states[i].customisable) {
/* Set custom messages if wanted */
- list = empathy_status_presets_get (states[i], 5);
+ list = empathy_status_presets_get (states[i].state, 5);
for (l = list; l; l = l->next) {
presence_chooser_menu_add_item (menu,
l->data,
- states[i]);
+ states[i].state);
}
g_list_free (list);
}
@@ -1026,7 +1028,7 @@ empathy_presence_chooser_create_menu (void)
static void
presence_chooser_menu_add_item (GtkWidget *menu,
const gchar *str,
- McPresence state)
+ TpConnectionPresenceType state)
{
GtkWidget *item;
GtkWidget *image;
@@ -1058,7 +1060,7 @@ static void
presence_chooser_noncustom_activate_cb (GtkWidget *item,
gpointer user_data)
{
- McPresence state;
+ TpConnectionPresenceType state;
const gchar *status;
status = g_object_get_data (G_OBJECT (item), "status");
@@ -1068,7 +1070,7 @@ presence_chooser_noncustom_activate_cb (GtkWidget *item,
}
static void
-presence_chooser_set_state (McPresence state,
+presence_chooser_set_state (TpConnectionPresenceType state,
const gchar *status)
{
EmpathyIdle *idle;
diff --git a/libempathy-gtk/empathy-presence-chooser.h b/libempathy-gtk/empathy-presence-chooser.h
index dab95f553..7b85a6217 100644
--- a/libempathy-gtk/empathy-presence-chooser.h
+++ b/libempathy-gtk/empathy-presence-chooser.h
@@ -15,8 +15,8 @@
*
* 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: Richard Hult <richard@imendio.com>
* Martyn Russell <martyn@imendio.com>
diff --git a/libempathy-gtk/empathy-profile-chooser.c b/libempathy-gtk/empathy-profile-chooser.c
index 10eb3791a..14965741c 100644
--- a/libempathy-gtk/empathy-profile-chooser.c
+++ b/libempathy-gtk/empathy-profile-chooser.c
@@ -56,7 +56,7 @@ enum {
*
* Return value: a new reference to the selected #McProfile
*/
-McProfile*
+McProfile *
empathy_profile_chooser_dup_selected (GtkWidget *widget)
{
GtkTreeModel *model;
@@ -208,7 +208,7 @@ empathy_profile_chooser_new (void)
if (g_list_find_custom (seen, unique_name, (GCompareFunc) strcmp)) {
continue;
}
- seen = g_list_append (seen, (char*) unique_name);
+ seen = g_list_append (seen, (char *) unique_name);
gtk_list_store_insert_with_values (store, &iter, 0,
COL_ICON, mc_profile_get_icon_name (profile),
diff --git a/libempathy-gtk/empathy-smiley-manager.c b/libempathy-gtk/empathy-smiley-manager.c
index 96b50206a..a729a2929 100644
--- a/libempathy-gtk/empathy-smiley-manager.c
+++ b/libempathy-gtk/empathy-smiley-manager.c
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Authors: Dafydd Harrie <dafydd.harries@collabora.co.uk>
* Xavier Claessens <xclaesse@gmail.com>
*/
@@ -367,15 +367,15 @@ empathy_smiley_manager_get_all (EmpathySmileyManager *manager)
typedef struct {
EmpathySmileyManager *manager;
EmpathySmiley *smiley;
- EmpathySmileyMenuFunc func;
- gpointer user_data;
+ EmpathySmileyMenuFunc func;
+ gpointer user_data;
} ActivateData;
static void
smiley_menu_data_free (gpointer user_data,
GClosure *closure)
{
- ActivateData *data = (ActivateData*) user_data;
+ ActivateData *data = (ActivateData *) user_data;
g_object_unref (data->manager);
g_slice_free (ActivateData, data);
@@ -385,7 +385,7 @@ static void
smiley_menu_activate_cb (GtkMenuItem *menuitem,
gpointer user_data)
{
- ActivateData *data = (ActivateData*) user_data;
+ ActivateData *data = (ActivateData *) user_data;
data->func (data->manager, data->smiley, data->user_data);
}
@@ -417,6 +417,7 @@ empathy_smiley_menu_new (EmpathySmileyManager *manager,
item = gtk_image_menu_item_new_with_label ("");
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
+ gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (item), TRUE);
gtk_menu_attach (GTK_MENU (menu), item,
x, x + 1, y, y + 1);
diff --git a/libempathy-gtk/empathy-smiley-manager.h b/libempathy-gtk/empathy-smiley-manager.h
index dae022dfa..5eaf4b283 100644
--- a/libempathy-gtk/empathy-smiley-manager.h
+++ b/libempathy-gtk/empathy-smiley-manager.h
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Authors: Dafydd Harrie <dafydd.harries@collabora.co.uk>
* Xavier Claessens <xclaesse@gmail.com>
*/
diff --git a/libempathy-gtk/empathy-spell-dialog.c b/libempathy-gtk/empathy-spell-dialog.c
deleted file mode 100644
index 9ce80eebb..000000000
--- a/libempathy-gtk/empathy-spell-dialog.c
+++ /dev/null
@@ -1,264 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2004-2007 Imendio AB
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * 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.
- */
-
-#include "config.h"
-
-#include <string.h>
-
-#include <glib/gi18n-lib.h>
-#include <gtk/gtk.h>
-
-#include <libempathy/empathy-utils.h>
-
-#include "empathy-chat.h"
-#include "empathy-spell.h"
-#include "empathy-spell-dialog.h"
-#include "empathy-ui-utils.h"
-
-typedef struct {
- GtkWidget *window;
- GtkWidget *button_replace;
- GtkWidget *label_word;
- GtkWidget *treeview_words;
-
- EmpathyChat *chat;
-
- gchar *word;
- GtkTextIter start;
- GtkTextIter end;
-} EmpathySpellDialog;
-
-enum {
- COL_SPELL_WORD,
- COL_SPELL_COUNT
-};
-
-static void spell_dialog_model_populate_columns (EmpathySpellDialog *dialog);
-static void spell_dialog_model_populate_suggestions (EmpathySpellDialog *dialog);
-static void spell_dialog_model_row_activated_cb (GtkTreeView *tree_view,
- GtkTreePath *path,
- GtkTreeViewColumn *column,
- EmpathySpellDialog *dialog);
-static void spell_dialog_model_selection_changed_cb (GtkTreeSelection *treeselection,
- EmpathySpellDialog *dialog);
-static void spell_dialog_model_setup (EmpathySpellDialog *dialog);
-static void spell_dialog_response_cb (GtkWidget *widget,
- gint response,
- EmpathySpellDialog *dialog);
-static void spell_dialog_destroy_cb (GtkWidget *widget,
- EmpathySpellDialog *dialog);
-
-static void
-spell_dialog_model_populate_columns (EmpathySpellDialog *dialog)
-{
- GtkTreeModel *model;
- GtkTreeViewColumn *column;
- GtkCellRenderer *renderer;
- guint col_offset;
-
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->treeview_words));
-
- renderer = gtk_cell_renderer_text_new ();
- col_offset = gtk_tree_view_insert_column_with_attributes (
- GTK_TREE_VIEW (dialog->treeview_words),
- -1, _("Word"),
- renderer,
- "text", COL_SPELL_WORD,
- NULL);
-
- g_object_set_data (G_OBJECT (renderer),
- "column", GINT_TO_POINTER (COL_SPELL_WORD));
-
- column = gtk_tree_view_get_column (GTK_TREE_VIEW (dialog->treeview_words), col_offset - 1);
- gtk_tree_view_column_set_sort_column_id (column, COL_SPELL_WORD);
- gtk_tree_view_column_set_resizable (column, FALSE);
- gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);
-}
-
-static void
-spell_dialog_model_populate_suggestions (EmpathySpellDialog *dialog)
-{
- GtkTreeModel *model;
- GtkListStore *store;
- GList *suggestions, *l;
-
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->treeview_words));
- store = GTK_LIST_STORE (model);
-
- suggestions = empathy_spell_get_suggestions (dialog->word);
- for (l = suggestions; l; l=l->next) {
- GtkTreeIter iter;
- gchar *word;
-
- word = l->data;
-
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter,
- COL_SPELL_WORD, word,
- -1);
- }
-
- empathy_spell_free_suggestions (suggestions);
-}
-
-static void
-spell_dialog_model_row_activated_cb (GtkTreeView *tree_view,
- GtkTreePath *path,
- GtkTreeViewColumn *column,
- EmpathySpellDialog *dialog)
-{
- spell_dialog_response_cb (dialog->window, GTK_RESPONSE_OK, dialog);
-}
-
-static void
-spell_dialog_model_selection_changed_cb (GtkTreeSelection *treeselection,
- EmpathySpellDialog *dialog)
-{
- gint count;
-
- count = gtk_tree_selection_count_selected_rows (treeselection);
- gtk_widget_set_sensitive (dialog->button_replace, (count == 1));
-}
-
-static void
-spell_dialog_model_setup (EmpathySpellDialog *dialog)
-{
- GtkTreeView *view;
- GtkListStore *store;
- GtkTreeSelection *selection;
-
- view = GTK_TREE_VIEW (dialog->treeview_words);
-
- g_signal_connect (view, "row-activated",
- G_CALLBACK (spell_dialog_model_row_activated_cb),
- dialog);
-
- store = gtk_list_store_new (COL_SPELL_COUNT,
- G_TYPE_STRING); /* word */
-
- gtk_tree_view_set_model (view, GTK_TREE_MODEL (store));
-
- selection = gtk_tree_view_get_selection (view);
- gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
-
- g_signal_connect (selection, "changed",
- G_CALLBACK (spell_dialog_model_selection_changed_cb),
- dialog);
-
- spell_dialog_model_populate_columns (dialog);
- spell_dialog_model_populate_suggestions (dialog);
-
- g_object_unref (store);
-}
-
-static void
-spell_dialog_destroy_cb (GtkWidget *widget,
- EmpathySpellDialog *dialog)
-{
- g_object_unref (dialog->chat);
- g_free (dialog->word);
-
- g_free (dialog);
-}
-
-static void
-spell_dialog_response_cb (GtkWidget *widget,
- gint response,
- EmpathySpellDialog *dialog)
-{
- if (response == GTK_RESPONSE_OK) {
- GtkTreeView *view;
- GtkTreeModel *model;
- GtkTreeSelection *selection;
- GtkTreeIter iter;
-
- gchar *new_word;
-
- view = GTK_TREE_VIEW (dialog->treeview_words);
- selection = gtk_tree_view_get_selection (view);
-
- if (!gtk_tree_selection_get_selected (selection, &model, &iter)) {
- return;
- }
-
- gtk_tree_model_get (model, &iter, COL_SPELL_WORD, &new_word, -1);
-
- empathy_chat_correct_word (dialog->chat,
- &dialog->start,
- &dialog->end,
- new_word);
-
- g_free (new_word);
- }
-
- gtk_widget_destroy (dialog->window);
-}
-
-void
-empathy_spell_dialog_show (EmpathyChat *chat,
- GtkTextIter *start,
- GtkTextIter *end,
- const gchar *word)
-{
- EmpathySpellDialog *dialog;
- GtkBuilder *gui;
- gchar *str;
- gchar *filename;
-
- g_return_if_fail (chat != NULL);
- g_return_if_fail (word != NULL);
-
- dialog = g_new0 (EmpathySpellDialog, 1);
-
- dialog->chat = g_object_ref (chat);
-
- dialog->word = g_strdup (word);
-
- dialog->start = *start;
- dialog->end = *end;
-
- filename = empathy_file_lookup ("empathy-spell-dialog.ui",
- "libempathy-gtk");
- gui = empathy_builder_get_file (filename,
- "spell_dialog", &dialog->window,
- "button_replace", &dialog->button_replace,
- "label_word", &dialog->label_word,
- "treeview_words", &dialog->treeview_words,
- NULL);
- g_free (filename);
-
- empathy_builder_connect (gui, dialog,
- "spell_dialog", "response", spell_dialog_response_cb,
- "spell_dialog", "destroy", spell_dialog_destroy_cb,
- NULL);
-
- g_object_unref (gui);
-
- str = g_markup_printf_escaped ("%s:\n<b>%s</b>",
- _("Suggestions for the word"),
- word);
-
- gtk_label_set_markup (GTK_LABEL (dialog->label_word), str);
- g_free (str);
-
- spell_dialog_model_setup (dialog);
-
- gtk_widget_show (dialog->window);
-}
diff --git a/libempathy-gtk/empathy-spell-dialog.h b/libempathy-gtk/empathy-spell-dialog.h
deleted file mode 100644
index ce0218812..000000000
--- a/libempathy-gtk/empathy-spell-dialog.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2004-2007 Imendio AB
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * 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.
- *
- * Authors: Martyn Russell <martyn@imendio.com>
- * Richard Hult <richard@imendio.com>
- */
-
-#ifndef __EMPATHY_SPELL_DIALOG_H__
-#define __EMPATHY_SPELL_DIALOG_H__
-
-#include <gtk/gtktextiter.h>
-#include "empathy-chat.h"
-
-G_BEGIN_DECLS
-
-void empathy_spell_dialog_show (EmpathyChat *chat,
- GtkTextIter *start,
- GtkTextIter *end,
- const gchar *word);
-
-G_END_DECLS
-
-#endif /* __EMPATHY_SPELL_DIALOG_H__ */
diff --git a/libempathy-gtk/empathy-spell-dialog.ui b/libempathy-gtk/empathy-spell-dialog.ui
deleted file mode 100644
index 382346c1a..000000000
--- a/libempathy-gtk/empathy-spell-dialog.ui
+++ /dev/null
@@ -1,131 +0,0 @@
-<?xml version="1.0"?>
-<!--*- mode: xml -*-->
-<interface>
- <object class="GtkDialog" id="spell_dialog">
- <property name="border_width">5</property>
- <property name="title" translatable="yes">Spell Checker</property>
- <property name="modal">True</property>
- <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
- <property name="default_width">275</property>
- <property name="default_height">225</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
- <property name="has_separator">False</property>
- <child internal-child="vbox">
- <object class="GtkVBox" id="dialog-vbox7">
- <property name="visible">True</property>
- <property name="spacing">2</property>
- <child>
- <object class="GtkVBox" id="vbox128">
- <property name="visible">True</property>
- <property name="border_width">5</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkLabel" id="label_word">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Suggestions for the word:</property>
- <property name="use_markup">True</property>
- <property name="wrap">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- <child>
- <object class="GtkScrolledWindow" id="scrolledwindow9">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
- <child>
- <object class="GtkTreeView" id="treeview_words">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="headers_visible">False</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area7">
- <property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
- <child>
- <object class="GtkButton" id="button_cancel">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="label">gtk-cancel</property>
- <property name="use_stock">True</property>
- </object>
- </child>
- <child>
- <object class="GtkButton" id="button_replace">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <child>
- <object class="GtkAlignment" id="alignment6">
- <property name="visible">True</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
- <child>
- <object class="GtkHBox" id="hbox135">
- <property name="visible">True</property>
- <property name="spacing">2</property>
- <child>
- <object class="GtkImage" id="image245">
- <property name="visible">True</property>
- <property name="stock">gtk-convert</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label594">
- <property name="visible">True</property>
- <property name="label">_Replace</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="pack_type">GTK_PACK_END</property>
- </packing>
- </child>
- </object>
- </child>
- <action-widgets>
- <action-widget response="-6">button_cancel</action-widget>
- <action-widget response="-5">button_replace</action-widget>
- </action-widgets>
- </object>
-</interface>
diff --git a/libempathy-gtk/empathy-spell.c b/libempathy-gtk/empathy-spell.c
index 914c0c78d..9cd7c555b 100644
--- a/libempathy-gtk/empathy-spell.c
+++ b/libempathy-gtk/empathy-spell.c
@@ -14,8 +14,8 @@
*
* 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: Martyn Russell <martyn@imendio.com>
* Richard Hult <richard@imendio.com>
diff --git a/libempathy-gtk/empathy-spell.h b/libempathy-gtk/empathy-spell.h
index 797997c0a..65dbb131d 100644
--- a/libempathy-gtk/empathy-spell.h
+++ b/libempathy-gtk/empathy-spell.h
@@ -14,8 +14,8 @@
*
* 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: Martyn Russell <martyn@imendio.com>
* Richard Hult <richard@imendio.com>
diff --git a/libempathy-gtk/empathy-status-preset-dialog.c b/libempathy-gtk/empathy-status-preset-dialog.c
index 734ac356a..7ac13ad38 100644
--- a/libempathy-gtk/empathy-status-preset-dialog.c
+++ b/libempathy-gtk/empathy-status-preset-dialog.c
@@ -19,8 +19,8 @@
*
* 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: Davyd Madeley <davyd.madeley@collabora.co.uk>
*/
@@ -39,8 +39,6 @@
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
-#include <libmissioncontrol/mc-enum-types.h>
-
#include <libempathy/empathy-utils.h>
#include <libempathy/empathy-status-presets.h>
@@ -54,16 +52,16 @@
G_DEFINE_TYPE (EmpathyStatusPresetDialog, empathy_status_preset_dialog, GTK_TYPE_DIALOG);
-static McPresence states[] = {
- MC_PRESENCE_AVAILABLE,
- MC_PRESENCE_DO_NOT_DISTURB,
- MC_PRESENCE_AWAY
+static TpConnectionPresenceType states[] = {
+ TP_CONNECTION_PRESENCE_TYPE_AVAILABLE,
+ TP_CONNECTION_PRESENCE_TYPE_BUSY,
+ TP_CONNECTION_PRESENCE_TYPE_AWAY,
};
typedef struct _EmpathyStatusPresetDialogPriv EmpathyStatusPresetDialogPriv;
struct _EmpathyStatusPresetDialogPriv
{
- /* block status_preset_dialog_add_combo_changed() when > 0 */
+ /* block status_preset_dialog_add_combo_changed () when > 0 */
int block_add_combo_changed;
GtkWidget *presets_treeview;
@@ -153,6 +151,10 @@ static void
status_preset_add_combo_reset (EmpathyStatusPresetDialog *self)
{
EmpathyStatusPresetDialogPriv *priv = GET_PRIV (self);
+ GtkWidget *entry;
+
+ entry = gtk_bin_get_child (GTK_BIN (priv->add_combobox));
+ gtk_entry_set_text (GTK_ENTRY (entry), "");
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (priv->add_combobox),
&priv->selected_iter);
@@ -168,7 +170,7 @@ status_preset_dialog_setup_add_combobox (EmpathyStatusPresetDialog *self)
int i;
store = gtk_list_store_new (ADD_COMBO_N_COLS,
- MC_TYPE_PRESENCE, /* ADD_COMBO_STATE */
+ G_TYPE_UINT, /* ADD_COMBO_STATE */
G_TYPE_STRING, /* ADD_COMBO_ICON_NAME */
G_TYPE_STRING, /* ADD_COMBO_STATUS */
G_TYPE_STRING); /* ADD_COMBO_DEFAULT_TEXT */
@@ -218,7 +220,7 @@ status_preset_dialog_status_edited (GtkCellRendererText *renderer,
GtkTreeModel *model;
GtkTreePath *path;
GtkTreeIter iter;
- McPresence state;
+ TpConnectionPresenceType state;
char *old_status;
gboolean valid;
@@ -265,7 +267,7 @@ status_preset_dialog_setup_presets_treeview (EmpathyStatusPresetDialog *self)
GtkCellRenderer *renderer;
store = gtk_list_store_new (PRESETS_STORE_N_COLS,
- MC_TYPE_PRESENCE, /* PRESETS_STORE_STATE */
+ G_TYPE_UINT, /* PRESETS_STORE_STATE */
G_TYPE_STRING, /* PRESETS_STORE_ICON_NAME */
G_TYPE_STRING); /* PRESETS_STORE_STATUS */
@@ -311,7 +313,7 @@ status_preset_dialog_preset_remove (GtkButton *button,
GtkTreeSelection *selection;
GtkTreeModel *model;
GtkTreeIter iter;
- McPresence state;
+ TpConnectionPresenceType state;
char *status;
selection = gtk_tree_view_get_selection (
@@ -412,9 +414,12 @@ status_preset_dialog_add_preset (GtkWidget *widget,
{
EmpathyStatusPresetDialogPriv *priv = GET_PRIV (self);
GtkTreeModel *model;
+ GtkTreeIter iter;
GtkWidget *entry;
- McPresence state;
+ TpConnectionPresenceType state, cstate;
const char *status;
+ char *cstatus;
+ gboolean valid, match = FALSE;
g_return_if_fail (priv->add_combo_changed);
@@ -430,6 +435,40 @@ status_preset_dialog_add_preset (GtkWidget *widget,
empathy_status_presets_set_last (state, status);
status_preset_dialog_presets_update (self);
+
+ /* select the added status*/
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->presets_treeview));
+ for (valid = gtk_tree_model_get_iter_first (model, &iter);
+ valid;
+ valid = gtk_tree_model_iter_next (model, &iter)) {
+
+ gtk_tree_model_get (model, &iter,
+ PRESETS_STORE_STATE, &cstate,
+ PRESETS_STORE_STATUS, &cstatus,
+ -1);
+
+ match = (cstate == state) && (strcmp (cstatus, status) == 0);
+
+ g_free (cstatus);
+
+ if (match) {
+ GtkTreePath *path;
+
+ path = gtk_tree_model_get_path (model, &iter);
+
+ gtk_tree_selection_select_iter (
+ gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->presets_treeview)),
+ &iter);
+ gtk_tree_view_scroll_to_cell (
+ GTK_TREE_VIEW (priv->presets_treeview),
+ path, NULL,
+ FALSE, 0., 0.);
+ break;
+ }
+ }
+
+ if (!match) g_warning ("No match");
+
status_preset_add_combo_reset (self);
}
@@ -520,7 +559,7 @@ empathy_status_preset_dialog_init (EmpathyStatusPresetDialog *self)
status_preset_dialog_setup_presets_treeview (self);
status_preset_dialog_setup_add_combobox (self);
- gtk_box_pack_start(GTK_BOX (GTK_DIALOG (self)->vbox), toplevel_vbox,
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (self)->vbox), toplevel_vbox,
TRUE, TRUE, 0);
g_object_unref (gui);
diff --git a/libempathy-gtk/empathy-status-preset-dialog.h b/libempathy-gtk/empathy-status-preset-dialog.h
index e53c3d8ad..2c507ce37 100644
--- a/libempathy-gtk/empathy-status-preset-dialog.h
+++ b/libempathy-gtk/empathy-status-preset-dialog.h
@@ -19,8 +19,8 @@
*
* 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: Davyd Madeley <davyd.madeley@collabora.co.uk>
*/
diff --git a/libempathy-gtk/empathy-theme-boxes.c b/libempathy-gtk/empathy-theme-boxes.c
index 5b435f1d5..199132956 100644
--- a/libempathy-gtk/empathy-theme-boxes.c
+++ b/libempathy-gtk/empathy-theme-boxes.c
@@ -15,8 +15,8 @@
*
* 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>
*/
@@ -259,7 +259,7 @@ theme_boxes_maybe_append_header (EmpathyThemeBoxes *theme,
/* Add the message receive time */
time = empathy_message_get_timestamp (msg);
- tmp = empathy_time_to_string_local (time,
+ tmp = empathy_time_to_string_local (time,
EMPATHY_TIME_FORMAT_DISPLAY_SHORT);
str = g_strdup_printf ("<i>%s</i>", tmp);
label2 = g_object_new (GTK_TYPE_LABEL,
@@ -330,7 +330,7 @@ theme_boxes_append_message (EmpathyChatTextView *view,
TP_CHANNEL_TEXT_MESSAGE_TYPE_ACTION) {
gchar *body;
- body = g_strdup_printf (" * %s %s",
+ body = g_strdup_printf (" * %s %s",
empathy_contact_get_name (sender),
empathy_message_get_body (message));
empathy_chat_text_view_append_body (EMPATHY_CHAT_TEXT_VIEW (view),
diff --git a/libempathy-gtk/empathy-theme-boxes.h b/libempathy-gtk/empathy-theme-boxes.h
index fed7ceea0..53dd350ad 100644
--- a/libempathy-gtk/empathy-theme-boxes.h
+++ b/libempathy-gtk/empathy-theme-boxes.h
@@ -15,8 +15,8 @@
*
* 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>
*/
diff --git a/libempathy-gtk/empathy-theme-irc.c b/libempathy-gtk/empathy-theme-irc.c
index 479108ce3..183a5cc51 100644
--- a/libempathy-gtk/empathy-theme-irc.c
+++ b/libempathy-gtk/empathy-theme-irc.c
@@ -15,8 +15,8 @@
*
* 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>
*/
@@ -65,7 +65,7 @@ theme_irc_append_message (EmpathyChatTextView *view,
name = empathy_contact_get_name (contact);
if (empathy_message_get_tptype (message) == TP_CHANNEL_TEXT_MESSAGE_TYPE_ACTION) {
- tmp = g_strdup_printf (" * %s %s",
+ tmp = g_strdup_printf (" * %s %s",
empathy_contact_get_name (contact),
empathy_message_get_body (message));
empathy_chat_text_view_append_body (view, tmp,
diff --git a/libempathy-gtk/empathy-theme-irc.h b/libempathy-gtk/empathy-theme-irc.h
index 58d82ac0e..30bee6271 100644
--- a/libempathy-gtk/empathy-theme-irc.h
+++ b/libempathy-gtk/empathy-theme-irc.h
@@ -15,8 +15,8 @@
*
* 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>
*/
diff --git a/libempathy-gtk/empathy-theme-manager.c b/libempathy-gtk/empathy-theme-manager.c
index 841e26297..0186b5eb7 100644
--- a/libempathy-gtk/empathy-theme-manager.c
+++ b/libempathy-gtk/empathy-theme-manager.c
@@ -15,8 +15,8 @@
*
* 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>
*/
@@ -69,8 +69,8 @@ G_DEFINE_TYPE (EmpathyThemeManager, empathy_theme_manager, G_TYPE_OBJECT);
static void
theme_manager_gdk_color_to_hex (GdkColor *gdk_color, gchar *str_color)
{
- g_snprintf (str_color, 10,
- "#%02x%02x%02x",
+ g_snprintf (str_color, 10,
+ "#%02x%02x%02x",
gdk_color->red >> 8,
gdk_color->green >> 8,
gdk_color->blue >> 8);
diff --git a/libempathy-gtk/empathy-theme-manager.h b/libempathy-gtk/empathy-theme-manager.h
index 05661d306..99c96d784 100644
--- a/libempathy-gtk/empathy-theme-manager.h
+++ b/libempathy-gtk/empathy-theme-manager.h
@@ -15,8 +15,8 @@
*
* 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>
*/
diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c
index 9a249e65b..f30c58aad 100644
--- a/libempathy-gtk/empathy-ui-utils.c
+++ b/libempathy-gtk/empathy-ui-utils.c
@@ -15,15 +15,15 @@
*
* 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: Mikael Hallendal <micke@imendio.com>
* Richard Hult <richard@imendio.com>
* Martyn Russell <martyn@imendio.com>
* Xavier Claessens <xclaesse@gmail.com>
* Jonny Lamb <jonny.lamb@collabora.co.uk>
- *
+ *
* Part of this file is copied from GtkSourceView (gtksourceiter.c):
* Paolo Maggi
* Jeroen Zwartepoorte
@@ -50,7 +50,7 @@
#include <libempathy/empathy-utils.h>
#include <libempathy/empathy-dispatcher.h>
#include <libempathy/empathy-idle.h>
-#include <libempathy/empathy-tp-file.h>
+#include <libempathy/empathy-ft-factory.h>
#define SCHEMES "(https?|s?ftps?|nntp|news|javascript|about|ghelp|apt|telnet|"\
"file|webcal|mailto)"
@@ -194,24 +194,25 @@ empathy_icon_name_from_account (McAccount *account)
}
const gchar *
-empathy_icon_name_for_presence (McPresence presence)
+empathy_icon_name_for_presence (TpConnectionPresenceType presence)
{
switch (presence) {
- case MC_PRESENCE_AVAILABLE:
+ case TP_CONNECTION_PRESENCE_TYPE_AVAILABLE:
return EMPATHY_IMAGE_AVAILABLE;
- case MC_PRESENCE_DO_NOT_DISTURB:
+ case TP_CONNECTION_PRESENCE_TYPE_BUSY:
return EMPATHY_IMAGE_BUSY;
- case MC_PRESENCE_AWAY:
+ case TP_CONNECTION_PRESENCE_TYPE_AWAY:
return EMPATHY_IMAGE_AWAY;
- case MC_PRESENCE_EXTENDED_AWAY:
+ case TP_CONNECTION_PRESENCE_TYPE_EXTENDED_AWAY:
return EMPATHY_IMAGE_EXT_AWAY;
- case MC_PRESENCE_HIDDEN:
+ case TP_CONNECTION_PRESENCE_TYPE_HIDDEN:
return EMPATHY_IMAGE_HIDDEN;
- case MC_PRESENCE_OFFLINE:
- case MC_PRESENCE_UNSET:
+ case TP_CONNECTION_PRESENCE_TYPE_OFFLINE:
+ case TP_CONNECTION_PRESENCE_TYPE_ERROR:
+ case TP_CONNECTION_PRESENCE_TYPE_UNKNOWN:
return EMPATHY_IMAGE_OFFLINE;
- default:
- g_assert_not_reached ();
+ case TP_CONNECTION_PRESENCE_TYPE_UNSET:
+ return NULL;
}
return NULL;
@@ -220,7 +221,7 @@ empathy_icon_name_for_presence (McPresence presence)
const gchar *
empathy_icon_name_for_contact (EmpathyContact *contact)
{
- McPresence presence;
+ TpConnectionPresenceType presence;
g_return_val_if_fail (EMPATHY_IS_CONTACT (contact),
EMPATHY_IMAGE_OFFLINE);
@@ -609,7 +610,7 @@ g_utf8_strcasestr (const gchar *haystack, const gchar *needle)
if (needle_len == 0)
{
- ret = (gchar *)haystack;
+ ret = (gchar *) haystack;
goto finally_1;
}
@@ -619,7 +620,7 @@ g_utf8_strcasestr (const gchar *haystack, const gchar *needle)
goto finally_1;
}
- p = (gchar*)caseless_haystack;
+ p = (gchar *) caseless_haystack;
needle_len = strlen (needle);
i = 0;
@@ -715,7 +716,7 @@ forward_chars_with_skipping (GtkTextIter *iter,
/* being UTF8 correct sucks; this accounts for extra
offsets coming from canonical decompositions of
UTF8 characters (e.g. accented characters) which
- g_utf8_normalize() performs */
+ g_utf8_normalize () performs */
gchar *normal;
gchar buffer[6];
gint buffer_len;
@@ -968,7 +969,7 @@ empathy_text_iter_forward_search (const GtkTextIter *iter,
}
} while (gtk_text_iter_forward_line (&search));
- g_strfreev ((gchar**)lines);
+ g_strfreev ((gchar **) lines);
return retval;
}
@@ -996,7 +997,7 @@ g_utf8_strrcasestr (const gchar *haystack, const gchar *needle)
if (needle_len == 0)
{
- ret = (gchar *)haystack;
+ ret = (gchar *) haystack;
goto finally_1;
}
@@ -1214,7 +1215,7 @@ empathy_text_iter_backward_search (const GtkTextIter *iter,
}
}
- g_strfreev ((gchar**)lines);
+ g_strfreev ((gchar **) lines);
return retval;
}
@@ -1240,7 +1241,7 @@ empathy_window_get_is_visible (GtkWindow *window)
return TRUE;
}
-void
+void
empathy_window_iconify (GtkWindow *window, GtkStatusIcon *status_icon)
{
GdkRectangle icon_location;
@@ -1350,7 +1351,7 @@ empathy_url_show (GtkWidget *parent,
GtkWidget *dialog;
dialog = gtk_message_dialog_new (NULL, 0,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
_("Unable to open URI"));
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
"%s", error->message);
@@ -1401,86 +1402,31 @@ empathy_toggle_button_set_state_quietly (GtkWidget *widget,
g_signal_handlers_unblock_by_func (widget, callback, user_data);
}
-/* Sending files with the file chooser */
-
-static void
-file_manager_send_file_request_cb (EmpathyDispatchOperation *operation,
- const GError *error, gpointer user_data)
-{
- GFile *file = (GFile *)user_data;
- EmpathyTpFile *tp_file;
-
- if (error != NULL) {
- DEBUG ("Couldn't request channel: %s", error->message);
- g_object_unref (file);
- return;
- }
-
- DEBUG ("Starting to send file");
-
- tp_file = EMPATHY_TP_FILE (
- empathy_dispatch_operation_get_channel_wrapper (operation));
-
- empathy_tp_file_offer (tp_file, file, NULL);
-
- g_object_unref (file);
-}
-
static void
file_manager_send_file_response_cb (GtkDialog *widget,
gint response_id,
EmpathyContact *contact)
{
- if (response_id == GTK_RESPONSE_OK) {
- GSList *list;
- GSList *l;
-
- list = gtk_file_chooser_get_uris (GTK_FILE_CHOOSER (widget));
-
- DEBUG ("File chooser selected files:");
-
- for (l = list; l; l = l->next) {
- gchar *uri;
- GFile *gfile;
- GFileInfo *info;
- GtkRecentManager *manager;
- gchar *filename;
- GTimeVal mtime;
- GError *error = NULL;
-
- uri = l->data;
- gfile = g_file_new_for_uri (uri);
- info = g_file_query_info (gfile,
- G_FILE_ATTRIBUTE_STANDARD_SIZE ","
- G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE ","
- G_FILE_ATTRIBUTE_TIME_MODIFIED,
- 0, NULL, &error);
-
- if (error) {
- DEBUG ("Can't get info about the file: %s", error->message);
- g_clear_error (&error);
- g_object_unref (gfile);
- continue;
- }
+ EmpathyFTFactory *factory;
+ GFile *file;
+ gchar *uri;
+ GtkRecentManager *manager;
- DEBUG ("\t%s", uri);
- filename = g_file_get_basename (gfile);
- g_file_info_get_modification_time (info, &mtime);
+ if (response_id == GTK_RESPONSE_OK) {
+ file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (widget));
+ uri = g_file_get_uri (file);
- empathy_dispatcher_send_file_to_contact (contact,
- filename, g_file_info_get_size (info), mtime.tv_sec,
- g_file_info_get_content_type (info),
- file_manager_send_file_request_cb, gfile);
+ factory = empathy_ft_factory_dup_singleton ();
- g_free (filename);
- g_object_unref (info);
+ empathy_ft_factory_new_transfer_outgoing (factory, contact,
+ file);
- manager = gtk_recent_manager_get_default ();
- gtk_recent_manager_add_item (manager, uri);
+ manager = gtk_recent_manager_get_default ();
+ gtk_recent_manager_add_item (manager, uri);
- g_free (uri);
- }
- g_slist_free (list);
+ g_free (uri);
+ g_object_unref (factory);
+ g_object_unref (file);
}
gtk_widget_destroy (GTK_WIDGET (widget));
@@ -1522,6 +1468,57 @@ empathy_send_file_with_file_chooser (EmpathyContact *contact)
gtk_widget_show (widget);
}
+static void
+file_manager_receive_file_response_cb (GtkDialog *dialog,
+ GtkResponseType response,
+ EmpathyFTHandler *handler)
+{
+ EmpathyFTFactory *factory;
+ GFile *file;
+
+ if (response == GTK_RESPONSE_OK) {
+ factory = empathy_ft_factory_dup_singleton ();
+ file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
+
+ empathy_ft_factory_set_destination_for_incoming_handler
+ (factory, handler, file);
+
+ g_object_unref (factory);
+ g_object_unref (file);
+ } else {
+ /* unref the handler, as we dismissed the file chooser,
+ * and refused the transfer.
+ */
+ g_object_unref (handler);
+ }
+
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+}
+
+void
+empathy_receive_file_with_file_chooser (EmpathyFTHandler *handler)
+{
+ GtkWidget *widget;
+
+ widget = gtk_file_chooser_dialog_new (_("Select a destination"),
+ NULL,
+ GTK_FILE_CHOOSER_ACTION_SAVE,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_CANCEL,
+ GTK_STOCK_SAVE,
+ GTK_RESPONSE_OK,
+ NULL);
+ gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (widget),
+ empathy_ft_handler_get_filename (handler));
+ gtk_file_chooser_set_do_overwrite_confirmation
+ (GTK_FILE_CHOOSER (widget), TRUE);
+
+ g_signal_connect (widget, "response",
+ G_CALLBACK (file_manager_receive_file_response_cb), handler);
+
+ gtk_widget_show (widget);
+}
+
typedef struct {
EmpathySound sound_id;
const char * event_ca_id;
@@ -1624,7 +1621,7 @@ empathy_sound_play_full (GtkWidget *widget, EmpathySound sound_id,
entry->event_ca_id,
entry->event_ca_description);
- if (ca_proplist_create(&p) < 0)
+ if (ca_proplist_create (&p) < 0)
goto failed;
if (ca_proplist_sets (p, CA_PROP_EVENT_ID, entry->event_ca_id) < 0)
diff --git a/libempathy-gtk/empathy-ui-utils.h b/libempathy-gtk/empathy-ui-utils.h
index 8dcc4c037..4d58fedcf 100644
--- a/libempathy-gtk/empathy-ui-utils.h
+++ b/libempathy-gtk/empathy-ui-utils.h
@@ -15,15 +15,15 @@
*
* 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: Mikael Hallendal <micke@imendio.com>
* Richard Hult <richard@imendio.com>
* Martyn Russell <martyn@imendio.com>
* Xavier Claessens <xclaesse@gmail.com>
* Jonny Lamb <jonny.lamb@collabora.co.uk>
- *
+ *
* Part of this file is copied from GtkSourceView (gtksourceiter.c):
* Paolo Maggi
* Jeroen Zwartepoorte
@@ -39,8 +39,8 @@
#include <libmissioncontrol/mc-account.h>
#include <libmissioncontrol/mc-profile.h>
-
#include <libempathy/empathy-contact.h>
+#include <libempathy/empathy-ft-handler.h>
#include "empathy-chat-view.h"
@@ -77,7 +77,7 @@ GtkWidget *empathy_builder_unref_and_keep_widget (GtkBuilder *gui,
/* Pixbufs */
const gchar * empathy_icon_name_from_account (McAccount *account);
-const gchar * empathy_icon_name_for_presence (McPresence presence);
+const gchar * empathy_icon_name_for_presence (TpConnectionPresenceType presence);
const gchar * empathy_icon_name_for_contact (EmpathyContact *contact);
GdkPixbuf * empathy_pixbuf_from_data (gchar *data,
gsize data_size);
@@ -124,6 +124,7 @@ GtkWidget * empathy_link_button_new (const gchar *url,
const gchar *title);
void empathy_send_file_with_file_chooser (EmpathyContact *contact);
+void empathy_receive_file_with_file_chooser (EmpathyFTHandler *handler);
/* Sounds */
void empathy_sound_play (GtkWidget *widget,
diff --git a/libempathy-gtk/empathy-video-src.c b/libempathy-gtk/empathy-video-src.c
index d2d03026b..bd014a5d9 100644
--- a/libempathy-gtk/empathy-video-src.c
+++ b/libempathy-gtk/empathy-video-src.c
@@ -159,7 +159,7 @@ empathy_video_src_set_channel (GstElement *src,
channels = gst_color_balance_list_channels (balance);
- for (l = (GList *)channels; l != NULL; l = g_list_next (l))
+ for (l = (GList *) channels; l != NULL; l = g_list_next (l))
{
GstColorBalanceChannel *c = GST_COLOR_BALANCE_CHANNEL (l->data);
@@ -195,7 +195,7 @@ empathy_video_src_get_channel (GstElement *src,
channels = gst_color_balance_list_channels (balance);
- for (l = (GList *)channels; l != NULL; l = g_list_next (l))
+ for (l = (GList *) channels; l != NULL; l = g_list_next (l))
{
GstColorBalanceChannel *c = GST_COLOR_BALANCE_CHANNEL (l->data);
@@ -235,7 +235,7 @@ empathy_video_src_get_supported_channels (GstElement *src)
channels = gst_color_balance_list_channels (balance);
- for (l = (GList *)channels; l != NULL; l = g_list_next (l))
+ for (l = (GList *) channels; l != NULL; l = g_list_next (l))
{
GstColorBalanceChannel *channel = GST_COLOR_BALANCE_CHANNEL (l->data);
int i;
diff --git a/libempathy-gtk/empathy-video-src.h b/libempathy-gtk/empathy-video-src.h
index fef0b84dd..4197d7fad 100644
--- a/libempathy-gtk/empathy-video-src.h
+++ b/libempathy-gtk/empathy-video-src.h
@@ -55,7 +55,7 @@ GType empathy_video_src_get_type (void);
/* TYPE MACROS */
#define EMPATHY_TYPE_GST_VIDEO_SRC \
- (empathy_video_src_get_type())
+ (empathy_video_src_get_type ())
#define EMPATHY_GST_VIDEO_SRC(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), EMPATHY_TYPE_GST_VIDEO_SRC, \
EmpathyGstVideoSrc))
diff --git a/libempathy-gtk/empathy-video-widget.c b/libempathy-gtk/empathy-video-widget.c
index 4c7bee9db..7647b845f 100644
--- a/libempathy-gtk/empathy-video-widget.c
+++ b/libempathy-gtk/empathy-video-widget.c
@@ -263,14 +263,14 @@ empathy_video_widget_class_init (
param_spec = g_param_spec_int ("min-width",
"min-width",
"Minimal width of the widget",
- 0, G_MAXINT, 320,
+ 0, G_MAXINT, EMPATHY_VIDEO_WIDGET_DEFAULT_WIDTH,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (object_class, PROP_MIN_WIDTH, param_spec);
param_spec = g_param_spec_int ("min-height",
"min-height",
"Minimal height of the widget",
- 0, G_MAXINT, 240,
+ 0, G_MAXINT, EMPATHY_VIDEO_WIDGET_DEFAULT_HEIGHT,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (object_class, PROP_MIN_HEIGHT, param_spec);
diff --git a/libempathy-gtk/empathy-video-widget.h b/libempathy-gtk/empathy-video-widget.h
index 08acdaa71..cfdd0354c 100644
--- a/libempathy-gtk/empathy-video-widget.h
+++ b/libempathy-gtk/empathy-video-widget.h
@@ -21,6 +21,9 @@
#ifndef __EMPATHY_VIDEO_WIDGET_H__
#define __EMPATHY_VIDEO_WIDGET_H__
+#define EMPATHY_VIDEO_WIDGET_DEFAULT_WIDTH 320
+#define EMPATHY_VIDEO_WIDGET_DEFAULT_HEIGHT 240
+
#include <glib-object.h>
#include <gst/gst.h>
#include <gtk/gtk.h>
@@ -42,7 +45,7 @@ GType empathy_video_widget_get_type (void);
/* TYPE MACROS */
#define EMPATHY_TYPE_VIDEO_WIDGET \
- (empathy_video_widget_get_type())
+ (empathy_video_widget_get_type ())
#define EMPATHY_VIDEO_WIDGET(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), EMPATHY_TYPE_VIDEO_WIDGET, \
EmpathyVideoWidget))