mirror of https://github.com/GNOME/gimp.git
always quote the filename, since system/popen uses the shell. Also, never
2003-03-21 Manish Singh <yosh@gimp.org> * plug-ins/common/ps.c: always quote the filename, since system/popen uses the shell. Also, never quote the filename if we are reading from a parameter file (only in the win32 case). Fixes #108648. * plug-ins/dbbrowser/dbbrowser_utils.c: double click on a list item files Apply, if applicable. Remove the existing model in the treeview (which will deallocate it) instead of clearing it.
This commit is contained in:
parent
6d960a0ecd
commit
200e6596c9
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2003-03-21 Manish Singh <yosh@gimp.org>
|
||||
|
||||
* plug-ins/common/ps.c: always quote the filename, since system/popen
|
||||
uses the shell. Also, never quote the filename if we are reading from
|
||||
a parameter file (only in the win32 case). Fixes #108648.
|
||||
|
||||
* plug-ins/dbbrowser/dbbrowser_utils.c: double click on a list item
|
||||
files Apply, if applicable. Remove the existing model in the treeview
|
||||
(which will deallocate it) instead of clearing it.
|
||||
|
||||
2003-03-22 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* themes/Default/images/stock-channel-16.png
|
||||
|
|
|
@ -91,6 +91,10 @@ static void dialog_apply_callback (GtkWidget *widget,
|
|||
dbbrowser_t *dbbrowser);
|
||||
static gint procedure_select_callback (GtkTreeSelection *sel,
|
||||
dbbrowser_t *dbbrowser);
|
||||
static void procedure_activated_callback (GtkTreeView *treeview,
|
||||
GtkTreePath *path,
|
||||
GtkTreeViewColumn *column,
|
||||
dbbrowser_t *dbbrowser);
|
||||
static void dialog_search_callback (GtkWidget *widget,
|
||||
dbbrowser_t *dbbrowser);
|
||||
static void dialog_select (dbbrowser_t *dbbrowser,
|
||||
|
@ -191,6 +195,10 @@ gimp_db_browser (GimpDBBrowserApplyCallback apply_callback)
|
|||
"text", 0, NULL);
|
||||
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (dbbrowser->tv), FALSE);
|
||||
|
||||
if (apply_callback)
|
||||
g_signal_connect (dbbrowser->tv, "row_activated",
|
||||
G_CALLBACK (procedure_activated_callback), dbbrowser);
|
||||
|
||||
gtk_widget_set_size_request (dbbrowser->tv, DBL_LIST_WIDTH, DBL_HEIGHT);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_window), dbbrowser->tv);
|
||||
gtk_widget_show (dbbrowser->tv);
|
||||
|
@ -259,6 +267,15 @@ gimp_db_browser (GimpDBBrowserApplyCallback apply_callback)
|
|||
return dbbrowser->dialog;
|
||||
}
|
||||
|
||||
static void
|
||||
procedure_activated_callback (GtkTreeView *treeview,
|
||||
GtkTreePath *path,
|
||||
GtkTreeViewColumn *column,
|
||||
dbbrowser_t *dbbrowser)
|
||||
{
|
||||
dialog_apply_callback (NULL, dbbrowser);
|
||||
}
|
||||
|
||||
static gint
|
||||
procedure_select_callback (GtkTreeSelection *sel,
|
||||
dbbrowser_t *dbbrowser)
|
||||
|
@ -580,18 +597,7 @@ dialog_search_callback (GtkWidget *widget,
|
|||
GString *query;
|
||||
GtkTreeIter iter;
|
||||
|
||||
if (dbbrowser->store)
|
||||
{
|
||||
gtk_list_store_clear (dbbrowser->store);
|
||||
|
||||
/* Perhaps I'm too stupid but I can't find a proper way of
|
||||
keeping the list store from sorting itself while new items
|
||||
are added. Since this _slow_, we unset the store here to
|
||||
force creation of a new one that doesn't sort and activate
|
||||
sorting later.
|
||||
*/
|
||||
dbbrowser->store = NULL;
|
||||
}
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW (dbbrowser->tv), NULL);
|
||||
|
||||
/* search */
|
||||
|
||||
|
@ -635,13 +641,10 @@ dialog_search_callback (GtkWidget *widget,
|
|||
&num_procs, &proc_list);
|
||||
}
|
||||
|
||||
if (!dbbrowser->store)
|
||||
{
|
||||
dbbrowser->store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW (dbbrowser->tv),
|
||||
GTK_TREE_MODEL (dbbrowser->store));
|
||||
g_object_unref (dbbrowser->store);
|
||||
}
|
||||
|
||||
for (i = 0; i < num_procs; i++)
|
||||
{
|
||||
|
|
|
@ -91,6 +91,10 @@ static void dialog_apply_callback (GtkWidget *widget,
|
|||
dbbrowser_t *dbbrowser);
|
||||
static gint procedure_select_callback (GtkTreeSelection *sel,
|
||||
dbbrowser_t *dbbrowser);
|
||||
static void procedure_activated_callback (GtkTreeView *treeview,
|
||||
GtkTreePath *path,
|
||||
GtkTreeViewColumn *column,
|
||||
dbbrowser_t *dbbrowser);
|
||||
static void dialog_search_callback (GtkWidget *widget,
|
||||
dbbrowser_t *dbbrowser);
|
||||
static void dialog_select (dbbrowser_t *dbbrowser,
|
||||
|
@ -191,6 +195,10 @@ gimp_db_browser (GimpDBBrowserApplyCallback apply_callback)
|
|||
"text", 0, NULL);
|
||||
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (dbbrowser->tv), FALSE);
|
||||
|
||||
if (apply_callback)
|
||||
g_signal_connect (dbbrowser->tv, "row_activated",
|
||||
G_CALLBACK (procedure_activated_callback), dbbrowser);
|
||||
|
||||
gtk_widget_set_size_request (dbbrowser->tv, DBL_LIST_WIDTH, DBL_HEIGHT);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_window), dbbrowser->tv);
|
||||
gtk_widget_show (dbbrowser->tv);
|
||||
|
@ -259,6 +267,15 @@ gimp_db_browser (GimpDBBrowserApplyCallback apply_callback)
|
|||
return dbbrowser->dialog;
|
||||
}
|
||||
|
||||
static void
|
||||
procedure_activated_callback (GtkTreeView *treeview,
|
||||
GtkTreePath *path,
|
||||
GtkTreeViewColumn *column,
|
||||
dbbrowser_t *dbbrowser)
|
||||
{
|
||||
dialog_apply_callback (NULL, dbbrowser);
|
||||
}
|
||||
|
||||
static gint
|
||||
procedure_select_callback (GtkTreeSelection *sel,
|
||||
dbbrowser_t *dbbrowser)
|
||||
|
@ -580,18 +597,7 @@ dialog_search_callback (GtkWidget *widget,
|
|||
GString *query;
|
||||
GtkTreeIter iter;
|
||||
|
||||
if (dbbrowser->store)
|
||||
{
|
||||
gtk_list_store_clear (dbbrowser->store);
|
||||
|
||||
/* Perhaps I'm too stupid but I can't find a proper way of
|
||||
keeping the list store from sorting itself while new items
|
||||
are added. Since this _slow_, we unset the store here to
|
||||
force creation of a new one that doesn't sort and activate
|
||||
sorting later.
|
||||
*/
|
||||
dbbrowser->store = NULL;
|
||||
}
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW (dbbrowser->tv), NULL);
|
||||
|
||||
/* search */
|
||||
|
||||
|
@ -635,13 +641,10 @@ dialog_search_callback (GtkWidget *widget,
|
|||
&num_procs, &proc_list);
|
||||
}
|
||||
|
||||
if (!dbbrowser->store)
|
||||
{
|
||||
dbbrowser->store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW (dbbrowser->tv),
|
||||
GTK_TREE_MODEL (dbbrowser->store));
|
||||
g_object_unref (dbbrowser->store);
|
||||
}
|
||||
|
||||
for (i = 0; i < num_procs; i++)
|
||||
{
|
||||
|
|
|
@ -90,6 +90,14 @@ static char ident[] = "@(#) GIMP PostScript/PDF file-plugin v1.15 04-Oct-2002";
|
|||
|
||||
#define STR_LENGTH 64
|
||||
|
||||
#ifndef G_OS_WIN32
|
||||
#define DEFAULT_GS_PROG "gs"
|
||||
#else
|
||||
/* We want the console ghostscript application. It should be in the PATH */
|
||||
#define DEFAULT_GS_PROG "gswin32c"
|
||||
#endif
|
||||
|
||||
|
||||
/* Load info */
|
||||
typedef struct
|
||||
{
|
||||
|
@ -1269,13 +1277,12 @@ ps_open (gchar *filename,
|
|||
gint *ury,
|
||||
gint *is_epsf)
|
||||
{
|
||||
char *cmd, *gs, *gs_opts, *driver, *fnbuf = NULL;
|
||||
char *cmd, *gs, *gs_opts, *driver, *quoted_fn, *fnbuf = NULL;
|
||||
FILE *fd_popen;
|
||||
int width, height, resolution;
|
||||
int x0, y0, x1, y1;
|
||||
int offx = 0, offy = 0;
|
||||
int is_pdf, maybe_epsf = 0;
|
||||
int blank, anf, apo;
|
||||
char TextAlphaBits[64], GraphicsAlphaBits[64], geometry[32];
|
||||
char offset[32];
|
||||
|
||||
|
@ -1360,43 +1367,10 @@ ps_open (gchar *filename,
|
|||
#endif
|
||||
|
||||
gs = getenv ("GS_PROG");
|
||||
#ifndef G_OS_WIN32
|
||||
if (gs == NULL) gs = "gs";
|
||||
|
||||
/* Escape special characters. Escaping " does not work with call of shell. */
|
||||
/* fnbuf points to memory that should be freed. */
|
||||
filename = fnbuf = g_strescape (filename, "\"");
|
||||
blank = (strchr (filename, ' ') != NULL);
|
||||
apo = (strchr (filename, '\'') != NULL);
|
||||
anf = (strchr (filename, '"') != NULL);
|
||||
|
||||
/* Must the filename be enclosed ? */
|
||||
/* If we have " and ' it will not work */
|
||||
if (blank || anf || apo)
|
||||
{
|
||||
if (!anf) /* No " ? Enclose with " */
|
||||
{
|
||||
filename = g_strdup_printf ("\"%s\"", filename);
|
||||
g_free (fnbuf);
|
||||
fnbuf = filename;
|
||||
}
|
||||
else if (!apo) /* No ' ? Enclose with ' */
|
||||
{
|
||||
filename = g_strdup_printf ("'%s'", filename);
|
||||
g_free (fnbuf);
|
||||
fnbuf = filename;
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
/* We want the console ghostscript application. It should be in the PATH */
|
||||
if (gs == NULL)
|
||||
gs = "gswin32c";
|
||||
/* Quote the filename in case it contains spaces. Ignore memory leak,
|
||||
* this is a short-lived plug-in.
|
||||
*/
|
||||
filename = g_strdup_printf ("\"%s\"", filename);
|
||||
#endif
|
||||
gs = DEFAULT_GS_PROG;
|
||||
|
||||
quoted_fn = g_shell_quote (filename);
|
||||
|
||||
gs_opts = getenv ("GS_OPTIONS");
|
||||
if (gs_opts == NULL)
|
||||
|
@ -1422,11 +1396,11 @@ ps_open (gchar *filename,
|
|||
if (!is_pdf) /* For PDF, we cant set geometry */
|
||||
sprintf (geometry,"-g%dx%d ", width, height);
|
||||
|
||||
cmd = g_strdup_printf ("%s -sDEVICE=%s -r%d %s%s%s-q -dNOPAUSE %s \
|
||||
-sOutputFile=%s %s-f %s %s-c quit",
|
||||
cmd = g_strdup_printf ("%s -sDEVICE=%s -r%d %s%s%s-q -dNOPAUSE %s "
|
||||
"-sOutputFile=%s %s-f %s %s-c quit",
|
||||
gs, driver, resolution, geometry,
|
||||
TextAlphaBits, GraphicsAlphaBits,
|
||||
gs_opts, pnmfile, offset, filename,
|
||||
gs_opts, pnmfile, offset, quoted_fn,
|
||||
*is_epsf ? "-c showpage " : "");
|
||||
#ifdef PS_DEBUG
|
||||
g_print ("Going to start ghostscript with:\n%s\n", cmd);
|
||||
|
@ -1454,7 +1428,12 @@ ps_open (gchar *filename,
|
|||
indirfile = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "i%lx",
|
||||
g_get_tmp_dir (), getpid ());
|
||||
indf = fopen (indirfile, "w");
|
||||
fprintf (indf, "%s\n", cmd + strlen (gs) + 1);
|
||||
fprintf (indf, "%s -sDEVICE=%s -r%d %s%s%s-q -dNOPAUSE %s "
|
||||
"-sOutputFile=%s %s-f %s %s-c quit\n",
|
||||
gs, driver, resolution, geometry,
|
||||
TextAlphaBits, GraphicsAlphaBits,
|
||||
gs_opts, pnmfile, offset, filename,
|
||||
*is_epsf ? "-c showpage " : "");
|
||||
sprintf (cmd, "%s @%s", gs, indirfile);
|
||||
fclose (indf);
|
||||
}
|
||||
|
@ -1464,6 +1443,7 @@ ps_open (gchar *filename,
|
|||
#endif
|
||||
g_free (cmd);
|
||||
g_free (fnbuf);
|
||||
g_free (quoted_fn);
|
||||
|
||||
return (fd_popen);
|
||||
}
|
||||
|
|
|
@ -90,6 +90,14 @@ static char ident[] = "@(#) GIMP PostScript/PDF file-plugin v1.15 04-Oct-2002";
|
|||
|
||||
#define STR_LENGTH 64
|
||||
|
||||
#ifndef G_OS_WIN32
|
||||
#define DEFAULT_GS_PROG "gs"
|
||||
#else
|
||||
/* We want the console ghostscript application. It should be in the PATH */
|
||||
#define DEFAULT_GS_PROG "gswin32c"
|
||||
#endif
|
||||
|
||||
|
||||
/* Load info */
|
||||
typedef struct
|
||||
{
|
||||
|
@ -1269,13 +1277,12 @@ ps_open (gchar *filename,
|
|||
gint *ury,
|
||||
gint *is_epsf)
|
||||
{
|
||||
char *cmd, *gs, *gs_opts, *driver, *fnbuf = NULL;
|
||||
char *cmd, *gs, *gs_opts, *driver, *quoted_fn, *fnbuf = NULL;
|
||||
FILE *fd_popen;
|
||||
int width, height, resolution;
|
||||
int x0, y0, x1, y1;
|
||||
int offx = 0, offy = 0;
|
||||
int is_pdf, maybe_epsf = 0;
|
||||
int blank, anf, apo;
|
||||
char TextAlphaBits[64], GraphicsAlphaBits[64], geometry[32];
|
||||
char offset[32];
|
||||
|
||||
|
@ -1360,43 +1367,10 @@ ps_open (gchar *filename,
|
|||
#endif
|
||||
|
||||
gs = getenv ("GS_PROG");
|
||||
#ifndef G_OS_WIN32
|
||||
if (gs == NULL) gs = "gs";
|
||||
|
||||
/* Escape special characters. Escaping " does not work with call of shell. */
|
||||
/* fnbuf points to memory that should be freed. */
|
||||
filename = fnbuf = g_strescape (filename, "\"");
|
||||
blank = (strchr (filename, ' ') != NULL);
|
||||
apo = (strchr (filename, '\'') != NULL);
|
||||
anf = (strchr (filename, '"') != NULL);
|
||||
|
||||
/* Must the filename be enclosed ? */
|
||||
/* If we have " and ' it will not work */
|
||||
if (blank || anf || apo)
|
||||
{
|
||||
if (!anf) /* No " ? Enclose with " */
|
||||
{
|
||||
filename = g_strdup_printf ("\"%s\"", filename);
|
||||
g_free (fnbuf);
|
||||
fnbuf = filename;
|
||||
}
|
||||
else if (!apo) /* No ' ? Enclose with ' */
|
||||
{
|
||||
filename = g_strdup_printf ("'%s'", filename);
|
||||
g_free (fnbuf);
|
||||
fnbuf = filename;
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
/* We want the console ghostscript application. It should be in the PATH */
|
||||
if (gs == NULL)
|
||||
gs = "gswin32c";
|
||||
/* Quote the filename in case it contains spaces. Ignore memory leak,
|
||||
* this is a short-lived plug-in.
|
||||
*/
|
||||
filename = g_strdup_printf ("\"%s\"", filename);
|
||||
#endif
|
||||
gs = DEFAULT_GS_PROG;
|
||||
|
||||
quoted_fn = g_shell_quote (filename);
|
||||
|
||||
gs_opts = getenv ("GS_OPTIONS");
|
||||
if (gs_opts == NULL)
|
||||
|
@ -1422,11 +1396,11 @@ ps_open (gchar *filename,
|
|||
if (!is_pdf) /* For PDF, we cant set geometry */
|
||||
sprintf (geometry,"-g%dx%d ", width, height);
|
||||
|
||||
cmd = g_strdup_printf ("%s -sDEVICE=%s -r%d %s%s%s-q -dNOPAUSE %s \
|
||||
-sOutputFile=%s %s-f %s %s-c quit",
|
||||
cmd = g_strdup_printf ("%s -sDEVICE=%s -r%d %s%s%s-q -dNOPAUSE %s "
|
||||
"-sOutputFile=%s %s-f %s %s-c quit",
|
||||
gs, driver, resolution, geometry,
|
||||
TextAlphaBits, GraphicsAlphaBits,
|
||||
gs_opts, pnmfile, offset, filename,
|
||||
gs_opts, pnmfile, offset, quoted_fn,
|
||||
*is_epsf ? "-c showpage " : "");
|
||||
#ifdef PS_DEBUG
|
||||
g_print ("Going to start ghostscript with:\n%s\n", cmd);
|
||||
|
@ -1454,7 +1428,12 @@ ps_open (gchar *filename,
|
|||
indirfile = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "i%lx",
|
||||
g_get_tmp_dir (), getpid ());
|
||||
indf = fopen (indirfile, "w");
|
||||
fprintf (indf, "%s\n", cmd + strlen (gs) + 1);
|
||||
fprintf (indf, "%s -sDEVICE=%s -r%d %s%s%s-q -dNOPAUSE %s "
|
||||
"-sOutputFile=%s %s-f %s %s-c quit\n",
|
||||
gs, driver, resolution, geometry,
|
||||
TextAlphaBits, GraphicsAlphaBits,
|
||||
gs_opts, pnmfile, offset, filename,
|
||||
*is_epsf ? "-c showpage " : "");
|
||||
sprintf (cmd, "%s @%s", gs, indirfile);
|
||||
fclose (indf);
|
||||
}
|
||||
|
@ -1464,6 +1443,7 @@ ps_open (gchar *filename,
|
|||
#endif
|
||||
g_free (cmd);
|
||||
g_free (fnbuf);
|
||||
g_free (quoted_fn);
|
||||
|
||||
return (fd_popen);
|
||||
}
|
||||
|
|
|
@ -91,6 +91,10 @@ static void dialog_apply_callback (GtkWidget *widget,
|
|||
dbbrowser_t *dbbrowser);
|
||||
static gint procedure_select_callback (GtkTreeSelection *sel,
|
||||
dbbrowser_t *dbbrowser);
|
||||
static void procedure_activated_callback (GtkTreeView *treeview,
|
||||
GtkTreePath *path,
|
||||
GtkTreeViewColumn *column,
|
||||
dbbrowser_t *dbbrowser);
|
||||
static void dialog_search_callback (GtkWidget *widget,
|
||||
dbbrowser_t *dbbrowser);
|
||||
static void dialog_select (dbbrowser_t *dbbrowser,
|
||||
|
@ -191,6 +195,10 @@ gimp_db_browser (GimpDBBrowserApplyCallback apply_callback)
|
|||
"text", 0, NULL);
|
||||
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (dbbrowser->tv), FALSE);
|
||||
|
||||
if (apply_callback)
|
||||
g_signal_connect (dbbrowser->tv, "row_activated",
|
||||
G_CALLBACK (procedure_activated_callback), dbbrowser);
|
||||
|
||||
gtk_widget_set_size_request (dbbrowser->tv, DBL_LIST_WIDTH, DBL_HEIGHT);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_window), dbbrowser->tv);
|
||||
gtk_widget_show (dbbrowser->tv);
|
||||
|
@ -259,6 +267,15 @@ gimp_db_browser (GimpDBBrowserApplyCallback apply_callback)
|
|||
return dbbrowser->dialog;
|
||||
}
|
||||
|
||||
static void
|
||||
procedure_activated_callback (GtkTreeView *treeview,
|
||||
GtkTreePath *path,
|
||||
GtkTreeViewColumn *column,
|
||||
dbbrowser_t *dbbrowser)
|
||||
{
|
||||
dialog_apply_callback (NULL, dbbrowser);
|
||||
}
|
||||
|
||||
static gint
|
||||
procedure_select_callback (GtkTreeSelection *sel,
|
||||
dbbrowser_t *dbbrowser)
|
||||
|
@ -580,18 +597,7 @@ dialog_search_callback (GtkWidget *widget,
|
|||
GString *query;
|
||||
GtkTreeIter iter;
|
||||
|
||||
if (dbbrowser->store)
|
||||
{
|
||||
gtk_list_store_clear (dbbrowser->store);
|
||||
|
||||
/* Perhaps I'm too stupid but I can't find a proper way of
|
||||
keeping the list store from sorting itself while new items
|
||||
are added. Since this _slow_, we unset the store here to
|
||||
force creation of a new one that doesn't sort and activate
|
||||
sorting later.
|
||||
*/
|
||||
dbbrowser->store = NULL;
|
||||
}
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW (dbbrowser->tv), NULL);
|
||||
|
||||
/* search */
|
||||
|
||||
|
@ -635,13 +641,10 @@ dialog_search_callback (GtkWidget *widget,
|
|||
&num_procs, &proc_list);
|
||||
}
|
||||
|
||||
if (!dbbrowser->store)
|
||||
{
|
||||
dbbrowser->store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW (dbbrowser->tv),
|
||||
GTK_TREE_MODEL (dbbrowser->store));
|
||||
g_object_unref (dbbrowser->store);
|
||||
}
|
||||
|
||||
for (i = 0; i < num_procs; i++)
|
||||
{
|
||||
|
|
|
@ -91,6 +91,10 @@ static void dialog_apply_callback (GtkWidget *widget,
|
|||
dbbrowser_t *dbbrowser);
|
||||
static gint procedure_select_callback (GtkTreeSelection *sel,
|
||||
dbbrowser_t *dbbrowser);
|
||||
static void procedure_activated_callback (GtkTreeView *treeview,
|
||||
GtkTreePath *path,
|
||||
GtkTreeViewColumn *column,
|
||||
dbbrowser_t *dbbrowser);
|
||||
static void dialog_search_callback (GtkWidget *widget,
|
||||
dbbrowser_t *dbbrowser);
|
||||
static void dialog_select (dbbrowser_t *dbbrowser,
|
||||
|
@ -191,6 +195,10 @@ gimp_db_browser (GimpDBBrowserApplyCallback apply_callback)
|
|||
"text", 0, NULL);
|
||||
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (dbbrowser->tv), FALSE);
|
||||
|
||||
if (apply_callback)
|
||||
g_signal_connect (dbbrowser->tv, "row_activated",
|
||||
G_CALLBACK (procedure_activated_callback), dbbrowser);
|
||||
|
||||
gtk_widget_set_size_request (dbbrowser->tv, DBL_LIST_WIDTH, DBL_HEIGHT);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_window), dbbrowser->tv);
|
||||
gtk_widget_show (dbbrowser->tv);
|
||||
|
@ -259,6 +267,15 @@ gimp_db_browser (GimpDBBrowserApplyCallback apply_callback)
|
|||
return dbbrowser->dialog;
|
||||
}
|
||||
|
||||
static void
|
||||
procedure_activated_callback (GtkTreeView *treeview,
|
||||
GtkTreePath *path,
|
||||
GtkTreeViewColumn *column,
|
||||
dbbrowser_t *dbbrowser)
|
||||
{
|
||||
dialog_apply_callback (NULL, dbbrowser);
|
||||
}
|
||||
|
||||
static gint
|
||||
procedure_select_callback (GtkTreeSelection *sel,
|
||||
dbbrowser_t *dbbrowser)
|
||||
|
@ -580,18 +597,7 @@ dialog_search_callback (GtkWidget *widget,
|
|||
GString *query;
|
||||
GtkTreeIter iter;
|
||||
|
||||
if (dbbrowser->store)
|
||||
{
|
||||
gtk_list_store_clear (dbbrowser->store);
|
||||
|
||||
/* Perhaps I'm too stupid but I can't find a proper way of
|
||||
keeping the list store from sorting itself while new items
|
||||
are added. Since this _slow_, we unset the store here to
|
||||
force creation of a new one that doesn't sort and activate
|
||||
sorting later.
|
||||
*/
|
||||
dbbrowser->store = NULL;
|
||||
}
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW (dbbrowser->tv), NULL);
|
||||
|
||||
/* search */
|
||||
|
||||
|
@ -635,13 +641,10 @@ dialog_search_callback (GtkWidget *widget,
|
|||
&num_procs, &proc_list);
|
||||
}
|
||||
|
||||
if (!dbbrowser->store)
|
||||
{
|
||||
dbbrowser->store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW (dbbrowser->tv),
|
||||
GTK_TREE_MODEL (dbbrowser->store));
|
||||
g_object_unref (dbbrowser->store);
|
||||
}
|
||||
|
||||
for (i = 0; i < num_procs; i++)
|
||||
{
|
||||
|
|
|
@ -91,6 +91,10 @@ static void dialog_apply_callback (GtkWidget *widget,
|
|||
dbbrowser_t *dbbrowser);
|
||||
static gint procedure_select_callback (GtkTreeSelection *sel,
|
||||
dbbrowser_t *dbbrowser);
|
||||
static void procedure_activated_callback (GtkTreeView *treeview,
|
||||
GtkTreePath *path,
|
||||
GtkTreeViewColumn *column,
|
||||
dbbrowser_t *dbbrowser);
|
||||
static void dialog_search_callback (GtkWidget *widget,
|
||||
dbbrowser_t *dbbrowser);
|
||||
static void dialog_select (dbbrowser_t *dbbrowser,
|
||||
|
@ -191,6 +195,10 @@ gimp_db_browser (GimpDBBrowserApplyCallback apply_callback)
|
|||
"text", 0, NULL);
|
||||
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (dbbrowser->tv), FALSE);
|
||||
|
||||
if (apply_callback)
|
||||
g_signal_connect (dbbrowser->tv, "row_activated",
|
||||
G_CALLBACK (procedure_activated_callback), dbbrowser);
|
||||
|
||||
gtk_widget_set_size_request (dbbrowser->tv, DBL_LIST_WIDTH, DBL_HEIGHT);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_window), dbbrowser->tv);
|
||||
gtk_widget_show (dbbrowser->tv);
|
||||
|
@ -259,6 +267,15 @@ gimp_db_browser (GimpDBBrowserApplyCallback apply_callback)
|
|||
return dbbrowser->dialog;
|
||||
}
|
||||
|
||||
static void
|
||||
procedure_activated_callback (GtkTreeView *treeview,
|
||||
GtkTreePath *path,
|
||||
GtkTreeViewColumn *column,
|
||||
dbbrowser_t *dbbrowser)
|
||||
{
|
||||
dialog_apply_callback (NULL, dbbrowser);
|
||||
}
|
||||
|
||||
static gint
|
||||
procedure_select_callback (GtkTreeSelection *sel,
|
||||
dbbrowser_t *dbbrowser)
|
||||
|
@ -580,18 +597,7 @@ dialog_search_callback (GtkWidget *widget,
|
|||
GString *query;
|
||||
GtkTreeIter iter;
|
||||
|
||||
if (dbbrowser->store)
|
||||
{
|
||||
gtk_list_store_clear (dbbrowser->store);
|
||||
|
||||
/* Perhaps I'm too stupid but I can't find a proper way of
|
||||
keeping the list store from sorting itself while new items
|
||||
are added. Since this _slow_, we unset the store here to
|
||||
force creation of a new one that doesn't sort and activate
|
||||
sorting later.
|
||||
*/
|
||||
dbbrowser->store = NULL;
|
||||
}
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW (dbbrowser->tv), NULL);
|
||||
|
||||
/* search */
|
||||
|
||||
|
@ -635,13 +641,10 @@ dialog_search_callback (GtkWidget *widget,
|
|||
&num_procs, &proc_list);
|
||||
}
|
||||
|
||||
if (!dbbrowser->store)
|
||||
{
|
||||
dbbrowser->store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW (dbbrowser->tv),
|
||||
GTK_TREE_MODEL (dbbrowser->store));
|
||||
g_object_unref (dbbrowser->store);
|
||||
}
|
||||
|
||||
for (i = 0; i < num_procs; i++)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue