[evolution/wip-webkit2] Move e_mail_display_get_selection_plain_text_sync to return const gchar
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip-webkit2] Move e_mail_display_get_selection_plain_text_sync to return const gchar
- Date: Tue, 29 Oct 2013 15:10:32 +0000 (UTC)
commit eb027d6885d0556956b0ad7c5254affd06ae8e21
Author: Tomas Popela <tpopela redhat com>
Date: Tue Oct 29 14:40:16 2013 +0100
Move e_mail_display_get_selection_plain_text_sync to return const gchar
mail/e-mail-display.c | 6 +++---
mail/e-mail-display.h | 4 ++--
plugins/mail-to-task/mail-to-task.c | 16 +++++++---------
3 files changed, 12 insertions(+), 14 deletions(-)
---
diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c
index 3e63c77..252290b 100644
--- a/mail/e-mail-display.c
+++ b/mail/e-mail-display.c
@@ -1924,7 +1924,7 @@ e_mail_display_set_status (EMailDisplay *display,
g_free (str);
}
-gchar *
+const gchar *
e_mail_display_get_selection_plain_text_sync (EMailDisplay *display,
GCancellable *cancellable,
GError **error)
@@ -1939,7 +1939,7 @@ e_mail_display_get_selection_plain_text_sync (EMailDisplay *display,
web_extension = e_web_view_get_web_extension_proxy (E_WEB_VIEW (display));
if (web_extension) {
GVariant *result;
- gchar *text_content = NULL;
+ const gchar *text_content = NULL;
result = g_dbus_proxy_call_sync (
web_extension,
@@ -1954,7 +1954,7 @@ e_mail_display_get_selection_plain_text_sync (EMailDisplay *display,
error);
if (result) {
- g_variant_get (result, "(s)", &text_content);
+ text_content = g_variant_get_string (result, NULL);
g_variant_unref (result);
return text_content;
}
diff --git a/mail/e-mail-display.h b/mail/e-mail-display.h
index 4e39ba6..f8e3199 100644
--- a/mail/e-mail-display.h
+++ b/mail/e-mail-display.h
@@ -89,10 +89,10 @@ GtkAction * e_mail_display_get_action (EMailDisplay *display,
const gchar *action_name);
void e_mail_display_set_status (EMailDisplay *display,
const gchar *status);
-gchar * e_mail_display_get_selection_plain_text_sync
+const gchar * e_mail_display_get_selection_plain_text_sync
(EMailDisplay *display,
GCancellable *cancellable,
- GError *error);
+ GError **error);
void e_mail_display_load_images (EMailDisplay *display);
void e_mail_display_set_force_load_images
(EMailDisplay *display,
diff --git a/plugins/mail-to-task/mail-to-task.c b/plugins/mail-to-task/mail-to-task.c
index 28ce0b1..f2185fa 100644
--- a/plugins/mail-to-task/mail-to-task.c
+++ b/plugins/mail-to-task/mail-to-task.c
@@ -831,7 +831,7 @@ typedef struct {
ECalClientSourceType source_type;
CamelFolder *folder;
GPtrArray *uids;
- gchar *selected_text;
+ const gchar *selected_text;
gboolean with_attendees;
}AsyncData;
@@ -1080,24 +1080,21 @@ text_contains_nonwhitespace (const gchar *text,
return p - text < len - 1 && c != 0;
}
-/* should be freed with g_free after done with it */
-static gchar *
+static const gchar *
get_selected_text (EMailReader *reader)
{
EMailDisplay *display;
- gchar *text = NULL;
+ const gchar *text = NULL;
display = e_mail_reader_get_mail_display (reader);
if (!e_web_view_is_selection_active (E_WEB_VIEW (display)))
return NULL;
- text = e_mail_display_get_selection_plain_text (display);
+ text = e_mail_display_get_selection_plain_text_sync (display, NULL, NULL);
- if (text == NULL || !text_contains_nonwhitespace (text, strlen (text))) {
- g_free (text);
+ if (text == NULL || !text_contains_nonwhitespace (text, strlen (text)))
return NULL;
- }
return text;
}
@@ -1221,8 +1218,9 @@ mail_to_event (ECalClientSourceType source_type,
data->uids = g_ptr_array_ref (uids);
data->with_attendees = with_attendees;
+ /* FIXME move data->selected_text to const gchar * */
if (uids->len == 1)
- data->selected_text = get_selected_text (reader);
+ data->selected_text = g_strdup (get_selected_text (reader));
else
data->selected_text = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]