Add g_return_if_fail() (_gtk_file_chooser_embed_get_resizable_hints): Add

Sun Feb 29 01:51:27 2004  Jonathan Blandford  <jrb@gnome.org>

        * gtk/gtkfilechooserembed.c
        (_gtk_file_chooser_embed_get_default_size):  Add g_return_if_fail()
        (_gtk_file_chooser_embed_get_resizable_hints): Add g_return_if_fail()

        * gtk/gtkfilechooserdialog.c
        (file_chooser_widget_default_size_changed): Get the correct
        initial size for the dialog.  Also, don't bother with
        gtk_window_set_default_size().  It's not really meaningful.

        * gtk/gtkfilechooserdefault.c
        (gtk_file_chooser_default_get_default_size): Get the correct
        spacing for the preview_widget
        (update_preview_widget_visibility): Clear widget field after we
        destroy it.
This commit is contained in:
Jonathan Blandford 2004-02-29 07:55:24 +00:00 committed by Jonathan Blandford
parent be1e6e6bea
commit 7359903ef0
11 changed files with 117 additions and 18 deletions

View File

@ -1,3 +1,20 @@
Sun Feb 29 01:51:27 2004 Jonathan Blandford <jrb@gnome.org>
* gtk/gtkfilechooserembed.c
(_gtk_file_chooser_embed_get_default_size): Add g_return_if_fail()
(_gtk_file_chooser_embed_get_resizable_hints): Add g_return_if_fail()
* gtk/gtkfilechooserdialog.c
(file_chooser_widget_default_size_changed): Get the correct
initial size for the dialog. Also, don't bother with
gtk_window_set_default_size(). It's not really meaningful.
* gtk/gtkfilechooserdefault.c
(gtk_file_chooser_default_get_default_size): Get the correct
spacing for the preview_widget
(update_preview_widget_visibility): Clear widget field after we
destroy it.
2004-02-29 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooserdefault.c

View File

@ -1,3 +1,20 @@
Sun Feb 29 01:51:27 2004 Jonathan Blandford <jrb@gnome.org>
* gtk/gtkfilechooserembed.c
(_gtk_file_chooser_embed_get_default_size): Add g_return_if_fail()
(_gtk_file_chooser_embed_get_resizable_hints): Add g_return_if_fail()
* gtk/gtkfilechooserdialog.c
(file_chooser_widget_default_size_changed): Get the correct
initial size for the dialog. Also, don't bother with
gtk_window_set_default_size(). It's not really meaningful.
* gtk/gtkfilechooserdefault.c
(gtk_file_chooser_default_get_default_size): Get the correct
spacing for the preview_widget
(update_preview_widget_visibility): Clear widget field after we
destroy it.
2004-02-29 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooserdefault.c

View File

@ -1,3 +1,20 @@
Sun Feb 29 01:51:27 2004 Jonathan Blandford <jrb@gnome.org>
* gtk/gtkfilechooserembed.c
(_gtk_file_chooser_embed_get_default_size): Add g_return_if_fail()
(_gtk_file_chooser_embed_get_resizable_hints): Add g_return_if_fail()
* gtk/gtkfilechooserdialog.c
(file_chooser_widget_default_size_changed): Get the correct
initial size for the dialog. Also, don't bother with
gtk_window_set_default_size(). It's not really meaningful.
* gtk/gtkfilechooserdefault.c
(gtk_file_chooser_default_get_default_size): Get the correct
spacing for the preview_widget
(update_preview_widget_visibility): Clear widget field after we
destroy it.
2004-02-29 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooserdefault.c

View File

@ -1,3 +1,20 @@
Sun Feb 29 01:51:27 2004 Jonathan Blandford <jrb@gnome.org>
* gtk/gtkfilechooserembed.c
(_gtk_file_chooser_embed_get_default_size): Add g_return_if_fail()
(_gtk_file_chooser_embed_get_resizable_hints): Add g_return_if_fail()
* gtk/gtkfilechooserdialog.c
(file_chooser_widget_default_size_changed): Get the correct
initial size for the dialog. Also, don't bother with
gtk_window_set_default_size(). It's not really meaningful.
* gtk/gtkfilechooserdefault.c
(gtk_file_chooser_default_get_default_size): Get the correct
spacing for the preview_widget
(update_preview_widget_visibility): Clear widget field after we
destroy it.
2004-02-29 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooserdefault.c

View File

@ -1,3 +1,20 @@
Sun Feb 29 01:51:27 2004 Jonathan Blandford <jrb@gnome.org>
* gtk/gtkfilechooserembed.c
(_gtk_file_chooser_embed_get_default_size): Add g_return_if_fail()
(_gtk_file_chooser_embed_get_resizable_hints): Add g_return_if_fail()
* gtk/gtkfilechooserdialog.c
(file_chooser_widget_default_size_changed): Get the correct
initial size for the dialog. Also, don't bother with
gtk_window_set_default_size(). It's not really meaningful.
* gtk/gtkfilechooserdefault.c
(gtk_file_chooser_default_get_default_size): Get the correct
spacing for the preview_widget
(update_preview_widget_visibility): Clear widget field after we
destroy it.
2004-02-29 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooserdefault.c

View File

@ -94,7 +94,6 @@ an application.)
@list: the list shown in the drop-down window.
@Deprecated: Use #GtkComboBox instead.
<!-- ##### ARG GtkCombo:allow-empty ##### -->
<para>

View File

@ -200,6 +200,11 @@ update_preview_cb (GtkFileChooser *file_chooser, gpointer data)
</para>
<!-- ##### ARG GtkFileChooser:use-preview-label ##### -->
<para>
</para>
<!-- ##### ENUM GtkFileChooserAction ##### -->
<para>
Describes whether a #GtkFileChooser is being used to open

View File

@ -37,7 +37,6 @@ should be accessed using the functions below.
@Deprecated: Use #GtkComboBox instead.
<!-- ##### SIGNAL GtkOptionMenu::changed ##### -->
<para>

View File

@ -72,7 +72,6 @@ typedef struct _GtkFileChooserDefaultClass GtkFileChooserDefaultClass;
#define GTK_IS_FILE_CHOOSER_DEFAULT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FILE_CHOOSER_DEFAULT))
#define GTK_FILE_CHOOSER_DEFAULT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FILE_CHOOSER_DEFAULT, GtkFileChooserDefaultClass))
#define PREVIEW_HBOX_SPACING 12
struct _GtkFileChooserDefaultClass
{
@ -207,6 +206,9 @@ typedef enum {
/* Standard icon size */
/* FIXME: maybe this should correspond to the font size in the tree views... */
#define ICON_SIZE 20
#define PREVIEW_HBOX_SPACING 12
#define NUM_LINES 40
#define NUM_CHARS 60
static void gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class);
static void gtk_file_chooser_default_iface_init (GtkFileChooserIface *iface);
@ -639,7 +641,10 @@ update_preview_widget_visibility (GtkFileChooserDefault *impl)
else
{
if (impl->preview_label)
gtk_widget_destroy (impl->preview_label);
{
gtk_widget_destroy (impl->preview_label);
impl->preview_label = NULL;
}
}
if (impl->preview_widget_active && impl->preview_widget)
@ -2186,6 +2191,7 @@ update_appearance (GtkFileChooserDefault *impl)
gtk_widget_hide (impl->save_extra_align);
gtk_widget_hide (impl->browse_extra_align);
}
g_signal_emit_by_name (impl, "default-size-changed");
}
@ -2342,7 +2348,7 @@ static void
gtk_file_chooser_default_style_set (GtkWidget *widget,
GtkStyle *previous_style)
{
if (GTK_WIDGET_CLASS (parent_class)->style_set)
if (GTK_WIDGET_CLASS (parent_class)->style_set)
GTK_WIDGET_CLASS (parent_class)->style_set (widget, previous_style);
g_signal_emit_by_name (widget, "default-size-changed");
@ -3094,9 +3100,6 @@ gtk_file_chooser_default_list_shortcut_folders (GtkFileChooser *chooser)
return g_slist_reverse (list);
}
#define NUM_LINES 40
#define NUM_CHARS 50
/* Guesses a size based upon font sizes */
static void
find_good_size_from_style (GtkWidget *widget,
@ -3145,7 +3148,7 @@ gtk_file_chooser_default_get_default_size (GtkFileChooserEmbed *chooser_embed,
find_good_size_from_style (GTK_WIDGET (chooser_embed), default_width, default_height);
if (impl->preview_widget_active && impl->preview_widget)
*default_width += impl->preview_widget->requisition.width + PREVIEW_HBOX_SPACING;
*default_width += impl->preview_box->requisition.width + PREVIEW_HBOX_SPACING;
}
static void

View File

@ -27,9 +27,6 @@
#include <stdarg.h>
#define NUM_LINES 40
#define NUM_CHARS 50
struct _GtkFileChooserDialogPrivate
{
GtkWidget *widget;
@ -59,8 +56,8 @@ static void gtk_file_chooser_dialog_get_property (GObject *obj
GValue *value,
GParamSpec *pspec);
static void gtk_file_chooser_dialog_style_set (GtkWidget *widget,
GtkStyle *previous_style);
static void gtk_file_chooser_dialog_style_set (GtkWidget *widget,
GtkStyle *previous_style);
static GObjectClass *parent_class;
@ -160,9 +157,14 @@ file_chooser_widget_default_size_changed (GtkWidget *widget,
gint extra_width;
gint extra_height;
gint width, height;
GtkRequisition req;
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;
@ -173,7 +175,6 @@ file_chooser_widget_default_size_changed (GtkWidget *widget,
width = extra_width + width;
height = extra_height + height;
/* g_print ("file_chooser_widget_default_size_changed: %d %d\n", width, height);*/
/* FIXME: We should make sure that we arent' bigger than the current screen */
if (GTK_WIDGET_REALIZED (dialog) &&
priv->default_width > 0 &&
@ -183,6 +184,7 @@ file_chooser_widget_default_size_changed (GtkWidget *widget,
gint dx, dy;
gtk_window_get_size (GTK_WINDOW (dialog), &cur_width, &cur_height);
dx = width - priv->default_width;
dy = height - priv->default_height;
gtk_window_resize (GTK_WINDOW (dialog),
@ -191,7 +193,7 @@ file_chooser_widget_default_size_changed (GtkWidget *widget,
}
else
{
gtk_window_set_default_size (GTK_WINDOW (dialog), width, height);
gtk_window_resize (GTK_WINDOW (dialog), width, height);
}
priv->default_width = width;
priv->default_height = height;
@ -268,6 +270,7 @@ gtk_file_chooser_dialog_get_property (GObject *object,
g_object_get_property (G_OBJECT (priv->widget), pspec->name, value);
}
#if 0
static void
set_default_size (GtkFileChooserDialog *dialog)
{
@ -316,6 +319,7 @@ set_default_size (GtkFileChooserDialog *dialog)
(default_width == -1) ? width : default_width,
(default_height == -1) ? height : default_height);
}
#endif
static void
gtk_file_chooser_dialog_style_set (GtkWidget *widget,

View File

@ -147,16 +147,20 @@ _gtk_file_chooser_embed_get_default_size (GtkFileChooserEmbed *chooser_embed,
gint *default_height)
{
g_return_if_fail (GTK_IS_FILE_CHOOSER_EMBED (chooser_embed));
g_return_if_fail (default_width != NULL);
g_return_if_fail (default_height != NULL);
GTK_FILE_CHOOSER_EMBED_GET_IFACE (chooser_embed)->get_default_size (chooser_embed, default_width, default_height);
}
void
_gtk_file_chooser_embed_get_resizable_hints (GtkFileChooserEmbed *chooser_embed,
gboolean *resize_horizontally,
gboolean *resize_vertically)
gboolean *resize_horizontally,
gboolean *resize_vertically)
{
g_return_if_fail (GTK_IS_FILE_CHOOSER_EMBED (chooser_embed));
g_return_if_fail (resize_horizontally != NULL);
g_return_if_fail (resize_vertically != NULL);
GTK_FILE_CHOOSER_EMBED_GET_IFACE (chooser_embed)->get_resizable_hints (chooser_embed, resize_horizontally, resize_vertically);
}