summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Balneaves <[email protected]>2012-12-13 12:10:25 -0600
committerScott Balneaves <[email protected]>2012-12-13 12:10:25 -0600
commit7542533b7a12b6d5e379707c51ab45a4e314e169 (patch)
tree4a23b357a86774dcb285fd859e02767fe4710a1a
parent61b61c3fb75dee78f362558764149e18df75c96a (diff)
downloadmate-control-center-7542533b7a12b6d5e379707c51ab45a4e314e169.tar.bz2
mate-control-center-7542533b7a12b6d5e379707c51ab45a4e314e169.tar.xz
Actually remove obviously uneeded code
-rw-r--r--capplets/about-me/mate-about-me.c491
1 files changed, 0 insertions, 491 deletions
diff --git a/capplets/about-me/mate-about-me.c b/capplets/about-me/mate-about-me.c
index 235e414b..9a0b048b 100644
--- a/capplets/about-me/mate-about-me.c
+++ b/capplets/about-me/mate-about-me.c
@@ -26,9 +26,6 @@
#include <glib/gstdio.h>
#include <gio/gio.h>
#include <unistd.h>
-#if 0
-#include <libebook/e-book.h>
-#endif
#include <dbus/dbus-glib-bindings.h>
#define MATE_DESKTOP_USE_UNSTABLE_API
@@ -47,10 +44,6 @@
#define EMAIL_SLOTS 4
typedef struct {
-#if 0
- EContact *contact;
- EBook *book;
-#endif
GtkBuilder *dialog;
GtkWidget *enable_fingerprint_button;
@@ -61,12 +54,6 @@ typedef struct {
GtkIconTheme *theme;
MateDesktopThumbnailFactory *thumbs;
-#if 0
- EContactAddress *addr1;
- EContactAddress *addr2;
- gchar *email[EMAIL_SLOTS];
- const gchar *email_types[EMAIL_SLOTS];
-#endif
gboolean have_image;
gboolean image_changed;
gboolean create_self;
@@ -85,73 +72,6 @@ struct WidToCid {
guint cid;
};
-#if 0
-enum {
- ADDRESS_STREET = 1,
- ADDRESS_POBOX,
- ADDRESS_LOCALITY,
- ADDRESS_CODE,
- ADDRESS_REGION,
- ADDRESS_COUNTRY
-};
-
-#define EMAIL_WORK 0
-#define EMAIL_HOME 1
-#define ADDRESS_HOME 21
-#define ADDRESS_WORK 27
-
-struct WidToCid ids[] = {
-
- { "email-work-e", 0 }, /* 00 */
- { "email-home-e", 1 }, /* 01 */
-
- { "phone-home-e", E_CONTACT_PHONE_HOME }, /* 02 */
- { "phone-mobile-e", E_CONTACT_PHONE_MOBILE }, /* 03 */
- { "phone-work-e", E_CONTACT_PHONE_BUSINESS }, /* 04 */
- { "phone-work-fax-e", E_CONTACT_PHONE_BUSINESS_FAX }, /* 05 */
-
- { "im-jabber-e", E_CONTACT_IM_JABBER_HOME_1 }, /* 06 */
- { "im-msn-e", E_CONTACT_IM_MSN_HOME_1 }, /* 07 */
- { "im-icq-e", E_CONTACT_IM_ICQ_HOME_1 }, /* 08 */
- { "im-yahoo-e", E_CONTACT_IM_YAHOO_HOME_1 }, /* 09 */
- { "im-aim-e", E_CONTACT_IM_AIM_HOME_1 }, /* 10 */
- { "im-groupwise-e", E_CONTACT_IM_GROUPWISE_HOME_1 }, /* 11 */
-
- { "web-homepage-e", E_CONTACT_HOMEPAGE_URL }, /* 12 */
- { "web-calendar-e", E_CONTACT_CALENDAR_URI }, /* 13 */
- { "web-weblog-e", E_CONTACT_BLOG_URL }, /* 14 */
-
- { "job-profession-e", E_CONTACT_ROLE }, /* 15 */
- { "job-title-e", E_CONTACT_TITLE }, /* 16 */
- { "job-dept-e", E_CONTACT_ORG_UNIT }, /* 17 */
- { "job-assistant-e", E_CONTACT_ASSISTANT }, /* 18 */
- { "job-company-e", E_CONTACT_ORG }, /* 19 */
- { "job-manager-e", E_CONTACT_MANAGER }, /* 20 */
-
- { "addr-street-1", ADDRESS_STREET }, /* 21 */
- { "addr-po-1", ADDRESS_POBOX }, /* 22 */
- { "addr-locality-1", ADDRESS_LOCALITY }, /* 23 */
- { "addr-code-1", ADDRESS_CODE }, /* 24 */
- { "addr-region-1", ADDRESS_REGION }, /* 25 */
- { "addr-country-1", ADDRESS_COUNTRY }, /* 26 */
-
- { "addr-street-2", ADDRESS_STREET }, /* 27 */
- { "addr-po-2", ADDRESS_POBOX }, /* 28 */
- { "addr-locality-2", ADDRESS_LOCALITY }, /* 29 */
- { "addr-code-2", ADDRESS_CODE }, /* 30 */
- { "addr-region-2", ADDRESS_REGION }, /* 31 */
- { "addr-country-2", ADDRESS_COUNTRY }, /* 32 */
-
- { NULL, 0 }
-};
-
-#define ATTRIBUTE_HOME "HOME"
-#define ATTRIBUTE_WORK "WORK"
-#define ATTRIBUTE_OTHER "OTHER"
-
-static void about_me_set_address_field (EContactAddress *, guint, gchar *);
-#endif
-
/*** Utility functions ***/
static void
about_me_error (GtkWindow *parent, gchar *str)
@@ -170,25 +90,9 @@ about_me_error (GtkWindow *parent, gchar *str)
static void
about_me_destroy (void)
{
-#if 0
- e_contact_address_free (me->addr1);
- e_contact_address_free (me->addr2);
-
- if (me->contact)
- g_object_unref (me->contact);
- if (me->book)
- g_object_unref (me->book);
-#endif
if (me->dialog)
g_object_unref (me->dialog);
-#if 0
- g_free (me->email[0]);
- g_free (me->email[1]);
- g_free (me->email[2]);
- g_free (me->email[3]);
-#endif
-
g_free (me->person);
g_free (me->login);
g_free (me->username);
@@ -196,326 +100,6 @@ about_me_destroy (void)
me = NULL;
}
-#if 0
-static void
-about_me_update_email (MateAboutMe *me)
-{
- GList *attrs = NULL;
- gint i;
-
- for (i = 0; i < EMAIL_SLOTS; ++i) {
- if (me->email[i] != NULL) {
- EVCardAttribute *attr;
- const gchar *type = me->email_types[i];
-
- attr = e_vcard_attribute_new (NULL, EVC_EMAIL);
-
- e_vcard_attribute_add_param_with_value (attr,
- e_vcard_attribute_param_new (EVC_TYPE),
- type ? type : ATTRIBUTE_OTHER);
-
- e_vcard_attribute_add_value (attr, me->email[i]);
- attrs = g_list_append (attrs, attr);
- }
- }
-
- e_contact_set_attributes (me->contact, E_CONTACT_EMAIL, attrs);
-
- g_list_foreach (attrs, (GFunc) e_vcard_attribute_free, NULL);
- g_list_free (attrs);
-}
-
-static void
-about_me_commit (MateAboutMe *me)
-{
- EContactName *name;
-
- char *strings[4], **stringptr;
- char *fileas;
-
- name = NULL;
-
- if (me->create_self) {
- if (me->username == NULL)
- fileas = g_strdup ("Myself");
- else {
- name = e_contact_name_from_string (me->username);
-
- stringptr = strings;
- if (name->family && *name->family)
- *(stringptr++) = name->family;
- if (name->given && *name->given)
- *(stringptr++) = name->given;
- *stringptr = NULL;
- fileas = g_strjoinv (", ", strings);
- }
-
- e_contact_set (me->contact, E_CONTACT_FILE_AS, fileas);
- e_contact_set (me->contact, E_CONTACT_NICKNAME, me->login);
- e_contact_set (me->contact, E_CONTACT_FULL_NAME, me->username);
-
- e_contact_name_free (name);
- g_free (fileas);
- }
-
- about_me_update_email (me);
-
- if (me->create_self) {
- e_book_add_contact (me->book, me->contact, NULL);
- e_book_set_self (me->book, me->contact, NULL);
- } else {
- if (!e_book_commit_contact (me->book, me->contact, NULL))
- g_warning ("Could not save contact information");
- }
-
- me->create_self = FALSE;
-}
-
-static gboolean
-about_me_commit_from_timeout (MateAboutMe *me)
-{
- about_me_commit (me);
-
- return FALSE;
-}
-
-static gboolean
-about_me_focus_out (GtkWidget *widget, GdkEventFocus *event, MateAboutMe *unused)
-{
- gchar *str;
- const gchar *wid;
- gint i;
-
- if (me == NULL)
- return FALSE;
-
- wid = gtk_buildable_get_name (GTK_BUILDABLE (widget));
-
- if (wid == NULL)
- return FALSE;
-
- for (i = 0; ids[i].wid != NULL; i++)
- if (strcmp (ids[i].wid, wid) == 0)
- break;
-
- if (GTK_IS_ENTRY (widget)) {
- str = gtk_editable_get_chars (GTK_EDITABLE (widget), 0, -1);
- } else if (GTK_IS_TEXT_VIEW (widget)) {
- GtkTextBuffer *buffer;
- GtkTextIter iter_start;
- GtkTextIter iter_end;
-
- buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget));
- gtk_text_buffer_get_start_iter (buffer, &iter_start);
- iter_end = iter_start;
- gtk_text_iter_forward_to_end (&iter_end);
- str = gtk_text_iter_get_text (&iter_start, &iter_end);
- } else {
- return FALSE;
- }
-
- if (i == EMAIL_HOME || i == EMAIL_WORK) {
-
- g_free (me->email[ids[i].cid]);
- if (str[0] == '\0')
- me->email[ids[i].cid] = NULL;
- else
- me->email[ids[i].cid] = g_strdup (str);
- me->email_types[ids[i].cid] = (i == EMAIL_HOME) ? ATTRIBUTE_HOME : ATTRIBUTE_WORK;
- /* FIXME: i'm getting an empty address field in evolution */
- } else if (i >= ADDRESS_HOME && i < ADDRESS_WORK) {
- about_me_set_address_field (me->addr1, ids[i].cid, str);
- e_contact_set (me->contact, E_CONTACT_ADDRESS_HOME, me->addr1);
- } else if (i >= ADDRESS_WORK) {
- about_me_set_address_field (me->addr2, ids[i].cid, str);
- e_contact_set (me->contact, E_CONTACT_ADDRESS_WORK, me->addr2);
- } else {
- e_contact_set (me->contact, ids[i].cid, str);
- }
-
- g_free (str);
-
- if (me->commit_timeout_id) {
- g_source_remove (me->commit_timeout_id);
- }
-
- me->commit_timeout_id = g_timeout_add (600, (GSourceFunc) about_me_commit_from_timeout, me);
-
- return FALSE;
-}
-
-
-/*
- * Helpers
- */
-
-static gchar *
-about_me_get_address_field (EContactAddress *addr, guint cid)
-{
- gchar *str;
-
- if (addr == NULL) {
- return NULL;
- }
-
- switch (cid) {
- case ADDRESS_STREET:
- str = addr->street;
- break;
- case ADDRESS_POBOX:
- str = addr->po;
- break;
- case ADDRESS_LOCALITY:
- str = addr->locality;
- break;
- case ADDRESS_CODE:
- str = addr->code;
- break;
- case ADDRESS_REGION:
- str = addr->region;
- break;
- case ADDRESS_COUNTRY:
- str = addr->country;
- break;
- default:
- str = NULL;
- break;
- }
-
- return str;
-}
-
-static void
-about_me_set_address_field (EContactAddress *addr, guint cid, gchar *str)
-{
- switch (cid) {
- case ADDRESS_STREET:
- g_free (addr->street);
- addr->street = g_strdup (str);
- break;
- case ADDRESS_POBOX:
- g_free (addr->po);
- addr->po = g_strdup (str);
- break;
- case ADDRESS_LOCALITY:
- g_free (addr->locality);
- addr->locality = g_strdup (str);
- break;
- case ADDRESS_CODE:
- g_free (addr->code);
- addr->code = g_strdup (str);
- break;
- case ADDRESS_REGION:
- g_free (addr->region);
- addr->region = g_strdup (str);
- break;
- case ADDRESS_COUNTRY:
- g_free (addr->country);
- addr->country = g_strdup (str);
- break;
- }
-}
-
-static void
-about_me_setup_email (MateAboutMe *me)
-{
- GList *attrs, *la;
- gboolean has_home = FALSE, has_work = FALSE;
- guint i;
-
- attrs = e_contact_get_attributes (me->contact, E_CONTACT_EMAIL);
-
- for (la = attrs, i = 0; la; la = la->next, ++i) {
- EVCardAttribute *a = la->data;
-
- me->email[i] = e_vcard_attribute_get_value (a);
- if (e_vcard_attribute_has_type (a, ATTRIBUTE_HOME)) {
- me->email_types[i] = ATTRIBUTE_HOME;
- if (!has_home) {
- ids[EMAIL_HOME].cid = i;
- has_home = TRUE;
- }
- } else if (e_vcard_attribute_has_type (a, ATTRIBUTE_WORK)) {
- me->email_types[i] = ATTRIBUTE_WORK;
- if (!has_work) {
- ids[EMAIL_WORK].cid = i;
- has_work = TRUE;
- }
- } else {
- me->email_types[i] = ATTRIBUTE_OTHER;
- }
-
- e_vcard_attribute_free (a);
- }
-
- g_list_free (attrs);
-
- if (ids[EMAIL_HOME].cid == ids[EMAIL_WORK].cid) {
- if (has_home)
- ids[EMAIL_WORK].cid = 1;
- else
- ids[EMAIL_HOME].cid = 0;
- }
-
- me->email_types[ids[EMAIL_WORK].cid] = ATTRIBUTE_WORK;
- me->email_types[ids[EMAIL_HOME].cid] = ATTRIBUTE_HOME;
-}
-
-/**
- * about_me_load_string_field:
- *
- * wid: UI widget name
- * cid: id of the field (EDS id)
- * aid: position in the array WidToCid
- **/
-
-static void
-about_me_load_string_field (MateAboutMe *me, const gchar *wid, guint cid, guint aid)
-{
- GtkWidget *widget;
- GtkBuilder *dialog;
- const gchar *str;
-
- dialog = me->dialog;
-
- widget = WID (wid);
-
- if (me->create_self == TRUE) {
- g_signal_connect (widget, "focus-out-event", G_CALLBACK (about_me_focus_out), me);
- return;
- }
-
- if (aid == EMAIL_HOME || aid == EMAIL_WORK) {
- str = e_contact_get_const (me->contact, E_CONTACT_EMAIL_1 + cid);
- } else if (aid >= ADDRESS_HOME && aid < ADDRESS_WORK) {
- str = about_me_get_address_field (me->addr1, cid);
- } else if (aid >= ADDRESS_WORK) {
- str = about_me_get_address_field (me->addr2, cid);
- } else {
- str = e_contact_get_const (me->contact, cid);
- }
-
- str = str ? str : "";
-
- if (GTK_IS_ENTRY (widget)) {
- gtk_entry_set_text (GTK_ENTRY (widget), str);
- } else if (GTK_IS_TEXT_VIEW (widget)) {
- GtkTextBuffer *buffer;
-
- buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget));
- gtk_text_buffer_set_text (buffer, str, -1);
- }
-
- g_signal_connect (widget, "focus-out-event", G_CALLBACK (about_me_focus_out), me);
-}
-
-#endif
-
-#if 0
-static void
-about_me_load_photo (MateAboutMe *me, EContact *contact)
-#endif
-
static void
about_me_load_photo (MateAboutMe *me)
{
@@ -640,25 +224,6 @@ about_me_update_photo (MateAboutMe *me)
static void
about_me_load_info (MateAboutMe *me)
{
-#if 0
- gint i;
-
- if (me->create_self == FALSE) {
- me->addr1 = e_contact_get (me->contact, E_CONTACT_ADDRESS_HOME);
- if (me->addr1 == NULL)
- me->addr1 = g_new0 (EContactAddress, 1);
- me->addr2 = e_contact_get (me->contact, E_CONTACT_ADDRESS_WORK);
- if (me->addr2 == NULL)
- me->addr2 = g_new0 (EContactAddress, 1);
- } else {
- me->addr1 = g_new0 (EContactAddress, 1);
- me->addr2 = g_new0 (EContactAddress, 1);
- }
-
- for (i = 0; ids[i].wid != NULL; i++) {
- about_me_load_string_field (me, ids[i].wid, ids[i].cid, i);
- }
-#endif
set_fingerprint_label (me->enable_fingerprint_button,
me->disable_fingerprint_button);
}
@@ -903,40 +468,6 @@ about_me_setup_dialog (void)
main_dialog,
G_CONNECT_SWAPPED);
-#if 0
- /* Get the self contact */
- if (!e_book_get_self (&me->contact, &me->book, &error)) {
- if (error->code == E_BOOK_ERROR_PROTOCOL_NOT_SUPPORTED) {
- about_me_error (NULL, _("There was an error while trying to get the addressbook information\n" \
- "Evolution Data Server can't handle the protocol"));
- g_clear_error (&error);
- about_me_destroy ();
- return -1;
- }
-
- g_clear_error (&error);
-
- me->create_self = TRUE;
- me->contact = e_contact_new ();
-
- if (me->book == NULL) {
- me->book = e_book_new_system_addressbook (&error);
- if (me->book == NULL || error != NULL) {
- g_error ("%s", error->message);
- g_clear_error (&error);
- }
-
- if (e_book_open (me->book, FALSE, NULL) == FALSE) {
- about_me_error (GTK_WINDOW (main_dialog),
- _("Unable to open address book"));
- g_clear_error (&error);
- }
- }
- } else {
- about_me_setup_email (me);
- }
-#endif
-
me->login = g_strdup (g_get_user_name ());
me->username = g_strdup (g_get_real_name ());
@@ -975,28 +506,6 @@ about_me_setup_dialog (void)
g_signal_connect (me->image_chooser, "changed",
G_CALLBACK (about_me_image_changed_cb), me);
-#if 0
- /* Address tab: set up the focus chains */
- chain = g_list_prepend (NULL, WID ("addr-country-1"));
- chain = g_list_prepend (chain, WID ("addr-po-1"));
- chain = g_list_prepend (chain, WID ("addr-region-1"));
- chain = g_list_prepend (chain, WID ("addr-code-1"));
- chain = g_list_prepend (chain, WID ("addr-locality-1"));
- chain = g_list_prepend (chain, WID ("addr-scrolledwindow-1"));
- widget = WID ("addr-table-1");
- gtk_container_set_focus_chain (GTK_CONTAINER (widget), chain);
- g_list_free (chain);
-
- chain = g_list_prepend (NULL, WID ("addr-country-2"));
- chain = g_list_prepend (chain, WID ("addr-po-2"));
- chain = g_list_prepend (chain, WID ("addr-region-2"));
- chain = g_list_prepend (chain, WID ("addr-code-2"));
- chain = g_list_prepend (chain, WID ("addr-locality-2"));
- chain = g_list_prepend (chain, WID ("addr-scrolledwindow-2"));
- widget = WID ("addr-table-2");
- gtk_container_set_focus_chain (GTK_CONTAINER (widget), chain);
- g_list_free (chain);
-#endif
about_me_load_info (me);
gtk_widget_show_all (main_dialog);