* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
* #GtkFileChooserDialog is a dialog box suitable for use with
* "File/Open" or "File/Save as" commands. This widget works by
* putting a #GtkFileChooserWidget inside a #GtkDialog. It exposes
- * the #GtkFileChooserIface interface, so you can use all of the
+ * the #GtkFileChooser interface, so you can use all of the
* #GtkFileChooser functions on the file chooser dialog as well as
* those for #GtkDialog.
*
GParamSpec *pspec);
static void gtk_file_chooser_dialog_map (GtkWidget *widget);
+static void gtk_file_chooser_dialog_unmap (GtkWidget *widget);
static void response_cb (GtkDialog *dialog,
gint response_id);
gobject_class->finalize = gtk_file_chooser_dialog_finalize;
widget_class->map = gtk_file_chooser_dialog_map;
+ widget_class->unmap = gtk_file_chooser_dialog_unmap;
gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_FILE_CHOOSER);
gtk_box_set_spacing (GTK_BOX (content_area), 2); /* 2 * 5 + 2 = 12 */
gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
+ gtk_window_set_role (GTK_WINDOW (dialog), "GtkFileChooserDialog");
+
/* We do a signal connection here rather than overriding the method in
* class_init because GtkDialog::response is a RUN_LAST signal. We want *our*
* handler to be run *first*, regardless of whether the user installs response
GTK_WIDGET_CLASS (gtk_file_chooser_dialog_parent_class)->map (widget);
}
+static void
+save_dialog_geometry (GtkFileChooserDialog *dialog)
+{
+ GtkWindow *window;
+ GSettings *settings;
+ int x, y, width, height;
+
+ settings = _gtk_file_chooser_get_settings_for_widget (GTK_WIDGET (dialog));
+
+ window = GTK_WINDOW (dialog);
+
+ gtk_window_get_position (window, &x, &y);
+ gtk_window_get_size (window, &width, &height);
+
+ g_settings_set (settings, SETTINGS_KEY_WINDOW_POSITION, "(ii)", x, y);
+ g_settings_set (settings, SETTINGS_KEY_WINDOW_SIZE, "(ii)", width, height);
+}
+
+/* GtkWidget::unmap handler */
+static void
+gtk_file_chooser_dialog_unmap (GtkWidget *widget)
+{
+ GtkFileChooserDialog *dialog = GTK_FILE_CHOOSER_DIALOG (widget);
+
+ save_dialog_geometry (dialog);
+
+ GTK_WIDGET_CLASS (gtk_file_chooser_dialog_parent_class)->unmap (widget);
+}
+
/* GtkDialog::response handler */
static void
response_cb (GtkDialog *dialog,
* @parent: (allow-none): Transient parent of the dialog, or %NULL
* @action: Open or save mode for the dialog
* @first_button_text: (allow-none): stock ID or text to go in the first button, or %NULL
- * @Varargs: response ID for the first button, then additional (button, id) pairs, ending with %NULL
+ * @...: response ID for the first button, then additional (button, id) pairs, ending with %NULL
*
* Creates a new #GtkFileChooserDialog. This function is analogous to
* gtk_dialog_new_with_buttons().