aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-12-24 06:57:26 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-12-24 08:49:53 +0800
commit6feca1bf560b3269555d4f0a890cd192fdaa0f00 (patch)
treedd77b59b48d803fc095b9ea86dc02dbbd152e0db /calendar
parent9d4348036c46232d3cfc728724be8b1d80e1df78 (diff)
downloadgsoc2013-evolution-6feca1bf560b3269555d4f0a890cd192fdaa0f00.tar
gsoc2013-evolution-6feca1bf560b3269555d4f0a890cd192fdaa0f00.tar.gz
gsoc2013-evolution-6feca1bf560b3269555d4f0a890cd192fdaa0f00.tar.bz2
gsoc2013-evolution-6feca1bf560b3269555d4f0a890cd192fdaa0f00.tar.lz
gsoc2013-evolution-6feca1bf560b3269555d4f0a890cd192fdaa0f00.tar.xz
gsoc2013-evolution-6feca1bf560b3269555d4f0a890cd192fdaa0f00.tar.zst
gsoc2013-evolution-6feca1bf560b3269555d4f0a890cd192fdaa0f00.zip
Remove e_dialog_editable_get().
Silly function. Use gtk_entry_get_text() for a const string or else gtk_editable_get_chars() for an allocated string.
Diffstat (limited to 'calendar')
-rw-r--r--calendar/gui/dialogs/alarm-dialog.c32
-rw-r--r--calendar/gui/dialogs/event-page.c42
-rw-r--r--calendar/gui/dialogs/memo-page.c30
-rw-r--r--calendar/gui/dialogs/task-details-page.c8
-rw-r--r--calendar/gui/dialogs/task-page.c24
5 files changed, 59 insertions, 77 deletions
diff --git a/calendar/gui/dialogs/alarm-dialog.c b/calendar/gui/dialogs/alarm-dialog.c
index b5aaed5093..d18594e826 100644
--- a/calendar/gui/dialogs/alarm-dialog.c
+++ b/calendar/gui/dialogs/alarm-dialog.c
@@ -576,28 +576,24 @@ static void
palarm_widgets_to_alarm (Dialog *dialog,
ECalComponentAlarm *alarm)
{
- gchar *program;
icalattach *attach;
- gchar *str;
ECalComponentText description;
icalcomponent *icalcomp;
icalproperty *icalprop;
+ const gchar *text;
- program = e_dialog_editable_get (dialog->palarm_program);
- attach = icalattach_new_from_url (program ? program : "");
- g_free (program);
+ text = gtk_entry_get_text (GTK_ENTRY (dialog->palarm_program));
+ attach = icalattach_new_from_url ((text != NULL) ? text : "");
e_cal_component_alarm_set_attach (alarm, attach);
icalattach_unref (attach);
- str = e_dialog_editable_get (dialog->palarm_args);
-
- description.value = str;
- description.altrep = NULL;
+ text = gtk_entry_get_text (GTK_ENTRY (dialog->palarm_args));
- e_cal_component_alarm_set_description (alarm, &description);
+ description.value = text;
+ description.altrep = NULL;
- g_free (str);
+ e_cal_component_alarm_set_description (alarm, &description);
/* remove the X-EVOLUTION-NEEDS-DESCRIPTION property, so that
* we don't re-set the alarm's description */
@@ -1040,13 +1036,17 @@ dalarm_description_changed_cb (GtkWidget *widget,
static void
check_custom_program (Dialog *dialog)
{
- gchar *str;
- gboolean sens;
+ GtkEntry *entry;
+ const gchar *text;
+ gboolean sensitive;
- str = e_dialog_editable_get (dialog->palarm_program);
+ entry = GTK_ENTRY (dialog->palarm_program);
+ text = gtk_entry_get_text (entry);
+ sensitive = (text != NULL && *text != '\0');
- sens = str && *str;
- gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog->toplevel), GTK_RESPONSE_OK, sens);
+ gtk_dialog_set_response_sensitive (
+ GTK_DIALOG (dialog->toplevel),
+ GTK_RESPONSE_OK, sensitive);
}
static void
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index 11524cdf27..5152b9ab21 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -1020,7 +1020,8 @@ event_page_save_locations_list (CompEditorPage *page,
GtkTreeIter iter;
const gchar *cache_dir;
- gchar *file_name, *current_location;
+ const gchar *current_location;
+ gchar *file_name;
GString *contents;
priv = EVENT_PAGE (page)->priv;
@@ -1040,7 +1041,7 @@ event_page_save_locations_list (CompEditorPage *page,
}
}
- current_location = e_dialog_editable_get (priv->location);
+ current_location = gtk_entry_get_text (GTK_ENTRY (priv->location));
/* Put current locatin on the very top of the list */
contents = g_string_new (current_location);
@@ -1074,7 +1075,6 @@ event_page_save_locations_list (CompEditorPage *page,
g_string_free (contents, TRUE);
g_free (file_name);
- g_free (current_location);
}
static gboolean
@@ -1383,8 +1383,8 @@ event_page_fill_component (CompEditorPage *page,
/* Summary */
- str = e_dialog_editable_get (priv->summary);
- if (!str || !*str)
+ str = gtk_editable_get_chars (GTK_EDITABLE (priv->summary), 0, -1);
+ if (str == NULL || *str == '\0')
e_cal_component_set_summary (comp, NULL);
else {
ECalComponentText text;
@@ -1395,21 +1395,19 @@ event_page_fill_component (CompEditorPage *page,
e_cal_component_set_summary (comp, &text);
}
- if (str)
- g_free (str);
+ g_free (str);
/* Location */
- str = e_dialog_editable_get (priv->location);
- if (!str || !*str)
+ str = gtk_editable_get_chars (GTK_EDITABLE (priv->location), 0, -1);
+ if (str == NULL || *str == '\0')
e_cal_component_set_location (comp, NULL);
else {
e_cal_component_set_location (comp, str);
event_page_save_locations_list (page, comp);
}
- if (str)
- g_free (str);
+ g_free (str);
/* Description */
@@ -1417,7 +1415,7 @@ event_page_fill_component (CompEditorPage *page,
gtk_text_buffer_get_end_iter (text_buffer, &text_iter_end);
str = gtk_text_buffer_get_text (text_buffer, &text_iter_start, &text_iter_end, FALSE);
- if (!str || !*str)
+ if (str == NULL || *str == '\0')
e_cal_component_set_description_list (comp, NULL);
else {
GSList l;
@@ -1431,8 +1429,7 @@ event_page_fill_component (CompEditorPage *page,
e_cal_component_set_description_list (comp, &l);
}
- if (str)
- g_free (str);
+ g_free (str);
/* Dates */
@@ -1501,15 +1498,13 @@ event_page_fill_component (CompEditorPage *page,
/* Categories */
- cat = e_dialog_editable_get (priv->categories);
+ cat = gtk_editable_get_chars (GTK_EDITABLE (priv->categories), 0, -1);
str = comp_editor_strip_categories (cat);
- if (cat)
- g_free (cat);
+ g_free (cat);
e_cal_component_set_categories (comp, str);
- if (str)
- g_free (str);
+ g_free (str);
/* Classification */
classification = comp_editor_get_classification (editor);
@@ -2590,19 +2585,18 @@ get_widgets (EventPage *epage)
}
static void
-summary_changed_cb (GtkEditable *editable,
+summary_changed_cb (GtkEntry *entry,
CompEditorPage *page)
{
CompEditor *editor;
- gchar *summary;
+ const gchar *text;
if (comp_editor_page_get_updating (page))
return;
editor = comp_editor_page_get_editor (page);
- summary = e_dialog_editable_get (GTK_WIDGET (editable));
- comp_editor_set_summary (editor, summary);
- g_free (summary);
+ text = gtk_entry_get_text (entry);
+ comp_editor_set_summary (editor, text);
}
/* Note that this assumes that the start_tt and end_tt passed to it are the
diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c
index 3b783d343f..4ef58eace7 100644
--- a/calendar/gui/dialogs/memo-page.c
+++ b/calendar/gui/dialogs/memo-page.c
@@ -652,8 +652,8 @@ memo_page_fill_component (CompEditorPage *page,
text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->memo_content));
/* Summary */
- str = e_dialog_editable_get (priv->summary_entry);
- if (!str || strlen (str) == 0)
+ str = gtk_editable_get_chars (GTK_EDITABLE (priv->summary_entry), 0, -1);
+ if (str == NULL || *str == '\0')
e_cal_component_set_summary (comp, NULL);
else {
ECalComponentText text;
@@ -664,10 +664,8 @@ memo_page_fill_component (CompEditorPage *page,
e_cal_component_set_summary (comp, &text);
}
- if (str) {
- g_free (str);
- str = NULL;
- }
+ g_free (str);
+ str = NULL;
/* Memo Content */
@@ -701,8 +699,7 @@ memo_page_fill_component (CompEditorPage *page,
e_cal_component_set_description_list (comp, &l);
}
- if (str)
- g_free (str);
+ g_free (str);
/* Dates */
start_tt = icaltime_null_time ();
@@ -727,15 +724,13 @@ memo_page_fill_component (CompEditorPage *page,
e_cal_component_set_classification (comp, classification);
/* Categories */
- cat = e_dialog_editable_get (priv->categories);
+ cat = gtk_editable_get_chars (GTK_EDITABLE (priv->categories), 0, -1);
str = comp_editor_strip_categories (cat);
- if (cat)
- g_free (cat);
+ g_free (cat);
e_cal_component_set_categories (comp, str);
- if (str)
- g_free (str);
+ g_free (str);
/* change recipients only when creating new item, after that no such action is available */
if ((flags & COMP_EDITOR_IS_SHARED) && (flags & COMP_EDITOR_NEW_ITEM) && fill_comp_with_recipients (priv->name_selector, comp)) {
@@ -1026,19 +1021,18 @@ set_subscriber_info_string (MemoPage *mpage,
}
static void
-summary_changed_cb (GtkEditable *editable,
+summary_changed_cb (GtkEntry *entry,
CompEditorPage *page)
{
CompEditor *editor;
- gchar *summary;
+ const gchar *text;
if (comp_editor_page_get_updating (page))
return;
editor = comp_editor_page_get_editor (page);
- summary = e_dialog_editable_get (GTK_WIDGET (editable));
- comp_editor_set_summary (editor, summary);
- g_free (summary);
+ text = gtk_entry_get_text (entry);
+ comp_editor_set_summary (editor, text);
}
static void
diff --git a/calendar/gui/dialogs/task-details-page.c b/calendar/gui/dialogs/task-details-page.c
index 71905ceabb..919a9c0550 100644
--- a/calendar/gui/dialogs/task-details-page.c
+++ b/calendar/gui/dialogs/task-details-page.c
@@ -315,7 +315,7 @@ task_details_page_fill_component (CompEditorPage *page,
TaskEditorPriority priority;
CompEditor *editor;
gint priority_value, percent;
- gchar *url;
+ const gchar *text;
gboolean date_set;
icaltimezone *zone;
@@ -389,10 +389,8 @@ task_details_page_fill_component (CompEditorPage *page,
}
/* URL. */
- url = e_dialog_editable_get (priv->url);
- e_cal_component_set_url (comp, url);
- if (url)
- g_free (url);
+ text = gtk_entry_get_text (GTK_ENTRY (priv->url));
+ e_cal_component_set_url (comp, text);
return TRUE;
}
diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c
index 493af6f28c..2fe06d9658 100644
--- a/calendar/gui/dialogs/task-page.c
+++ b/calendar/gui/dialogs/task-page.c
@@ -763,8 +763,8 @@ task_page_fill_component (CompEditorPage *page,
/* Summary. */
- str = e_dialog_editable_get (priv->summary);
- if (!str || strlen (str) == 0)
+ str = gtk_editable_get_chars (GTK_EDITABLE (priv->summary), 0, -1);
+ if (str == NULL || *str == '\0')
e_cal_component_set_summary (comp, NULL);
else {
ECalComponentText text;
@@ -775,8 +775,7 @@ task_page_fill_component (CompEditorPage *page,
e_cal_component_set_summary (comp, &text);
}
- if (str)
- g_free (str);
+ g_free (str);
/* Description */
@@ -798,8 +797,7 @@ task_page_fill_component (CompEditorPage *page,
e_cal_component_set_description_list (comp, &l);
}
- if (str)
- g_free (str);
+ g_free (str);
/* Dates */
@@ -857,10 +855,9 @@ task_page_fill_component (CompEditorPage *page,
}
/* Categories */
- cat = e_dialog_editable_get (priv->categories);
+ cat = gtk_editable_get_chars (GTK_EDITABLE (priv->categories), 0, -1);
str = comp_editor_strip_categories (cat);
- if (cat)
- g_free (cat);
+ g_free (cat);
e_cal_component_set_categories (comp, str);
@@ -1521,19 +1518,18 @@ get_widgets (TaskPage *tpage)
}
static void
-summary_changed_cb (GtkEditable *editable,
+summary_changed_cb (GtkEntry *entry,
CompEditorPage *page)
{
CompEditor *editor;
- gchar *summary;
+ const gchar *text;
if (comp_editor_page_get_updating (page))
return;
editor = comp_editor_page_get_editor (page);
- summary = e_dialog_editable_get (GTK_WIDGET (editable));
- comp_editor_set_summary (editor, summary);
- g_free (summary);
+ text = gtk_entry_get_text (entry);
+ comp_editor_set_summary (editor, text);
}
/* Callback used when the start or due date widgets change. We notify the