filechooserbutton: Use a bin layout

This commit is contained in:
Timm Bäder 2019-05-03 08:04:39 +02:00 committed by Timm Bäder
parent bd490ed511
commit c675d1c9e1

View File

@ -49,6 +49,7 @@
#include "gtkfilechooserprivate.h" #include "gtkfilechooserprivate.h"
#include "gtkfilechooserutils.h" #include "gtkfilechooserutils.h"
#include "gtkmarshalers.h" #include "gtkmarshalers.h"
#include "gtkbinlayout.h"
#include "gtkfilechooserbutton.h" #include "gtkfilechooserbutton.h"
@ -339,41 +340,6 @@ G_DEFINE_TYPE_WITH_CODE (GtkFileChooserButton, gtk_file_chooser_button, GTK_TYPE
G_IMPLEMENT_INTERFACE (GTK_TYPE_FILE_CHOOSER, G_IMPLEMENT_INTERFACE (GTK_TYPE_FILE_CHOOSER,
gtk_file_chooser_button_file_chooser_iface_init)) gtk_file_chooser_button_file_chooser_iface_init))
static void
gtk_file_chooser_button_measure (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline)
{
GtkFileChooserButton *button = GTK_FILE_CHOOSER_BUTTON (widget);
GtkFileChooserButtonPrivate *priv = gtk_file_chooser_button_get_instance_private (button);
gtk_widget_measure (priv->child, orientation, for_size,
minimum, natural,
minimum_baseline, natural_baseline);
}
static void
gtk_file_chooser_button_size_allocate (GtkWidget *widget,
int width,
int height,
int baseline)
{
GtkFileChooserButton *button = GTK_FILE_CHOOSER_BUTTON (widget);
GtkFileChooserButtonPrivate *priv = gtk_file_chooser_button_get_instance_private (button);
gtk_widget_size_allocate (priv->child,
&(GtkAllocation) {
0, 0,
width, height
}, baseline);
}
static void static void
gtk_file_chooser_button_class_init (GtkFileChooserButtonClass * class) gtk_file_chooser_button_class_init (GtkFileChooserButtonClass * class)
{ {
@ -397,8 +363,6 @@ gtk_file_chooser_button_class_init (GtkFileChooserButtonClass * class)
widget_class->root = gtk_file_chooser_button_root; widget_class->root = gtk_file_chooser_button_root;
widget_class->mnemonic_activate = gtk_file_chooser_button_mnemonic_activate; widget_class->mnemonic_activate = gtk_file_chooser_button_mnemonic_activate;
widget_class->state_flags_changed = gtk_file_chooser_button_state_flags_changed; widget_class->state_flags_changed = gtk_file_chooser_button_state_flags_changed;
widget_class->measure = gtk_file_chooser_button_measure;
widget_class->size_allocate = gtk_file_chooser_button_size_allocate;
/** /**
* GtkFileChooserButton::file-set: * GtkFileChooserButton::file-set:
@ -533,6 +497,8 @@ gtk_file_chooser_button_init (GtkFileChooserButton *button)
target_list, target_list,
GDK_ACTION_COPY); GDK_ACTION_COPY);
gdk_content_formats_unref (target_list); gdk_content_formats_unref (target_list);
gtk_widget_set_layout_manager (GTK_WIDGET (button), gtk_bin_layout_new ());
} }