[67218] trunk/dports/graphics/xsane

jmr at macports.org jmr at macports.org
Sun May 2 17:32:11 PDT 2010


Revision: 67218
          http://trac.macports.org/changeset/67218
Author:   jmr at macports.org
Date:     2010-05-02 17:32:05 -0700 (Sun, 02 May 2010)
Log Message:
-----------
xsane: add patches to fix ability to set some options and fix some runtime warnings, add maintainer (#24761)

Modified Paths:
--------------
    trunk/dports/graphics/xsane/Portfile

Added Paths:
-----------
    trunk/dports/graphics/xsane/files/patch-gtk_adjustment_new.diff
    trunk/dports/graphics/xsane/files/patch-sane-options-handling-fix.diff

Modified: trunk/dports/graphics/xsane/Portfile
===================================================================
--- trunk/dports/graphics/xsane/Portfile	2010-05-02 23:47:54 UTC (rev 67217)
+++ trunk/dports/graphics/xsane/Portfile	2010-05-03 00:32:05 UTC (rev 67218)
@@ -5,9 +5,9 @@
 
 name            xsane
 version         0.996
-revision        2
+revision        3
 categories      graphics x11
-maintainers     nomaintainer
+maintainers     puffin.lb.shuttle.de:michael.klein openmaintainer
 description     X11 frontend for SANE
 homepage        http://www.xsane.org/
 platforms       darwin
@@ -29,10 +29,10 @@
                 port:gtk2 \
                 port:sane-backends
 
-patchfiles      patch-src-xsane-back-gtk.c.diff
+patchfiles      patch-src-xsane-back-gtk.c.diff \
+                patch-sane-options-handling-fix.diff \
+                patch-gtk_adjustment_new.diff
 
-configure.cppflags-append -no-cpp-precomp
-
 destroot.destdir        prefix=${destroot}${prefix}
 post-destroot {
     delete ${destroot}${prefix}/share/man

Added: trunk/dports/graphics/xsane/files/patch-gtk_adjustment_new.diff
===================================================================
--- trunk/dports/graphics/xsane/files/patch-gtk_adjustment_new.diff	                        (rev 0)
+++ trunk/dports/graphics/xsane/files/patch-gtk_adjustment_new.diff	2010-05-03 00:32:05 UTC (rev 67218)
@@ -0,0 +1,48 @@
+--- src/xsane.c.orig	2002-10-02 13:02:50.000000000 +0200
++++ src/xsane.c	2009-11-04 22:04:30.000000000 +0100
+@@ -1218,7 +1218,7 @@
+   gtk_widget_show(pixmapwidget);
+ 
+   /* adf pages maximum */
+-  adjustment = gtk_adjustment_new(preferences.adf_pages_max, 1, 9999, 1, 10, 1);
++  adjustment = gtk_adjustment_new(preferences.adf_pages_max, 1, 9999, 1, 10, 0);
+   xsane_spinbutton = gtk_spin_button_new(GTK_ADJUSTMENT(adjustment), 0, 0);
+   gtk_widget_set_size_request(xsane_spinbutton, 55, -1);
+   gtk_spin_button_set_wrap(GTK_SPIN_BUTTON(xsane_spinbutton), FALSE);
+@@ -1317,7 +1317,7 @@
+ 
+ 
+     /* number of copies */
+-    adjustment = gtk_adjustment_new(xsane.copy_number, 1, 99, 1, 10, 1);
++    adjustment = gtk_adjustment_new(xsane.copy_number, 1, 99, 1, 10, 0);
+     xsane_spinbutton = gtk_spin_button_new(GTK_ADJUSTMENT(adjustment), 0, 0);
+     gtk_widget_set_size_request(xsane_spinbutton, 40, -1);
+     gtk_spin_button_set_wrap(GTK_SPIN_BUTTON(xsane_spinbutton), FALSE);
+--- src/xsane-front-gtk.c.orig	2010-03-25 22:47:14.000000000 +0100
++++ src/xsane-front-gtk.c	2010-03-25 22:49:40.000000000 +0100
+@@ -1153,6 +1153,7 @@
+   /* spinbutton */
+   if (preferences.show_range_mode & 4)
+   {
++    g_object_set(*data, "page-size", 0.0, (void*)NULL);
+     spinbutton = gtk_spin_button_new(GTK_ADJUSTMENT(*data), 0, digits);
+     if (preferences.show_range_mode & 3) /* slider also visible */
+     {
+@@ -1246,6 +1247,7 @@
+   /* spinbutton */
+   if (preferences.show_range_mode & 4)
+   {
++    g_object_set(*data, "page-size", 0.0, (void*)NULL);
+     spinbutton = gtk_spin_button_new(GTK_ADJUSTMENT(*data), 0, digits);
+     gtk_widget_set_size_request(spinbutton, 60, -1);
+     xsane_back_gtk_set_tooltip(xsane.tooltips, spinbutton, desc);
+--- src/xsane-back-gtk.c.orig	2007-08-13 09:49:34.000000000 +0200
++++ src/xsane-back-gtk.c	2010-03-25 22:42:07.000000000 +0100
+@@ -2029,6 +2029,7 @@
+       digits = 5;
+     }
+ #endif
++    g_object_set(elem->data, "page-size", 0.0, (void*)NULL);
+     spinbutton = gtk_spin_button_new(GTK_ADJUSTMENT(elem->data), 0, digits);
+ 
+     if (preferences.show_range_mode & 3) /* slider also visible */

Added: trunk/dports/graphics/xsane/files/patch-sane-options-handling-fix.diff
===================================================================
--- trunk/dports/graphics/xsane/files/patch-sane-options-handling-fix.diff	                        (rev 0)
+++ trunk/dports/graphics/xsane/files/patch-sane-options-handling-fix.diff	2010-05-03 00:32:05 UTC (rev 67218)
@@ -0,0 +1,234 @@
+# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=487475
+diff -urw ../xsane-0.996.orig/src/xsane-back-gtk.c ./src/xsane-back-gtk.c
+--- ../xsane-0.996.orig/src/xsane-back-gtk.c	2007-08-13 09:49:34.000000000 +0200
++++ ./src/xsane-back-gtk.c	2010-05-01 20:48:41.000000000 +0200
+@@ -2226,11 +2226,13 @@
+ /* ----------------------------------------------------------------------------------------------------------------- */
+ 
+ void xsane_back_gtk_option_menu_new(GtkWidget *parent, const char *name, char *str_list[],
+-		 const char *val, DialogElement *elem,
++		 const char *val, SANE_Constraint_Type constraint_type, DialogElement *elem,
+ 		 GtkTooltips *tooltips, const char *desc, SANE_Int settable)
+ {
+  GtkWidget *hbox, *label, *option_menu, *menu, *item;
+  MenuItem *menu_items;
++ int dup_string;
++ char *strval;
+  int i, num_items;
+ 
+   DBG(DBG_proc, "xsane_back_gtk_option_menu_new(%s)\n", name);
+@@ -2248,16 +2250,23 @@
+ 
+   menu_items = malloc((num_items + 1) * sizeof(menu_items[0]));
+ 
++  dup_string = (constraint_type == SANE_CONSTRAINT_STRING_LIST);
++
+   menu = gtk_menu_new();
+   for (i = 0; i < num_items; ++i)
+   {
+-    item = gtk_menu_item_new_with_label(_BGT(str_list[i]));
++    if (dup_string)
++      strval = strdup(str_list[i]);
++    else
++      strval = str_list[i];
++
++    item = gtk_menu_item_new_with_label(_BGT(strval));
+     gtk_container_add(GTK_CONTAINER(menu), item);
+     g_signal_connect(GTK_OBJECT(item), "activate", (GtkSignalFunc) xsane_back_gtk_option_menu_callback, menu_items + i);
+ 
+     gtk_widget_show(item);
+ 
+-    menu_items[i].label = str_list[i];
++    menu_items[i].label = strval;
+     menu_items[i].elem = elem;
+     menu_items[i].index = i;
+   }
+@@ -2403,14 +2412,15 @@
+   xsane.standard_hbox = NULL;
+   xsane.advanced_hbox = NULL;
+ 
+-  /* free the menu labels of integer/fix-point word-lists: */
++  /* free the menu labels */
+   for (i = 0; i < xsane.num_elements; ++i)
+   {
+     if (xsane.element[i].menu)
+     {
+       opt = xsane_get_option_descriptor(xsane.dev, i);
+       elem = xsane.element + i;
+-      if (opt->type != SANE_TYPE_STRING)
++      if ((opt->type != SANE_TYPE_STRING)
++	  || (opt->constraint_type == SANE_CONSTRAINT_STRING_LIST))
+       {
+         for (j = 0; j < elem->menu_size; ++j)
+         {
+diff -urw ../xsane-0.996.orig/src/xsane-back-gtk.h ./src/xsane-back-gtk.h
+--- ../xsane-0.996.orig/src/xsane-back-gtk.h	2007-02-24 01:56:54.000000000 +0100
++++ ./src/xsane-back-gtk.h	2010-05-01 20:48:41.000000000 +0200
+@@ -117,7 +117,7 @@
+ 	   gfloat quant, int automatic,
+ 	   DialogElement *elem, GtkTooltips *tooltips, const char *desc, SANE_Int settable);
+ extern void xsane_back_gtk_option_menu_new(GtkWidget *parent, const char *name, char *str_list[],
+-           const char *val, DialogElement *elem, GtkTooltips *tooltips, const char *desc, SANE_Int settable);
++           const char *val, SANE_Constraint_Type constraint_type, DialogElement *elem, GtkTooltips *tooltips, const char *desc, SANE_Int settable);
+ extern void xsane_back_gtk_text_entry_new(GtkWidget *parent, const char *name, const char *val,
+                 DialogElement *elem, GtkTooltips *tooltips, const char *desc, SANE_Int settable);
+ extern void xsane_back_gtk_push_button_callback(GtkWidget *widget, gpointer data);
+diff -urw ../xsane-0.996.orig/src/xsane-front-gtk.c ./src/xsane-front-gtk.c
+--- ../xsane-0.996.orig/src/xsane-front-gtk.c	2007-05-17 15:35:06.000000000 +0200
++++ ./src/xsane-front-gtk.c	2010-05-01 20:48:41.000000000 +0200
+@@ -64,10 +64,10 @@
+                                          int *state, void *xsane_toggle_button_callback);
+ GtkWidget *xsane_button_new_with_pixmap(GdkWindow *window, GtkWidget *parent, const char *xpm_d[], const char *desc,
+                                         void *xsane_button_callback, gpointer data);
+-void xsane_option_menu_new(GtkWidget *parent, char *str_list[], const char *val, int option_number, const char *desc,
++void xsane_option_menu_new(GtkWidget *parent, char *str_list[], const char *val, SANE_Constraint_Type constraint_type, int option_number, const char *desc,
+                            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,
++                                       char *str_list[], const char *val, SANE_Constraint_Type constraint_type,
+                                        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,
+@@ -1007,12 +1007,14 @@
+ 
+ /* ---------------------------------------------------------------------------------------------------------------------- */
+ 
+-void xsane_option_menu_new(GtkWidget *parent, char *str_list[], const char *val, int option_number, const char *desc,
++void xsane_option_menu_new(GtkWidget *parent, char *str_list[], const char *val, SANE_Constraint_Type constraint_type, int option_number, const char *desc,
+                            void *option_menu_callback, SANE_Int settable, const gchar *widget_name)
+ {
+  GtkWidget *option_menu, *menu, *item;
+  MenuItem *menu_items;
+  DialogElement *elem;
++ int dup_string;
++ char *strval;
+  int i, num_items;
+ 
+   DBG(DBG_proc, "xsane_option_menu_new\n");
+@@ -1031,9 +1033,16 @@
+     gtk_widget_set_name(menu, widget_name);
+   }
+ 
++  dup_string = (constraint_type == SANE_CONSTRAINT_STRING_LIST);
++
+   for (i = 0; i < num_items; ++i)
+   {
+-    item = gtk_menu_item_new_with_label(_BGT(str_list[i]));
++    if (dup_string)
++      strval = strdup(str_list[i]);
++    else
++      strval = str_list[i];
++
++    item = gtk_menu_item_new_with_label(_BGT(strval));
+     gtk_container_add(GTK_CONTAINER(menu), item);
+ 
+     if (option_menu_callback)
+@@ -1047,7 +1056,7 @@
+ 
+     gtk_widget_show(item);
+ 
+-    menu_items[i].label = str_list[i];
++    menu_items[i].label = strval;
+     menu_items[i].elem  = elem;
+     menu_items[i].index = i;
+   }
+@@ -1075,7 +1084,7 @@
+ /* ---------------------------------------------------------------------------------------------------------------------- */
+ 
+ void xsane_option_menu_new_with_pixmap(GdkWindow *window, GtkBox *parent, const char *xpm_d[], const char *desc,
+-                                       char *str_list[], const char *val,
++                                       char *str_list[], const char *val, SANE_Constraint_Type constraint_type,
+                                        GtkWidget **data, int option,
+                                        void *option_menu_callback, SANE_Int settable, const gchar *widget_name)
+ {
+@@ -1094,7 +1103,7 @@
+   gtk_box_pack_start(GTK_BOX(hbox), pixmapwidget, FALSE, FALSE, 2);
+   gtk_widget_show(pixmapwidget);
+ 
+-  xsane_option_menu_new(hbox, str_list, val, option, desc, option_menu_callback, settable, widget_name);
++  xsane_option_menu_new(hbox, str_list, val, constraint_type, option, desc, option_menu_callback, settable, widget_name);
+   gtk_widget_show(hbox);
+ }
+ 
+diff -urw ../xsane-0.996.orig/src/xsane-front-gtk.h ./src/xsane-front-gtk.h
+--- ../xsane-0.996.orig/src/xsane-front-gtk.h	2007-05-17 14:45:19.000000000 +0200
++++ ./src/xsane-front-gtk.h	2010-05-01 20:48:41.000000000 +0200
+@@ -54,10 +54,10 @@
+ extern GtkWidget *xsane_button_new_with_pixmap(GdkWindow *window, GtkWidget *parent, const char *xpm_d[], const char *desc, 
+                                                void *xsane_button_callback, gpointer data);
+ extern void xsane_pixmap_new(GtkWidget *parent, char *title, int width, int height, XsanePixmap *hist);
+-extern void xsane_option_menu_new(GtkWidget *parent, char *str_list[], const char *val, int option_number, const char *desc,
++extern void xsane_option_menu_new(GtkWidget *parent, char *str_list[], const char *val, SANE_Constraint_Type constraint_type, int option_number, const char *desc,
+                                   void *option_menu_callback, SANE_Int settable, const gchar *widget_name);
+ extern void xsane_option_menu_new_with_pixmap(GdkWindow *window, GtkBox *parent, const char *xpm_d[], const char *desc,
+-                                              char *str_list[], const char *val,
++                                              char *str_list[], const char *val, SANE_Constraint_Type constraint_type,
+                                               GtkWidget **data, int option,
+                                               void *option_menu_callback, SANE_Int settable, const gchar *widget_name);
+ extern void xsane_range_new(GtkBox *parent, char *labeltext, const char *desc,
+diff -urw ../xsane-0.996.orig/src/xsane.c ./src/xsane.c
+--- ../xsane-0.996.orig/src/xsane.c	2008-03-29 09:56:30.000000000 +0100
++++ ./src/xsane.c	2010-05-01 20:48:41.000000000 +0200
+@@ -876,7 +876,7 @@
+             str_list[j] = 0;
+             sprintf(str, "%d", (int) val);
+ 
+-            xsane_option_menu_new_with_pixmap(xsane.xsane_window->window, GTK_BOX(parent), image_xpm, desc, str_list, str, &resolution_widget, well_known_option,
++            xsane_option_menu_new_with_pixmap(xsane.xsane_window->window, GTK_BOX(parent), image_xpm, desc, str_list, str, opt->constraint_type, &resolution_widget, well_known_option,
+                                               xsane_resolution_list_callback, SANE_OPTION_IS_SETTABLE(opt->cap), widget_name);
+ 
+             free(str_list);
+@@ -931,7 +931,7 @@
+ 
+ 
+           xsane_option_menu_new_with_pixmap(xsane.xsane_window->window, GTK_BOX(parent), image_xpm, desc,
+-                                            str_list, str, &resolution_widget, well_known_option,
++                                            str_list, str, opt->constraint_type, &resolution_widget, well_known_option,
+                                             xsane_resolution_list_callback, SANE_OPTION_IS_SETTABLE(opt->cap), widget_name);
+           free(str_list);
+         }
+@@ -1490,7 +1490,7 @@
+           set = malloc(opt->size);
+           status = xsane_control_option(xsane.dev, xsane.well_known.scansource, SANE_ACTION_GET_VALUE, set, 0);
+ 
+-          xsane_option_menu_new(hbox, (char **) opt->constraint.string_list, set, xsane.well_known.scansource,
++          xsane_option_menu_new(hbox, (char **) opt->constraint.string_list, set, opt->constraint_type, xsane.well_known.scansource,
+                                 _BGT(opt->desc), 0, SANE_OPTION_IS_SETTABLE(opt->cap), 0);
+          }
+          break;
+@@ -1529,7 +1529,7 @@
+           set = malloc(opt->size);
+           status = xsane_control_option(xsane.dev, xsane.well_known.scanmode, SANE_ACTION_GET_VALUE, set, 0);
+ 
+-          xsane_option_menu_new(hbox, (char **) opt->constraint.string_list, set, xsane.well_known.scanmode,
++          xsane_option_menu_new(hbox, (char **) opt->constraint.string_list, set, opt->constraint_type, xsane.well_known.scanmode,
+                                 _BGT(opt->desc), xsane_scanmode_menu_callback, SANE_OPTION_IS_SETTABLE(opt->cap), 0);
+         }
+          break;
+@@ -4634,7 +4634,7 @@
+               }
+               str_list[j] = 0;
+               sprintf(str, "%d", val);
+-              xsane_back_gtk_option_menu_new(parent, title, str_list, str, elem, xsane.tooltips, _BGT(opt->desc),
++              xsane_back_gtk_option_menu_new(parent, title, str_list, str, opt->constraint_type, elem, xsane.tooltips, _BGT(opt->desc),
+                                   SANE_OPTION_IS_SETTABLE(opt->cap));
+               free(str_list);
+               gtk_widget_show(parent->parent);
+@@ -4732,7 +4732,7 @@
+               }
+               str_list[j] = 0;
+               sprintf(str, "%g", SANE_UNFIX(val));
+-              xsane_back_gtk_option_menu_new(parent, title, str_list, str, elem, xsane.tooltips, _BGT(opt->desc), SANE_OPTION_IS_SETTABLE(opt->cap));
++              xsane_back_gtk_option_menu_new(parent, title, str_list, str, opt->constraint_type, elem, xsane.tooltips, _BGT(opt->desc), SANE_OPTION_IS_SETTABLE(opt->cap));
+               free (str_list);
+               gtk_widget_show(parent->parent);
+             }
+@@ -4769,7 +4769,7 @@
+                  (strcmp (opt->name, SANE_NAME_SCAN_SOURCE) != 0) ) /* do not show scansource */
+             {
+               /* use a "list-selection" widget */
+-              xsane_back_gtk_option_menu_new(parent, title, (char **) opt->constraint.string_list, buf,
++              xsane_back_gtk_option_menu_new(parent, title, (char **) opt->constraint.string_list, buf, opt->constraint_type,
+                                   elem, xsane.tooltips, _BGT(opt->desc), SANE_OPTION_IS_SETTABLE(opt->cap));
+               gtk_widget_show (parent->parent);
+             }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100502/2dd86471/attachment-0001.html>


More information about the macports-changes mailing list