empathy r621 - in trunk: docs/libempathy-gtk libempathy-gtk python python/pyempathy python/pyempathygtk
- From: xclaesse svn gnome org
- To: svn-commits-list gnome org
- Subject: empathy r621 - in trunk: docs/libempathy-gtk libempathy-gtk python python/pyempathy python/pyempathygtk
- Date: Sun, 10 Feb 2008 17:12:09 +0000 (GMT)
Author: xclaesse
Date: Sun Feb 10 17:12:07 2008
New Revision: 621
URL: http://svn.gnome.org/viewvc/empathy?rev=621&view=rev
Log:
Add a generic UI to make easy building UI for protocol specific settings. Port empathy-account-widget-*.[ch] to use that API.
Added:
trunk/libempathy-gtk/empathy-account-widget.c
trunk/libempathy-gtk/empathy-account-widget.h
- copied, changed from r620, /trunk/libempathy-gtk/empathy-account-widget-generic.h
trunk/python/pyempathygtk.patch
Removed:
trunk/libempathy-gtk/empathy-account-widget-generic.c
trunk/libempathy-gtk/empathy-account-widget-generic.h
trunk/libempathy-gtk/empathy-account-widget-jabber.c
trunk/libempathy-gtk/empathy-account-widget-jabber.h
trunk/libempathy-gtk/empathy-account-widget-msn.c
trunk/libempathy-gtk/empathy-account-widget-msn.h
trunk/libempathy-gtk/empathy-account-widget-salut.c
trunk/libempathy-gtk/empathy-account-widget-salut.h
Modified:
trunk/docs/libempathy-gtk/libempathy-gtk-docs.sgml
trunk/libempathy-gtk/Makefile.am
trunk/libempathy-gtk/empathy-accounts-dialog.c
trunk/libempathy-gtk/empathy-ui-utils.c
trunk/libempathy-gtk/empathy-ui-utils.h
trunk/python/pyempathy/pyempathy.defs
trunk/python/pyempathygtk/pyempathygtk.defs
trunk/python/pyempathygtk/pyempathygtk.override
Modified: trunk/docs/libempathy-gtk/libempathy-gtk-docs.sgml
==============================================================================
--- trunk/docs/libempathy-gtk/libempathy-gtk-docs.sgml (original)
+++ trunk/docs/libempathy-gtk/libempathy-gtk-docs.sgml Sun Feb 10 17:12:07 2008
@@ -19,10 +19,7 @@
<xi:include href="xml/empathy-about-dialog.xml"/>
<xi:include href="xml/empathy-account-chooser.xml"/>
<xi:include href="xml/empathy-accounts-dialog.xml"/>
- <xi:include href="xml/empathy-account-widget-generic.xml"/>
- <xi:include href="xml/empathy-account-widget-jabber.xml"/>
- <xi:include href="xml/empathy-account-widget-msn.xml"/>
- <xi:include href="xml/empathy-account-widget-salut.xml"/>
+ <xi:include href="xml/empathy-account-widget.xml"/>
<xi:include href="xml/empathy-avatar-chooser.xml"/>
<xi:include href="xml/empathy-avatar-image.xml"/>
<xi:include href="xml/empathy-call-window.xml"/>
Modified: trunk/libempathy-gtk/Makefile.am
==============================================================================
--- trunk/libempathy-gtk/Makefile.am (original)
+++ trunk/libempathy-gtk/Makefile.am Sun Feb 10 17:12:07 2008
@@ -22,10 +22,7 @@
empathy-contact-widget.c \
empathy-contact-dialogs.c \
empathy-accounts-dialog.c \
- empathy-account-widget-generic.c \
- empathy-account-widget-jabber.c \
- empathy-account-widget-msn.c \
- empathy-account-widget-salut.c \
+ empathy-account-widget.c \
empathy-profile-chooser.c \
empathy-cell-renderer-expander.c \
empathy-cell-renderer-text.c \
@@ -78,10 +75,7 @@
empathy-contact-widget.h \
empathy-contact-dialogs.h \
empathy-accounts-dialog.h \
- empathy-account-widget-generic.h \
- empathy-account-widget-jabber.h \
- empathy-account-widget-msn.h \
- empathy-account-widget-salut.h \
+ empathy-account-widget.h \
empathy-profile-chooser.h \
empathy-cell-renderer-expander.h \
empathy-cell-renderer-text.h \
Added: trunk/libempathy-gtk/empathy-account-widget.c
==============================================================================
--- (empty file)
+++ trunk/libempathy-gtk/empathy-account-widget.c Sun Feb 10 17:12:07 2008
@@ -0,0 +1,589 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2006-2007 Imendio AB
+ * 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>
+ * Martyn Russell <martyn imendio com>
+ */
+
+#include <config.h>
+
+#include <string.h>
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+
+#include <libmissioncontrol/mc-account.h>
+#include <libmissioncontrol/mc-protocol.h>
+
+#include <libempathy/empathy-debug.h>
+
+#include "empathy-account-widget.h"
+#include "empathy-ui-utils.h"
+
+#define DEBUG_DOMAIN "AccountWidget"
+
+static gboolean
+account_widget_entry_focus_cb (GtkWidget *widget,
+ GdkEventFocus *event,
+ McAccount *account)
+{
+ const gchar *str;
+ const gchar *param_name;
+
+ str = gtk_entry_get_text (GTK_ENTRY (widget));
+ param_name = g_object_get_data (G_OBJECT (widget), "param_name");
+
+ if (G_STR_EMPTY (str)) {
+ gchar *value = NULL;
+
+ mc_account_unset_param (account, param_name);
+ mc_account_get_param_string (account, param_name, &value);
+ empathy_debug (DEBUG_DOMAIN, "Unset %s and restore to %s", param_name, value);
+ gtk_entry_set_text (GTK_ENTRY (widget), value ? value : "");
+ g_free (value);
+ } else {
+ empathy_debug (DEBUG_DOMAIN, "Setting %s to %s", param_name, str);
+ mc_account_set_param_string (account, param_name, str);
+ }
+
+ return FALSE;
+}
+
+static void
+account_widget_int_changed_cb (GtkWidget *widget,
+ McAccount *account)
+{
+ const gchar *param_name;
+ gint value;
+
+ value = gtk_spin_button_get_value (GTK_SPIN_BUTTON (widget));
+ param_name = g_object_get_data (G_OBJECT (widget), "param_name");
+
+ if (value == 0) {
+ gint val;
+
+ mc_account_unset_param (account, param_name);
+ mc_account_get_param_int (account, param_name, &val);
+ empathy_debug (DEBUG_DOMAIN, "Unset %s and restore to %d", param_name, val);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), val);
+ } else {
+ empathy_debug (DEBUG_DOMAIN, "Setting %s to %d", param_name, (gint) value);
+ mc_account_set_param_int (account, param_name, (gint) value);
+ }
+}
+
+static void
+account_widget_checkbutton_toggled_cb (GtkWidget *widget,
+ McAccount *account)
+{
+ gboolean value;
+ gboolean default_value;
+ const gchar *param_name;
+
+ value = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
+ param_name = g_object_get_data (G_OBJECT (widget), "param_name");
+
+ /* FIXME: This is ugly! checkbox don't have a "not-set" value so we
+ * always unset the param and set the value if different from the
+ * default value. */
+ mc_account_unset_param (account, param_name);
+ mc_account_get_param_boolean (account, param_name, &default_value);
+
+ if (default_value == value) {
+ empathy_debug (DEBUG_DOMAIN, "Unset %s and restore to %d", param_name, default_value);
+ } else {
+ empathy_debug (DEBUG_DOMAIN, "Setting %s to %d", param_name, value);
+ mc_account_set_param_boolean (account, param_name, value);
+ }
+}
+
+static void
+account_widget_forget_clicked_cb (GtkWidget *button,
+ GtkWidget *entry)
+{
+ McAccount *account;
+ const gchar *param_name;
+
+ param_name = g_object_get_data (G_OBJECT (entry), "param_name");
+ account = g_object_get_data (G_OBJECT (entry), "account");
+
+ empathy_debug (DEBUG_DOMAIN, "Unset %s", param_name);
+ mc_account_unset_param (account, param_name);
+ gtk_entry_set_text (GTK_ENTRY (entry), "");
+}
+
+static void
+account_widget_password_changed_cb (GtkWidget *entry,
+ GtkWidget *button)
+{
+ const gchar *str;
+
+ str = gtk_entry_get_text (GTK_ENTRY (entry));
+ gtk_widget_set_sensitive (button, !G_STR_EMPTY (str));
+}
+
+static void
+account_widget_jabber_ssl_toggled_cb (GtkWidget *checkbutton_ssl,
+ GtkWidget *spinbutton_port)
+{
+ McAccount *account;
+ gboolean value;
+ gint port = 0;
+
+ value = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbutton_ssl));
+ account = g_object_get_data (G_OBJECT (spinbutton_port), "account");
+ mc_account_get_param_int (account, "port", &port);
+
+ if (value) {
+ if (port == 5222 || port == 0) {
+ port = 5223;
+ }
+ } else {
+ if (port == 5223 || port == 0) {
+ port = 5222;
+ }
+ }
+
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (spinbutton_port), port);
+}
+
+static void
+account_widget_destroy_cb (GtkWidget *widget,
+ McAccount *account)
+{
+ empathy_debug (DEBUG_DOMAIN, "destroyed!");
+ g_object_unref (account);
+}
+
+static void
+account_widget_setup_widget (GtkWidget *widget,
+ McAccount *account,
+ const gchar *param_name)
+{
+ g_object_set_data_full (G_OBJECT (widget), "param_name",
+ g_strdup (param_name), g_free);
+
+ if (GTK_IS_SPIN_BUTTON (widget)) {
+ gint value = 0;
+
+ mc_account_get_param_int (account, param_name, &value);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), value);
+
+ g_signal_connect (widget, "value-changed",
+ G_CALLBACK (account_widget_int_changed_cb),
+ account);
+ }
+ else if (GTK_IS_ENTRY (widget)) {
+ gchar *str = NULL;
+
+ mc_account_get_param_string (account, param_name, &str);
+ gtk_entry_set_text (GTK_ENTRY (widget), str ? str : "");
+ g_free (str);
+
+ if (strstr (param_name, "password")) {
+ gtk_entry_set_visibility (GTK_ENTRY (widget), FALSE);
+ }
+
+ g_signal_connect (widget, "focus-out-event",
+ G_CALLBACK (account_widget_entry_focus_cb),
+ account);
+ }
+ else if (GTK_IS_TOGGLE_BUTTON (widget)) {
+ gboolean value = FALSE;
+
+ mc_account_get_param_boolean (account, param_name, &value);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), value);
+
+ g_signal_connect (widget, "toggled",
+ G_CALLBACK (account_widget_checkbutton_toggled_cb),
+ account);
+ } else {
+ empathy_debug (DEBUG_DOMAIN,
+ "Unknown type of widget for param %s",
+ param_name);
+ }
+}
+
+static gchar *
+account_widget_generic_format_param_name (const gchar *param_name)
+{
+ gchar *str;
+ gchar *p;
+
+ str = g_strdup (param_name);
+
+ if (str && g_ascii_isalpha (str[0])) {
+ str[0] = g_ascii_toupper (str[0]);
+ }
+
+ while ((p = strchr (str, '-')) != NULL) {
+ if (p[1] != '\0' && g_ascii_isalpha (p[1])) {
+ p[0] = ' ';
+ p[1] = g_ascii_toupper (p[1]);
+ }
+
+ p++;
+ }
+
+ return str;
+}
+
+static void
+accounts_widget_generic_setup (McAccount *account,
+ GtkWidget *table_settings)
+{
+ McProtocol *protocol;
+ McProfile *profile;
+ GSList *params, *l;
+ guint n_rows = 0;
+
+ profile = mc_account_get_profile (account);
+ protocol = mc_profile_get_protocol (profile);
+
+ 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
+ * install the CM
+ */
+ g_object_unref (profile);
+ return;
+ }
+
+ params = mc_protocol_get_params (protocol);
+
+ for (l = params; l; l = l->next) {
+ McProtocolParam *param;
+ GtkWidget *widget = NULL;
+ gchar *param_name_formatted;
+
+ param = l->data;
+ param_name_formatted = account_widget_generic_format_param_name (param->name);
+ gtk_table_resize (GTK_TABLE (table_settings), ++n_rows, 2);
+
+ if (param->signature[0] == 's') {
+ gchar *str;
+
+ str = g_strdup_printf (_("%s:"), param_name_formatted);
+ widget = gtk_label_new (str);
+ gtk_misc_set_alignment (GTK_MISC (widget), 0, 0.5);
+ g_free (str);
+
+ gtk_table_attach (GTK_TABLE (table_settings),
+ widget,
+ 0, 1,
+ n_rows - 1, n_rows,
+ GTK_FILL, 0,
+ 0, 0);
+
+ widget = gtk_entry_new ();
+ gtk_table_attach (GTK_TABLE (table_settings),
+ widget,
+ 1, 2,
+ n_rows - 1, n_rows,
+ GTK_FILL | GTK_EXPAND, 0,
+ 0, 0);
+ }
+ /* int types: ynqiuxt. double type is 'd' */
+ else if (param->signature[0] == 'y' ||
+ param->signature[0] == 'n' ||
+ param->signature[0] == 'q' ||
+ param->signature[0] == 'i' ||
+ param->signature[0] == 'u' ||
+ param->signature[0] == 'x' ||
+ param->signature[0] == 't' ||
+ param->signature[0] == 'd') {
+ gchar *str = NULL;
+ gdouble minint = 0;
+ gdouble maxint = 0;
+ gdouble step = 1;
+
+ switch (param->signature[0]) {
+ case 'y': minint = G_MININT8; maxint = G_MAXINT8; break;
+ case 'n': minint = G_MININT16; maxint = G_MAXINT16; break;
+ case 'q': minint = 0; maxint = G_MAXUINT16; break;
+ case 'i': minint = G_MININT32; maxint = G_MAXINT32; break;
+ case 'u': minint = 0; maxint = G_MAXUINT32; break;
+ case 'x': minint = G_MININT64; maxint = G_MAXINT64; break;
+ case 't': minint = 0; maxint = G_MAXUINT64; break;
+ case 'd': minint = G_MININT32; maxint = G_MAXINT32; step = 0.1; break;
+ }
+
+ str = g_strdup_printf (_("%s:"), param_name_formatted);
+ widget = gtk_label_new (str);
+ gtk_misc_set_alignment (GTK_MISC (widget), 0, 0.5);
+ g_free (str);
+
+ gtk_table_attach (GTK_TABLE (table_settings),
+ widget,
+ 0, 1,
+ n_rows - 1, n_rows,
+ GTK_FILL, 0,
+ 0, 0);
+
+ widget = gtk_spin_button_new_with_range (minint, maxint, step);
+ gtk_table_attach (GTK_TABLE (table_settings),
+ widget,
+ 1, 2,
+ n_rows - 1, n_rows,
+ GTK_FILL | GTK_EXPAND, 0,
+ 0, 0);
+ }
+ else if (param->signature[0] == 'b') {
+ widget = gtk_check_button_new_with_label (param_name_formatted);
+ gtk_table_attach (GTK_TABLE (table_settings),
+ widget,
+ 0, 2,
+ n_rows - 1, n_rows,
+ GTK_FILL | GTK_EXPAND, 0,
+ 0, 0);
+ } else {
+ empathy_debug (DEBUG_DOMAIN,
+ "Unknown signature for param %s: %s",
+ param_name_formatted, param->signature);
+ }
+
+ if (widget) {
+ account_widget_setup_widget (widget, account, param->name);
+ }
+
+ g_free (param_name_formatted);
+ }
+
+ g_slist_free (params);
+ g_object_unref (profile);
+ g_object_unref (protocol);
+}
+
+static GtkWidget *
+account_widget_new_valist (McAccount *account,
+ GladeXML *gui,
+ const gchar *root,
+ const gchar *first_widget_name,
+ va_list args)
+{
+ GtkWidget *widget;
+ const gchar *widget_name;
+
+ for (widget_name = first_widget_name; widget_name; widget_name = va_arg (args, gchar*)) {
+ const gchar *param_name;
+
+ param_name = va_arg (args, gchar*);
+
+ widget = glade_xml_get_widget (gui, widget_name);
+
+ if (!widget) {
+ g_warning ("Glade is missing widget '%s'.", widget_name);
+ continue;
+ }
+
+ account_widget_setup_widget (widget, account, param_name);
+ }
+
+ widget = glade_xml_get_widget (gui, root);
+ g_signal_connect (widget, "destroy",
+ G_CALLBACK (account_widget_destroy_cb),
+ g_object_ref (account));
+
+ return widget;
+}
+
+GtkWidget *
+empathy_account_widget_new_with_glade (McAccount *account,
+ GladeXML *gui,
+ const gchar *root,
+ const gchar *first_widget_name,
+ ...)
+{
+ GtkWidget *widget;
+ va_list args;
+
+ g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL);
+
+ va_start (args, first_widget_name);
+ widget = account_widget_new_valist (account, gui, root,
+ first_widget_name,
+ args);
+ va_end (args);
+
+ return widget;
+}
+
+void
+emapthy_account_widget_add_forget_button (McAccount *account,
+ GladeXML *glade,
+ const gchar *button,
+ const gchar *entry)
+{
+ GtkWidget *button_forget;
+ GtkWidget *entry_password;
+ gchar *password = NULL;
+
+ button_forget = glade_xml_get_widget (glade, button);
+ entry_password = glade_xml_get_widget (glade, entry);
+
+ mc_account_get_param_string (account, "password", &password);
+ gtk_widget_set_sensitive (button_forget, !G_STR_EMPTY (password));
+ g_free (password);
+
+ g_signal_connect (button_forget, "clicked",
+ G_CALLBACK (account_widget_forget_clicked_cb),
+ entry_password);
+ g_signal_connect (entry_password, "changed",
+ G_CALLBACK (account_widget_password_changed_cb),
+ button_forget);
+
+ g_object_set_data_full (G_OBJECT (entry_password), "account",
+ g_object_ref (account),
+ g_object_unref);
+}
+
+GtkWidget *
+empathy_account_widget_generic_new (McAccount *account)
+{
+ GtkWidget *table_settings;
+ GtkWidget *sw;
+
+ g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL);
+
+ table_settings = gtk_table_new (0, 2, FALSE);
+ gtk_table_set_row_spacings (GTK_TABLE (table_settings), 6);
+ gtk_table_set_col_spacings (GTK_TABLE (table_settings), 6);
+ sw = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
+ GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw),
+ table_settings);
+
+ accounts_widget_generic_setup (account, table_settings);
+
+ g_signal_connect (sw, "destroy",
+ G_CALLBACK (account_widget_destroy_cb),
+ g_object_ref (account));
+
+ gtk_widget_show_all (sw);
+
+ return sw;
+}
+
+GtkWidget *
+empathy_account_widget_salut_new (McAccount *account)
+{
+ GladeXML *glade;
+ GtkWidget *widget;
+
+ glade = empathy_glade_get ("empathy-account-widget-salut.glade",
+ "vbox_salut_settings",
+ NULL);
+
+ widget = empathy_account_widget_new_with_glade (account, glade,
+ "vbox_salut_settings",
+ "entry_published", "published-name",
+ "entry_nickname", "nickname",
+ "entry_first_name", "first-name",
+ "entry_last_name", "last-name",
+ "entry_email", "email",
+ "entry_jid", "jid",
+ NULL);
+
+ g_object_unref (glade);
+
+ gtk_widget_show (widget);
+
+ return widget;
+}
+
+GtkWidget *
+empathy_account_widget_msn_new (McAccount *account)
+{
+ GladeXML *glade;
+ GtkWidget *widget;
+
+ glade = empathy_glade_get ("empathy-account-widget-msn.glade",
+ "vbox_msn_settings",
+ NULL);
+
+ widget = empathy_account_widget_new_with_glade (account, glade,
+ "vbox_msn_settings",
+ "entry_id", "account",
+ "entry_password", "password",
+ "entry_server", "server",
+ "spinbutton_port", "port",
+ NULL);
+
+ emapthy_account_widget_add_forget_button (account, glade,
+ "button_forget",
+ "entry_password");
+
+ g_object_unref (glade);
+
+ gtk_widget_show (widget);
+
+ return widget;
+}
+
+GtkWidget *
+empathy_account_widget_jabber_new (McAccount *account)
+{
+ GladeXML *glade;
+ GtkWidget *widget;
+ GtkWidget *spinbutton_port;
+ GtkWidget *checkbutton_ssl;
+
+ glade = empathy_glade_get_file ("empathy-account-widget-jabber.glade",
+ "vbox_jabber_settings",
+ NULL,
+ "spinbutton_port", &spinbutton_port,
+ "checkbutton_ssl", &checkbutton_ssl,
+ NULL);
+
+ widget = empathy_account_widget_new_with_glade (account, glade,
+ "vbox_jabber_settings",
+ "entry_id", "account",
+ "entry_password", "password",
+ "entry_resource", "resource",
+ "entry_server", "server",
+ "spinbutton_port", "port",
+ "spinbutton_priority", "priority",
+ "checkbutton_ssl", "old-ssl",
+ "checkbutton_ignore_ssl_errors", "ignore-ssl-errors",
+ "checkbutton_encryption", "require-encryption",
+ NULL);
+
+ emapthy_account_widget_add_forget_button (account, glade,
+ "button_forget",
+ "entry_password");
+
+ g_signal_connect (checkbutton_ssl, "toggled",
+ G_CALLBACK (account_widget_jabber_ssl_toggled_cb),
+ spinbutton_port);
+
+ g_object_set_data_full (G_OBJECT (spinbutton_port), "account",
+ g_object_ref (account),
+ g_object_unref);
+
+ g_object_unref (glade);
+
+ gtk_widget_show (widget);
+
+ return widget;
+}
+
Copied: trunk/libempathy-gtk/empathy-account-widget.h (from r620, /trunk/libempathy-gtk/empathy-account-widget-generic.h)
==============================================================================
--- /trunk/libempathy-gtk/empathy-account-widget-generic.h (original)
+++ trunk/libempathy-gtk/empathy-account-widget.h Sun Feb 10 17:12:07 2008
@@ -26,12 +26,25 @@
#define __EMPATHY_ACCOUNT_WIDGET_GENERIC_H__
#include <gtk/gtk.h>
+#include <glade/glade.h>
#include <libmissioncontrol/mc-account.h>
G_BEGIN_DECLS
-GtkWidget *empathy_account_widget_generic_new (McAccount *account);
+GtkWidget *empathy_account_widget_new_with_glade (McAccount *account,
+ GladeXML *glade,
+ const gchar *root,
+ const gchar *first_widget_name,
+ ...);
+void emapthy_account_widget_add_forget_button (McAccount *account,
+ GladeXML *glade,
+ const gchar *button,
+ 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);
+GtkWidget *empathy_account_widget_jabber_new (McAccount *account);
G_END_DECLS
Modified: trunk/libempathy-gtk/empathy-accounts-dialog.c
==============================================================================
--- trunk/libempathy-gtk/empathy-accounts-dialog.c (original)
+++ trunk/libempathy-gtk/empathy-accounts-dialog.c Sun Feb 10 17:12:07 2008
@@ -45,10 +45,7 @@
#include "empathy-accounts-dialog.h"
#include "empathy-profile-chooser.h"
-#include "empathy-account-widget-generic.h"
-#include "empathy-account-widget-jabber.h"
-#include "empathy-account-widget-msn.h"
-#include "empathy-account-widget-salut.h"
+#include "empathy-account-widget.h"
#define DEBUG_DOMAIN "AccountDialog"
Modified: trunk/libempathy-gtk/empathy-ui-utils.c
==============================================================================
--- trunk/libempathy-gtk/empathy-ui-utils.c (original)
+++ trunk/libempathy-gtk/empathy-ui-utils.c Sun Feb 10 17:12:07 2008
@@ -53,17 +53,13 @@
gboolean preserve_aspect_ratio;
};
-static GladeXML *
-get_glade_file (const gchar *filename,
- const gchar *root,
- const gchar *domain,
- const gchar *first_required_widget,
- va_list args)
+GladeXML *
+empathy_glade_get (const gchar *filename,
+ const gchar *root,
+ const gchar *domain)
{
- gchar *path;
- GladeXML *gui;
- const char *name;
- GtkWidget **widget_ptr;
+ GladeXML *gui;
+ gchar *path;
path = g_build_filename (UNINSTALLED_GLADE_DIR, filename, NULL);
if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
@@ -77,9 +73,24 @@
if (!gui) {
g_warning ("Couldn't find necessary glade file '%s'", filename);
- return NULL;
}
+ return gui;
+}
+
+static GladeXML *
+get_glade_file (const gchar *filename,
+ const gchar *root,
+ const gchar *domain,
+ const gchar *first_required_widget,
+ va_list args)
+{
+ GladeXML *gui;
+ const char *name;
+ GtkWidget **widget_ptr;
+
+ gui = empathy_glade_get (filename, root, domain);
+
for (name = first_required_widget; name; name = va_arg (args, char *)) {
widget_ptr = va_arg (args, void *);
@@ -114,11 +125,9 @@
va_end (args);
- if (!gui) {
- return;
+ if (gui) {
+ g_object_unref (gui);
}
-
- g_object_unref (gui);
}
GladeXML *
Modified: trunk/libempathy-gtk/empathy-ui-utils.h
==============================================================================
--- trunk/libempathy-gtk/empathy-ui-utils.h (original)
+++ trunk/libempathy-gtk/empathy-ui-utils.h Sun Feb 10 17:12:07 2008
@@ -47,6 +47,9 @@
#define G_STR_EMPTY(x) ((x) == NULL || (x)[0] == '\0')
/* Glade */
+GladeXML * empathy_glade_get (const gchar *filename,
+ const gchar *root,
+ const gchar *domain);
void empathy_glade_get_file_simple (const gchar *filename,
const gchar *root,
const gchar *domain,
Modified: trunk/python/pyempathy/pyempathy.defs
==============================================================================
--- trunk/python/pyempathy/pyempathy.defs (original)
+++ trunk/python/pyempathy/pyempathy.defs Sun Feb 10 17:12:07 2008
@@ -1962,6 +1962,15 @@
)
)
+(define-function empathy_call_with_contact_id
+ (c-name "empathy_call_with_contact_id")
+ (return-type "none")
+ (parameters
+ '("McAccount*" "account")
+ '("const-gchar*" "contact_id")
+ )
+)
+
(define-function empathy_chat_with_contact
(c-name "empathy_chat_with_contact")
(return-type "none")
@@ -2004,63 +2013,3 @@
)
-
-;; From tp-stream-engine-gen.h
-
-(define-function dbus_g_proxy_begin_call
- (c-name "dbus_g_proxy_begin_call")
- (return-type "return")
- (parameters
- )
-)
-
-(define-function dbus_g_proxy_begin_call
- (c-name "dbus_g_proxy_begin_call")
- (return-type "return")
- (parameters
- )
-)
-
-(define-function dbus_g_proxy_begin_call
- (c-name "dbus_g_proxy_begin_call")
- (return-type "return")
- (parameters
- )
-)
-
-(define-function dbus_g_proxy_begin_call
- (c-name "dbus_g_proxy_begin_call")
- (return-type "return")
- (parameters
- )
-)
-
-(define-function dbus_g_proxy_begin_call
- (c-name "dbus_g_proxy_begin_call")
- (return-type "return")
- (parameters
- )
-)
-
-(define-function dbus_g_proxy_begin_call
- (c-name "dbus_g_proxy_begin_call")
- (return-type "return")
- (parameters
- )
-)
-
-(define-function dbus_g_proxy_begin_call
- (c-name "dbus_g_proxy_begin_call")
- (return-type "return")
- (parameters
- )
-)
-
-(define-function dbus_g_proxy_begin_call
- (c-name "dbus_g_proxy_begin_call")
- (return-type "return")
- (parameters
- )
-)
-
-
Added: trunk/python/pyempathygtk.patch
==============================================================================
--- (empty file)
+++ trunk/python/pyempathygtk.patch Sun Feb 10 17:12:07 2008
@@ -0,0 +1,57 @@
+--- pyempathygtk.defs 2008-02-10 17:56:26.000000000 +0100
++++ pyempathygtk/pyempathygtk.defs 2008-02-10 17:57:11.000000000 +0100
+@@ -147,13 +147,6 @@
+ (gtype-id "EMPATHY_TYPE_THEME_MANAGER")
+ )
+
+-(define-object Spinner
+- (in-module "Ephy")
+- (parent "GtkWidget")
+- (c-name "EphySpinner")
+- (gtype-id "EPHY_TYPE_SPINNER")
+-)
+-
+ ;; Enumerations and flags ...
+
+ (define-enum ChatViewBlock
+@@ -2112,40 +2105,3 @@
+ (varargs #t)
+ )
+
+-
+-
+-;; From ephy-spinner.h
+-
+-(define-function ephy_spinner_get_type
+- (c-name "ephy_spinner_get_type")
+- (return-type "GType")
+-)
+-
+-(define-function ephy_spinner_new
+- (c-name "ephy_spinner_new")
+- (is-constructor-of "EphySpinner")
+- (return-type "GtkWidget*")
+-)
+-
+-(define-method start
+- (of-object "EphySpinner")
+- (c-name "ephy_spinner_start")
+- (return-type "none")
+-)
+-
+-(define-method stop
+- (of-object "EphySpinner")
+- (c-name "ephy_spinner_stop")
+- (return-type "none")
+-)
+-
+-(define-method set_size
+- (of-object "EphySpinner")
+- (c-name "ephy_spinner_set_size")
+- (return-type "none")
+- (parameters
+- '("GtkIconSize" "size")
+- )
+-)
+-
+-
Modified: trunk/python/pyempathygtk/pyempathygtk.defs
==============================================================================
--- trunk/python/pyempathygtk/pyempathygtk.defs (original)
+++ trunk/python/pyempathygtk/pyempathygtk.defs Sun Feb 10 17:12:07 2008
@@ -320,7 +320,30 @@
-;; From empathy-account-widget-generic.h
+;; From empathy-account-widget.h
+
+(define-function empathy_account_widget_new_with_glade
+ (c-name "empathy_account_widget_new_with_glade")
+ (return-type "GtkWidget*")
+ (parameters
+ '("McAccount*" "account")
+ '("GladeXML*" "glade")
+ '("const-gchar*" "root")
+ '("const-gchar*" "first_widget_name")
+ )
+ (varargs #t)
+)
+
+(define-function emapthy_account_widget_add_forget_button
+ (c-name "emapthy_account_widget_add_forget_button")
+ (return-type "none")
+ (parameters
+ '("McAccount*" "account")
+ '("GladeXML*" "glade")
+ '("const-gchar*" "button")
+ '("const-gchar*" "entry")
+ )
+)
(define-function empathy_account_widget_generic_new
(c-name "empathy_account_widget_generic_new")
@@ -331,23 +354,15 @@
)
)
-
-
-;; From empathy-account-widget-jabber.h
-
-(define-function empathy_account_widget_jabber_new
- (c-name "empathy_account_widget_jabber_new")
- (is-constructor-of "EmpathyAccountWidgetJabber")
+(define-function empathy_account_widget_salut_new
+ (c-name "empathy_account_widget_salut_new")
+ (is-constructor-of "EmpathyAccountWidgetSalut")
(return-type "GtkWidget*")
(parameters
'("McAccount*" "account")
)
)
-
-
-;; From empathy-account-widget-msn.h
-
(define-function empathy_account_widget_msn_new
(c-name "empathy_account_widget_msn_new")
(is-constructor-of "EmpathyAccountWidgetMsn")
@@ -357,13 +372,9 @@
)
)
-
-
-;; From empathy-account-widget-salut.h
-
-(define-function empathy_account_widget_salut_new
- (c-name "empathy_account_widget_salut_new")
- (is-constructor-of "EmpathyAccountWidgetSalut")
+(define-function empathy_account_widget_jabber_new
+ (c-name "empathy_account_widget_jabber_new")
+ (is-constructor-of "EmpathyAccountWidgetJabber")
(return-type "GtkWidget*")
(parameters
'("McAccount*" "account")
@@ -1869,6 +1880,16 @@
;; From empathy-ui-utils.h
+(define-function empathy_glade_get
+ (c-name "empathy_glade_get")
+ (return-type "GladeXML*")
+ (parameters
+ '("const-gchar*" "filename")
+ '("const-gchar*" "root")
+ '("const-gchar*" "domain")
+ )
+)
+
(define-function empathy_glade_get_file_simple
(c-name "empathy_glade_get_file_simple")
(return-type "none")
Modified: trunk/python/pyempathygtk/pyempathygtk.override
==============================================================================
--- trunk/python/pyempathygtk/pyempathygtk.override (original)
+++ trunk/python/pyempathygtk/pyempathygtk.override Sun Feb 10 17:12:07 2008
@@ -7,9 +7,7 @@
#include "empathy-about-dialog.h"
#include "empathy-account-chooser.h"
#include "empathy-accounts-dialog.h"
-#include "empathy-account-widget-generic.h"
-#include "empathy-account-widget-jabber.h"
-#include "empathy-account-widget-msn.h"
+#include "empathy-account-widget.h"
#include "empathy-cell-renderer-expander.h"
#include "empathy-cell-renderer-text.h"
#include "empathy-cell-renderer-activatable.h"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]