aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIain Holmes <iain@helixcode.com>2000-10-16 00:52:48 +0800
committerIain Holmes <iain@src.gnome.org>2000-10-16 00:52:48 +0800
commitbb04032cc84ec70c1b998901d5fe99eab97ec380 (patch)
treee7988acec8e3df5f830ff084a128aece7d426928
parent0a74c490105736f8d162fe1410079c36f12a8043 (diff)
downloadgsoc2013-evolution-bb04032cc84ec70c1b998901d5fe99eab97ec380.tar
gsoc2013-evolution-bb04032cc84ec70c1b998901d5fe99eab97ec380.tar.gz
gsoc2013-evolution-bb04032cc84ec70c1b998901d5fe99eab97ec380.tar.bz2
gsoc2013-evolution-bb04032cc84ec70c1b998901d5fe99eab97ec380.tar.lz
gsoc2013-evolution-bb04032cc84ec70c1b998901d5fe99eab97ec380.tar.xz
gsoc2013-evolution-bb04032cc84ec70c1b998901d5fe99eab97ec380.tar.zst
gsoc2013-evolution-bb04032cc84ec70c1b998901d5fe99eab97ec380.zip
Check if there are any files in default_user that are not in ~/evolution
2000-10-11 Iain Holmes <iain@helixcode.com> * e-setup.c (check_evolution_directory): Check if there are any files in default_user that are not in ~/evolution and if so copy them over. (check_dir_recur): Recursive function to check the directory. * e-shell-view-menu.c: Look Maw! I'm an Evolution hacker too. * e-shell-view.c: Don't quit on when a view is destroyed. * e-shell.c: Save the settings for the remaining views whenever a view is destroyed. svn path=/trunk/; revision=5929
-rw-r--r--shell/ChangeLog14
-rw-r--r--shell/e-setup.c145
-rw-r--r--shell/e-shell-view-menu.c1
-rw-r--r--shell/e-shell-view.c4
-rw-r--r--shell/e-shell.c1
5 files changed, 162 insertions, 3 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index f5d6979cac..65f61b4097 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,17 @@
+2000-10-11 Iain Holmes <iain@helixcode.com>
+
+ * e-setup.c (check_evolution_directory): Check if there are any
+ files in default_user that are not in ~/evolution and if so
+ copy them over.
+ (check_dir_recur): Recursive function to check the directory.
+
+ * e-shell-view-menu.c: Look Maw! I'm an Evolution hacker too.
+
+ * e-shell-view.c: Don't quit on when a view is destroyed.
+
+ * e-shell.c: Save the settings for the remaining views whenever
+ a view is destroyed.
+
2000-10-15 Ettore Perazzoli <ettore@helixcode.com>
* e-shell-view.c (setup_storage_set_subwindow): Use an
diff --git a/shell/e-setup.c b/shell/e-setup.c
index 3393247f35..bdbb227abe 100644
--- a/shell/e-setup.c
+++ b/shell/e-setup.c
@@ -27,12 +27,153 @@
#include <errno.h>
#include <sys/stat.h>
+#include <sys/types.h>
+#include <dirent.h>
#include "e-util/e-gui-utils.h"
#include "e-setup.h"
+static GList *
+check_dir_recur (const char *evolution_directory,
+ const char *current_directory)
+{
+ DIR *def;
+ GList *newfiles = NULL;
+ struct dirent *current;
+
+ def = opendir (current_directory);
+ if (def == NULL)
+ return NULL;
+
+ current = readdir (def);
+ while (current != NULL) {
+ struct stat buf;
+ char *fullname, *fulldefaultname;
+
+ fullname = g_concat_dir_and_file (evolution_directory,
+ current->d_name);
+ fulldefaultname = g_concat_dir_and_file (current_directory,
+ current->d_name);
+
+ if (current->d_name[0] == '.' &&
+ (current->d_name[1] == '\0' ||
+ (current->d_name[1] == '.' && current->d_name[2] == '\0'))) {
+ current = readdir (def);
+ continue;
+ }
+
+ if (stat (fullname, &buf) == -1) {
+ char *name;
+
+ name = g_strdup (fulldefaultname);
+ newfiles = g_list_append (newfiles, name);
+ } else {
+ if (S_ISDIR (buf.st_mode)) {
+ newfiles = g_list_concat (newfiles,
+ check_dir_recur (fullname,
+ fulldefaultname));
+ }
+ }
+
+ g_free (fulldefaultname);
+ g_free (fullname);
+ current = readdir (def);
+ }
+
+ closedir (def);
+ return newfiles;
+}
+
+static gboolean
+check_evolution_directory (const char *evolution_directory)
+{
+ GtkWidget *dialog;
+ GtkWidget *scroller, *clist;
+ GtkWidget *label;
+ gboolean retval;
+ GList *newfiles, *l;
+ char *defaultdir;
+ int result;
+
+ defaultdir = g_strdup (EVOLUTION_DATADIR "/evolution/default_user");
+ newfiles = g_list_concat (NULL, check_dir_recur (evolution_directory,
+ defaultdir));
+
+ if (newfiles == NULL)
+ return TRUE;
+
+ dialog = gnome_dialog_new (_("Evolution Installation"),
+ GNOME_STOCK_BUTTON_OK,
+ GNOME_STOCK_BUTTON_CANCEL,
+ NULL);
+ label = gtk_label_new (_("Since Evolution was installed,"
+ "\nthe following files need to be updated"));
+ gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), label,
+ TRUE, TRUE, 0);
+ scroller = gtk_scrolled_window_new (NULL, NULL);
+ clist = gtk_clist_new (1);
+ gtk_clist_column_titles_hide (GTK_CLIST (clist));
+
+ for (l = newfiles; l; l = l->next) {
+ char *row[1];
+
+ row[0] = l->data;
+ gtk_clist_append (GTK_CLIST (clist), row);
+ }
+
+ gtk_container_add (GTK_CONTAINER (scroller), clist);
+ gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), scroller,
+ TRUE, TRUE, 0);
+
+ gtk_widget_show (label);
+ gtk_widget_show_all (scroller);
+ result = gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
+
+ if (result != 0)
+ return FALSE;
+
+ retval = TRUE;
+ for (l = newfiles; l; l = l->next) {
+ char *command;
+ char *shortpath;
+
+ shortpath = l->data + strlen (EVOLUTION_DATADIR "/evolution/default_user/");
+ command = g_strconcat ("cp -r ",
+ l->data, " ",
+ evolution_directory, "/",
+ shortpath,
+ NULL);
+
+ if (system (command) != 0) {
+ retval = FALSE;
+ } else {
+ retval = (retval && TRUE);
+ }
+
+ g_free (command);
+
+ g_free (l->data);
+ }
+
+ g_list_free (newfiles);
+ g_free (defaultdir);
+
+ if (retval == FALSE) {
+ e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
+ _("Could not update files correctly"));
+ return FALSE;
+ } else {
+ e_notice (NULL, GNOME_MESSAGE_BOX_INFO,
+ _("Evolution files successfully installed."));
+ return TRUE;
+ }
+
+ return TRUE;
+}
+
+
static gboolean
copy_default_stuff (const char *evolution_directory)
{
@@ -140,5 +281,7 @@ e_setup (const char *evolution_directory)
}
g_free (file);
- return TRUE;
+ /* User has evolution directory...
+ Check if it is up to date. */
+ return check_evolution_directory (evolution_directory);
}
diff --git a/shell/e-shell-view-menu.c b/shell/e-shell-view-menu.c
index e551e8ce3f..71ef8f30d1 100644
--- a/shell/e-shell-view-menu.c
+++ b/shell/e-shell-view-menu.c
@@ -148,6 +148,7 @@ command_about_box (BonoboUIHandler *uih,
"Larry Ewing",
"Nat Friedman",
"Bertrand Guiheneuf",
+ "Iain Holmes",
"Tuomas Kuosmanen",
"Christopher J. Lahey",
"Matthew Loper",
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index 7d0092203a..b9c34f7abb 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -602,10 +602,10 @@ delete_event (GtkWidget *widget,
EShell *shell;
shell = e_shell_view_get_shell (E_SHELL_VIEW (widget));
- e_shell_quit (shell);
+/* e_shell_quit (shell); */
/* FIXME: Is this right, or should it be FALSE? */
- return TRUE;
+ return FALSE;
}
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 08581c9ea4..71405b89ed 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -474,6 +474,7 @@ view_destroy_cb (GtkObject *object,
shell->priv->views = g_list_remove (
shell->priv->views, object);
+ save_settings_for_views (shell);
if (shell->priv->views == NULL) {
/* FIXME: This looks like a Bonobo bug to me. */
bonobo_object_ref (BONOBO_OBJECT (shell));