soylent r178 - trunk/src
- From: treitter svn gnome org
- To: svn-commits-list gnome org
- Subject: soylent r178 - trunk/src
- Date: Mon, 23 Jun 2008 05:40:45 +0000 (UTC)
Author: treitter
Date: Mon Jun 23 05:40:45 2008
New Revision: 178
URL: http://svn.gnome.org/viewvc/soylent?rev=178&view=rev
Log:
begin cutting out functions no longer necessary, due to simpler person edits model
Modified:
trunk/src/soylent-browser-person-view.c
trunk/src/soylent-browser-person-view.h
trunk/src/soylent-browser.c
Modified: trunk/src/soylent-browser-person-view.c
==============================================================================
--- trunk/src/soylent-browser-person-view.c (original)
+++ trunk/src/soylent-browser-person-view.c Mon Jun 23 05:40:45 2008
@@ -512,58 +512,6 @@
return retval;
}
-/* Handle a person's (simple, GtkEntry-based) detail's edit
- *
- * Return TRUE for success, FALSE for any failure. */
-gboolean
-soylent_browser_person_entry_changed_e_contact_cb (GtkEditable *editable,
- gpointer user_data)
-{
- gboolean retval = FALSE;
- cb_entry_changed_e_contact *cb_data = NULL;
- SoylentBrowser *browser = NULL;
- GHashTable *edits_pending = NULL;
- gpointer value_existing = NULL;
-
- g_return_val_if_fail (user_data, retval);
- /* FIXME: uncomment once SoylentBrowser is a GObject:
- g_return_val_if_fail (SOYLENT_IS_BROWSER (browser), retval);
- */
-
- cb_data = (cb_entry_changed_e_contact*) user_data;
- browser = cb_data->browser;
- /* FIXME: once SoylentBrowser is a GObject, check SOYLENT_IS_BROWSER */
- if (browser)
- {
- edits_pending = soylent_browser_get_edits_pending (browser);
- if (edits_pending)
- {
- value_existing = g_hash_table_lookup (edits_pending,
- cb_data->widget_name);
-
- /* Note: if we ever insert values == NULL (which we shouldn't be
- * anyhow), this assumes the key doesn't have an entry in the hash */
- if (!value_existing)
- {
- g_hash_table_insert (edits_pending, cb_data->widget_name,
- cb_data->field);
- }
-
- retval = TRUE;
- }
- else
- {
- g_critical ("pending edits hash is invalid");
- }
- }
- else
- {
- g_critical ("SoylentBrowser is invalid");
- }
-
- return retval;
-}
-
/* Create a new SoylentPerson and matching EContact in e-d-s
*
* Return TRUE for success, FALSE for any failure. */
@@ -2814,17 +2762,13 @@
email_str = (gchar*) l->data;
if (email_str)
{
- entry_set_text_block_handler
- (entry_email, email_str,
- soylent_browser_person_entry_changed_e_contact_cb);
+ gtk_entry_set_text (entry_email, email_str);
gtk_widget_show (GTK_WIDGET (hbox_email));
num_entries_set++;
}
else
{
- entry_set_text_block_handler
- (entry_email, "",
- soylent_browser_person_entry_changed_e_contact_cb);
+ gtk_entry_set_text (entry_email, "");
gtk_widget_hide (GTK_WIDGET (hbox_email));
}
@@ -2978,9 +2922,7 @@
gtk_label_set_text
(label_im,
e_vcard_attribute_get_name (attr) + 2);
- entry_set_text_block_handler
- (entry_im, im_name,
- soylent_browser_person_entry_changed_e_contact_cb);
+ gtk_entry_set_text (entry_im, im_name);
gtk_widget_show (GTK_WIDGET (hbox_im));
}
@@ -3209,24 +3151,12 @@
gtk_widget_show (GTK_WIDGET (frame_mail_cur));
frames_visible++;
- text_buffer_set_text_block_handler
- (tb_street, addr->street,
- soylent_browser_person_entry_changed_e_contact_cb);
- entry_set_text_block_handler
- (entry_po, addr->po,
- soylent_browser_person_entry_changed_e_contact_cb);
- entry_set_text_block_handler
- (entry_code, addr->code,
- soylent_browser_person_entry_changed_e_contact_cb);
- entry_set_text_block_handler
- (entry_locality, addr->locality,
- soylent_browser_person_entry_changed_e_contact_cb);
- entry_set_text_block_handler
- (entry_region, addr->region,
- soylent_browser_person_entry_changed_e_contact_cb);
- entry_set_text_block_handler
- (entry_country, addr->country,
- soylent_browser_person_entry_changed_e_contact_cb);
+ gtk_text_buffer_set_text (tb_street, addr->street, -1);
+ gtk_entry_set_text (entry_po, addr->po);
+ gtk_entry_set_text (entry_code, addr->code);
+ gtk_entry_set_text (entry_locality, addr->locality);
+ gtk_entry_set_text (entry_region, addr->region);
+ gtk_entry_set_text (entry_country, addr->country);
e_contact_address_free (addr);
}
@@ -3280,9 +3210,7 @@
/* TODO: use the <b></b> markup */
name = display_name_from_e_contact (e_contact);
- entry_set_text_block_handler
- (entry_name, name,
- soylent_browser_person_entry_changed_e_contact_cb);
+ gtk_entry_set_text (entry_name, name);
/*
soylent_debug ("\n%s\n",
@@ -3348,9 +3276,7 @@
E_CONTACT_FIELDS_PHONE[context]);
if (phone_str)
{
- entry_set_text_block_handler
- (entry_phone, phone_str,
- soylent_browser_person_entry_changed_e_contact_cb);
+ gtk_entry_set_text (entry_phone, phone_str);
num_entries_set++;
gtk_widget_show (GTK_WIDGET (hbox_phone));
@@ -3431,10 +3357,7 @@
* string instead of NULL */
if (web_name && *web_name != '\0')
{
- entry_set_text_block_handler
- (entry_web, web_name,
- soylent_browser_person_entry_changed_e_contact_cb);
-
+ gtk_entry_set_text (entry_web, web_name);
num_entries_set++;
gtk_widget_show (GTK_WIDGET (hbox_web));
Modified: trunk/src/soylent-browser-person-view.h
==============================================================================
--- trunk/src/soylent-browser-person-view.h (original)
+++ trunk/src/soylent-browser-person-view.h Mon Jun 23 05:40:45 2008
@@ -68,9 +68,6 @@
(SoylentBrowser *browser,
SoylentPerson *person);
-gboolean soylent_browser_person_entry_changed_e_contact_cb
- (GtkEditable *editable,
- gpointer user_data);
void soylent_browser_person_error_chat_new_cb (MissionControl *mc,
GError *error,
gpointer user_data);
Modified: trunk/src/soylent-browser.c
==============================================================================
--- trunk/src/soylent-browser.c (original)
+++ trunk/src/soylent-browser.c Mon Jun 23 05:40:45 2008
@@ -75,8 +75,6 @@
static gboolean soylent_browser_about_dialog_setup (SoylentBrowser *browser);
static gboolean soylent_browser_widget_setup (SoylentBrowser *browser);
static gboolean soylent_browser_widget_signals_setup (SoylentBrowser *browser);
-static gboolean soylent_browser_person_info_mail_signals_setup
- (SoylentBrowser *browser);
/* Instantiate the main SoylentBrowser */
SoylentBrowser*
@@ -1750,109 +1748,6 @@
{"entry_person_mail_add_country", "changed",
soylent_browser_person_btn_detail_add_update_mail, CB_DATA_SIMPLE,
browser},
-
- /*
- * Editing existing Person Details
- */
- /* Name */
- {"entry_person_name", "changed",
- soylent_browser_person_entry_changed_e_contact_cb,
- CB_DATA_COMPLEX_FROM_E_CONTACT_FIELD, (void*) E_CONTACT_FULL_NAME},
-
- /* Avatar */
- /* TODO: set up avatar editing */
-
- /* Email addresses */
- {"entry_person_email_1", "changed",
- soylent_browser_person_entry_changed_e_contact_cb,
- CB_DATA_COMPLEX_FROM_E_CONTACT_FIELD, (void*) E_CONTACT_EMAIL_1},
- {"entry_person_email_2", "changed",
- soylent_browser_person_entry_changed_e_contact_cb,
- CB_DATA_COMPLEX_FROM_E_CONTACT_FIELD, (void*) E_CONTACT_EMAIL_2},
- {"entry_person_email_3", "changed",
- soylent_browser_person_entry_changed_e_contact_cb,
- CB_DATA_COMPLEX_FROM_E_CONTACT_FIELD, (void*) E_CONTACT_EMAIL_3},
- {"entry_person_email_4", "changed",
- soylent_browser_person_entry_changed_e_contact_cb,
- CB_DATA_COMPLEX_FROM_E_CONTACT_FIELD, (void*) E_CONTACT_EMAIL_4},
-
- /* Phone numbers */
- {"entry_person_phone_home", "changed",
- soylent_browser_person_entry_changed_e_contact_cb,
- CB_DATA_COMPLEX_FROM_E_CONTACT_FIELD, (void*) E_CONTACT_PHONE_HOME},
- {"entry_person_phone_work", "changed",
- soylent_browser_person_entry_changed_e_contact_cb,
- CB_DATA_COMPLEX_FROM_E_CONTACT_FIELD, (void*) E_CONTACT_PHONE_BUSINESS},
- {"entry_person_phone_cell", "changed",
- soylent_browser_person_entry_changed_e_contact_cb,
- CB_DATA_COMPLEX_FROM_E_CONTACT_FIELD, (void*) E_CONTACT_PHONE_MOBILE},
-
- /* XXX: pretty arbitrary and extremely noisy */
- /* Instant messenger */
- /* home */
- {"entry_person_im_home_1", "changed",
- soylent_browser_person_entry_changed_e_contact_cb,
- CB_DATA_COMPLEX_FROM_E_CONTACT_FIELD, (void*) CB_DATA_FIELD_IM},
- {"entry_person_im_home_2", "changed",
- soylent_browser_person_entry_changed_e_contact_cb,
- CB_DATA_COMPLEX_FROM_E_CONTACT_FIELD, (void*) CB_DATA_FIELD_IM},
- {"entry_person_im_home_3", "changed",
- soylent_browser_person_entry_changed_e_contact_cb,
- CB_DATA_COMPLEX_FROM_E_CONTACT_FIELD, (void*) CB_DATA_FIELD_IM},
- {"entry_person_im_home_4", "changed",
- soylent_browser_person_entry_changed_e_contact_cb,
- CB_DATA_COMPLEX_FROM_E_CONTACT_FIELD, (void*) CB_DATA_FIELD_IM},
- {"entry_person_im_home_5", "changed",
- soylent_browser_person_entry_changed_e_contact_cb,
- CB_DATA_COMPLEX_FROM_E_CONTACT_FIELD, (void*) CB_DATA_FIELD_IM},
- {"entry_person_im_home_6", "changed",
- soylent_browser_person_entry_changed_e_contact_cb,
- CB_DATA_COMPLEX_FROM_E_CONTACT_FIELD, (void*) CB_DATA_FIELD_IM},
- {"entry_person_im_home_7", "changed",
- soylent_browser_person_entry_changed_e_contact_cb,
- CB_DATA_COMPLEX_FROM_E_CONTACT_FIELD, (void*) CB_DATA_FIELD_IM},
- {"entry_person_im_home_8", "changed",
- soylent_browser_person_entry_changed_e_contact_cb,
- CB_DATA_COMPLEX_FROM_E_CONTACT_FIELD, (void*) CB_DATA_FIELD_IM},
- /* work */
- {"entry_person_im_work_1", "changed",
- soylent_browser_person_entry_changed_e_contact_cb,
- CB_DATA_COMPLEX_FROM_E_CONTACT_FIELD, (void*) CB_DATA_FIELD_IM},
- {"entry_person_im_work_2", "changed",
- soylent_browser_person_entry_changed_e_contact_cb,
- CB_DATA_COMPLEX_FROM_E_CONTACT_FIELD, (void*) CB_DATA_FIELD_IM},
- {"entry_person_im_work_3", "changed",
- soylent_browser_person_entry_changed_e_contact_cb,
- CB_DATA_COMPLEX_FROM_E_CONTACT_FIELD, (void*) CB_DATA_FIELD_IM},
- {"entry_person_im_work_4", "changed",
- soylent_browser_person_entry_changed_e_contact_cb,
- CB_DATA_COMPLEX_FROM_E_CONTACT_FIELD, (void*) CB_DATA_FIELD_IM},
- {"entry_person_im_work_5", "changed",
- soylent_browser_person_entry_changed_e_contact_cb,
- CB_DATA_COMPLEX_FROM_E_CONTACT_FIELD, (void*) CB_DATA_FIELD_IM},
- {"entry_person_im_work_6", "changed",
- soylent_browser_person_entry_changed_e_contact_cb,
- CB_DATA_COMPLEX_FROM_E_CONTACT_FIELD, (void*) CB_DATA_FIELD_IM},
- {"entry_person_im_work_7", "changed",
- soylent_browser_person_entry_changed_e_contact_cb,
- CB_DATA_COMPLEX_FROM_E_CONTACT_FIELD, (void*) CB_DATA_FIELD_IM},
- {"entry_person_im_work_8", "changed",
- soylent_browser_person_entry_changed_e_contact_cb,
- CB_DATA_COMPLEX_FROM_E_CONTACT_FIELD, (void*) CB_DATA_FIELD_IM},
-
- /* Web URLs */
- {"entry_person_web_homepage", "changed",
- soylent_browser_person_entry_changed_e_contact_cb,
- CB_DATA_COMPLEX_FROM_E_CONTACT_FIELD, (void*) E_CONTACT_HOMEPAGE_URL},
- {"entry_person_web_blog", "changed",
- soylent_browser_person_entry_changed_e_contact_cb,
- CB_DATA_COMPLEX_FROM_E_CONTACT_FIELD, (void*) E_CONTACT_BLOG_URL},
- {"entry_person_web_calendar", "changed",
- soylent_browser_person_entry_changed_e_contact_cb,
- CB_DATA_COMPLEX_FROM_E_CONTACT_FIELD, (void*) E_CONTACT_CALENDAR_URI},
- {"entry_person_web_video", "changed",
- soylent_browser_person_entry_changed_e_contact_cb,
- CB_DATA_COMPLEX_FROM_E_CONTACT_FIELD, (void*) E_CONTACT_VIDEO_URL},
};
gboolean retval = FALSE;
gint signals_num = -1;
@@ -1866,95 +1761,6 @@
retval = TRUE;
retval &= widget_signal_connect_mass (browser, signal_handlers, signals_num);
- retval &= soylent_browser_person_info_mail_signals_setup (browser);
-
- return retval;
-}
-
-/* Hook up handlers for edits to peoples' existing mailing addresses
- *
- * Return TRUE for success, FALSE for any failure. */
-static gboolean
-soylent_browser_person_info_mail_signals_setup (SoylentBrowser *browser)
-{
- const guint e_contact_fields[] = {E_CONTACT_ADDRESS_HOME,
- E_CONTACT_ADDRESS_WORK,
- E_CONTACT_ADDRESS_OTHER,};
- gboolean retval = FALSE;
- GladeXML *wtree = NULL;
- guint i = 0;
- guint j = 0;
-
- g_return_val_if_fail (browser, retval);
- /* FIXME: uncomment once SoylentBrowser is a GObject:
- g_return_val_if_fail (SOYLENT_IS_BROWSER (browser), retval);
- */
-
- wtree = browser->main_window;
-
- /* invert usual logic to simplify the loop below */
- retval = TRUE;
-
- for (i = 0; i < ARRAY_LEN (e_contact_fields); i++)
- {
- for (j = 0; j < MAIL_FIELDS_NUM; j++)
- {
- /* TODO: factor this out somewhere else, if possible */
- const gchar *context_list[] = {"home", "work", "other"};
- const gchar *signal_name = "changed";
- const GCallback callback =
- G_CALLBACK (soylent_browser_person_entry_changed_e_contact_cb);
- gboolean connect_retval = FALSE;
- gchar *widget_name = NULL;
- cb_entry_changed_e_contact *cb_data = NULL;
-
- widget_name = g_strdup_printf ("%s_person_mail_%s_%s",
- MAIL_WIDGET_TYPE_STRS[j],
- context_list[i], MAIL_FIELD_STRS[j]);
-
- cb_data = g_new0 (cb_entry_changed_e_contact, 1);
- if (cb_data)
- {
- cb_data->browser = browser;
- /* FIXME: don't special-case this name (compared to the other
- * similar signal-handler-setup functions) */
- cb_data->widget_name = g_strdup_printf ("mail_%s",
- context_list[i]);
- cb_data->field = g_new0 (EContactField, 1);
- if (cb_data->field)
- {
- *(cb_data->field) = e_contact_fields[i];
-
- /* FIXME - use a version which uses g_signal_connect_data so we
- * can eventually free each instance of cb_data */
- connect_retval = widget_signal_connect (wtree, widget_name,
- signal_name, callback,
- cb_data);
- }
- }
-
- if (connect_retval)
- {
- /* success */
- }
- else
- {
- g_critical ("failed to set up signal handler for widget "
- "%s::%s\n", widget_name, signal_name);
-
- retval = FALSE;
-
- if (cb_data)
- {
- g_free (cb_data->field);
- g_free (cb_data);
- }
- g_free (cb_data->widget_name);
- }
-
- g_free (widget_name);
- }
- }
return retval;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]