Lines 272-277
Link Here
|
272 |
GtkStyle *previous_style); |
272 |
GtkStyle *previous_style); |
273 |
static void gtk_file_chooser_default_screen_changed (GtkWidget *widget, |
273 |
static void gtk_file_chooser_default_screen_changed (GtkWidget *widget, |
274 |
GdkScreen *previous_screen); |
274 |
GdkScreen *previous_screen); |
|
|
275 |
static void gtk_file_chooser_default_size_allocate (GtkWidget *widget, |
276 |
GtkAllocation *allocation); |
275 |
|
277 |
|
276 |
static gboolean gtk_file_chooser_default_set_current_folder (GtkFileChooser *chooser, |
278 |
static gboolean gtk_file_chooser_default_set_current_folder (GtkFileChooser *chooser, |
277 |
const GtkFilePath *path, |
279 |
const GtkFilePath *path, |
Lines 310-318
Link Here
|
310 |
static void gtk_file_chooser_default_get_default_size (GtkFileChooserEmbed *chooser_embed, |
312 |
static void gtk_file_chooser_default_get_default_size (GtkFileChooserEmbed *chooser_embed, |
311 |
gint *default_width, |
313 |
gint *default_width, |
312 |
gint *default_height); |
314 |
gint *default_height); |
313 |
static void gtk_file_chooser_default_get_resizable_hints (GtkFileChooserEmbed *chooser_embed, |
315 |
static gboolean gtk_file_chooser_default_get_resizable (GtkFileChooserEmbed *chooser_embed); |
314 |
gboolean *resize_horizontally, |
|
|
315 |
gboolean *resize_vertically); |
316 |
static gboolean gtk_file_chooser_default_should_respond (GtkFileChooserEmbed *chooser_embed); |
316 |
static gboolean gtk_file_chooser_default_should_respond (GtkFileChooserEmbed *chooser_embed); |
317 |
static void gtk_file_chooser_default_initial_focus (GtkFileChooserEmbed *chooser_embed); |
317 |
static void gtk_file_chooser_default_initial_focus (GtkFileChooserEmbed *chooser_embed); |
318 |
|
318 |
|
Lines 423-429
Link Here
|
423 |
static void location_button_toggled_cb (GtkToggleButton *toggle, |
423 |
static void location_button_toggled_cb (GtkToggleButton *toggle, |
424 |
GtkFileChooserDefault *impl); |
424 |
GtkFileChooserDefault *impl); |
425 |
static void location_switch_to_path_bar (GtkFileChooserDefault *impl); |
425 |
static void location_switch_to_path_bar (GtkFileChooserDefault *impl); |
426 |
|
426 |
static void settings_load (GtkFileChooserDefault *impl); |
427 |
|
427 |
|
428 |
|
428 |
|
429 |
|
429 |
|
Lines 485-490
Link Here
|
485 |
widget_class->hierarchy_changed = gtk_file_chooser_default_hierarchy_changed; |
485 |
widget_class->hierarchy_changed = gtk_file_chooser_default_hierarchy_changed; |
486 |
widget_class->style_set = gtk_file_chooser_default_style_set; |
486 |
widget_class->style_set = gtk_file_chooser_default_style_set; |
487 |
widget_class->screen_changed = gtk_file_chooser_default_screen_changed; |
487 |
widget_class->screen_changed = gtk_file_chooser_default_screen_changed; |
|
|
488 |
widget_class->size_allocate = gtk_file_chooser_default_size_allocate; |
488 |
|
489 |
|
489 |
signals[LOCATION_POPUP] = |
490 |
signals[LOCATION_POPUP] = |
490 |
_gtk_binding_signal_new (I_("location-popup"), |
491 |
_gtk_binding_signal_new (I_("location-popup"), |
Lines 665-671
Link Here
|
665 |
gtk_file_chooser_embed_default_iface_init (GtkFileChooserEmbedIface *iface) |
666 |
gtk_file_chooser_embed_default_iface_init (GtkFileChooserEmbedIface *iface) |
666 |
{ |
667 |
{ |
667 |
iface->get_default_size = gtk_file_chooser_default_get_default_size; |
668 |
iface->get_default_size = gtk_file_chooser_default_get_default_size; |
668 |
iface->get_resizable_hints = gtk_file_chooser_default_get_resizable_hints; |
669 |
iface->get_resizable = gtk_file_chooser_default_get_resizable; |
669 |
iface->should_respond = gtk_file_chooser_default_should_respond; |
670 |
iface->should_respond = gtk_file_chooser_default_should_respond; |
670 |
iface->initial_focus = gtk_file_chooser_default_initial_focus; |
671 |
iface->initial_focus = gtk_file_chooser_default_initial_focus; |
671 |
} |
672 |
} |
Lines 4998-5003
Link Here
|
4998 |
} |
4999 |
} |
4999 |
impl->action = action; |
5000 |
impl->action = action; |
5000 |
update_appearance (impl); |
5001 |
update_appearance (impl); |
|
|
5002 |
settings_load (impl); |
5001 |
} |
5003 |
} |
5002 |
} |
5004 |
} |
5003 |
break; |
5005 |
break; |
Lines 5419-5424
Link Here
|
5419 |
profile_end ("end", NULL); |
5421 |
profile_end ("end", NULL); |
5420 |
} |
5422 |
} |
5421 |
|
5423 |
|
|
|
5424 |
static void |
5425 |
gtk_file_chooser_default_size_allocate (GtkWidget *widget, |
5426 |
GtkAllocation *allocation) |
5427 |
{ |
5428 |
GtkFileChooserDefault *impl; |
5429 |
|
5430 |
impl = GTK_FILE_CHOOSER_DEFAULT (widget); |
5431 |
|
5432 |
GTK_WIDGET_CLASS (_gtk_file_chooser_default_parent_class)->size_allocate (widget, allocation); |
5433 |
|
5434 |
if (!gtk_file_chooser_default_get_resizable (GTK_FILE_CHOOSER_EMBED (impl))) |
5435 |
{ |
5436 |
/* The dialog is not resizable, we shouldn't |
5437 |
* trust in the size it has in this stage |
5438 |
*/ |
5439 |
return; |
5440 |
} |
5441 |
|
5442 |
impl->default_width = allocation->width; |
5443 |
impl->default_height = allocation->height; |
5444 |
|
5445 |
if (impl->preview_widget_active && |
5446 |
impl->preview_widget && |
5447 |
GTK_WIDGET_DRAWABLE (impl->preview_widget)) |
5448 |
impl->default_width -= impl->preview_widget->allocation.width + PREVIEW_HBOX_SPACING; |
5449 |
|
5450 |
if (impl->extra_widget && |
5451 |
GTK_WIDGET_DRAWABLE (impl->extra_widget)) |
5452 |
impl->default_height -= GTK_BOX (widget)->spacing + impl->extra_widget->allocation.height; |
5453 |
} |
5454 |
|
5422 |
static gboolean |
5455 |
static gboolean |
5423 |
get_is_file_filtered (GtkFileChooserDefault *impl, |
5456 |
get_is_file_filtered (GtkFileChooserDefault *impl, |
5424 |
const GtkFilePath *path, |
5457 |
const GtkFilePath *path, |
Lines 7186-7234
Link Here
|
7186 |
gint *height) |
7219 |
gint *height) |
7187 |
{ |
7220 |
{ |
7188 |
GtkFileChooserDefault *impl; |
7221 |
GtkFileChooserDefault *impl; |
7189 |
gint default_width, default_height; |
|
|
7190 |
int font_size; |
7222 |
int font_size; |
7191 |
GtkRequisition req; |
|
|
7192 |
GdkScreen *screen; |
7223 |
GdkScreen *screen; |
7193 |
double resolution; |
7224 |
double resolution; |
7194 |
|
7225 |
|
7195 |
g_assert (widget->style != NULL); |
7226 |
g_assert (widget->style != NULL); |
7196 |
impl = GTK_FILE_CHOOSER_DEFAULT (widget); |
7227 |
impl = GTK_FILE_CHOOSER_DEFAULT (widget); |
7197 |
|
7228 |
|
7198 |
screen = gtk_widget_get_screen (widget); |
7229 |
if (impl->default_width == 0 && |
7199 |
if (screen) |
7230 |
impl->default_height == 0) |
7200 |
{ |
7231 |
{ |
7201 |
resolution = gdk_screen_get_resolution (screen); |
7232 |
screen = gtk_widget_get_screen (widget); |
7202 |
if (resolution < 0.0) /* will be -1 if the resolution is not defined in the GdkScreen */ |
7233 |
if (screen) |
7203 |
resolution = 96.0; |
7234 |
{ |
7204 |
} |
7235 |
resolution = gdk_screen_get_resolution (screen); |
7205 |
else |
7236 |
if (resolution < 0.0) /* will be -1 if the resolution is not defined in the GdkScreen */ |
7206 |
resolution = 96.0; /* wheeee */ |
7237 |
resolution = 96.0; |
7207 |
|
7238 |
} |
7208 |
font_size = pango_font_description_get_size (widget->style->font_desc); |
7239 |
else |
7209 |
font_size = PANGO_PIXELS (font_size) * resolution / 72.0; |
7240 |
resolution = 96.0; /* wheeee */ |
7210 |
|
7241 |
|
7211 |
default_width = font_size * NUM_CHARS; |
7242 |
font_size = pango_font_description_get_size (widget->style->font_desc); |
7212 |
default_height = font_size * NUM_LINES; |
7243 |
font_size = PANGO_PIXELS (font_size) * resolution / 72.0; |
7213 |
|
7244 |
|
7214 |
if (impl->preview_widget_active && impl->preview_widget) |
7245 |
impl->default_width = font_size * NUM_CHARS; |
7215 |
{ |
7246 |
impl->default_height = font_size * NUM_LINES; |
7216 |
gtk_widget_size_request (impl->preview_box, &req); |
|
|
7217 |
default_width += PREVIEW_HBOX_SPACING + req.width; |
7218 |
} |
7247 |
} |
7219 |
|
7248 |
|
7220 |
if (impl->extra_widget) |
7249 |
*width = impl->default_width; |
7221 |
{ |
7250 |
*height = impl->default_height; |
7222 |
gtk_widget_size_request (impl->extra_align, &req); |
|
|
7223 |
default_height += GTK_BOX (widget)->spacing + req.height; |
7224 |
} |
7225 |
|
7226 |
gtk_widget_size_request (widget, &req); |
7227 |
default_width = MAX (default_width, req.width); |
7228 |
default_height = MAX (default_height, req.height); |
7229 |
|
7230 |
*width = default_width; |
7231 |
*height = default_height; |
7232 |
} |
7251 |
} |
7233 |
|
7252 |
|
7234 |
static void |
7253 |
static void |
Lines 7237-7271
Link Here
|
7237 |
gint *default_height) |
7256 |
gint *default_height) |
7238 |
{ |
7257 |
{ |
7239 |
GtkFileChooserDefault *impl; |
7258 |
GtkFileChooserDefault *impl; |
|
|
7259 |
GtkRequisition req; |
7240 |
|
7260 |
|
7241 |
impl = GTK_FILE_CHOOSER_DEFAULT (chooser_embed); |
7261 |
impl = GTK_FILE_CHOOSER_DEFAULT (chooser_embed); |
7242 |
find_good_size_from_style (GTK_WIDGET (chooser_embed), default_width, default_height); |
7262 |
find_good_size_from_style (GTK_WIDGET (chooser_embed), default_width, default_height); |
|
|
7263 |
|
7264 |
if (impl->preview_widget_active && |
7265 |
impl->preview_widget && |
7266 |
GTK_WIDGET_VISIBLE (impl->preview_widget)) |
7267 |
{ |
7268 |
gtk_widget_size_request (impl->preview_box, &req); |
7269 |
*default_width += PREVIEW_HBOX_SPACING + req.width; |
7270 |
} |
7271 |
|
7272 |
if (impl->extra_widget && |
7273 |
GTK_WIDGET_VISIBLE (impl->extra_widget)) |
7274 |
{ |
7275 |
gtk_widget_size_request (impl->extra_align, &req); |
7276 |
*default_height += GTK_BOX (chooser_embed)->spacing + req.height; |
7277 |
} |
7243 |
} |
7278 |
} |
7244 |
|
7279 |
|
7245 |
static void |
7280 |
static gboolean |
7246 |
gtk_file_chooser_default_get_resizable_hints (GtkFileChooserEmbed *chooser_embed, |
7281 |
gtk_file_chooser_default_get_resizable (GtkFileChooserEmbed *chooser_embed) |
7247 |
gboolean *resize_horizontally, |
|
|
7248 |
gboolean *resize_vertically) |
7249 |
{ |
7282 |
{ |
7250 |
GtkFileChooserDefault *impl; |
7283 |
GtkFileChooserDefault *impl; |
7251 |
|
7284 |
|
7252 |
g_return_if_fail (resize_horizontally != NULL); |
|
|
7253 |
g_return_if_fail (resize_vertically != NULL); |
7254 |
|
7255 |
impl = GTK_FILE_CHOOSER_DEFAULT (chooser_embed); |
7285 |
impl = GTK_FILE_CHOOSER_DEFAULT (chooser_embed); |
7256 |
|
7286 |
|
7257 |
*resize_horizontally = TRUE; |
7287 |
return (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN || |
7258 |
*resize_vertically = TRUE; |
7288 |
impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER || |
7259 |
|
7289 |
gtk_expander_get_expanded (GTK_EXPANDER (impl->save_expander))); |
7260 |
if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE || |
|
|
7261 |
impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER) |
7262 |
{ |
7263 |
if (! gtk_expander_get_expanded (GTK_EXPANDER (impl->save_expander))) |
7264 |
{ |
7265 |
*resize_horizontally = FALSE; |
7266 |
*resize_vertically = FALSE; |
7267 |
} |
7268 |
} |
7269 |
} |
7290 |
} |
7270 |
|
7291 |
|
7271 |
struct switch_folder_closure { |
7292 |
struct switch_folder_closure { |