summaryrefslogtreecommitdiff
path: root/src/xsane-front-gtk.c
diff options
context:
space:
mode:
authorMattia Rizzolo <mattia@mapreri.org>2014-10-03 14:05:31 +0000
committerMattia Rizzolo <mattia@mapreri.org>2014-10-03 14:05:31 +0000
commit129ed4b29e21fdb8bda3bee89c3e5d8cca6ba749 (patch)
treea9b7be66e1a760c586d68ab7d601953f5a090c7c /src/xsane-front-gtk.c
parent96b92dfa3cb0a3ae876a3e650984a404327cdf93 (diff)
Imported Upstream version 0.993upstream/0.993
Diffstat (limited to 'src/xsane-front-gtk.c')
-rw-r--r--src/xsane-front-gtk.c90
1 files changed, 52 insertions, 38 deletions
diff --git a/src/xsane-front-gtk.c b/src/xsane-front-gtk.c
index a11779e..3d98a5b 100644
--- a/src/xsane-front-gtk.c
+++ b/src/xsane-front-gtk.c
@@ -3,7 +3,7 @@
xsane-front-gtk.c
Oliver Rauch <Oliver.Rauch@rauch-domain.de>
- Copyright (C) 1998-2005 Oliver Rauch
+ Copyright (C) 1998-2007 Oliver Rauch
This file is part of the XSANE package.
This program is free software; you can redistribute it and/or modify
@@ -67,14 +67,14 @@ void xsane_option_menu_new(GtkWidget *parent, char *str_list[], const char *val,
void *option_menu_callback, SANE_Int settable, const gchar *widget_name);
void xsane_option_menu_new_with_pixmap(GdkWindow *window, GtkBox *parent, const char *xpm_d[], const char *desc,
char *str_list[], const char *val,
- GtkObject **data, int option,
+ GtkWidget **data, int option,
void *option_menu_callback, SANE_Int settable, const gchar *widget_name);
void xsane_range_new(GtkBox *parent, char *labeltext, const char *desc,
float min, float max, float quant, float page_step,
- int digits, double *val, GtkObject **data, void *xsane_range_callback, SANE_Int settable);
+ int digits, double *val, GtkWidget **data, void *xsane_range_callback, SANE_Int settable);
void xsane_range_new_with_pixmap(GdkWindow *window, GtkBox *parent, const char *xpm_d[], const char *desc,
float min, float max, float quant, float page_step, int digits,
- double *val, GtkObject **data, int option, void *xsane_range_callback, SANE_Int settable);
+ double *val, GtkWidget **data, int option, void *xsane_range_callback, SANE_Int settable);
static void xsane_outputfilename_changed_callback(GtkWidget *widget, gpointer data);
void xsane_set_filename(gchar *filename);
void xsane_separator_new(GtkWidget *xsane_parent, int dist);
@@ -411,7 +411,7 @@ void xsane_define_maximum_output_size()
if ( (opt) && (opt->unit== SANE_UNIT_MM) )
{
- switch(preferences.xsane_mode)
+ switch(xsane.xsane_mode)
{
case XSANE_SAVE:
@@ -662,6 +662,15 @@ gint xsane_authorization_callback(SANE_String_Const resource,
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 10); /* y-space around buttons */
#ifdef HAVE_GTK2
+ button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
+#else
+ button = gtk_button_new_with_label(BUTTON_CANCEL);
+#endif
+ g_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(xsane_authorization_button_callback), (void *) -1);
+ gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 10); /* x-space around cancel-button */
+ gtk_widget_show(button);
+
+#ifdef HAVE_GTK2
button = gtk_button_new_from_stock(GTK_STOCK_OK);
#else
button = gtk_button_new_with_label(BUTTON_OK);
@@ -672,15 +681,6 @@ gint xsane_authorization_callback(SANE_String_Const resource,
gtk_widget_grab_default(button);
gtk_widget_show(button);
-#ifdef HAVE_GTK2
- button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
-#else
- button = gtk_button_new_with_label(BUTTON_CANCEL);
-#endif
- g_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(xsane_authorization_button_callback), (void *) -1);
- gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 10); /* x-space around cancel-button */
- gtk_widget_show(button);
-
gtk_widget_show(hbox);
gtk_widget_show(authorize_dialog);
@@ -1032,7 +1032,7 @@ void xsane_option_menu_new(GtkWidget *parent, char *str_list[], const char *val,
void xsane_option_menu_new_with_pixmap(GdkWindow *window, GtkBox *parent, const char *xpm_d[], const char *desc,
char *str_list[], const char *val,
- GtkObject **data, int option,
+ GtkWidget **data, int option,
void *option_menu_callback, SANE_Int settable, const gchar *widget_name)
{
GtkWidget *hbox;
@@ -1071,7 +1071,7 @@ static void xsane_range_display_value_right_callback(GtkAdjustment *adjust, gpoi
void xsane_range_new(GtkBox *parent, char *labeltext, const char *desc,
float min, float max, float quant, float page_step,
- int digits, double *val, GtkObject **data, void *xsane_range_callback, SANE_Int settable)
+ int digits, double *val, GtkWidget **data, void *xsane_range_callback, SANE_Int settable)
{
GtkWidget *hbox;
GtkWidget *label;
@@ -1087,7 +1087,7 @@ void xsane_range_new(GtkBox *parent, char *labeltext, const char *desc,
label = gtk_label_new(labeltext);
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 1);
- *data = gtk_adjustment_new(*val, min, max, quant, page_step, (max-min) * 1e-30);
+ *data = (GtkWidget *) gtk_adjustment_new(*val, min, max, quant, page_step, (max-min) * 1e-30);
/* 1e-30 => hscrollbar has an unwanted side effect: the maximum is not the maximum */
/* of the given range, it is reduced by the page_size, so it has to be very small */
@@ -1159,7 +1159,7 @@ void xsane_range_new(GtkBox *parent, char *labeltext, const char *desc,
void xsane_range_new_with_pixmap(GdkWindow *window, GtkBox *parent, const char *xpm_d[], const char *desc,
float min, float max, float quant, float page_step,
- int digits, double *val, GtkObject **data, int option, void *xsane_range_callback, SANE_Int settable)
+ int digits, double *val, GtkWidget **data, int option, void *xsane_range_callback, SANE_Int settable)
{
GtkWidget *hbox;
GtkWidget *slider = NULL;
@@ -1180,7 +1180,7 @@ void xsane_range_new_with_pixmap(GdkWindow *window, GtkBox *parent, const char *
gtk_widget_show(pixmapwidget);
gdk_drawable_unref(pixmap);
- *data = gtk_adjustment_new(*val, min, max, quant, page_step, (max-min) * 1e-30);
+ *data = (GtkWidget *) gtk_adjustment_new(*val, min, max, quant, page_step, (max-min) * 1e-30);
/* 1e-30 => hscrollbar has an unwanted side effect: the maximum is not the maximum */
/* of the given range, it is reduced by the page_size, so it has to be very small */
@@ -1251,7 +1251,7 @@ void xsane_range_new_with_pixmap(GdkWindow *window, GtkBox *parent, const char *
DialogElement *elem;
elem=xsane.element + option;
- elem->data = *data;
+ elem->data = (GtkObject *) *data;
elem->widget = slider;
}
}
@@ -1262,6 +1262,7 @@ static void xsane_browse_filename_callback(GtkWidget *widget, gpointer data)
{
char filename[PATH_MAX];
char windowname[TEXTBUFSIZE];
+ int show_extra_widgets;
DBG(DBG_proc, "xsane_browse_filename_callback\n");
@@ -1277,10 +1278,17 @@ static void xsane_browse_filename_callback(GtkWidget *widget, gpointer data)
strcpy(filename, OUT_FILENAME);
}
+ show_extra_widgets = XSANE_GET_FILENAME_SHOW_FILETYPE;
+ if (xsane.enable_color_management)
+ {
+ show_extra_widgets |= XSANE_GET_FILENAME_SHOW_CMS_FUNCTION;
+ }
+
+
snprintf(windowname, sizeof(windowname), "%s %s %s", xsane.prog_name, WINDOW_OUTPUT_FILENAME, xsane.device_text);
umask((mode_t) preferences.directory_umask); /* define new file permissions */
- xsane_back_gtk_get_filename(windowname, filename, sizeof(filename), filename, &preferences.filetype, TRUE, TRUE, FALSE, TRUE);
+ xsane_back_gtk_get_filename(windowname, filename, sizeof(filename), filename, &preferences.filetype, &preferences.cms_function, XSANE_FILE_CHOOSER_ACTION_SELECT_SAVE, show_extra_widgets, XSANE_FILE_FILTER_ALL | XSANE_FILE_FILTER_IMAGES, XSANE_FILE_FILTER_IMAGES);
umask(XSANE_DEFAULT_UMASK); /* define new file permissions */
if (preferences.filename)
@@ -1294,6 +1302,10 @@ static void xsane_browse_filename_callback(GtkWidget *widget, gpointer data)
xsane_back_gtk_filetype_menu_set_history(xsane.filetype_option_menu, preferences.filetype);
+#ifdef HAVE_LIBLCMS
+ gtk_option_menu_set_history(GTK_OPTION_MENU(xsane.cms_function_option_menu), preferences.cms_function);
+#endif
+
/* correct length of filename counter if it is shorter than minimum length */
xsane_update_counter_in_filename(&preferences.filename, FALSE, 0, preferences.filename_counter_len);
@@ -1629,17 +1641,17 @@ void xsane_update_param(void *arg)
if (xsane.param.format == SANE_FRAME_GRAY)
{
- xsane.xsane_colors = 1;
+ xsane.xsane_channels = 1;
}
#ifdef SUPPORT_RGBA
else if (xsane.param.format == SANE_FRAME_RGBA)
{
- xsane.xsane_colors = 4;
+ xsane.xsane_channels = 4;
}
#endif
else /* RGB */
{
- xsane.xsane_colors = 3;
+ xsane.xsane_channels = 3;
}
}
else
@@ -1785,6 +1797,7 @@ int xsane_identify_output_format(char *filename, char *filetype, char **ext)
/* ---------------------------------------------------------------------------------------------------------------------- */
+#if 0
void xsane_change_working_directory(void)
{
char filename[PATH_MAX];
@@ -1797,7 +1810,7 @@ void xsane_change_working_directory(void)
sprintf(windowname, "%s %s %s", xsane.prog_name, WINDOW_CHANGE_WORKING_DIR, xsane.device_text);
if (getcwd(filename, sizeof(filename)))
{
- xsane_back_gtk_get_filename(windowname, filename, sizeof(filename), filename, NULL, TRUE, FALSE, TRUE, FALSE);
+// xsane_back_gtk_get_filename(windowname, filename, sizeof(filename), filename, NULL, TRUE, FALSE, TRUE, FALSE);
if (chdir(filename))
{
char buf[TEXTBUFSIZE];
@@ -1819,6 +1832,7 @@ void xsane_change_working_directory(void)
xsane_set_sensitivity(TRUE);
}
+#endif
/* ---------------------------------------------------------------------------------------------------------------------- */
@@ -2019,11 +2033,6 @@ int xsane_display_eula(int ask_for_accept)
if (ask_for_accept) /* show accept + not accept buttons */
{
- button = gtk_button_new_with_label(BUTTON_ACCEPT);
- g_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_eula_button_callback, (void *) 0 /* accept */);
- gtk_container_add(GTK_CONTAINER(hbox), button);
- gtk_widget_show(button);
-
button = gtk_button_new_with_label(BUTTON_NOT_ACCEPT);
gtk_widget_add_accelerator(button, "clicked", accelerator_group, GDK_Escape, 0, DEF_GTK_ACCEL_LOCKED);
GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
@@ -2031,6 +2040,11 @@ int xsane_display_eula(int ask_for_accept)
gtk_container_add(GTK_CONTAINER(hbox), button);
gtk_widget_grab_default(button);
gtk_widget_show(button);
+
+ button = gtk_button_new_with_label(BUTTON_ACCEPT);
+ g_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_eula_button_callback, (void *) 0 /* accept */);
+ gtk_container_add(GTK_CONTAINER(hbox), button);
+ gtk_widget_show(button);
}
else /* show close button */
{
@@ -2397,22 +2411,22 @@ int xsane_front_gtk_getname_dialog(const char *dialog_title, const char *desc_te
gtk_window_add_accel_group(GTK_WINDOW(getname_dialog), accelerator_group);
#ifdef HAVE_GTK2
- button = gtk_button_new_from_stock(GTK_STOCK_OK);
+ button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
#else
- button = gtk_button_new_with_label(BUTTON_OK);
+ button = gtk_button_new_with_label(BUTTON_CANCEL);
#endif
- g_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_front_gtk_getname_button_callback, (void *) 1);
- GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
+ g_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_front_gtk_getname_button_callback, (void *) -1);
+ gtk_widget_add_accelerator(button, "clicked", accelerator_group, GDK_Escape, 0, DEF_GTK_ACCEL_LOCKED); /* ESC */
gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0);
gtk_widget_show(button);
#ifdef HAVE_GTK2
- button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
+ button = gtk_button_new_from_stock(GTK_STOCK_OK);
#else
- button = gtk_button_new_with_label(BUTTON_CANCEL);
+ button = gtk_button_new_with_label(BUTTON_OK);
#endif
- g_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_front_gtk_getname_button_callback, (void *) -1);
- gtk_widget_add_accelerator(button, "clicked", accelerator_group, GDK_Escape, 0, DEF_GTK_ACCEL_LOCKED); /* ESC */
+ g_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc) xsane_front_gtk_getname_button_callback, (void *) 1);
+ GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0);
gtk_widget_show(button);