diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index 138276ac17..97046189c0 100644 --- a/docs/reference/ChangeLog +++ b/docs/reference/ChangeLog @@ -1,3 +1,15 @@ +2005-07-15 Federico Mena Quintero + + * gtk/tmpl/gtkfilechooserdialog.sgml: Add a "save" example to the + typical usage. + + * gtk/gtk-sections.txt: Add GtkFileChooserConfirmation, + gtk_file_chooser_set_do_overwrite_confirmation, + gtk_file_chooser_get_do_overwrite_confirmation. + + * gtk/tmpl/gtkfilechooser.sgml: Document the confirmation signal + and enumeration; provide an example. + 2005-07-14 Matthias Clasen * gtk/gtk-sections.txt: Add new api. diff --git a/docs/reference/gdk/tmpl/x_interaction.sgml b/docs/reference/gdk/tmpl/x_interaction.sgml index a3573de193..2f814abddf 100644 --- a/docs/reference/gdk/tmpl/x_interaction.sgml +++ b/docs/reference/gdk/tmpl/x_interaction.sgml @@ -439,6 +439,14 @@ Since: 2.2 @timestamp: + + + + + +@window: + + diff --git a/docs/reference/gtk/gtk-sections.txt b/docs/reference/gtk/gtk-sections.txt index bed68c8701..0938d86976 100644 --- a/docs/reference/gtk/gtk-sections.txt +++ b/docs/reference/gtk/gtk-sections.txt @@ -1195,6 +1195,7 @@ GtkExpanderPrivate GtkFileChooser GtkFileChooser GtkFileChooserAction +GtkFileChooserConfirmation GTK_FILE_CHOOSER_ERROR GtkFileChooserError gtk_file_chooser_error_quark @@ -1206,6 +1207,8 @@ gtk_file_chooser_set_select_multiple gtk_file_chooser_get_select_multiple gtk_file_chooser_set_show_hidden gtk_file_chooser_get_show_hidden +gtk_file_chooser_set_do_overwrite_confirmation +gtk_file_chooser_get_do_overwrite_confirmation gtk_file_chooser_set_current_name gtk_file_chooser_get_filename gtk_file_chooser_set_filename diff --git a/docs/reference/gtk/tmpl/gtkfilechooser.sgml b/docs/reference/gtk/tmpl/gtkfilechooser.sgml index 454bb50bf4..6d8aa5ede8 100644 --- a/docs/reference/gtk/tmpl/gtkfilechooser.sgml +++ b/docs/reference/gtk/tmpl/gtkfilechooser.sgml @@ -410,6 +410,79 @@ class "GtkFileChooserDefault" binding "my-own-gtkfilechooser-bindings" + + + This signal gets emitted whenever it is appropriate to present a + confirmation dialog when the user has selected a file name that + already exists. The signal only gets emitted when the file + chooser is in #GTK_FILE_CHOOSER_ACTION_SAVE mode. + + + + Most applications just need to turn on the do-overwrite-confirmation + property (or call the + gtk_file_chooser_set_do_overwrite_confirmation() function), and + they will automatically get a stock confirmation dialog. + Applications which need to customize this behavior should do + that, and also connect to the confirm-overwrite + signal. + + + + A signal handler for this signal must return a + #GtkFileChooserConfirmation value, which indicates the action to + take. If the handler determines that the user wants to select a + different filename, it should return + #GTK_FILE_CHOOSER_CONFIRMATION_SELECT_AGAIN. If it determines + that the user is satisfied with his choice of file name, it + should return #GTK_FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME. + On the other hand, if it determines that the stock confirmation + dialog should be used, it should return + #GTK_FILE_CHOOSER_CONFIRMATION_CONFIRM. The following example + illustrates this. + + + + Custom confirmation + + +static GtkFileChooserConfirmation +confirm_overwrite_callback (GtkFileChooser *chooser, gpointer data) +{ + char *uri; + + uri = gtk_file_chooser_get_uri (chooser); + + if (is_uri_read_only (uri)) + { + if (user_wants_to_replace_read_only_file (uri)) + return GTK_FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME; + else + return GTK_FILE_CHOOSER_CONFIRMATION_SELECT_AGAIN; + } else + return GTK_FILE_CHOOSER_CONFIRMATION_CONFIRM; /* fall back to the default dialog */ +} + +... + +chooser = gtk_file_chooser_dialog_new (...); + +gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE); +g_signal_connect (chooser, "confirm-overwrite", + G_CALLBACK (confirm_overwrite_callback), NULL); + +if (gtk_dialog_run (chooser) == GTK_RESPONSE_ACCEPT) + save_to_file (gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser)); + +gtk_widget_destroy (chooser); + + + +@filechooser: the object which received the signal. +@Returns: #GtkFileChooserConfirmation value that indicates which + action to take after emitting the signal. + @@ -443,6 +516,11 @@ class "GtkFileChooserDefault" binding "my-own-gtkfilechooser-bindings" + + + + + @@ -506,6 +584,23 @@ class "GtkFileChooserDefault" binding "my-own-gtkfilechooser-bindings" new folder. The file chooser will let the user name an existing or new folder. + + + Used as a return value of handlers for the confirm-overwrite + signal of a GtkFileChooser. This value + determines whether the file chooser will present the stock + confirmation dialog, accept the user's choice of a filename, or + let the user choose another filename. + + +@GTK_FILE_CHOOSER_CONFIRMATION_CONFIRM: The file chooser will present + its stock dialog to confirm about overwriting an existing file. +@GTK_FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME: The file chooser will + terminate and accept the user's choice of a file name. +@GTK_FILE_CHOOSER_CONFIRMATION_SELECT_AGAIN: The file chooser will + continue running, so as to let the user select another file name. + Used to get the #GError quark for #GtkFileChooser errors. @@ -604,6 +699,24 @@ class "GtkFileChooserDefault" binding "my-own-gtkfilechooser-bindings" @Returns: + + + + + +@chooser: +@do_overwrite_confirmation: + + + + + + + +@chooser: +@Returns: + + diff --git a/docs/reference/gtk/tmpl/gtkfilechooserdialog.sgml b/docs/reference/gtk/tmpl/gtkfilechooserdialog.sgml index 629c35ea0a..fec26a8784 100644 --- a/docs/reference/gtk/tmpl/gtkfilechooserdialog.sgml +++ b/docs/reference/gtk/tmpl/gtkfilechooserdialog.sgml @@ -24,8 +24,8 @@ A file chooser dialog, suitable for "File/Open" or "File/Save" commands Typical usage - In the simplest of cases, you can use #GtkFileChooserDialog - as in the following code: + In the simplest of cases, you can the following code to use + #GtkFileChooserDialog to select a file for opening: @@ -47,6 +47,33 @@ if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) g_free (filename); } +gtk_widget_destroy (dialog); + + + + To use a dialog for saving, you can use this: + + + +GtkWidget *dialog; + +dialog = gtk_file_chooser_dialog_new ("Save File", + parent_window, + GTK_FILE_CHOOSER_ACTION_SAVE, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, + NULL); +gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE); + +if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) + { + char *filename; + + filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); + save_to_file (filename); + g_free (filename); + } + gtk_widget_destroy (dialog); diff --git a/docs/reference/gtk/tmpl/gtktreemodel.sgml b/docs/reference/gtk/tmpl/gtktreemodel.sgml index b4ccf255f8..ed0af1588f 100644 --- a/docs/reference/gtk/tmpl/gtktreemodel.sgml +++ b/docs/reference/gtk/tmpl/gtktreemodel.sgml @@ -514,6 +514,15 @@ compatibility reasons. @Returns: + + + + + +@reference: +@Returns: + + diff --git a/docs/reference/gtk/tmpl/gtktreeview.sgml b/docs/reference/gtk/tmpl/gtktreeview.sgml index 12a97a06bb..def070312b 100644 --- a/docs/reference/gtk/tmpl/gtktreeview.sgml +++ b/docs/reference/gtk/tmpl/gtktreeview.sgml @@ -794,6 +794,17 @@ has some similarity to strcmp() returning 0 for equal strings. @visible_rect: + + + + + +@tree_view: +@start_path: +@end_path: +@Returns: + + diff --git a/docs/reference/gtk/tmpl/gtktreeviewcolumn.sgml b/docs/reference/gtk/tmpl/gtktreeviewcolumn.sgml index 5c76be5166..4aedcab6c3 100644 --- a/docs/reference/gtk/tmpl/gtktreeviewcolumn.sgml +++ b/docs/reference/gtk/tmpl/gtktreeviewcolumn.sgml @@ -607,3 +607,11 @@ calling gtk_tree_view_column_set_cell_data_func() @cell: + + + + + +@tree_column: + +