diff options
author | Xavier Claessens <xclaesse@gmail.com> | 2007-06-04 02:45:53 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2007-06-04 02:45:53 +0800 |
commit | ec7481901727606b0ce05f1dc2088c34f9e18b5f (patch) | |
tree | 97a0e0f147278845b1f06b26cb70d76177d05af0 /src | |
parent | f76a92f31b0d8212526fe8dd8c89dc1399812072 (diff) | |
download | gsoc2013-empathy-ec7481901727606b0ce05f1dc2088c34f9e18b5f.tar gsoc2013-empathy-ec7481901727606b0ce05f1dc2088c34f9e18b5f.tar.gz gsoc2013-empathy-ec7481901727606b0ce05f1dc2088c34f9e18b5f.tar.bz2 gsoc2013-empathy-ec7481901727606b0ce05f1dc2088c34f9e18b5f.tar.lz gsoc2013-empathy-ec7481901727606b0ce05f1dc2088c34f9e18b5f.tar.xz gsoc2013-empathy-ec7481901727606b0ce05f1dc2088c34f9e18b5f.tar.zst gsoc2013-empathy-ec7481901727606b0ce05f1dc2088c34f9e18b5f.zip |
libempathy-gtk/gossip-ui-utils.c libempathy-gtk/gossip-accounts-dialog.c
2007-06-03 Xavier Claessens <xclaesse@gmail.com>
* libempathy-gtk/gossip-ui-utils.c
* libempathy-gtk/gossip-accounts-dialog.c
* libempathy-gtk/Makefile.am
* src/empathy-accounts-main.c
* src/empathy-chat-main.c
* src/Makefile.am
* src/empathy-main.c
* libempathy/gossip-utils.c
* libempathy/Makefile.am
* src/empathy-filter.h
* src/empathy-filter-plugin.c
* src/empathy-filter.xml
* src/empathy-filter.c
* libempathy/gossip-paths.c
* libempathy/gossip-paths.h: Remove unused code.
svn path=/trunk/; revision=120
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 24 | ||||
-rw-r--r-- | src/empathy-accounts-main.c | 2 | ||||
-rw-r--r-- | src/empathy-chat-main.c | 8 | ||||
-rw-r--r-- | src/empathy-filter-plugin.c | 143 | ||||
-rw-r--r-- | src/empathy-filter.c | 173 | ||||
-rw-r--r-- | src/empathy-filter.h | 56 | ||||
-rw-r--r-- | src/empathy-filter.xml | 19 | ||||
-rw-r--r-- | src/empathy-main.c | 29 |
8 files changed, 12 insertions, 442 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 05bc6f55a..0f0c2d0c0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -4,7 +4,8 @@ cppflags = \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ -DDATADIR=\""$(datadir)"\" \ -DLIBDIR=\""$(libdir)"\" \ - $(EMPATHY_CFLAGS) \ + -DLOCALEDIR=\""$(datadir)/locale"\" \ + $(EMPATHY_CFLAGS) \ $(WARN_CFLAGS) libs = \ @@ -16,9 +17,7 @@ bin_PROGRAMS = \ empathy-chat \ empathy-accounts -empathy_SOURCES = \ - empathy-main.c \ - empathy-filter.c empathy-filter.h +empathy_SOURCES = empathy-main.c empathy_CPPFLAGS = $(cppflags) empathy_LDADD = $(libs) @@ -30,12 +29,6 @@ empathy_chat_SOURCES = empathy-chat-main.c empathy_chat_CPPFLAGS = $(cppflags) empathy_chat_LDADD = $(libs) -# MC plugin -#pluginlib_LTLIBRARIES = libempathy-filter-plugin.la -#libempathy_filter_plugin_la_SOURCES = empathy-filter-plugin.c -#libempathy_filter_plugin_la_CPPFLAGS = $(MISSION_CONTROL_PLUGINS_CFLAGS) -#libempathy_filter_plugin_la_LIBADD = $(MISSION_CONTROL_PLUGINS_LIBS) - # Dbus service file servicedir = $(datadir)/dbus-1/services service_in_files = org.gnome.Empathy.Chat.service.in @@ -48,20 +41,11 @@ $(service_DATA): $(service_in_files) Makefile chandlerdir = $(datadir)/telepathy/managers chandler_DATA = empathy-chat.chandler -# Empathy filter DBus API -empathy-filter-glue.h: empathy-filter.xml - $(LIBTOOL) --mode=execute $(DBUS_BINDING_TOOL) --prefix=empathy_filter --mode=glib-server --output=$@ $< -empathy-filter-gen.h: empathy-filter.xml - $(LIBTOOL) --mode=execute $(DBUS_BINDING_TOOL) --prefix=empathy_filter --mode=glib-client --output=$@ $< - BUILT_SOURCES = \ - org.gnome.Empathy.Chat.service \ - empathy-filter-glue.h \ - empathy-filter-gen.h + org.gnome.Empathy.Chat.service EXTRA_DIST = \ org.gnome.Empathy.Chat.service.in \ - empathy-filter.xml \ $(autostart_DATA) \ $(chandler_DATA) diff --git a/src/empathy-accounts-main.c b/src/empathy-accounts-main.c index 1f53e131e..bc569d315 100644 --- a/src/empathy-accounts-main.c +++ b/src/empathy-accounts-main.c @@ -44,6 +44,8 @@ main (int argc, char *argv[]) gtk_init (&argc, &argv); + gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), + DATADIR G_DIR_SEPARATOR_S "empathy"); dialog = gossip_accounts_dialog_show (NULL); g_signal_connect (dialog, "destroy", diff --git a/src/empathy-chat-main.c b/src/empathy-chat-main.c index fb0964934..3af734ba8 100644 --- a/src/empathy-chat-main.c +++ b/src/empathy-chat-main.c @@ -40,7 +40,6 @@ #include <libempathy/gossip-utils.h> #include <libempathy/empathy-chandler.h> #include <libempathy/empathy-tp-chat.h> -#include <libempathy/gossip-paths.h> #include <libempathy-gtk/gossip-private-chat.h> #include <libempathy-gtk/gossip-group-chat.h> @@ -163,13 +162,10 @@ main (int argc, char *argv[]) { EmpathyChandler *chandler; GnomeProgram *program; - gchar *localedir; - localedir = gossip_paths_get_locale_path (); - bindtextdomain (GETTEXT_PACKAGE, localedir); + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); - g_free (localedir); program = gnome_program_init ("empathy-chat", PACKAGE_VERSION, @@ -180,6 +176,8 @@ main (int argc, char *argv[]) NULL); gtk_window_set_default_icon_name ("empathy"); + gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), + DATADIR G_DIR_SEPARATOR_S "empathy"); if (g_getenv ("EMPATHY_DEBUG")) { debug_mode = TRUE; diff --git a/src/empathy-filter-plugin.c b/src/empathy-filter-plugin.c deleted file mode 100644 index ee90d974e..000000000 --- a/src/empathy-filter-plugin.c +++ /dev/null @@ -1,143 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2007 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., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Authors: Xavier Claessens <xclaesse@gmail.com> - */ - -#include <glib.h> - -#include <dbus/dbus-glib.h> - -#include <libtelepathy/tp-helpers.h> -#include <libtelepathy/tp-conn.h> - -#include <mission-control/mcd-dispatcher.h> -#include <mission-control/mcd-dispatcher-context.h> -#include <mission-control/mcd-channel.h> - -#include <libempathy/empathy-marshal-main.c> - -#include "empathy-filter-gen.h" - -static void filter_plugin_text_channel (McdDispatcherContext *ctx); -static void filter_plugin_handle_channel_cb (DBusGProxy *proxy, - GError *error, - McdDispatcherContext *ctx); -static void filter_plugin_process_cb (DBusGProxy *filter, - guint context_handle, - gboolean result, - McdDispatcher *dispatcher); - -static McdFilter text_in_filters[] = { - {filter_plugin_text_channel, MCD_FILTER_PRIORITY_USER}, - {NULL, 0} -}; - -static DBusGProxy *filter = NULL; -static GHashTable *contexts = NULL; -static guint n_contexts = 0; - -void -mcd_filters_init (McdDispatcher *dispatcher) -{ - static gboolean initialized = FALSE; - - if (initialized) { - return; - } - - filter = dbus_g_proxy_new_for_name (tp_get_bus (), - "org.gnome.Empathy.Filter", - "/org/gnome/Empathy/Filter", - "org.gnome.Empathy.Filter"); - - dbus_g_object_register_marshaller ( - empathy_marshal_VOID__UINT_BOOLEAN, - G_TYPE_NONE, - G_TYPE_UINT, - G_TYPE_BOOLEAN, - G_TYPE_INVALID); - - dbus_g_proxy_add_signal (filter, "Process", - G_TYPE_UINT, - G_TYPE_BOOLEAN, - G_TYPE_INVALID); - dbus_g_proxy_connect_signal (filter, "Process", - G_CALLBACK (filter_plugin_process_cb), - dispatcher, - NULL); - contexts = g_hash_table_new_full (g_direct_hash, - g_direct_equal, - NULL, - (GDestroyNotify) g_object_unref); - - mcd_dispatcher_register_filters (dispatcher, - text_in_filters, - TELEPATHY_CHAN_IFACE_TEXT_QUARK, - MCD_FILTER_IN); - - initialized = TRUE; -} - -static void -filter_plugin_text_channel (McdDispatcherContext *ctx) -{ - const TpConn *tp_conn; - McdChannel *channel; - - tp_conn = mcd_dispatcher_context_get_connection_object (ctx); - channel = mcd_dispatcher_context_get_channel (ctx); - - n_contexts++; - g_hash_table_insert (contexts, - GUINT_TO_POINTER (n_contexts), - ctx); - - empathy_filter_handle_channel_async (filter, - dbus_g_proxy_get_bus_name (DBUS_G_PROXY (tp_conn)), - dbus_g_proxy_get_path (DBUS_G_PROXY (tp_conn)), - mcd_channel_get_channel_type (channel), - mcd_channel_get_object_path (channel), - mcd_channel_get_handle_type (channel), - mcd_channel_get_handle (channel), - n_contexts, - (empathy_filter_handle_channel_reply) filter_plugin_handle_channel_cb, - ctx); -} - -static void -filter_plugin_handle_channel_cb (DBusGProxy *proxy, - GError *error, - McdDispatcherContext *ctx) -{ -} - -static void -filter_plugin_process_cb (DBusGProxy *filter, - guint context_handle, - gboolean result, - McdDispatcher *dispatcher) -{ - McdDispatcherContext *ctx; - - g_print ("****processing\n"); - ctx = g_hash_table_lookup (contexts, GUINT_TO_POINTER (context_handle)); - mcd_dispatcher_context_process (ctx, result); -} - diff --git a/src/empathy-filter.c b/src/empathy-filter.c deleted file mode 100644 index 3696cc1c9..000000000 --- a/src/empathy-filter.c +++ /dev/null @@ -1,173 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2007 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., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Authors: Xavier Claessens <xclaesse@gmail.com> - */ - -#include <config.h> - -#include <dbus/dbus-glib.h> - -#include <libtelepathy/tp-helpers.h> -#include <libtelepathy/tp-conn.h> -#include <libtelepathy/tp-chan.h> - -#include <libempathy/gossip-debug.h> -#include <libempathy/empathy-marshal.h> - -#include "empathy-filter.h" - -#define DEBUG_DOMAIN "EmpathyFilter" - -static gboolean empathy_filter_handle_channel (EmpathyFilter *filter, - const gchar *bus_name, - const gchar *connection, - const gchar *channel_type, - const gchar *channel, - guint handle_type, - guint handle, - guint context_handle, - GError **error); - -#include "empathy-filter-glue.h" - -enum { - NEW_CHANNEL, - PROCESS, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL]; - -G_DEFINE_TYPE (EmpathyFilter, empathy_filter, G_TYPE_OBJECT) - -static void -empathy_filter_class_init (EmpathyFilterClass *klass) -{ - signals[NEW_CHANNEL] = - g_signal_new ("new-channel", - G_OBJECT_CLASS_TYPE (klass), - G_SIGNAL_RUN_LAST, - 0, - NULL, NULL, - empathy_marshal_VOID__OBJECT_OBJECT_UINT, - G_TYPE_NONE, - 3, TELEPATHY_CONN_TYPE, TELEPATHY_CHAN_TYPE, G_TYPE_UINT); - - signals[PROCESS] = - g_signal_new ("process", - G_OBJECT_CLASS_TYPE (klass), - G_SIGNAL_RUN_LAST, - 0, - NULL, NULL, - empathy_marshal_VOID__UINT_BOOLEAN, - G_TYPE_NONE, - 2, G_TYPE_UINT, G_TYPE_BOOLEAN); -} - -static void -empathy_filter_init (EmpathyFilter *filter) -{ -} - -EmpathyFilter * -empathy_filter_new (void) -{ - static gboolean initialized = FALSE; - EmpathyFilter *filter; - DBusGProxy *proxy; - guint result; - GError *error = NULL; - - if (!initialized) { - dbus_g_object_type_install_info (EMPATHY_TYPE_FILTER, - &dbus_glib_empathy_filter_object_info); - initialized = TRUE; - } - - proxy = dbus_g_proxy_new_for_name (tp_get_bus (), - DBUS_SERVICE_DBUS, - DBUS_PATH_DBUS, - DBUS_INTERFACE_DBUS); - - if (!dbus_g_proxy_call (proxy, "RequestName", &error, - G_TYPE_STRING, "org.gnome.Empathy.Filter", - G_TYPE_UINT, DBUS_NAME_FLAG_DO_NOT_QUEUE, - G_TYPE_INVALID, - G_TYPE_UINT, &result, - G_TYPE_INVALID)) { - gossip_debug (DEBUG_DOMAIN, - "Failed to request name: %s", - error ? error->message : "No error given"); - g_clear_error (&error); - - return NULL; - } - g_object_unref (proxy); - - filter = g_object_new (EMPATHY_TYPE_FILTER, NULL); - dbus_g_connection_register_g_object (tp_get_bus (), - "/org/gnome/Empathy/Filter", - G_OBJECT (filter)); - - return filter; -} - -void -empathy_filter_process (EmpathyFilter *filter, - guint context_handle, - gboolean result) -{ - g_print ("hello\n"); - g_signal_emit (filter, signals[PROCESS], 0, context_handle, result); -} - -static gboolean -empathy_filter_handle_channel (EmpathyFilter *filter, - const gchar *bus_name, - const gchar *connection, - const gchar *channel_type, - const gchar *channel, - guint handle_type, - guint handle, - guint context_handle, - GError **error) -{ - TpChan *tp_chan; - TpConn *tp_conn; - - tp_conn = tp_conn_new (tp_get_bus (), - bus_name, - connection); - - tp_chan = tp_chan_new (tp_get_bus(), - bus_name, - channel, - channel_type, - handle_type, - handle); -g_print ("new channel\n"); - g_signal_emit (filter, signals[NEW_CHANNEL], 0, tp_conn, tp_chan, context_handle); - - g_object_unref (tp_chan); - g_object_unref (tp_conn); - - return TRUE; -} - diff --git a/src/empathy-filter.h b/src/empathy-filter.h deleted file mode 100644 index 071310bd4..000000000 --- a/src/empathy-filter.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2007 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., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Authors: Xavier Claessens <xclaesse@gmail.com> - */ - -#ifndef __EMPATHY_FILTER_H__ -#define __EMPATHY_FILTER_H__ - -#include <glib.h> - -G_BEGIN_DECLS - -#define EMPATHY_TYPE_FILTER (empathy_filter_get_type ()) -#define EMPATHY_FILTER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EMPATHY_TYPE_FILTER, EmpathyFilter)) -#define EMPATHY_FILTER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), EMPATHY_TYPE_FILTER, EmpathyFilterClass)) -#define EMPATHY_IS_FILTER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_FILTER)) -#define EMPATHY_IS_FILTER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_FILTER)) -#define EMPATHY_FILTER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_FILTER, EmpathyFilterClass)) - -typedef struct _EmpathyFilter EmpathyFilter; -typedef struct _EmpathyFilterClass EmpathyFilterClass; - -struct _EmpathyFilter { - GObject parent; -}; - -struct _EmpathyFilterClass { - GObjectClass parent_class; -}; - -GType empathy_filter_get_type (void) G_GNUC_CONST; -EmpathyFilter *empathy_filter_new (void); -void empathy_filter_process (EmpathyFilter *filter, - guint context_handle, - gboolean result); - -G_END_DECLS - -#endif /* __EMPATHY_FILTER_H__ */ diff --git a/src/empathy-filter.xml b/src/empathy-filter.xml deleted file mode 100644 index e6b8daeef..000000000 --- a/src/empathy-filter.xml +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<node name="/Filter"> - <interface name="org.gnome.Empathy.Filter"> - <annotation name="org.freedesktop.DBus.GLib.ClientCSymbol" value="empathy_filter"/> - <method name="HandleChannel"> - <arg direction="in" type="s" name="bus_name" /> - <arg direction="in" type="o" name="connection" /> - <arg direction="in" type="s" name="channel_type" /> - <arg direction="in" type="o" name="channel" /> - <arg direction="in" type="u" name="handle_type" /> - <arg direction="in" type="u" name="handle" /> - <arg direction="in" type="u" name="context_handle" /> - </method> - <signal name="Process"> - <arg type="u" name="context_handle" /> - <arg type="u" name="result" /> - </signal> - </interface> -</node> diff --git a/src/empathy-main.c b/src/empathy-main.c index a49611123..f64b2d6e9 100644 --- a/src/empathy-main.c +++ b/src/empathy-main.c @@ -38,12 +38,9 @@ #include <libempathy/gossip-debug.h> #include <libempathy/gossip-utils.h> #include <libempathy/gossip-presence.h> -#include <libempathy/gossip-paths.h> #include <libempathy-gtk/empathy-main-window.h> #include <libempathy-gtk/empathy-status-icon.h> -#include "empathy-filter.h" - #define DEBUG_DOMAIN "EmpathyMain" static void error_cb (MissionControl *mc, @@ -115,18 +112,6 @@ start_mission_control (MissionControl *mc) NULL); } -static void -new_channel_cb (EmpathyFilter *filter, - TpConn *tp_conn, - TpChan *tp_chan, - guint context_handle, - gpointer user_data) -{ - gossip_debug (DEBUG_DOMAIN, "Filtering context handle: %d", - context_handle); - empathy_filter_process (filter, context_handle, TRUE); -} - int main (int argc, char *argv[]) { @@ -134,8 +119,6 @@ main (int argc, char *argv[]) GtkWidget *window; MissionControl *mc; McAccountMonitor *monitor; - EmpathyFilter *filter; - gchar *localedir; GnomeProgram *program; gboolean no_connect = FALSE; GOptionContext *context; @@ -146,11 +129,9 @@ main (int argc, char *argv[]) NULL }, }; - localedir = gossip_paths_get_locale_path (); - bindtextdomain (GETTEXT_PACKAGE, localedir); + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); - g_free (localedir); context = g_option_context_new (_("- Empathy Instant Messenger")); g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE); @@ -167,12 +148,8 @@ main (int argc, char *argv[]) NULL); gtk_window_set_default_icon_name ("empathy"); - - /* Setting up channel filter */ - filter = empathy_filter_new (); - g_signal_connect (filter, "new-channel", - G_CALLBACK (new_channel_cb), - NULL); + gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), + DATADIR G_DIR_SEPARATOR_S "empathy"); /* Setting up MC */ monitor = mc_account_monitor_new (); |