Commit eec7aa25 authored by Andy Hertzfeld's avatar Andy Hertzfeld

first cut at the first-time preferences druid. It's still not hooked-up


	first cut at the first-time preferences druid.  It's still not
	hooked-up yet and it's appearance needs some work.
parent 1af470e9
2000-07-04 Andy Hertzfeld <andy@eazel.com>
First cut at the first-time preferences druid. It's still
not hooked-up yet, and it's appearance needs some work.
* libnautilus-extensions/nautilus-file-utilities.c,h:
(nautilus_user_main_directory_exists):
added routine to test if the user main directory has been created
* src/nautilus-application.c: (nautilus_application_startup):
if the user main directory hasn't been created yet, run the
first time druid instead of showing a Nautilus window.
* src/Makefile.am:
added new files: nautilus-first-time-druid.c and .h
* src/nautilus-first-time-druid.c,h: (druid_cancel),
(druid_finished), (set_up_background),
(user_level_selection_changed), (signup_selection_changed),
(set_up_user_level_page), (set_up_service_signup_page),
(nautilus_first_time_druid_show):
new, first-time druid asks for user level and service signup.
2000-07-04 J Shane Culpepper <pepper@eazel.com>
*
......
......@@ -203,6 +203,27 @@ nautilus_get_desktop_directory (void)
return desktop_directory;
}
/**
* nautilus_user_main_directory_exists:
*
* returns true if the user directory exists. This must be called
* before nautilus_get_user_main_directory, which creates it if necessary
*
**/
gboolean
nautilus_user_main_directory_exists(void)
{
gboolean directory_exists;
char *main_directory;
main_directory = g_strdup_printf ("%s/%s",
g_get_home_dir(),
NAUTILUS_USER_MAIN_DIRECTORY_NAME);
directory_exists = g_file_exists(main_directory);
g_free(main_directory);
return directory_exists;
}
/**
* nautilus_get_user_main_directory:
*
......
......@@ -47,6 +47,10 @@ const char * nautilus_get_user_main_directory (void);
const char * nautilus_get_desktop_directory (void);
const char * nautilus_get_pixmap_directory (void);
/* see if the user_main_directory exists. This must be called before
"nautilus_get_user_main_directory", which creates it */
gboolean nautilus_user_main_directory_exists (void);
/* Turn a "file://" URI into a local path.
* Returns NULL if it's not a URI that can be converted.
*/
......
......@@ -203,6 +203,27 @@ nautilus_get_desktop_directory (void)
return desktop_directory;
}
/**
* nautilus_user_main_directory_exists:
*
* returns true if the user directory exists. This must be called
* before nautilus_get_user_main_directory, which creates it if necessary
*
**/
gboolean
nautilus_user_main_directory_exists(void)
{
gboolean directory_exists;
char *main_directory;
main_directory = g_strdup_printf ("%s/%s",
g_get_home_dir(),
NAUTILUS_USER_MAIN_DIRECTORY_NAME);
directory_exists = g_file_exists(main_directory);
g_free(main_directory);
return directory_exists;
}
/**
* nautilus_get_user_main_directory:
*
......
......@@ -47,6 +47,10 @@ const char * nautilus_get_user_main_directory (void);
const char * nautilus_get_desktop_directory (void);
const char * nautilus_get_pixmap_directory (void);
/* see if the user_main_directory exists. This must be called before
"nautilus_get_user_main_directory", which creates it */
gboolean nautilus_user_main_directory_exists (void);
/* Turn a "file://" URI into a local path.
* Returns NULL if it's not a URI that can be converted.
*/
......
......@@ -38,11 +38,12 @@ LDADD =\
$(NULL)
noinst_HEADERS = \
nautilus-application.h \
nautilus-applicable-views.h \
nautilus-bookmark-list.h \
nautilus-bookmarks-window.h \
nautilus-desktop-window.h \
nautilus-sidebar-tabs.h \
nautilus-sidebar-title.h \
nautilus-first-time-druid.h \
nautilus-link-set-window.h \
nautilus-location-bar.h \
nautilus-search-bar.h \
......@@ -55,10 +56,10 @@ noinst_HEADERS = \
nautilus-self-check-functions.h \
nautilus-signaller.h \
nautilus-zoom-control.h \
nautilus-application.h \
nautilus-switchable-navigation-bar.h \
nautilus-sidebar.h \
nautilus-applicable-views.h \
nautilus-sidebar-tabs.h \
nautilus-sidebar-title.h \
nautilus-view-frame-private.h \
nautilus-view-frame.h \
nautilus-window-manage-views.h \
......@@ -70,8 +71,7 @@ nautilus_SOURCES =\
nautilus-bookmark-list.c \
nautilus-bookmarks-window.c \
nautilus-desktop-window.c \
nautilus-sidebar-tabs.c \
nautilus-sidebar-title.c \
nautilus-first-time-druid.c \
nautilus-link-set-window.c \
nautilus-location-bar.c \
nautilus-search-bar.c \
......@@ -89,6 +89,8 @@ nautilus_SOURCES =\
nautilus-zoomable-frame-corba.c \
nautilus-application.c \
nautilus-sidebar.c \
nautilus-sidebar-tabs.c \
nautilus-sidebar-title.c \
nautilus-switchable-navigation-bar.c \
nautilus-main.c \
nautilus-applicable-views.c \
......
......@@ -37,12 +37,10 @@
#include <libnautilus-extensions/nautilus-string-list.h>
#include <libnautilus-extensions/nautilus-undo-manager.h>
#include <liboaf/liboaf.h>
#include "nautilus-desktop-window.h"
#include "nautilus-first-time-druid.h"
#include <widgets/nautilus-druid/nautilus-druid.h>
#include <widgets/nautilus-druid/nautilus-druid-page-start.h>
#include <widgets/nautilus-druid/nautilus-druid-page-standard.h>
#include <widgets/nautilus-druid/nautilus-druid-page-finish.h>
#include <libnautilus-extensions/nautilus-icon-factory.h>
static CORBA_boolean manufactures (PortableServer_Servant servant,
......@@ -219,73 +217,6 @@ display_caveat (GtkWindow *parent_window)
gtk_widget_show (GTK_WIDGET (dialog));
}
#if 0
static void
display_installation_wizard (GtkWindow *parent_window)
{
GtkWidget *dialog;
GtkWidget *druid;
GtkWidget *start_page;
GtkWidget *finish_page;
GtkWidget *pages[3];
GdkPixbuf *logo;
dialog = gnome_dialog_new (_("Nautilus: Installation Wizard"),
NULL);
gtk_container_set_border_width (GTK_CONTAINER (dialog), GNOME_PAD);
gtk_window_set_policy (GTK_WINDOW (dialog), FALSE, FALSE, FALSE);
logo = gdk_pixbuf_new_from_file ("/gnome/share/pixmaps/nautilus.png");
g_assert (logo != NULL);
druid = nautilus_druid_new ();
start_page = nautilus_druid_page_start_new ();
finish_page = nautilus_druid_page_finish_new ();
pages[0] = nautilus_druid_page_standard_new ();
pages[1] = nautilus_druid_page_standard_new ();
pages[2] = nautilus_druid_page_standard_new ();
nautilus_druid_page_start_set_title (NAUTILUS_DRUID_PAGE_START (start_page), "Start");
nautilus_druid_page_finish_set_title (NAUTILUS_DRUID_PAGE_FINISH (finish_page), "Finish");
nautilus_druid_page_standard_set_title (NAUTILUS_DRUID_PAGE_STANDARD (pages[0]), "Step One");
nautilus_druid_page_standard_set_title (NAUTILUS_DRUID_PAGE_STANDARD (pages[1]), "Step Two");
nautilus_druid_page_standard_set_title (NAUTILUS_DRUID_PAGE_STANDARD (pages[2]), "Step Three");
nautilus_druid_append_page (NAUTILUS_DRUID (druid), NAUTILUS_DRUID_PAGE (start_page));
nautilus_druid_append_page (NAUTILUS_DRUID (druid), NAUTILUS_DRUID_PAGE (pages[0]));
nautilus_druid_append_page (NAUTILUS_DRUID (druid), NAUTILUS_DRUID_PAGE (pages[1]));
nautilus_druid_append_page (NAUTILUS_DRUID (druid), NAUTILUS_DRUID_PAGE (pages[2]));
nautilus_druid_append_page (NAUTILUS_DRUID (druid), NAUTILUS_DRUID_PAGE (finish_page));
nautilus_druid_page_start_set_logo (NAUTILUS_DRUID_PAGE_START (start_page), logo);
nautilus_druid_page_finish_set_logo (NAUTILUS_DRUID_PAGE_FINISH (finish_page), logo);
nautilus_druid_page_standard_set_logo (NAUTILUS_DRUID_PAGE_STANDARD (pages[0]), logo);
nautilus_druid_page_standard_set_logo (NAUTILUS_DRUID_PAGE_STANDARD (pages[1]), logo);
nautilus_druid_page_standard_set_logo (NAUTILUS_DRUID_PAGE_STANDARD (pages[2]), logo);
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox),
druid,
TRUE,
TRUE,
0);
gtk_widget_show_all (druid);
gtk_widget_set_usize (druid, 400, 200);
gtk_widget_show (GTK_WIDGET (dialog));
}
#endif
static void
nautilus_application_check_user_directories (NautilusApplication *application)
{
......@@ -350,6 +281,14 @@ nautilus_application_startup (NautilusApplication *application,
NautilusWindow *window;
NautilusWindow *first_window;
/* check if this is the first time running the program by seeing
if the user_main_directory exists; if not, run the first time druid
instead of launching the application */
if (!nautilus_user_main_directory_exists()) {
nautilus_first_time_druid_show(application, manage_desktop, urls);
return;
}
/* Try to register the file manager view factory with OAF. */
result = oaf_active_server_register
("OAFIID:nautilus_file_manager_factory:bd1e1862-92d7-4391-963e-37583f0daef3",
......@@ -456,17 +395,6 @@ nautilus_application_startup (NautilusApplication *application,
display_caveat, first_window);
}
}
#if 0
if (first_window == NULL) {
display_installation_wizard (NULL);
} else {
gtk_signal_connect (GTK_OBJECT (first_window),
"show",
display_installation_wizard,
first_window);
}
#endif
}
static void
......
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
nautilus-first-time-druid.c:
Copyright (C) 2000 Eazel, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public
License along with this program; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Author: Andy Hertzfeld <andy@eazel.com>
*/
#include <config.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <gnome.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <widgets/nautilus-druid/nautilus-druid.h>
#include <widgets/nautilus-druid/nautilus-druid-page-start.h>
#include <widgets/nautilus-druid/nautilus-druid-page-standard.h>
#include <widgets/nautilus-druid/nautilus-druid-page-finish.h>
#include <libnautilus-extensions/nautilus-background.h>
#include <libnautilus-extensions/nautilus-file-utilities.h>
#include <libnautilus-extensions/nautilus-gdk-pixbuf-extensions.h>
#include <libnautilus-extensions/nautilus-radio-button-group.h>
#include "nautilus-first-time-druid.h"
static NautilusApplication *save_application;
static gboolean save_manage_desktop;
static int last_user_level;
static int last_signup_choice;
static void
druid_cancel (GtkWidget *druid)
{
gtk_widget_destroy(gtk_widget_get_toplevel(druid));
_exit (0);
}
/* handle the final page finishing */
static void
druid_finished (GtkWidget *druid_page)
{
gtk_widget_destroy(gtk_widget_get_toplevel(druid_page));
nautilus_get_user_main_directory();
nautilus_application_startup(save_application, save_manage_desktop, NULL);
}
/* set up an event box to serve as the background */
static GtkWidget*
set_up_background (NautilusDruidPageStandard *page, const char *background_color)
{
GtkWidget *event_box;
NautilusBackground *background;
event_box = gtk_event_box_new();
gtk_container_add (GTK_CONTAINER (page->vbox), event_box);
background = nautilus_get_widget_background (event_box);
nautilus_background_set_color (background, background_color);
gtk_widget_show (event_box);
return event_box;
}
/* handler for user level buttons changing */
static void
user_level_selection_changed (GtkWidget *radio_buttons, gpointer user_data)
{
last_user_level = nautilus_radio_button_group_get_active_index (NAUTILUS_RADIO_BUTTON_GROUP (radio_buttons));
}
/* handler for signup buttons changing */
static void
signup_selection_changed (GtkWidget *radio_buttons, gpointer user_data)
{
last_signup_choice = nautilus_radio_button_group_get_active_index (NAUTILUS_RADIO_BUTTON_GROUP (radio_buttons));
}
/* set up the user level page */
static void
set_up_user_level_page (NautilusDruidPageStandard *page)
{
GtkWidget *radio_buttons, *frame, *label;
GtkWidget *container, *main_box;
container = set_up_background (page, "rgb:bbbb/bbbb/eeee-rgb:ffff/ffff/ffff:h");
/* allocate a vbox to hold the description and the widgets */
main_box = gtk_vbox_new (FALSE, 0);
gtk_widget_show (main_box);
gtk_container_add (GTK_CONTAINER (container), main_box);
/* allocate a descriptive label */
label = gtk_label_new (_("User levels provide a way to adjust the software to your level of technical expertise. Pick an initial level that you feel comfortable with; you can always change it later."));
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (main_box), label, FALSE, FALSE, 8);
frame = gtk_frame_new (_("User Levels"));
gtk_widget_show (frame);
gtk_container_set_border_width (GTK_CONTAINER (frame), 8);
radio_buttons = nautilus_radio_button_group_new ();
gtk_container_add (GTK_CONTAINER (frame),
radio_buttons);
nautilus_radio_button_group_insert (NAUTILUS_RADIO_BUTTON_GROUP (radio_buttons), _("Novice - for beginning users"));
nautilus_radio_button_group_insert (NAUTILUS_RADIO_BUTTON_GROUP (radio_buttons), _("Intermediate - for non-technical users"));
nautilus_radio_button_group_insert (NAUTILUS_RADIO_BUTTON_GROUP (radio_buttons), _("Hacker - for expert users"));
gtk_signal_connect (GTK_OBJECT (radio_buttons),
"changed",
GTK_SIGNAL_FUNC (user_level_selection_changed),
(gpointer) NULL);
gtk_box_pack_start (GTK_BOX (main_box), frame, FALSE, FALSE, 2);
gtk_widget_show (radio_buttons);
}
/* set up the user level page */
static void
set_up_service_signup_page (NautilusDruidPageStandard *page)
{
GtkWidget *radio_buttons, *frame, *label;
GtkWidget *container, *main_box;
container = set_up_background (page, "rgb:bbbb/bbbb/eeee-rgb:ffff/ffff/ffff:h");
/* allocate a vbox to hold the description and the widgets */
main_box = gtk_vbox_new (FALSE, 0);
gtk_widget_show (main_box);
gtk_container_add (GTK_CONTAINER (container), main_box);
/* allocate a descriptive label */
label = gtk_label_new (_("Eazel offers a number of services to help you manage your system and files, some of them free of charge. Click the sign-up button below to find out more about signing up. "));
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (main_box), label, FALSE, FALSE, 8);
frame = gtk_frame_new (_("Eazel Service Sign-up"));
gtk_widget_show (frame);
gtk_container_set_border_width (GTK_CONTAINER (frame), 8);
radio_buttons = nautilus_radio_button_group_new ();
gtk_container_add (GTK_CONTAINER (frame),
radio_buttons);
nautilus_radio_button_group_insert (NAUTILUS_RADIO_BUTTON_GROUP (radio_buttons), _("I want to sign up for Eazel services"));
nautilus_radio_button_group_insert (NAUTILUS_RADIO_BUTTON_GROUP (radio_buttons), _("I don't want to sign up at this time"));
gtk_signal_connect (GTK_OBJECT (radio_buttons),
"changed",
GTK_SIGNAL_FUNC (signup_selection_changed),
(gpointer) NULL);
gtk_box_pack_start (GTK_BOX (main_box), frame, FALSE, FALSE, 2);
gtk_widget_show (radio_buttons);
}
/* create the initial preferences druid */
GtkWidget *nautilus_first_time_druid_show (NautilusApplication *application, gboolean manage_desktop, const char *urls[])
{
char *logo_path;
GtkWidget *dialog;
GtkWidget *druid;
GtkWidget *start_page;
GtkWidget *finish_page;
GtkWidget *pages[2];
GdkPixbuf *logo;
/* remember parameters for later window invocation */
save_application = application;
save_manage_desktop = manage_desktop;
dialog = gnome_dialog_new (_("Nautilus: Initial Preferences"),
NULL);
gtk_container_set_border_width (GTK_CONTAINER (dialog), GNOME_PAD);
gtk_window_set_policy (GTK_WINDOW (dialog), FALSE, FALSE, FALSE);
druid = nautilus_druid_new ();
start_page = nautilus_druid_page_start_new ();
finish_page = nautilus_druid_page_finish_new ();
pages[0] = nautilus_druid_page_standard_new ();
pages[1] = nautilus_druid_page_standard_new ();
/* set up the initial page */
nautilus_druid_page_start_set_title (NAUTILUS_DRUID_PAGE_START (start_page), _("Welcome to Nautilus!"));
nautilus_druid_page_start_set_text (NAUTILUS_DRUID_PAGE_START(start_page), _("Welcome to Nautilus!\n\nSince this is the first time that you've launched\nNautilus, we'd like to ask you a few questions\nto help personalize itfor your use.\n\nPress the next button to continue."));
/* set up the final page */
nautilus_druid_page_finish_set_title (NAUTILUS_DRUID_PAGE_FINISH (finish_page), _("Finished"));
nautilus_druid_page_finish_set_text (NAUTILUS_DRUID_PAGE_FINISH(finish_page), _("Click to finish button to launch Nautilus.\n\nWe hope that you enjoying using it!"));
/* set up the user level page */
nautilus_druid_page_standard_set_title (NAUTILUS_DRUID_PAGE_STANDARD (pages[0]), "Select A User Level");
set_up_user_level_page(NAUTILUS_DRUID_PAGE_STANDARD (pages[0]));
/* set up the service sign-up page */
nautilus_druid_page_standard_set_title (NAUTILUS_DRUID_PAGE_STANDARD (pages[1]), "Sign Up for Eazel Services");
set_up_service_signup_page(NAUTILUS_DRUID_PAGE_STANDARD (pages[1]));
/* append all of the pages to the druid */
nautilus_druid_append_page (NAUTILUS_DRUID (druid), NAUTILUS_DRUID_PAGE (start_page));
nautilus_druid_append_page (NAUTILUS_DRUID (druid), NAUTILUS_DRUID_PAGE (pages[0]));
nautilus_druid_append_page (NAUTILUS_DRUID (druid), NAUTILUS_DRUID_PAGE (pages[1]));
nautilus_druid_append_page (NAUTILUS_DRUID (druid), NAUTILUS_DRUID_PAGE (finish_page));
/* set up the logo images */
logo_path = nautilus_pixmap_file ("nautilus-logo.png");
logo = gdk_pixbuf_new_from_file (logo_path);
g_assert (logo != NULL);
g_free (logo_path);
/*
nautilus_druid_page_start_set_logo (NAUTILUS_DRUID_PAGE_START (start_page), logo);
nautilus_druid_page_finish_set_logo (NAUTILUS_DRUID_PAGE_FINISH (finish_page), logo);
nautilus_druid_page_standard_set_logo (NAUTILUS_DRUID_PAGE_STANDARD (pages[0]), logo);
nautilus_druid_page_standard_set_logo (NAUTILUS_DRUID_PAGE_STANDARD (pages[1]), logo);
*/
gdk_pixbuf_unref (logo);
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox),
druid,
TRUE,
TRUE,
0);
/* set up the signals */
gtk_signal_connect (GTK_OBJECT (druid), "cancel",
GTK_SIGNAL_FUNC (druid_cancel),
NULL);
gtk_signal_connect (GTK_OBJECT (finish_page), "finish",
GTK_SIGNAL_FUNC (druid_finished),
NULL);
gtk_widget_show_all (druid);
gtk_widget_set_usize (druid, 400, 320);
gtk_widget_show (GTK_WIDGET (dialog));
return druid;
}
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
nautilus-first-time-druid.h: definition file for the first time druid
Copyright (C) 2000 Eazel, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public
License along with this program; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Authors: Andy Hertzfeld <andy@eazel.com>
*/
#ifndef NAUTILUS_FIRST_TIME_DRUID_H
#define NAUTILUS_FIRST_TIME_DRUID_H
#include <glib.h>
#include <gtk/gtkwidget.h>
#include "nautilus-application.h"
GtkWidget *nautilus_first_time_druid_show (NautilusApplication *application,
gboolean manage_desktop,
const char *urls[]);
#endif /* NAUTILUS_FIRST_TIME_DRUID_H */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment