summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog13
-rw-r--r--ChangeLog.pre-2-1013
-rw-r--r--ChangeLog.pre-2-413
-rw-r--r--ChangeLog.pre-2-613
-rw-r--r--ChangeLog.pre-2-813
-rw-r--r--gtk/gtkfilechooserdefault.c1
-rw-r--r--gtk/gtkfilechooserdialog.c153
-rw-r--r--gtk/gtkfilechooserembed.c18
-rw-r--r--gtk/gtkfilechooserembed.h1
-rw-r--r--tests/testfilechooser.c2
10 files changed, 172 insertions, 68 deletions
diff --git a/ChangeLog b/ChangeLog
index 16aab9aad2..9999bbafce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+Tue Mar 2 23:39:55 2004 Jonathan Blandford <jrb@gnome.org>
+
+ * gtk/gtkfilechooserdialog.c
+ (file_chooser_widget_default_realized_size_changed): Split
+ function into realized and unrealized variants, and consolidate
+ the handling fo size-changing and default changing.
+
+ * gtk/gtkfilechooserembed.[ch] (gtk_file_chooser_embed_class_init):
+ remove resizable-hints-changed, as it just complicated things.
+
+ * gtk/gtkfilechooserdefault.c (update_appearance): Don't emit
+ resizable-hints-changed.
+
2004-03-03 Tor Lillqvist <tml@iki.fi>
* gtk/gtk.def: Add a missing entry. (#135982, J. Ali Harlow)
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 16aab9aad2..9999bbafce 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,16 @@
+Tue Mar 2 23:39:55 2004 Jonathan Blandford <jrb@gnome.org>
+
+ * gtk/gtkfilechooserdialog.c
+ (file_chooser_widget_default_realized_size_changed): Split
+ function into realized and unrealized variants, and consolidate
+ the handling fo size-changing and default changing.
+
+ * gtk/gtkfilechooserembed.[ch] (gtk_file_chooser_embed_class_init):
+ remove resizable-hints-changed, as it just complicated things.
+
+ * gtk/gtkfilechooserdefault.c (update_appearance): Don't emit
+ resizable-hints-changed.
+
2004-03-03 Tor Lillqvist <tml@iki.fi>
* gtk/gtk.def: Add a missing entry. (#135982, J. Ali Harlow)
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 16aab9aad2..9999bbafce 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,16 @@
+Tue Mar 2 23:39:55 2004 Jonathan Blandford <jrb@gnome.org>
+
+ * gtk/gtkfilechooserdialog.c
+ (file_chooser_widget_default_realized_size_changed): Split
+ function into realized and unrealized variants, and consolidate
+ the handling fo size-changing and default changing.
+
+ * gtk/gtkfilechooserembed.[ch] (gtk_file_chooser_embed_class_init):
+ remove resizable-hints-changed, as it just complicated things.
+
+ * gtk/gtkfilechooserdefault.c (update_appearance): Don't emit
+ resizable-hints-changed.
+
2004-03-03 Tor Lillqvist <tml@iki.fi>
* gtk/gtk.def: Add a missing entry. (#135982, J. Ali Harlow)
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 16aab9aad2..9999bbafce 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,16 @@
+Tue Mar 2 23:39:55 2004 Jonathan Blandford <jrb@gnome.org>
+
+ * gtk/gtkfilechooserdialog.c
+ (file_chooser_widget_default_realized_size_changed): Split
+ function into realized and unrealized variants, and consolidate
+ the handling fo size-changing and default changing.
+
+ * gtk/gtkfilechooserembed.[ch] (gtk_file_chooser_embed_class_init):
+ remove resizable-hints-changed, as it just complicated things.
+
+ * gtk/gtkfilechooserdefault.c (update_appearance): Don't emit
+ resizable-hints-changed.
+
2004-03-03 Tor Lillqvist <tml@iki.fi>
* gtk/gtk.def: Add a missing entry. (#135982, J. Ali Harlow)
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 16aab9aad2..9999bbafce 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,16 @@
+Tue Mar 2 23:39:55 2004 Jonathan Blandford <jrb@gnome.org>
+
+ * gtk/gtkfilechooserdialog.c
+ (file_chooser_widget_default_realized_size_changed): Split
+ function into realized and unrealized variants, and consolidate
+ the handling fo size-changing and default changing.
+
+ * gtk/gtkfilechooserembed.[ch] (gtk_file_chooser_embed_class_init):
+ remove resizable-hints-changed, as it just complicated things.
+
+ * gtk/gtkfilechooserdefault.c (update_appearance): Don't emit
+ resizable-hints-changed.
+
2004-03-03 Tor Lillqvist <tml@iki.fi>
* gtk/gtk.def: Add a missing entry. (#135982, J. Ali Harlow)
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c
index ca0d7c1c1f..8502230202 100644
--- a/gtk/gtkfilechooserdefault.c
+++ b/gtk/gtkfilechooserdefault.c
@@ -2384,7 +2384,6 @@ update_appearance (GtkFileChooserDefault *impl)
}
g_signal_emit_by_name (impl, "default-size-changed");
- g_signal_emit_by_name (impl, "resizable-hints-changed");
}
static void
diff --git a/gtk/gtkfilechooserdialog.c b/gtk/gtkfilechooserdialog.c
index 8ba2804adb..4aa02b93ee 100644
--- a/gtk/gtkfilechooserdialog.c
+++ b/gtk/gtkfilechooserdialog.c
@@ -36,6 +36,8 @@ struct _GtkFileChooserDialogPrivate
/* for use with GtkFileChooserEmbed */
gint default_width;
gint default_height;
+ gboolean resize_horizontally;
+ gboolean resize_vertically;
};
#define GTK_FILE_CHOOSER_DIALOG_GET_PRIVATE(o) (GTK_FILE_CHOOSER_DIALOG (o)->priv)
@@ -127,6 +129,8 @@ gtk_file_chooser_dialog_init (GtkFileChooserDialog *dialog)
dialog->priv = priv;
dialog->priv->default_width = -1;
dialog->priv->default_height = -1;
+ dialog->priv->resize_horizontally = TRUE;
+ dialog->priv->resize_vertically = TRUE;
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
}
@@ -150,25 +154,17 @@ file_chooser_widget_file_activated (GtkFileChooser *chooser,
}
static void
-file_chooser_widget_resizable_hints_changed (GtkWidget *widget,
- GtkFileChooserDialog *dialog)
+file_chooser_widget_update_hints (GtkFileChooserDialog *dialog)
{
GtkFileChooserDialogPrivate *priv;
- gboolean resize_horizontally;
- gboolean resize_vertically;
GdkGeometry geometry;
priv = GTK_FILE_CHOOSER_DIALOG_GET_PRIVATE (dialog);
- _gtk_file_chooser_embed_get_resizable_hints (GTK_FILE_CHOOSER_EMBED (priv->widget),
- &resize_horizontally,
- &resize_vertically);
-
-
geometry.min_width = -1;
geometry.min_height = -1;
- geometry.max_width = (resize_horizontally?G_MAXSHORT:-1);
- geometry.max_height = (resize_vertically?G_MAXSHORT:-1);
+ geometry.max_width = (priv->resize_horizontally?G_MAXSHORT:-1);
+ geometry.max_height = (priv->resize_vertically?G_MAXSHORT:-1);
gtk_window_set_geometry_hints (GTK_WINDOW (dialog), NULL,
&geometry,
@@ -176,66 +172,131 @@ file_chooser_widget_resizable_hints_changed (GtkWidget *widget,
}
static void
-file_chooser_widget_default_size_changed (GtkWidget *widget,
- GtkFileChooserDialog *dialog)
+file_chooser_widget_default_realized_size_changed (GtkWidget *widget,
+ GtkFileChooserDialog *dialog)
{
GtkFileChooserDialogPrivate *priv;
- gint extra_width;
- gint extra_height;
- gint width, height;
+ gint width;
+ gint height;
+ gint default_width, default_height;
GtkRequisition req;
gboolean resize_horizontally;
gboolean resize_vertically;
+ gboolean update_hints;
+ gint dx = 0, dy = 0;
+ gint cur_width, cur_height;
priv = GTK_FILE_CHOOSER_DIALOG_GET_PRIVATE (dialog);
/* Force a size request of everything before we start. This will make sure
* that widget->requisition is meaningful. */
gtk_widget_size_request (GTK_WIDGET (dialog), &req);
-
- /* Determine how much space the rest of the dialog uses compared to priv->widget */
- extra_width = GTK_WIDGET (dialog)->requisition.width - priv->widget->requisition.width;
- extra_height = GTK_WIDGET (dialog)->requisition.height - priv->widget->requisition.height;
-
+ gtk_window_get_size (GTK_WINDOW (dialog), &cur_width, &cur_height);
+ width = GTK_WIDGET (dialog)->requisition.width - priv->widget->requisition.width;
+ height = GTK_WIDGET (dialog)->requisition.height - priv->widget->requisition.height;
_gtk_file_chooser_embed_get_default_size (GTK_FILE_CHOOSER_EMBED (priv->widget),
- &width, &height);
+ &default_width, &default_height);
- width = extra_width + width;
- height = extra_height + height;
+ /* Ideal target size modulo any resizing */
+ width = default_width + width;
+ height = default_height + height;
- /* FIXME: We should make sure that we arent' bigger than the current screen */
- if (GTK_WIDGET_REALIZED (dialog) &&
- priv->default_width > 0 &&
- priv->default_height > 0)
+ /* Now, we test for resizability */
+ update_hints = FALSE;
+ _gtk_file_chooser_embed_get_resizable_hints (GTK_FILE_CHOOSER_EMBED (priv->widget),
+ &resize_horizontally,
+ &resize_vertically);
+ resize_vertically = (!! resize_vertically); /* normalize */
+ resize_horizontally = (!! resize_horizontally);
+
+ if (resize_horizontally && priv->resize_horizontally)
+ {
+ dx = default_width - priv->default_width;
+ priv->default_width = default_width;
+ }
+ else if (resize_horizontally && ! priv->resize_horizontally)
+ {
+ /* We restore to the ideal size + any change in default_size (which is not
+ * expected). It would be nicer to store the older size to restore to in
+ * the future. */
+ dx = default_width - priv->default_width;
+ dx += width - cur_width;
+ priv->default_width = default_width;
+ update_hints = TRUE;
+ }
+ else
+ {
+ update_hints = TRUE;
+ }
+
+ if (resize_vertically && priv->resize_vertically)
+ {
+ dy = default_height - priv->default_height;
+ priv->default_height = default_height;
+ }
+ else if (resize_vertically && ! priv->resize_vertically)
+ {
+ dy = default_height - priv->default_height;
+ dy += height - cur_height;
+ priv->default_height = default_height;
+ update_hints = TRUE;
+ }
+ else
{
- gint cur_width, cur_height;
- gint dx, dy;
+ update_hints = TRUE;
+ }
- gtk_window_get_size (GTK_WINDOW (dialog), &cur_width, &cur_height);
+ priv->resize_horizontally = resize_horizontally;
+ priv->resize_vertically = resize_vertically;
- dx = width - priv->default_width;
- dy = height - priv->default_height;
+ /* FIXME: We should make sure that we arent' bigger than the current screen */
+ if (dx != 0 || dy != 0)
+ {
gtk_window_resize (GTK_WINDOW (dialog),
cur_width + dx,
cur_height + dy);
}
- else
- {
- gtk_window_resize (GTK_WINDOW (dialog), width, height);
- }
-
- _gtk_file_chooser_embed_get_resizable_hints (GTK_FILE_CHOOSER_EMBED (priv->widget),
- &resize_horizontally,
- &resize_vertically);
/* Only store the size if we can resize in that direction. */
- if (resize_horizontally)
- priv->default_width = width;
- if (resize_vertically)
- priv->default_height = height;
+ if (update_hints)
+ file_chooser_widget_update_hints (dialog);
}
+static void
+file_chooser_widget_default_unrealized_size_changed (GtkWidget *widget,
+ GtkFileChooserDialog *dialog)
+{
+ GtkFileChooserDialogPrivate *priv;
+ GtkRequisition req;
+ gint width, height;
+
+ priv = GTK_FILE_CHOOSER_DIALOG_GET_PRIVATE (dialog);
+ gtk_widget_size_request (GTK_WIDGET (dialog), &req);
+
+ _gtk_file_chooser_embed_get_resizable_hints (GTK_FILE_CHOOSER_EMBED (priv->widget),
+ &(priv->resize_horizontally),
+ &(priv->resize_vertically));
+ _gtk_file_chooser_embed_get_default_size (GTK_FILE_CHOOSER_EMBED (priv->widget),
+ &(priv->default_width), &(priv->default_height));
+
+ /* Determine how much space the rest of the dialog uses compared to priv->widget */
+ width = priv->default_width + GTK_WIDGET (dialog)->requisition.width - priv->widget->requisition.width;
+ height = priv->default_height + GTK_WIDGET (dialog)->requisition.height - priv->widget->requisition.height;
+
+ gtk_window_set_default_size (GTK_WINDOW (dialog), width, height);
+ file_chooser_widget_update_hints (dialog);
+}
+static void
+file_chooser_widget_default_size_changed (GtkWidget *widget,
+ GtkFileChooserDialog *dialog)
+{
+ if (GTK_WIDGET_REALIZED (dialog))
+ file_chooser_widget_default_realized_size_changed (widget, dialog);
+ else
+ file_chooser_widget_default_unrealized_size_changed (widget, dialog);
+}
+
static GObject*
gtk_file_chooser_dialog_constructor (GType type,
guint n_construct_properties,
@@ -262,8 +323,6 @@ gtk_file_chooser_dialog_constructor (GType type,
G_CALLBACK (file_chooser_widget_file_activated), object);
g_signal_connect (priv->widget, "default-size-changed",
G_CALLBACK (file_chooser_widget_default_size_changed), object);
- g_signal_connect (priv->widget, "resizable-hints-changed",
- G_CALLBACK (file_chooser_widget_resizable_hints_changed), object);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (object)->vbox), priv->widget, TRUE, TRUE, 0);
gtk_widget_show (priv->widget);
diff --git a/gtk/gtkfilechooserembed.c b/gtk/gtkfilechooserembed.c
index 72072408b5..61a48fff56 100644
--- a/gtk/gtkfilechooserembed.c
+++ b/gtk/gtkfilechooserembed.c
@@ -10,8 +10,6 @@ static void delegate_get_resizable_hints (GtkFileChooserEmbed *chooser_embe
gboolean *resize_vertically);
static void delegate_default_size_changed (GtkFileChooserEmbed *chooser_embed,
gpointer data);
-static void delegate_resizable_hints_changed (GtkFileChooserEmbed *chooser_embed,
- gpointer data);
static GtkFileChooserEmbed *
get_delegate (GtkFileChooserEmbed *receiver)
@@ -56,8 +54,6 @@ _gtk_file_chooser_embed_set_delegate (GtkFileChooserEmbed *receiver,
g_signal_connect (delegate, "default_size_changed",
G_CALLBACK (delegate_default_size_changed), receiver);
- g_signal_connect (delegate, "resizable_hints_changed",
- G_CALLBACK (delegate_resizable_hints_changed), receiver);
}
@@ -85,13 +81,6 @@ delegate_default_size_changed (GtkFileChooserEmbed *chooser_embed,
g_signal_emit_by_name (data, "default-size-changed");
}
-static void
-delegate_resizable_hints_changed (GtkFileChooserEmbed *chooser_embed,
- gpointer data)
-{
- g_signal_emit_by_name (data, "resizable-hints-changed");
-}
-
/* publicly callable functions */
@@ -132,13 +121,6 @@ gtk_file_chooser_embed_class_init (gpointer g_iface)
NULL, NULL,
_gtk_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- g_signal_new ("resizable-hints-changed",
- iface_type,
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GtkFileChooserEmbedIface, resizable_hints_changed),
- NULL, NULL,
- _gtk_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
}
void
diff --git a/gtk/gtkfilechooserembed.h b/gtk/gtkfilechooserembed.h
index a44f72b20d..e41c7f86cc 100644
--- a/gtk/gtkfilechooserembed.h
+++ b/gtk/gtkfilechooserembed.h
@@ -49,7 +49,6 @@ struct _GtkFileChooserEmbedIface
/* Signals
*/
void (*default_size_changed) (GtkFileChooserEmbed *chooser_embed);
- void (*resizable_hints_changed) (GtkFileChooserEmbed *chooser_embed);
};
GType _gtk_file_chooser_embed_get_type (void);
diff --git a/tests/testfilechooser.c b/tests/testfilechooser.c
index d6f0a1cfb7..6e43ac8b12 100644
--- a/tests/testfilechooser.c
+++ b/tests/testfilechooser.c
@@ -356,7 +356,7 @@ main (int argc, char **argv)
dialog = g_object_new (GTK_TYPE_FILE_CHOOSER_DIALOG,
"action", action,
- "file-system-backend", "gnome-vfs",
+ "file-system-backend", "gtk+",
NULL);
switch (action)
{