Re: problem with FileChooserButton in save mode
- From: "squall23 gmx at" <squall23 gmx at>
- To: "Murray Cumming" <murrayc murrayc com>
- Cc: gtkmm-list gnome org
- Subject: Re: problem with FileChooserButton in save mode
- Date: Sun, 13 Jul 2008 12:14:57 +0200
On 13.07.2008 at 11:48 Uhr, squall23 gmx at <squall23 gmx at> wrote:
On 13.07.2008 at 09:49, Murray Cumming <murrayc murrayc com> wrote:
On Thu, 2008-07-10 at 11:08 +0200, squall23 gmx at wrote:
Hy guys!
I am interested in using a Gtk::FileChooserButton with
Gtk::FILE_CHOOSER_ACTION_SAVE or FILE_CHOOSER_ACTION_CREATE_FOLDER
action. But when try to switch the button in one of these modes I get
one of the following errors.
Gtk-WARNING **: gtk_file_chooser_button_set_property: Choosers of type
`gtkmm__GtkFileChooserButton' do not support
`GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER'.
Gtk-WARNING **: gtk_file_chooser_button_set_property: Choosers of type
`gtkmm__GtkFileChooserButton' do not support
`GTK_FILE_CHOOSER_ACTION_SAVE'.
Because I get these errors during execution I blame my runtime files
for the problem. Currently I am using gtkmm and gtk in version
2.10.11-1 under windows xp. Shouldn't this feature be supported by
this runtime versions or what are the minimum requirements for this
purposes?
This seems rather odd. I haven't heard of this error before. Could you
submit a small-as-possible compileable test case to our bugzilla,
please?
You can reproduce this behaviour with the following code:
------------------------------------------------------------------------------------------
#include<gtkmm.h>
int main(int argc, char **argv)
{
Gtk::Main Kit(argc,argv);
Gtk::Window Window;
Gtk::FileChooserButton Button("Test",Gtk::FILE_CHOOSER_ACTION_SAVE);
Window.add(Button);
Window.show_all();
Kit.run(Window);
}
------------------------------------------------------------------------------------------
However I could already figure out that this is a problem of GTK and not
GTKmm.
I have tested it with the following modified example program:
------------------------------------------------------------------------------------------
#include <gtk/gtk.h>
/* This is a callback function. The data arguments are ignored
* in this example. More on callbacks below. */
static void hello( GtkWidget *widget,
gpointer data )
{
g_print ("Hello World\n");
}
static gboolean delete_event( GtkWidget *widget,
GdkEvent *event,
gpointer data )
{
/* If you return FALSE in the "delete_event" signal handler,
* GTK will emit the "destroy" signal. Returning TRUE means
* you don't want the window to be destroyed.
* This is useful for popping up 'are you sure you want to quit?'
* type dialogs. */
g_print ("delete event occurred\n");
/* Change TRUE to FALSE and the main window will be destroyed with
* a "delete_event". */
return FALSE;
}
/* Another callback */
static void destroy( GtkWidget *widget,
gpointer data )
{
gtk_main_quit ();
}
int main( int argc,
char *argv[] )
{
/* GtkWidget is the storage type for widgets */
GtkWidget *window;
GtkWidget *button;
/* This is called in all GTK applications. Arguments are parsed
* from the command line and are returned to the application. */
gtk_init (&argc, &argv);
/* create a new window */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
/* When the window is given the "delete_event" signal (this is given
* by the window manager, usually by the "close" option, or on the
* titlebar), we ask it to call the delete_event () function
* as defined above. The data passed to the callback
* function is NULL and is ignored in the callback function. */
g_signal_connect (G_OBJECT (window), "delete_event",
G_CALLBACK (delete_event), NULL);
/* Here we connect the "destroy" event to a signal handler.
* This event occurs when we call gtk_widget_destroy() on the
window,
* or if we return FALSE in the "delete_event" callback. */
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (destroy), NULL);
/* Sets the border width of the window. */
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
/* Creates a new button with the label "Hello World". */
button = gtk_file_chooser_widget_new(GTK_FILE_CHOOSER_ACTION_SAVE);
/* This packs the button into the window (a gtk container). */
gtk_container_add (GTK_CONTAINER (window), button);
/* The final step is to display this newly created widget. */
gtk_widget_show (button);
/* and the window */
gtk_widget_show (window);
/* All GTK applications must have a gtk_main(). Control ends here
* and waits for an event to occur (like a key press or
* mouse event). */
gtk_main ();
return 0;
}
------------------------------------------------------------------------------------------
After looking at the source of gtk i was even able find that only the
modes OPEN and
SELECT_DIRECTORY are explicit valid. You can see in the implementation
of the
gtk_file_chooser_button_new method:
------------------------------------------------------------------------------------------
GtkWidget *
gtk_file_chooser_button_new (const gchar *title,
GtkFileChooserAction action)
{
g_return_val_if_fail (action == GTK_FILE_CHOOSER_ACTION_OPEN ||
action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, NULL);
return g_object_new (GTK_TYPE_FILE_CHOOSER_BUTTON,
"action", action,
"title", (title ? title : _(DEFAULT_TITLE)),
NULL);
}
------------------------------------------------------------------------------------------
So this problem has nothing to do with gtkmm at all. I think I will move
on to the GTK
mailing list. Maybe they could explain me why
GTK_FILE_CHOOSER_ACTION_SAVE is an invalid
action for a FileChooserButton. If anyone who is related to GTK
development is here I would
be grateful for any kind of support.
_______________________________________________
I have just seen that i posted a wrong code snippet to reproduce the GTK
problem.
The line
button = gtk_file_chooser_widget_new(GTK_FILE_CHOOSER_ACTION_SAVE);
must be replaced by
button = gtk_file_chooser_button_new("test",GTK_FILE_CHOOSER_ACTION_SAVE);
Then the error is reproducible.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]