[gnome-chat] Borrow some bits from Empathy to show the presence icon and message
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-chat] Borrow some bits from Empathy to show the presence icon and message
- Date: Wed, 11 Sep 2013 13:10:49 +0000 (UTC)
commit 89e4cd84439f866fe82d03f3605662ff815a9617
Author: Debarshi Ray <debarshir gnome org>
Date: Wed Sep 11 14:18:19 2013 +0200
Borrow some bits from Empathy to show the presence icon and message
po/POTFILES.in | 1 +
src/Makefile.am | 5 +++
src/empathy-images.h | 60 +++++++++++++++++++++++++++++++++++++
src/empathy-ui-utils.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++++
src/empathy-ui-utils.h | 46 ++++++++++++++++++++++++++++
src/empathy-utils.c | 56 +++++++++++++++++++++++++++++++++++
src/empathy-utils.h | 39 ++++++++++++++++++++++++
7 files changed, 284 insertions(+), 0 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index a3ea5cd..81299f4 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -6,3 +6,4 @@ data/org.gnome.chat.gschema.xml.in
[type: gettext/glade]src/chat-contacts-list-dialog.ui
[type: gettext/glade]src/chat-main-toolbar.ui
src/chat-main-window.c
+src/empathy-utils.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 46feb28..213e8ae 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -16,6 +16,11 @@ nodist_gnome_chat_SOURCES = \
$(NULL)
gnome_chat_SOURCES = \
+ empathy-images.h \
+ empathy-ui-utils.c \
+ empathy-ui-utils.h \
+ empathy-utils.c \
+ empathy-utils.h \
polari-fixed-size-frame.c \
polari-fixed-size-frame.h \
chat-application.c \
diff --git a/src/empathy-images.h b/src/empathy-images.h
new file mode 100644
index 0000000..3b7b8fd
--- /dev/null
+++ b/src/empathy-images.h
@@ -0,0 +1,60 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2007-2008 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * 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>
+ */
+
+#ifndef __EMPATHY_IMAGES_H__
+#define __EMPATHY_IMAGES_H__
+
+G_BEGIN_DECLS
+
+#define EMPATHY_IMAGE_OFFLINE "user-offline"
+/* user-invisible is not (yet?) in the naming spec but already implemented by
+ * some theme */
+#define EMPATHY_IMAGE_HIDDEN "user-invisible"
+#define EMPATHY_IMAGE_AVAILABLE "user-available"
+#define EMPATHY_IMAGE_BUSY "user-busy"
+#define EMPATHY_IMAGE_AWAY "user-away"
+#define EMPATHY_IMAGE_EXT_AWAY "user-extended-away"
+#define EMPATHY_IMAGE_IDLE "user-idle"
+#define EMPATHY_IMAGE_PENDING "empathy-pending"
+
+#define EMPATHY_IMAGE_MESSAGE "im-message"
+#define EMPATHY_IMAGE_NEW_MESSAGE "im-message-new"
+#define EMPATHY_IMAGE_TYPING "user-typing"
+#define EMPATHY_IMAGE_CONTACT_INFORMATION "gtk-info"
+#define EMPATHY_IMAGE_GROUP_MESSAGE "system-users"
+#define EMPATHY_IMAGE_SMS "stock_cell-phone"
+#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"
+/* FIXME: need a better icon! */
+#define EMPATHY_IMAGE_EDIT_MESSAGE "format-text-direction-ltr"
+#define EMPATHY_IMAGE_MIC "audio-input-microphone-symbolic"
+#define EMPATHY_IMAGE_MIC_MUTED "audio-input-microphone-muted-symbolic"
+
+#define EMPATHY_IMAGE_CALL "call-start"
+#define EMPATHY_IMAGE_CALL_MISSED "call-stop"
+#define EMPATHY_IMAGE_CALL_INCOMING "call-start"
+#define EMPATHY_IMAGE_CALL_OUTGOING "call-start"
+
+G_END_DECLS
+
+#endif /* __EMPATHY_IMAGES_ICONS_H__ */
diff --git a/src/empathy-ui-utils.c b/src/empathy-ui-utils.c
new file mode 100644
index 0000000..aa0baf3
--- /dev/null
+++ b/src/empathy-ui-utils.c
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2002-2007 Imendio AB
+ * Copyright (C) 2007-2010 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: 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>
+ * Travis Reitter <travis reitter collabora co uk>
+ *
+ * Part of this file is copied from GtkSourceView (gtksourceiter.c):
+ * Paolo Maggi
+ * Jeroen Zwartepoorte
+ */
+
+#include "config.h"
+#include "empathy-ui-utils.h"
+
+#include <gtk/gtk.h>
+
+#include "empathy-images.h"
+
+const gchar *
+empathy_icon_name_for_presence (TpConnectionPresenceType presence)
+{
+ switch (presence)
+ {
+ case TP_CONNECTION_PRESENCE_TYPE_AVAILABLE:
+ return EMPATHY_IMAGE_AVAILABLE;
+ case TP_CONNECTION_PRESENCE_TYPE_BUSY:
+ return EMPATHY_IMAGE_BUSY;
+ case TP_CONNECTION_PRESENCE_TYPE_AWAY:
+ return EMPATHY_IMAGE_AWAY;
+ case TP_CONNECTION_PRESENCE_TYPE_EXTENDED_AWAY:
+ if (gtk_icon_theme_has_icon (gtk_icon_theme_get_default (),
+ EMPATHY_IMAGE_EXT_AWAY))
+ return EMPATHY_IMAGE_EXT_AWAY;
+
+ /* The 'extended-away' icon is not an official one so we fallback to
+ * idle if it's not implemented */
+ return EMPATHY_IMAGE_IDLE;
+ case TP_CONNECTION_PRESENCE_TYPE_HIDDEN:
+ if (gtk_icon_theme_has_icon (gtk_icon_theme_get_default (),
+ EMPATHY_IMAGE_HIDDEN))
+ return EMPATHY_IMAGE_HIDDEN;
+
+ /* The 'hidden' icon is not an official one so we fallback to offline if
+ * it's not implemented */
+ return EMPATHY_IMAGE_OFFLINE;
+ case TP_CONNECTION_PRESENCE_TYPE_OFFLINE:
+ case TP_CONNECTION_PRESENCE_TYPE_ERROR:
+ return EMPATHY_IMAGE_OFFLINE;
+ case TP_CONNECTION_PRESENCE_TYPE_UNKNOWN:
+ return EMPATHY_IMAGE_PENDING;
+ case TP_CONNECTION_PRESENCE_TYPE_UNSET:
+ default:
+ return NULL;
+ }
+
+ return NULL;
+}
diff --git a/src/empathy-ui-utils.h b/src/empathy-ui-utils.h
new file mode 100644
index 0000000..96ce2c3
--- /dev/null
+++ b/src/empathy-ui-utils.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2002-2007 Imendio AB
+ * Copyright (C) 2007-2010 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: 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>
+ * Travis Reitter <travis reitter collabora co uk>
+ *
+ * Part of this file is copied from GtkSourceView (gtksourceiter.c):
+ * Paolo Maggi
+ * Jeroen Zwartepoorte
+ */
+
+#ifndef __EMPATHY_UI_UTILS_H__
+#define __EMPATHY_UI_UTILS_H__
+
+#include <glib.h>
+#include <telepathy-glib/telepathy-glib.h>
+
+G_BEGIN_DECLS
+
+/* Pixbufs */
+const gchar * empathy_icon_name_for_presence (
+ TpConnectionPresenceType presence);
+
+G_END_DECLS
+
+#endif /* __EMPATHY_UI_UTILS_H__ */
diff --git a/src/empathy-utils.c b/src/empathy-utils.c
new file mode 100644
index 0000000..0b66227
--- /dev/null
+++ b/src/empathy-utils.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2003-2007 Imendio AB
+ * Copyright (C) 2007-2011 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: Richard Hult <richard imendio com>
+ * Martyn Russell <martyn imendio com>
+ * Xavier Claessens <xclaesse gmail com>
+ */
+
+#include "config.h"
+#include "empathy-utils.h"
+
+#include <glib/gi18n-lib.h>
+
+const gchar *
+empathy_presence_get_default_message (TpConnectionPresenceType presence)
+{
+ switch (presence)
+ {
+ case TP_CONNECTION_PRESENCE_TYPE_AVAILABLE:
+ return _("Available");
+ case TP_CONNECTION_PRESENCE_TYPE_BUSY:
+ return _("Busy");
+ case TP_CONNECTION_PRESENCE_TYPE_AWAY:
+ case TP_CONNECTION_PRESENCE_TYPE_EXTENDED_AWAY:
+ return _("Away");
+ case TP_CONNECTION_PRESENCE_TYPE_HIDDEN:
+ return _("Invisible");
+ case TP_CONNECTION_PRESENCE_TYPE_OFFLINE:
+ return _("Offline");
+ case TP_CONNECTION_PRESENCE_TYPE_UNKNOWN:
+ /* translators: presence type is unknown */
+ return C_("presence", "Unknown");
+ case TP_CONNECTION_PRESENCE_TYPE_UNSET:
+ case TP_CONNECTION_PRESENCE_TYPE_ERROR:
+ default:
+ return NULL;
+ }
+
+ return NULL;
+}
diff --git a/src/empathy-utils.h b/src/empathy-utils.h
new file mode 100644
index 0000000..a78388d
--- /dev/null
+++ b/src/empathy-utils.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2003-2007 Imendio AB
+ * Copyright (C) 2007-2011 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: Richard Hult <richard imendio com>
+ * Martyn Russell <martyn imendio com>
+ * Xavier Claessens <xclaesse gmail com>
+ */
+
+#ifndef __EMPATHY_UTILS_H__
+#define __EMPATHY_UTILS_H__
+
+#include <glib.h>
+#include <telepathy-glib/telepathy-glib.h>
+
+G_BEGIN_DECLS
+
+/* Others */
+const gchar * empathy_presence_get_default_message (
+ TpConnectionPresenceType presence);
+
+G_END_DECLS
+
+#endif /* __EMPATHY_UTILS_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]