aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-folder-selector.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-08-31 11:26:15 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-08-31 11:26:15 +0800
commit674a09b0f31fb2a0216ceb67e17718ce93fdc5fc (patch)
tree61dec7495992d73029a2fcb8a5938107107eb2bc /mail/em-folder-selector.c
parentf7d31c11f5c3fbd42e0a172e34a1bc8d28e7a44e (diff)
downloadgsoc2013-evolution-674a09b0f31fb2a0216ceb67e17718ce93fdc5fc.tar.gz
gsoc2013-evolution-674a09b0f31fb2a0216ceb67e17718ce93fdc5fc.tar.zst
gsoc2013-evolution-674a09b0f31fb2a0216ceb67e17718ce93fdc5fc.zip
** See bug #64377.
2004-08-30 Not Zed <NotZed@Ximian.com> ** See bug #64377. * em-folder-selector.c (emfs_response): only set the uri if we have one to set. * em-folder-tree.c (em_folder_tree_finalize): Removed cose using selected_path and selected_uri strings. (emft_popup_new_folder): " (emft_popup_copy_folder_selected): " (emft_tree_selection_changed): (emft_tree_row_activated): ", free paths after use. * em-folder-selector.c (emfs_create_name_changed): free get_selected_uri return. (emfs_create_name_activate): " (em_folder_selector_get_selected_path): handle api change, store the selected_path too. * em-folder-tree.c (em_folder_tree_get_selected_uri): de-constify,and get the selection directly from the tree. (em_folder_tree_get_selected_path): same. svn path=/trunk/; revision=27092
Diffstat (limited to 'mail/em-folder-selector.c')
-rw-r--r--mail/em-folder-selector.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/mail/em-folder-selector.c b/mail/em-folder-selector.c
index d5aecd9667..7df4d50e9f 100644
--- a/mail/em-folder-selector.c
+++ b/mail/em-folder-selector.c
@@ -166,7 +166,8 @@ emfs_response (GtkWidget *dialog, int response, EMFolderSelector *emfs)
dialog = em_folder_selector_create_new (emft, 0, _("Create New Folder"), _("Specify where to create the folder:"));
gtk_window_set_transient_for ((GtkWindow *) dialog, (GtkWindow *) emfs);
uri = em_folder_selector_get_selected_uri (emfs);
- em_folder_tree_set_selected (emft, uri);
+ if (uri)
+ em_folder_tree_set_selected (emft, uri);
if (gtk_dialog_run ((GtkDialog *) dialog) == GTK_RESPONSE_OK) {
uri = em_folder_selector_get_selected_uri ((EMFolderSelector *) dialog);
@@ -189,16 +190,17 @@ emfs_response (GtkWidget *dialog, int response, EMFolderSelector *emfs)
static void
emfs_create_name_changed (GtkEntry *entry, EMFolderSelector *emfs)
{
- const char *path, *text = NULL;
+ char *path;
+ const char *text = NULL;
gboolean active;
if (emfs->name_entry->text_length > 0)
text = gtk_entry_get_text (emfs->name_entry);
path = em_folder_tree_get_selected_uri(emfs->emft);
-
active = text && path && !strchr (text, '/');
-
+ g_free(path);
+
gtk_dialog_set_response_sensitive ((GtkDialog *) emfs, GTK_RESPONSE_OK, active);
}
@@ -276,13 +278,15 @@ static void
emfs_create_name_activate (GtkEntry *entry, EMFolderSelector *emfs)
{
if (emfs->name_entry->text_length > 0) {
- const char *path, *text;
+ char *path;
+ const char *text;
text = gtk_entry_get_text (emfs->name_entry);
path = em_folder_tree_get_selected_uri(emfs->emft);
if (text && path && !strchr (text, '/'))
g_signal_emit_by_name (emfs, "response", GTK_RESPONSE_OK);
+ g_free(path);
}
}
@@ -333,7 +337,8 @@ em_folder_selector_set_selected_list (EMFolderSelector *emfs, GList *list)
const char *
em_folder_selector_get_selected_uri (EMFolderSelector *emfs)
{
- const char *uri, *name;
+ char *uri;
+ const char *name;
if (!(uri = em_folder_tree_get_selected_uri (emfs->emft))) {
d(printf ("no selected folder?\n"));
@@ -397,32 +402,36 @@ em_folder_selector_get_selected_paths (EMFolderSelector *emfs)
const char *
em_folder_selector_get_selected_path (EMFolderSelector *emfs)
{
- const char *path;
+ char *uri, *path;
if (emfs->selected_path) {
/* already did the work in a previous call */
return emfs->selected_path;
}
- if (!em_folder_tree_get_selected_uri(emfs->emft)) {
+ if ((uri = em_folder_tree_get_selected_uri(emfs->emft)) == NULL) {
d(printf ("no selected folder?\n"));
return NULL;
}
+ g_free(uri);
path = em_folder_tree_get_selected_path(emfs->emft);
- path = path?path:"";
if (emfs->name_entry) {
const char *name;
char *newpath;
name = gtk_entry_get_text (emfs->name_entry);
if (strcmp (path, "") != 0)
- newpath = g_strdup_printf ("%s/%s", path, name);
+ newpath = g_strdup_printf ("%s/%s", path?path:"", name);
else
newpath = g_strdup (name);
- path = emfs->selected_path = newpath;
+ g_free(path);
+ emfs->selected_path = newpath;
+ } else {
+ g_free(emfs->selected_path);
+ emfs->selected_path = path?path:g_strdup("");
}
-
- return path;
+
+ return emfs->selected_path;
}