diff options
author | Pierre-Luc Beaudoin <pierre-luc@pierlux.com> | 2009-04-08 04:04:31 +0800 |
---|---|---|
committer | Pierre-Luc Beaudoin <pierre-luc@pierlux.com> | 2009-05-28 00:52:04 +0800 |
commit | b12b63f0c0a992d3caf8c0ada68e502bd8d3a506 (patch) | |
tree | 24c628aabb896d7efb1cef23794b2cde0bc28b18 | |
parent | 30165e135359e217e7a9581277f8bf9b7b5c7459 (diff) | |
download | gsoc2013-empathy-b12b63f0c0a992d3caf8c0ada68e502bd8d3a506.tar gsoc2013-empathy-b12b63f0c0a992d3caf8c0ada68e502bd8d3a506.tar.gz gsoc2013-empathy-b12b63f0c0a992d3caf8c0ada68e502bd8d3a506.tar.bz2 gsoc2013-empathy-b12b63f0c0a992d3caf8c0ada68e502bd8d3a506.tar.lz gsoc2013-empathy-b12b63f0c0a992d3caf8c0ada68e502bd8d3a506.tar.xz gsoc2013-empathy-b12b63f0c0a992d3caf8c0ada68e502bd8d3a506.tar.zst gsoc2013-empathy-b12b63f0c0a992d3caf8c0ada68e502bd8d3a506.zip |
Add a map in the Contact Information dialog
For now, the map in the tool tip is disabled as Clutter-gtk
does like at all this type of window/initialisation
-rw-r--r-- | libempathy-gtk/Makefile.am | 4 | ||||
-rw-r--r-- | libempathy-gtk/empathy-contact-dialogs.c | 5 | ||||
-rw-r--r-- | libempathy-gtk/empathy-contact-widget.c | 48 | ||||
-rw-r--r-- | libempathy-gtk/empathy-contact-widget.h | 1 | ||||
-rw-r--r-- | libempathy-gtk/empathy-contact-widget.ui | 50 |
5 files changed, 104 insertions, 4 deletions
diff --git a/libempathy-gtk/Makefile.am b/libempathy-gtk/Makefile.am index cf6a2762f..2f1eaaa25 100644 --- a/libempathy-gtk/Makefile.am +++ b/libempathy-gtk/Makefile.am @@ -7,6 +7,8 @@ AM_CPPFLAGS = \ -DPKGDATADIR=\""$(pkgdatadir)"\" \ $(LIBEMPATHYGTK_CFLAGS) \ $(ENCHANT_CFLAGS) \ + $(GEOCLUE_CFLAGS) \ + $(LIBCHAMPLAIN_CFLAGS) \ $(WARN_CFLAGS) \ $(DISABLE_DEPRECATED) @@ -68,6 +70,8 @@ nodist_libempathy_gtk_la_SOURCES =\ libempathy_gtk_la_LIBADD = \ $(LIBEMPATHYGTK_LIBS) \ $(ENCHANT_LIBS) \ + $(GEOCLUE_LIBS) \ + $(LIBCHAMPLAIN_LIBS) \ $(top_builddir)/libempathy/libempathy.la libempathy_gtk_la_LDFLAGS = \ diff --git a/libempathy-gtk/empathy-contact-dialogs.c b/libempathy-gtk/empathy-contact-dialogs.c index 7de793153..a4c05eb6d 100644 --- a/libempathy-gtk/empathy-contact-dialogs.c +++ b/libempathy-gtk/empathy-contact-dialogs.c @@ -190,6 +190,9 @@ empathy_contact_information_dialog_show (EmpathyContact *contact, /* Contact info widget */ contact_widget = empathy_contact_widget_new (contact, +#if HAVE_LIBCHAMPLAIN + EMPATHY_CONTACT_WIDGET_SHOW_LOCATION | +#endif 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), @@ -246,11 +249,11 @@ empathy_contact_edit_dialog_show (EmpathyContact *contact, gtk_window_set_default (GTK_WINDOW (dialog), button); gtk_widget_show (button); - /* Contact info widget */ contact_widget = empathy_contact_widget_new (contact, EMPATHY_CONTACT_WIDGET_EDIT_ALIAS | EMPATHY_CONTACT_WIDGET_EDIT_GROUPS); gtk_container_set_border_width (GTK_CONTAINER (contact_widget), 8); + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), contact_widget, TRUE, TRUE, 0); diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c index a32ac65d6..1fcfc4e56 100644 --- a/libempathy-gtk/empathy-contact-widget.c +++ b/libempathy-gtk/empathy-contact-widget.c @@ -27,6 +27,11 @@ #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> @@ -90,6 +95,15 @@ typedef struct GtkWidget *table_contact; GtkWidget *vbox_avatar; +#if HAVE_LIBCHAMPLAIN + /* Location */ + GtkWidget *vbox_location; + GtkWidget *label_location; + GtkWidget *viewport_map; + GtkWidget *map_view_embed; + ClutterActor *map_view; +#endif + /* Groups */ GtkWidget *vbox_groups; GtkWidget *entry_group; @@ -135,6 +149,10 @@ static void contact_widget_presence_notify_cb ( EmpathyContactWidget *information); static void contact_widget_avatar_notify_cb ( EmpathyContactWidget *information); +#if HAVE_LIBCHAMPLAIN +static void contact_widget_location_setup ( + EmpathyContactWidget *information); +#endif static void contact_widget_groups_setup ( EmpathyContactWidget *information); static void contact_widget_groups_update (EmpathyContactWidget *information); @@ -203,6 +221,11 @@ empathy_contact_widget_new (EmpathyContact *contact, "label_status", &information->label_status, "table_contact", &information->table_contact, "vbox_avatar", &information->vbox_avatar, +#if HAVE_LIBCHAMPLAIN + "vbox_location", &information->vbox_location, + "label_location", &information->label_location, + "viewport_map", &information->viewport_map, +#endif "vbox_groups", &information->vbox_groups, "entry_group", &information->entry_group, "button_group", &information->button_group, @@ -229,6 +252,9 @@ empathy_contact_widget_new (EmpathyContact *contact, /* Create widgets */ contact_widget_contact_setup (information); +#if HAVE_LIBCHAMPLAIN + contact_widget_location_setup (information); +#endif contact_widget_groups_setup (information); contact_widget_details_setup (information); contact_widget_client_setup (information); @@ -880,6 +906,28 @@ contact_widget_avatar_notify_cb (EmpathyContactWidget *information) EMPATHY_AVATAR_IMAGE (information->widget_avatar), avatar); } +#if HAVE_LIBCHAMPLAIN +static void +contact_widget_location_setup (EmpathyContactWidget *information) +{ + if (/* information->flags & EMPATHY_CONTACT_WIDGET_FOR_TOOLTIP || */ + information->flags & EMPATHY_CONTACT_WIDGET_SHOW_LOCATION) + { + information->map_view = champlain_view_new (CHAMPLAIN_VIEW_MODE_KINETIC); + 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, + NULL); + champlain_view_center_on (CHAMPLAIN_VIEW(information->map_view), 45, -73); + + gtk_widget_show_all (information->vbox_location); + } +} +#endif + static void contact_widget_groups_setup (EmpathyContactWidget *information) { 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..ed77df0f1 100644 --- a/libempathy-gtk/empathy-contact-widget.ui +++ b/libempathy-gtk/empathy-contact-widget.ui @@ -162,6 +162,50 @@ </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"><b>Location</b> 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="GtkViewport" id="viewport_map"> + <property name="height_request">150</property> + <property name="visible">True</property> + <property name="resize_mode">queue</property> + <child> + <placeholder/> + </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 +311,7 @@ </child> </object> <packing> - <property name="position">1</property> + <property name="position">2</property> </packing> </child> <child> @@ -411,7 +455,7 @@ </object> <packing> <property name="expand">False</property> - <property name="position">2</property> + <property name="position">3</property> </packing> </child> <child> @@ -578,7 +622,7 @@ </object> <packing> <property name="expand">False</property> - <property name="position">3</property> + <property name="position">4</property> </packing> </child> </object> |