mirror of https://github.com/GNOME/gimp.git
app/core/gimp-user-install.[ch] always migrate old user settings during
2006-06-05 Sven Neumann <sven@gimp.org> * app/core/gimp-user-install.[ch] * app/app_procs.c: always migrate old user settings during user installation. * app/dialogs/user-install-dialog.[ch]: don't ask questions and only show the dialog in case of an error.
This commit is contained in:
parent
84bac48c7c
commit
ded0516187
|
@ -1,3 +1,12 @@
|
|||
2006-06-05 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/core/gimp-user-install.[ch]
|
||||
* app/app_procs.c: always migrate old user settings during user
|
||||
installation.
|
||||
|
||||
* app/dialogs/user-install-dialog.[ch]: don't ask questions and
|
||||
only show the dialog in case of an error.
|
||||
|
||||
2006-06-05 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/tools/gimprectangletool.c: formatting.
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <glib-object.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
#include "libgimpconfig/gimpconfig.h"
|
||||
|
||||
#include "core/core-types.h"
|
||||
|
||||
|
@ -163,6 +164,7 @@ app_run (const gchar *full_prog_name,
|
|||
{
|
||||
GimpInitStatusFunc update_status_func = NULL;
|
||||
Gimp *gimp;
|
||||
GimpBaseConfig *config;
|
||||
GMainLoop *loop;
|
||||
gboolean swap_is_ok;
|
||||
gint i;
|
||||
|
@ -223,17 +225,12 @@ app_run (const gchar *full_prog_name,
|
|||
GimpUserInstall *install = gimp_user_install_new (be_verbose);
|
||||
|
||||
#ifdef GIMP_CONSOLE_COMPILATION
|
||||
gimp_user_install_run (install, FALSE);
|
||||
gimp_user_install_run (install);
|
||||
#else
|
||||
if (no_interface)
|
||||
{
|
||||
if (! gimp_user_install_run (install, FALSE))
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
else
|
||||
{
|
||||
user_install_dialog_run (install);
|
||||
}
|
||||
if (! (no_interface ?
|
||||
gimp_user_install_run (install) :
|
||||
user_install_dialog_run (install)))
|
||||
exit (EXIT_FAILURE);
|
||||
#endif
|
||||
|
||||
gimp_user_install_free (install);
|
||||
|
@ -251,9 +248,10 @@ app_run (const gchar *full_prog_name,
|
|||
|
||||
gimp_load_config (gimp, alternate_system_gimprc, alternate_gimprc);
|
||||
|
||||
config = GIMP_BASE_CONFIG (gimp->config);
|
||||
|
||||
/* initialize lowlevel stuff */
|
||||
swap_is_ok = base_init (GIMP_BASE_CONFIG (gimp->config),
|
||||
be_verbose, use_cpu_accel);
|
||||
swap_is_ok = base_init (config, be_verbose, use_cpu_accel);
|
||||
|
||||
#ifndef GIMP_CONSOLE_COMPILATION
|
||||
if (! no_interface)
|
||||
|
@ -274,11 +272,16 @@ app_run (const gchar *full_prog_name,
|
|||
|
||||
/* display a warning when no test swap file could be generated */
|
||||
if (! swap_is_ok)
|
||||
g_message (_("Unable to open a test swap file.\n\n"
|
||||
"To avoid data loss, please check the location "
|
||||
"and permissions of the swap directory defined in "
|
||||
"your Preferences (currently \"%s\")."),
|
||||
GIMP_BASE_CONFIG (gimp->config)->swap_path);
|
||||
{
|
||||
gchar *path = gimp_config_path_expand (config->swap_path, FALSE, NULL);
|
||||
|
||||
g_message (_("Unable to open a test swap file.\n\n"
|
||||
"To avoid data loss, please check the location "
|
||||
"and permissions of the swap directory defined in "
|
||||
"your Preferences (currently \"%s\")."), path);
|
||||
|
||||
g_free (path);
|
||||
}
|
||||
|
||||
/* enable autosave late so we don't autosave when the
|
||||
* monitor resolution is set in gui_init()
|
||||
|
|
|
@ -105,6 +105,7 @@ gimp_user_install_items[] =
|
|||
static void user_install_log (GimpUserInstall *install,
|
||||
const gchar *format,
|
||||
...) G_GNUC_PRINTF (2, 3);
|
||||
static void user_install_log_newline (GimpUserInstall *install);
|
||||
static void user_install_log_error (GimpUserInstall *install,
|
||||
GError **error);
|
||||
|
||||
|
@ -179,15 +180,34 @@ gimp_user_install_new (gboolean verbose)
|
|||
}
|
||||
|
||||
gboolean
|
||||
gimp_user_install_run (GimpUserInstall *install,
|
||||
gboolean migrate)
|
||||
gimp_user_install_run (GimpUserInstall *install)
|
||||
{
|
||||
gchar *dirname;
|
||||
|
||||
g_return_val_if_fail (install != NULL, FALSE);
|
||||
|
||||
dirname = g_filename_display_name (gimp_directory ());
|
||||
|
||||
if (install->migrate)
|
||||
user_install_log (install,
|
||||
_("It seems you have used GIMP %s before. "
|
||||
"GIMP will now migrate your user settings to '%s'."),
|
||||
install->migrate, dirname);
|
||||
else
|
||||
user_install_log (install,
|
||||
_("It appears that you are using GIMP for the "
|
||||
"first time. GIMP will now create a folder "
|
||||
"named '%s' and copy some files to it."),
|
||||
dirname);
|
||||
|
||||
g_free (dirname);
|
||||
|
||||
user_install_log_newline (install);
|
||||
|
||||
if (! user_install_mkdir (install, gimp_directory ()))
|
||||
return FALSE;
|
||||
|
||||
if (migrate && install->migrate)
|
||||
if (install->migrate)
|
||||
return user_install_migrate_files (install);
|
||||
else
|
||||
return user_install_create_files (install);
|
||||
|
@ -202,23 +222,6 @@ gimp_user_install_free (GimpUserInstall *install)
|
|||
g_free (install);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_user_install_is_migration (GimpUserInstall *install,
|
||||
gchar **version)
|
||||
{
|
||||
g_return_val_if_fail (install != NULL, FALSE);
|
||||
|
||||
if (install->migrate)
|
||||
{
|
||||
if (version)
|
||||
*version = g_strdup (install->migrate);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_user_install_set_log_handler (GimpUserInstall *install,
|
||||
GimpUserInstallLogFunc log,
|
||||
|
@ -233,7 +236,6 @@ gimp_user_install_set_log_handler (GimpUserInstall *install,
|
|||
|
||||
/* Local functions */
|
||||
|
||||
|
||||
static void
|
||||
user_install_log (GimpUserInstall *install,
|
||||
const gchar *format,
|
||||
|
@ -259,6 +261,16 @@ user_install_log (GimpUserInstall *install,
|
|||
va_end (args);
|
||||
}
|
||||
|
||||
static void
|
||||
user_install_log_newline (GimpUserInstall *install)
|
||||
{
|
||||
if (install->verbose)
|
||||
g_print ("\n");
|
||||
|
||||
if (install->log)
|
||||
install->log (NULL, FALSE, install->log_data);
|
||||
}
|
||||
|
||||
static void
|
||||
user_install_log_error (GimpUserInstall *install,
|
||||
GError **error)
|
||||
|
@ -278,9 +290,9 @@ user_install_log_error (GimpUserInstall *install,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
user_install_file_copy (GimpUserInstall *install,
|
||||
const gchar *source,
|
||||
const gchar *dest)
|
||||
user_install_file_copy (GimpUserInstall *install,
|
||||
const gchar *source,
|
||||
const gchar *dest)
|
||||
{
|
||||
GError *error = NULL;
|
||||
gboolean success;
|
||||
|
@ -337,6 +349,7 @@ user_install_dir_copy (GimpUserInstall *install,
|
|||
|
||||
{
|
||||
gchar *basename = g_path_get_basename (source);
|
||||
|
||||
dirname = g_build_filename (base, basename, NULL);
|
||||
g_free (basename);
|
||||
}
|
||||
|
|
|
@ -28,13 +28,9 @@ typedef void (* GimpUserInstallLogFunc) (const gchar *message,
|
|||
|
||||
|
||||
GimpUserInstall * gimp_user_install_new (gboolean verbose);
|
||||
gboolean gimp_user_install_run (GimpUserInstall *install,
|
||||
gboolean migrate);
|
||||
gboolean gimp_user_install_run (GimpUserInstall *install);
|
||||
void gimp_user_install_free (GimpUserInstall *install);
|
||||
|
||||
gboolean gimp_user_install_is_migration (GimpUserInstall *install,
|
||||
gchar **version);
|
||||
|
||||
void gimp_user_install_set_log_handler (GimpUserInstall *install,
|
||||
GimpUserInstallLogFunc log,
|
||||
gpointer user_data);
|
||||
|
|
|
@ -21,238 +21,112 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "dialogs-types.h"
|
||||
|
||||
#include "core/gimp-user-install.h"
|
||||
|
||||
#include "widgets/gimpmessagebox.h"
|
||||
#include "widgets/gimpmessagedialog.h"
|
||||
|
||||
#include "user-install-dialog.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
enum
|
||||
static GtkWidget * user_install_dialog_new (GimpUserInstall *install);
|
||||
static void user_install_dialog_log (const gchar *message,
|
||||
gboolean error,
|
||||
gpointer data);
|
||||
|
||||
|
||||
gboolean
|
||||
user_install_dialog_run (GimpUserInstall *install)
|
||||
{
|
||||
WELCOME_PAGE,
|
||||
INSTALLATION_PAGE
|
||||
};
|
||||
GtkWidget *dialog;
|
||||
gboolean success;
|
||||
|
||||
g_return_val_if_fail (install != NULL, FALSE);
|
||||
|
||||
static gboolean migrate;
|
||||
dialog = user_install_dialog_new (install);
|
||||
|
||||
success = gimp_user_install_run (install);
|
||||
|
||||
static void
|
||||
user_install_dialog_set_title (GtkWidget *dialog,
|
||||
const gchar *title)
|
||||
{
|
||||
GtkLabel *label = g_object_get_data (G_OBJECT (dialog), "title-label");
|
||||
|
||||
gtk_label_set_text (label, title);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
user_install_dialog_set_page (GtkWidget *dialog,
|
||||
gint index)
|
||||
{
|
||||
GtkNotebook *notebook = g_object_get_data (G_OBJECT (dialog), "notebook");
|
||||
GtkWidget *page = gtk_notebook_get_nth_page (notebook, index);
|
||||
|
||||
user_install_dialog_set_title (dialog,
|
||||
gtk_notebook_get_menu_label_text (notebook,
|
||||
page));
|
||||
|
||||
gtk_notebook_set_current_page (notebook, index);
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
static void
|
||||
user_install_dialog_response (GtkWidget *dialog,
|
||||
gint response_id,
|
||||
GimpUserInstall *install)
|
||||
{
|
||||
GtkWidget *notebook = g_object_get_data (G_OBJECT (dialog), "notebook");
|
||||
gint index;
|
||||
|
||||
if (response_id != GTK_RESPONSE_OK)
|
||||
exit (EXIT_SUCCESS);
|
||||
|
||||
index = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook));
|
||||
|
||||
switch (index)
|
||||
if (! success)
|
||||
{
|
||||
case WELCOME_PAGE:
|
||||
{
|
||||
user_install_dialog_set_page (dialog, ++index);
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (gtk_main_quit),
|
||||
NULL);
|
||||
|
||||
/* Creating the directories can take some time on NFS, so inform
|
||||
* the user and set the buttons insensitive
|
||||
*/
|
||||
gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
|
||||
GTK_RESPONSE_CANCEL, FALSE);
|
||||
gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
|
||||
GTK_RESPONSE_OK, TRUE);
|
||||
gtk_widget_show (dialog);
|
||||
|
||||
if (gimp_user_install_run (install, migrate))
|
||||
{
|
||||
user_install_dialog_set_title (dialog,
|
||||
_("Installation successful!"));
|
||||
|
||||
gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
|
||||
GTK_RESPONSE_OK, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
user_install_dialog_set_title (dialog,
|
||||
_("Installation failed!"));
|
||||
}
|
||||
|
||||
gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
|
||||
GTK_RESPONSE_CANCEL, TRUE);
|
||||
}
|
||||
break;
|
||||
|
||||
case INSTALLATION_PAGE:
|
||||
gtk_widget_destroy (dialog);
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
gtk_main ();
|
||||
}
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
user_install_dialog_append_page (GtkWidget *dialog,
|
||||
const gchar *title)
|
||||
user_install_dialog_new (GimpUserInstall *install)
|
||||
{
|
||||
GtkWidget *notebook = g_object_get_data (G_OBJECT (dialog), "notebook");
|
||||
GtkWidget *page = gtk_vbox_new (FALSE, 12);
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *scrolled;
|
||||
GtkTextBuffer *buffer;
|
||||
GtkWidget *view;
|
||||
|
||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, NULL);
|
||||
gtk_widget_show (page);
|
||||
gimp_stock_init ();
|
||||
|
||||
gtk_notebook_set_menu_label_text (GTK_NOTEBOOK (notebook), page, title);
|
||||
dialog = gimp_message_dialog_new (_("GIMP User Installation"),
|
||||
GIMP_STOCK_WILBER_EEK,
|
||||
NULL, 0, NULL, NULL,
|
||||
|
||||
return page;
|
||||
}
|
||||
GTK_STOCK_QUIT, GTK_RESPONSE_OK,
|
||||
|
||||
static GtkWidget *
|
||||
user_install_dialog_add_log (GtkWidget *dialog)
|
||||
{
|
||||
GtkWidget *scrolled_window;
|
||||
GtkTextBuffer *log_buffer;
|
||||
GtkWidget *log_view;
|
||||
NULL);
|
||||
|
||||
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||
gimp_message_box_set_primary_text (GIMP_MESSAGE_DIALOG (dialog)->box,
|
||||
_("User installation failed!"));
|
||||
gimp_message_box_set_text (GIMP_MESSAGE_DIALOG (dialog)->box,
|
||||
_("The GIMP user installation failed; "
|
||||
"see the log for details."));
|
||||
|
||||
frame = gimp_frame_new (_("Installation Log"));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (frame), 12);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), frame,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
scrolled = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_container_add (GTK_CONTAINER (frame), scrolled);
|
||||
gtk_widget_show (scrolled);
|
||||
|
||||
buffer = gtk_text_buffer_new (NULL);
|
||||
|
||||
log_buffer = gtk_text_buffer_new (NULL);
|
||||
|
||||
gtk_text_buffer_create_tag (log_buffer, "bold",
|
||||
gtk_text_buffer_create_tag (buffer, "bold",
|
||||
"weight", PANGO_WEIGHT_BOLD,
|
||||
NULL);
|
||||
|
||||
log_view = gtk_text_view_new_with_buffer (log_buffer);
|
||||
g_object_unref (log_buffer);
|
||||
view = gtk_text_view_new_with_buffer (buffer);
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD);
|
||||
gtk_widget_set_size_request (view, -1, 200);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled), view);
|
||||
gtk_widget_show (view);
|
||||
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (log_view), FALSE);
|
||||
g_object_unref (buffer);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_window), log_view);
|
||||
gtk_widget_show (log_view);
|
||||
gimp_user_install_set_log_handler (install, user_install_dialog_log, view);
|
||||
|
||||
g_object_set_data (G_OBJECT (dialog), "log-view", log_view);
|
||||
g_object_set_data (G_OBJECT (dialog), "log-buffer", log_buffer);
|
||||
|
||||
return scrolled_window;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
user_install_dialog_add_welcome_page (GtkWidget *dialog,
|
||||
GimpUserInstall *install)
|
||||
{
|
||||
GtkWidget *page;
|
||||
GtkWidget *widget;
|
||||
gchar *version;
|
||||
|
||||
page = user_install_dialog_append_page (dialog,
|
||||
_("Welcome to the GNU Image "
|
||||
"Manipulation Program"));
|
||||
|
||||
if (gimp_user_install_is_migration (install, &version))
|
||||
{
|
||||
gchar *title;
|
||||
|
||||
title = g_strdup_printf (_("It seems you have used GIMP %s before."),
|
||||
version);
|
||||
g_free (version);
|
||||
|
||||
migrate = TRUE;
|
||||
|
||||
widget = gimp_int_radio_group_new (TRUE, title,
|
||||
G_CALLBACK (gimp_radio_button_update),
|
||||
&migrate, migrate,
|
||||
|
||||
_("_Use my old settings"),
|
||||
TRUE, NULL,
|
||||
|
||||
_("_Do a fresh installation"),
|
||||
FALSE, NULL,
|
||||
|
||||
NULL);
|
||||
g_free (title);
|
||||
}
|
||||
else
|
||||
{
|
||||
gchar *text;
|
||||
|
||||
text = g_strdup_printf (_("It appears that you are using GIMP for the "
|
||||
"first time. GIMP will now create a folder "
|
||||
"named '<b>%s</b>' and copy some files to it."),
|
||||
gimp_filename_to_utf8 (gimp_directory ()));
|
||||
|
||||
widget = g_object_new (GTK_TYPE_LABEL,
|
||||
"use-markup", TRUE,
|
||||
"label", text,
|
||||
"wrap", TRUE,
|
||||
"xalign", 0.0,
|
||||
NULL);
|
||||
g_free (text);
|
||||
}
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (page), widget, FALSE, FALSE, 0);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
user_install_dialog_add_install_page (GtkWidget *dialog)
|
||||
{
|
||||
GtkWidget *page;
|
||||
GtkWidget *expander;
|
||||
GtkWidget *log;
|
||||
|
||||
page = user_install_dialog_append_page (dialog, _("Installing..."));
|
||||
|
||||
expander = gtk_expander_new (_("Installation Log"));
|
||||
gtk_box_pack_start (GTK_BOX (page), expander, TRUE, TRUE, 0);
|
||||
gtk_widget_show (expander);
|
||||
|
||||
log = user_install_dialog_add_log (dialog);
|
||||
gtk_widget_set_size_request (log, -1, 300);
|
||||
gtk_container_add (GTK_CONTAINER (expander), log);
|
||||
gtk_widget_show (log);
|
||||
|
||||
return page;
|
||||
return dialog;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -260,136 +134,21 @@ user_install_dialog_log (const gchar *message,
|
|||
gboolean error,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *dialog = GTK_WIDGET (data);
|
||||
GtkWidget *view = g_object_get_data (G_OBJECT (dialog), "log-view");
|
||||
GtkTextBuffer *buffer = g_object_get_data (G_OBJECT (dialog), "log-buffer");
|
||||
GdkPixbuf *pixbuf;
|
||||
GtkWidget *view = GTK_WIDGET (data);
|
||||
GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||
GtkTextIter cursor;
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (view));
|
||||
g_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));
|
||||
|
||||
gtk_text_buffer_insert_at_cursor (buffer, error ? "\n" : " ", -1);
|
||||
|
||||
gtk_text_buffer_get_end_iter (buffer, &cursor);
|
||||
|
||||
pixbuf =
|
||||
gtk_widget_render_icon (view,
|
||||
error ? GIMP_STOCK_ERROR : GTK_STOCK_APPLY,
|
||||
error ? GTK_ICON_SIZE_DIALOG : GTK_ICON_SIZE_MENU,
|
||||
NULL);
|
||||
|
||||
gtk_text_buffer_insert_pixbuf (buffer, &cursor, pixbuf);
|
||||
g_object_unref (pixbuf);
|
||||
|
||||
if (error)
|
||||
if (error && message)
|
||||
{
|
||||
gtk_text_buffer_insert (buffer, &cursor, "\n", -1);
|
||||
gtk_text_buffer_insert_with_tags_by_name (buffer, &cursor,
|
||||
message, -1,
|
||||
"bold",
|
||||
NULL);
|
||||
gtk_text_buffer_insert_with_tags_by_name (buffer, &cursor, message, -1,
|
||||
"bold", NULL);
|
||||
}
|
||||
else
|
||||
else if (message)
|
||||
{
|
||||
gtk_text_buffer_insert (buffer, &cursor, message, -1);
|
||||
}
|
||||
|
||||
gtk_text_buffer_insert (buffer, &cursor, "\n", -1);
|
||||
|
||||
while (gtk_events_pending ())
|
||||
gtk_main_iteration ();
|
||||
}
|
||||
|
||||
void
|
||||
user_install_dialog_run (GimpUserInstall *install)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *notebook;
|
||||
GtkWidget *label;
|
||||
GdkPixbuf *wilber;
|
||||
gchar *filename;
|
||||
|
||||
g_return_if_fail (install != NULL);
|
||||
|
||||
dialog = gimp_dialog_new (_("GIMP User Installation"),
|
||||
"gimp-user-installation",
|
||||
NULL, 0,
|
||||
NULL, NULL,
|
||||
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
_("C_ontinue"), GTK_RESPONSE_OK,
|
||||
|
||||
NULL);
|
||||
|
||||
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
|
||||
GTK_RESPONSE_OK,
|
||||
GTK_RESPONSE_CANCEL,
|
||||
-1);
|
||||
|
||||
g_signal_connect (dialog, "destroy",
|
||||
G_CALLBACK (gtk_main_quit),
|
||||
NULL);
|
||||
|
||||
gimp_user_install_set_log_handler (install, user_install_dialog_log, dialog);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 12);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), vbox);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 12);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
filename = g_build_filename (gimp_data_directory(),
|
||||
"images", "wilber-wizard.png", NULL);
|
||||
wilber = gdk_pixbuf_new_from_file (filename, NULL);
|
||||
g_free (filename);
|
||||
|
||||
if (wilber)
|
||||
{
|
||||
GtkWidget *image = gtk_image_new_from_pixbuf (wilber);
|
||||
|
||||
g_object_unref (wilber);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
|
||||
gtk_widget_show (image);
|
||||
}
|
||||
|
||||
label = gtk_label_new (NULL);
|
||||
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
|
||||
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gimp_label_set_attributes (GTK_LABEL (label),
|
||||
PANGO_ATTR_SCALE, PANGO_SCALE_X_LARGE,
|
||||
-1);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
g_object_set_data (G_OBJECT (dialog), "title-label", label);
|
||||
|
||||
notebook = gtk_notebook_new ();
|
||||
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE);
|
||||
gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), notebook, TRUE, TRUE, 0);
|
||||
gtk_widget_show (notebook);
|
||||
|
||||
g_object_set_data (G_OBJECT (dialog), "notebook", notebook);
|
||||
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (user_install_dialog_response),
|
||||
install);
|
||||
|
||||
user_install_dialog_add_welcome_page (dialog, install);
|
||||
user_install_dialog_add_install_page (dialog);
|
||||
|
||||
user_install_dialog_set_page (dialog, WELCOME_PAGE);
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
|
||||
gtk_main ();
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#define __USER_INSTALL_DIALOG_H__
|
||||
|
||||
|
||||
void user_install_dialog_run (GimpUserInstall *install);
|
||||
gboolean user_install_dialog_run (GimpUserInstall *install);
|
||||
|
||||
|
||||
#endif /* __USER_INSTALL_DIALOG_H__ */
|
||||
|
|
Loading…
Reference in New Issue