summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-03-29 13:18:35 +0000
committerMatthias Clasen <mclasen@redhat.com>2020-03-29 13:18:35 +0000
commitaf749dc1dc83810e6bbf0658dd608c1c1b75cb9e (patch)
treeeb2127bc7e5bb89b2426b71f6948928194acc65f
parent23b29341bae41d63a5f6078c061b6d259b4447ae (diff)
parent47982ae272d22ee0ea67477b8c090ae35a1c1650 (diff)
downloadgtk+-af749dc1dc83810e6bbf0658dd608c1c1b75cb9e.tar.gz
Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master See merge request GNOME/gtk!1583
-rw-r--r--gtk/gtkcolorchooserdialog.c54
-rw-r--r--gtk/gtkcolorchooserwidget.c164
-rw-r--r--gtk/gtkcoloreditor.c231
-rw-r--r--gtk/gtkcoloreditorprivate.h21
-rw-r--r--gtk/gtkfilechooserwidget.c2113
-rw-r--r--gtk/gtklevelbar.c261
-rw-r--r--gtk/gtklistbox.c533
-rw-r--r--gtk/gtknotebook.c1340
-rw-r--r--gtk/gtkprintjob.c274
-rw-r--r--gtk/gtkprintunixdialog.c1109
-rw-r--r--gtk/gtkspinbutton.c542
-rw-r--r--testsuite/gtk/notify.c9
12 files changed, 2938 insertions, 3713 deletions
diff --git a/gtk/gtkcolorchooserdialog.c b/gtk/gtkcolorchooserdialog.c
index b37e520dd5..4e3659c0e4 100644
--- a/gtk/gtkcolorchooserdialog.c
+++ b/gtk/gtkcolorchooserdialog.c
@@ -39,12 +39,13 @@
* a color. It implements the #GtkColorChooser interface.
*/
-typedef struct _GtkColorChooserDialogPrivate GtkColorChooserDialogPrivate;
typedef struct _GtkColorChooserDialogClass GtkColorChooserDialogClass;
struct _GtkColorChooserDialog
{
GtkDialog parent_instance;
+
+ GtkWidget *chooser;
};
struct _GtkColorChooserDialogClass
@@ -52,11 +53,6 @@ struct _GtkColorChooserDialogClass
GtkDialogClass parent_class;
};
-struct _GtkColorChooserDialogPrivate
-{
- GtkWidget *chooser;
-};
-
enum
{
PROP_ZERO,
@@ -68,7 +64,6 @@ enum
static void gtk_color_chooser_dialog_iface_init (GtkColorChooserInterface *iface);
G_DEFINE_TYPE_WITH_CODE (GtkColorChooserDialog, gtk_color_chooser_dialog, GTK_TYPE_DIALOG,
- G_ADD_PRIVATE (GtkColorChooserDialog)
G_IMPLEMENT_INTERFACE (GTK_TYPE_COLOR_CHOOSER,
gtk_color_chooser_dialog_iface_init))
@@ -137,9 +132,7 @@ gtk_color_chooser_dialog_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- GtkColorChooserDialog *cd = GTK_COLOR_CHOOSER_DIALOG (object);
- GtkColorChooserDialogPrivate *priv = gtk_color_chooser_dialog_get_instance_private (cd);
- GtkColorChooser *cc = GTK_COLOR_CHOOSER (object);
+ GtkColorChooserDialog *cc = GTK_COLOR_CHOOSER_DIALOG (object);
switch (prop_id)
{
@@ -147,17 +140,17 @@ gtk_color_chooser_dialog_get_property (GObject *object,
{
GdkRGBA color;
- gtk_color_chooser_get_rgba (cc, &color);
+ gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (cc), &color);
g_value_set_boxed (value, &color);
}
break;
case PROP_USE_ALPHA:
- g_value_set_boolean (value, gtk_color_chooser_get_use_alpha (GTK_COLOR_CHOOSER (priv->chooser)));
+ g_value_set_boolean (value, gtk_color_chooser_get_use_alpha (GTK_COLOR_CHOOSER (cc->chooser)));
break;
case PROP_SHOW_EDITOR:
{
gboolean show_editor;
- g_object_get (priv->chooser, "show-editor", &show_editor, NULL);
+ g_object_get (cc->chooser, "show-editor", &show_editor, NULL);
g_value_set_boolean (value, show_editor);
}
break;
@@ -173,24 +166,22 @@ gtk_color_chooser_dialog_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- GtkColorChooserDialog *cd = GTK_COLOR_CHOOSER_DIALOG (object);
- GtkColorChooserDialogPrivate *priv = gtk_color_chooser_dialog_get_instance_private (cd);
- GtkColorChooser *cc = GTK_COLOR_CHOOSER (object);
+ GtkColorChooserDialog *cc = GTK_COLOR_CHOOSER_DIALOG (object);
switch (prop_id)
{
case PROP_RGBA:
- gtk_color_chooser_set_rgba (cc, g_value_get_boxed (value));
+ gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (cc), g_value_get_boxed (value));
break;
case PROP_USE_ALPHA:
- if (gtk_color_chooser_get_use_alpha (GTK_COLOR_CHOOSER (priv->chooser)) != g_value_get_boolean (value))
+ if (gtk_color_chooser_get_use_alpha (GTK_COLOR_CHOOSER (cc->chooser)) != g_value_get_boolean (value))
{
- gtk_color_chooser_set_use_alpha (GTK_COLOR_CHOOSER (priv->chooser), g_value_get_boolean (value));
+ gtk_color_chooser_set_use_alpha (GTK_COLOR_CHOOSER (cc->chooser), g_value_get_boolean (value));
g_object_notify_by_pspec (object, pspec);
}
break;
case PROP_SHOW_EDITOR:
- g_object_set (priv->chooser,
+ g_object_set (cc->chooser,
"show-editor", g_value_get_boolean (value),
NULL);
break;
@@ -221,7 +212,7 @@ gtk_color_chooser_dialog_class_init (GtkColorChooserDialogClass *class)
*/
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gtk/libgtk/ui/gtkcolorchooserdialog.ui");
- gtk_widget_class_bind_template_child_private (widget_class, GtkColorChooserDialog, chooser);
+ gtk_widget_class_bind_template_child (widget_class, GtkColorChooserDialog, chooser);
gtk_widget_class_bind_template_callback (widget_class, propagate_notify);
gtk_widget_class_bind_template_callback (widget_class, color_activated_cb);
}
@@ -231,9 +222,8 @@ gtk_color_chooser_dialog_get_rgba (GtkColorChooser *chooser,
GdkRGBA *color)
{
GtkColorChooserDialog *cc = GTK_COLOR_CHOOSER_DIALOG (chooser);
- GtkColorChooserDialogPrivate *priv = gtk_color_chooser_dialog_get_instance_private (cc);
- gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (priv->chooser), color);
+ gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (cc->chooser), color);
}
static void
@@ -241,9 +231,8 @@ gtk_color_chooser_dialog_set_rgba (GtkColorChooser *chooser,
const GdkRGBA *color)
{
GtkColorChooserDialog *cc = GTK_COLOR_CHOOSER_DIALOG (chooser);
- GtkColorChooserDialogPrivate *priv = gtk_color_chooser_dialog_get_instance_private (cc);
- gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (priv->chooser), color);
+ gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (cc->chooser), color);
}
static void
@@ -254,9 +243,8 @@ gtk_color_chooser_dialog_add_palette (GtkColorChooser *chooser,
GdkRGBA *colors)
{
GtkColorChooserDialog *cc = GTK_COLOR_CHOOSER_DIALOG (chooser);
- GtkColorChooserDialogPrivate *priv = gtk_color_chooser_dialog_get_instance_private (cc);
- gtk_color_chooser_add_palette (GTK_COLOR_CHOOSER (priv->chooser),
+ gtk_color_chooser_add_palette (GTK_COLOR_CHOOSER (cc->chooser),
orientation, colors_per_line, n_colors, colors);
}
@@ -281,12 +269,8 @@ GtkWidget *
gtk_color_chooser_dialog_new (const gchar *title,
GtkWindow *parent)
{
- GtkColorChooserDialog *dialog;
-
- dialog = g_object_new (GTK_TYPE_COLOR_CHOOSER_DIALOG,
- "title", title,
- "transient-for", parent,
- NULL);
-
- return GTK_WIDGET (dialog);
+ return g_object_new (GTK_TYPE_COLOR_CHOOSER_DIALOG,
+ "title", title,
+ "transient-for", parent,
+ NULL);
}
diff --git a/gtk/gtkcolorchooserwidget.c b/gtk/gtkcolorchooserwidget.c
index bda681e7ab..0455d07457 100644
--- a/gtk/gtkcolorchooserwidget.c
+++ b/gtk/gtkcolorchooserwidget.c
@@ -69,15 +69,7 @@ typedef struct _GtkColorChooserWidgetClass GtkColorChooserWidgetClass;
struct _GtkColorChooserWidget
{
GtkWidget parent_instance;
-};
-
-struct _GtkColorChooserWidgetClass
-{
- GtkWidgetClass parent_class;
-};
-struct _GtkColorChooserWidgetPrivate
-{
GtkWidget *palette;
GtkWidget *editor;
GtkSizeGroup *size_group;
@@ -94,6 +86,11 @@ struct _GtkColorChooserWidgetPrivate
GSettings *settings;
};
+struct _GtkColorChooserWidgetClass
+{
+ GtkWidgetClass parent_class;
+};
+
enum
{
PROP_ZERO,
@@ -105,7 +102,6 @@ enum
static void gtk_color_chooser_widget_iface_init (GtkColorChooserInterface *iface);
G_DEFINE_TYPE_WITH_CODE (GtkColorChooserWidget, gtk_color_chooser_widget, GTK_TYPE_WIDGET,
- G_ADD_PRIVATE (GtkColorChooserWidget)
G_IMPLEMENT_INTERFACE (GTK_TYPE_COLOR_CHOOSER,
gtk_color_chooser_widget_iface_init))
@@ -113,18 +109,17 @@ static void
select_swatch (GtkColorChooserWidget *cc,
GtkColorSwatch *swatch)
{
- GtkColorChooserWidgetPrivate *priv = gtk_color_chooser_widget_get_instance_private (cc);
GdkRGBA color;
double red, green, blue, alpha;
- if (priv->current == swatch)
+ if (cc->current == swatch)
return;
- if (priv->current != NULL)
- gtk_widget_unset_state_flags (GTK_WIDGET (priv->current), GTK_STATE_FLAG_SELECTED);
+ if (cc->current != NULL)
+ gtk_widget_unset_state_flags (GTK_WIDGET (cc->current), GTK_STATE_FLAG_SELECTED);
gtk_widget_set_state_flags (GTK_WIDGET (swatch), GTK_STATE_FLAG_SELECTED, FALSE);
- priv->current = swatch;
+ cc->current = swatch;
gtk_color_swatch_get_rgba (swatch, &color);
@@ -132,11 +127,11 @@ select_swatch (GtkColorChooserWidget *cc,
green = color.green;
blue = color.blue;
alpha = color.alpha;
- g_settings_set (priv->settings, "selected-color", "(bdddd)",
+ g_settings_set (cc->settings, "selected-color", "(bdddd)",
TRUE, red, green, blue, alpha);
- if (gtk_widget_get_visible (GTK_WIDGET (priv->editor)))
- gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (priv->editor), &color);
+ if (gtk_widget_get_visible (GTK_WIDGET (cc->editor)))
+ gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (cc->editor), &color);
else
g_object_notify (G_OBJECT (cc), "rgba");
}
@@ -171,7 +166,6 @@ connect_button_signals (GtkWidget *p,
static void
save_custom_colors (GtkColorChooserWidget *cc)
{
- GtkColorChooserWidgetPrivate *priv = gtk_color_chooser_widget_get_instance_private (cc);
GVariantBuilder builder;
GVariant *variant;
GdkRGBA color;
@@ -180,7 +174,7 @@ save_custom_colors (GtkColorChooserWidget *cc)
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(dddd)"));
- children = gtk_container_get_children (GTK_CONTAINER (priv->custom));
+ children = gtk_container_get_children (GTK_CONTAINER (cc->custom));
for (l = g_list_nth (children, 1); l != NULL; l = l->next)
{
child = l->data;
@@ -197,7 +191,7 @@ save_custom_colors (GtkColorChooserWidget *cc)
}
variant = g_variant_builder_end (&builder);
- g_settings_set_value (priv->settings, "custom-colors", variant);
+ g_settings_set_value (cc->settings, "custom-colors", variant);
g_list_free (children);
}
@@ -215,19 +209,18 @@ static void
gtk_color_chooser_widget_set_use_alpha (GtkColorChooserWidget *cc,
gboolean use_alpha)
{
- GtkColorChooserWidgetPrivate *priv = gtk_color_chooser_widget_get_instance_private (cc);
GList *children, *l;
GList *palettes, *p;
GtkWidget *swatch;
GtkWidget *grid;
- if (priv->use_alpha == use_alpha)
+ if (cc->use_alpha == use_alpha)
return;
- priv->use_alpha = use_alpha;
- gtk_color_chooser_set_use_alpha (GTK_COLOR_CHOOSER (priv->editor), use_alpha);
+ cc->use_alpha = use_alpha;
+ gtk_color_chooser_set_use_alpha (GTK_COLOR_CHOOSER (cc->editor), use_alpha);
- palettes = gtk_container_get_children (GTK_CONTAINER (priv->palette));
+ palettes = gtk_container_get_children (GTK_CONTAINER (cc->palette));
for (p = palettes; p; p = p->next)
{
grid = p->data;
@@ -253,19 +246,17 @@ static void
gtk_color_chooser_widget_set_show_editor (GtkColorChooserWidget *cc,
gboolean show_editor)
{
- GtkColorChooserWidgetPrivate *priv = gtk_color_chooser_widget_get_instance_private (cc);
-
if (show_editor)
{
GdkRGBA color = { 0.75, 0.25, 0.25, 1.0 };
- if (priv->current)
- gtk_color_swatch_get_rgba (priv->current, &color);
- gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (priv->editor), &color);
+ if (cc->current)
+ gtk_color_swatch_get_rgba (cc->current, &color);
+ gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (cc->editor), &color);
}
- gtk_widget_set_visible (priv->editor, show_editor);
- gtk_widget_set_visible (priv->palette, !show_editor);
+ gtk_widget_set_visible (cc->editor, show_editor);
+ gtk_widget_set_visible (cc->palette, !show_editor);
}
static void
@@ -307,21 +298,20 @@ accessible_color_name (GdkRGBA *color)
static void
remove_palette (GtkColorChooserWidget *cc)
{
- GtkColorChooserWidgetPrivate *priv = gtk_color_chooser_widget_get_instance_private (cc);
GList *children, *l;
GtkWidget *widget;
- if (priv->current != NULL &&
- gtk_widget_get_parent (GTK_WIDGET (priv->current)) != priv->custom)
- priv->current = NULL;
+ if (cc->current != NULL &&
+ gtk_widget_get_parent (GTK_WIDGET (cc->current)) != cc->custom)
+ cc->current = NULL;
- children = gtk_container_get_children (GTK_CONTAINER (priv->palette));
+ children = gtk_container_get_children (GTK_CONTAINER (cc->palette));
for (l = children; l; l = l->next)
{
widget = l->data;
- if (widget == priv->custom_label || widget == priv->custom)
+ if (widget == cc->custom_label || widget == cc->custom)
continue;
- gtk_container_remove (GTK_CONTAINER (priv->palette), widget);
+ gtk_container_remove (GTK_CONTAINER (cc->palette), widget);
}
g_list_free (children);
}
@@ -334,7 +324,6 @@ add_palette (GtkColorChooserWidget *cc,
GdkRGBA *colors,
const gchar **names)
{
- GtkColorChooserWidgetPrivate *priv = gtk_color_chooser_widget_get_instance_private (cc);
GtkWidget *grid;
GtkWidget *p;
AtkObject *atk_obj;
@@ -352,7 +341,7 @@ add_palette (GtkColorChooserWidget *cc,
gtk_widget_set_margin_bottom (grid, 12);
gtk_grid_set_row_spacing (GTK_GRID (grid), 2);
gtk_grid_set_column_spacing (GTK_GRID (grid), 4);
- gtk_container_add (GTK_CONTAINER (priv->palette), grid);
+ gtk_container_add (GTK_CONTAINER (cc->palette), grid);
left = 0;
right = colors_per_line - 1;
@@ -412,19 +401,16 @@ add_palette (GtkColorChooserWidget *cc,
static void
remove_default_palette (GtkColorChooserWidget *cc)
{
- GtkColorChooserWidgetPrivate *priv = gtk_color_chooser_widget_get_instance_private (cc);
-
- if (!priv->has_default_palette)
+ if (!cc->has_default_palette)
return;
remove_palette (cc);
- priv->has_default_palette = FALSE;
+ cc->has_default_palette = FALSE;
}
static void
add_default_palette (GtkColorChooserWidget *cc)
{
- GtkColorChooserWidgetPrivate *priv = gtk_color_chooser_widget_get_instance_private (cc);
const gchar *default_colors[9][3] = {
{ "#ef2929", "#cc0000", "#a40000" }, /* Scarlet Red */
{ "#fcaf3e", "#f57900", "#ce5c00" }, /* Orange */
@@ -501,7 +487,7 @@ add_default_palette (GtkColorChooserWidget *cc)
add_palette (cc, GTK_ORIENTATION_HORIZONTAL, 9, 9, colors, gray_names);
- priv->has_default_palette = TRUE;
+ cc->has_default_palette = TRUE;
}
static void
@@ -510,7 +496,6 @@ gtk_color_chooser_widget_activate_color_customize (GtkWidget *widget,
GVariant *parameter)
{
GtkColorChooserWidget *cc = GTK_COLOR_CHOOSER_WIDGET (widget);
- GtkColorChooserWidgetPrivate *priv = gtk_color_chooser_widget_get_instance_private (cc);
double red, green, blue, alpha;
GdkRGBA color;
@@ -520,10 +505,10 @@ gtk_color_chooser_widget_activate_color_customize (GtkWidget *widget,
color.blue = blue;
color.alpha = alpha;
- gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (priv->editor), &color);
+ gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (cc->editor), &color);
- gtk_widget_hide (priv->palette);
- gtk_widget_show (priv->editor);
+ gtk_widget_hide (cc->palette);
+ gtk_widget_show (cc->editor);
g_object_notify (G_OBJECT (cc), "show-editor");
}
@@ -548,7 +533,6 @@ gtk_color_chooser_widget_activate_color_select (GtkWidget *widget,
static void
gtk_color_chooser_widget_init (GtkColorChooserWidget *cc)
{
- GtkColorChooserWidgetPrivate *priv = gtk_color_chooser_widget_get_instance_private (cc);
GtkWidget *box;
GtkWidget *p;
GtkWidget *button;
@@ -562,23 +546,23 @@ gtk_color_chooser_widget_init (GtkColorChooserWidget *cc)
AtkObject *atk_obj;
gchar *text, *name;
- priv->use_alpha = TRUE;
+ cc->use_alpha = TRUE;
- priv->palette = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_widget_set_parent (priv->palette, GTK_WIDGET (cc));
+ cc->palette = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+ gtk_widget_set_parent (cc->palette, GTK_WIDGET (cc));
add_default_palette (cc);
/* translators: label for the custom section in the color chooser */
- priv->custom_label = label = gtk_label_new (_("Custom"));
+ cc->custom_label = label = gtk_label_new (_("Custom"));
gtk_widget_set_halign (label, GTK_ALIGN_START);
- gtk_container_add (GTK_CONTAINER (priv->palette), label);
+ gtk_container_add (GTK_CONTAINER (cc->palette), label);
- priv->custom = box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
+ cc->custom = box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
g_object_set (box, "margin-top", 12, NULL);
- gtk_container_add (GTK_CONTAINER (priv->palette), box);
+ gtk_container_add (GTK_CONTAINER (cc->palette), box);
- priv->button = button = gtk_color_swatch_new ();
+ cc->button = button = gtk_color_swatch_new ();
gtk_widget_set_name (button, "add-color-button");
atk_obj = gtk_widget_get_accessible (button);
atk_object_set_name (atk_obj, _("Custom color"));
@@ -588,8 +572,8 @@ gtk_color_chooser_widget_init (GtkColorChooserWidget *cc)
gtk_color_swatch_set_selectable (GTK_COLOR_SWATCH (button), FALSE);
gtk_container_add (GTK_CONTAINER (box), button);
- priv->settings = g_settings_new ("org.gtk.gtk4.Settings.ColorChooser");
- variant = g_settings_get_value (priv->settings, I_("custom-colors"));
+ cc->settings = g_settings_new ("org.gtk.gtk4.Settings.ColorChooser");
+ variant = g_settings_get_value (cc->settings, I_("custom-colors"));
g_variant_iter_init (&iter, variant);
i = 0;
p = NULL;
@@ -619,15 +603,15 @@ gtk_color_chooser_widget_init (GtkColorChooserWidget *cc)
}
g_variant_unref (variant);
- priv->editor = gtk_color_editor_new ();
- gtk_widget_set_halign (priv->editor, GTK_ALIGN_CENTER);
- gtk_widget_set_hexpand (priv->editor, TRUE);
- g_signal_connect (priv->editor, "notify::rgba",
+ cc->editor = gtk_color_editor_new ();
+ gtk_widget_set_halign (cc->editor, GTK_ALIGN_CENTER);
+ gtk_widget_set_hexpand (cc->editor, TRUE);
+ g_signal_connect (cc->editor, "notify::rgba",
G_CALLBACK (update_from_editor), cc);
- gtk_widget_set_parent (priv->editor, GTK_WIDGET (cc));
+ gtk_widget_set_parent (cc->editor, GTK_WIDGET (cc));
- g_settings_get (priv->settings, I_("selected-color"), "(bdddd)",
+ g_settings_get (cc->settings, I_("selected-color"), "(bdddd)",
&selected,
&color[0], &color[1], &color[2], &color[3]);
if (selected)
@@ -639,7 +623,7 @@ gtk_color_chooser_widget_init (GtkColorChooserWidget *cc)
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (cc), &rgba);
}
- gtk_widget_hide (GTK_WIDGET (priv->editor));
+ gtk_widget_hide (GTK_WIDGET (cc->editor));
}
/* GObject implementation {{{1 */
@@ -650,9 +634,7 @@ gtk_color_chooser_widget_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- GtkColorChooserWidget *cw = GTK_COLOR_CHOOSER_WIDGET (object);
- GtkColorChooser *cc = GTK_COLOR_CHOOSER (object);
- GtkColorChooserWidgetPrivate *priv = gtk_color_chooser_widget_get_instance_private (cw);
+ GtkColorChooserWidget *cc = GTK_COLOR_CHOOSER_WIDGET (object);
switch (prop_id)
{
@@ -660,15 +642,15 @@ gtk_color_chooser_widget_get_property (GObject *object,
{
GdkRGBA color;
- gtk_color_chooser_get_rgba (cc, &color);
+ gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (cc), &color);
g_value_set_boxed (value, &color);
}
break;
case PROP_USE_ALPHA:
- g_value_set_boolean (value, priv->use_alpha);
+ g_value_set_boolean (value, cc->use_alpha);
break;
case PROP_SHOW_EDITOR:
- g_value_set_boolean (value, gtk_widget_get_visible (priv->editor));
+ g_value_set_boolean (value, gtk_widget_get_visible (cc->editor));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -708,12 +690,11 @@ static void
gtk_color_chooser_widget_finalize (GObject *object)
{
GtkColorChooserWidget *cc = GTK_COLOR_CHOOSER_WIDGET (object);
- GtkColorChooserWidgetPrivate *priv = gtk_color_chooser_widget_get_instance_private (cc);
- g_object_unref (priv->settings);
+ g_object_unref (cc->settings);
- gtk_widget_unparent (priv->editor);
- gtk_widget_unparent (priv->palette);
+ gtk_widget_unparent (cc->editor);
+ gtk_widget_unparent (cc->palette);
G_OBJECT_CLASS (gtk_color_chooser_widget_parent_class)->finalize (object);
}
@@ -780,12 +761,11 @@ gtk_color_chooser_widget_get_rgba (GtkColorChooser *chooser,
GdkRGBA *color)
{
GtkColorChooserWidget *cc = GTK_COLOR_CHOOSER_WIDGET (chooser);
- GtkColorChooserWidgetPrivate *priv = gtk_color_chooser_widget_get_instance_private (cc);
- if (gtk_widget_get_visible (priv->editor))
- gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (priv->editor), color);
- else if (priv->current)
- gtk_color_swatch_get_rgba (priv->current, color);
+ if (gtk_widget_get_visible (cc->editor))
+ gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (cc->editor), color);
+ else if (cc->current)
+ gtk_color_swatch_get_rgba (cc->current, color);
else
{
color->red = 1.0;
@@ -794,7 +774,7 @@ gtk_color_chooser_widget_get_rgba (GtkColorChooser *chooser,
color->alpha = 1.0;
}
- if (!priv->use_alpha)
+ if (!cc->use_alpha)
color->alpha = 1.0;
}
@@ -802,16 +782,15 @@ static void
add_custom_color (GtkColorChooserWidget *cc,
const GdkRGBA *color)
{
- GtkColorChooserWidgetPrivate *priv = gtk_color_chooser_widget_get_instance_private (cc);
GtkWidget *p;
GList *children;
- children = gtk_container_get_children (GTK_CONTAINER (priv->custom));
+ children = gtk_container_get_children (GTK_CONTAINER (cc->custom));
if (g_list_length (children) >= 9)
{
- GtkWidget *last = gtk_widget_get_last_child (priv->custom);
+ GtkWidget *last = gtk_widget_get_last_child (cc->custom);
- gtk_container_remove (GTK_CONTAINER (priv->custom), last);
+ gtk_container_remove (GTK_CONTAINER (cc->custom), last);
}
g_list_free (children);
@@ -820,7 +799,7 @@ add_custom_color (GtkColorChooserWidget *cc,
gtk_color_swatch_set_can_drop (GTK_COLOR_SWATCH (p), TRUE);
connect_custom_signals (p, cc);
- gtk_box_insert_child_after (GTK_BOX (priv->custom), p, gtk_widget_get_first_child (priv->custom));
+ gtk_box_insert_child_after (GTK_BOX (cc->custom), p, gtk_widget_get_first_child (cc->custom));
gtk_widget_show (p);
select_swatch (cc, GTK_COLOR_SWATCH (p));
@@ -832,14 +811,13 @@ gtk_color_chooser_widget_set_rgba (GtkColorChooser *chooser,
const GdkRGBA *color)
{
GtkColorChooserWidget *cc = GTK_COLOR_CHOOSER_WIDGET (chooser);
- GtkColorChooserWidgetPrivate *priv = gtk_color_chooser_widget_get_instance_private (cc);
GList *children, *l;
GList *palettes, *p;
GtkColorSwatch *swatch;
GtkWidget *w;
GdkRGBA c;
- palettes = gtk_container_get_children (GTK_CONTAINER (priv->palette));
+ palettes = gtk_container_get_children (GTK_CONTAINER (cc->palette));
for (p = palettes; p; p = p->next)
{
w = p->data;
@@ -851,7 +829,7 @@ gtk_color_chooser_widget_set_rgba (GtkColorChooser *chooser,
{
swatch = l->data;
gtk_color_swatch_get_rgba (swatch, &c);
- if (!priv->use_alpha)
+ if (!cc->use_alpha)
c.alpha = color->alpha;
if (gdk_rgba_equal (color, &c))
{
diff --git a/gtk/gtkcoloreditor.c b/gtk/gtkcoloreditor.c
index 9fb73fa027..463ca5db7b 100644
--- a/gtk/gtkcoloreditor.c
+++ b/gtk/gtkcoloreditor.c
@@ -40,8 +40,12 @@
#include <math.h>
-struct _GtkColorEditorPrivate
+typedef struct _GtkColorEditorClass GtkColorEditorClass;
+
+struct _GtkColorEditor
{
+ GtkBox parent_instance;
+
GtkWidget *overlay;
GtkWidget *grid;
GtkWidget *swatch;
@@ -73,6 +77,11 @@ struct _GtkColorEditorPrivate
guint use_alpha : 1;
};
+struct _GtkColorEditorClass
+{
+ GtkBoxClass parent_class;
+};
+
enum
{
PROP_ZERO,
@@ -83,7 +92,6 @@ enum
static void gtk_color_editor_iface_init (GtkColorChooserInterface *iface);
G_DEFINE_TYPE_WITH_CODE (GtkColorEditor, gtk_color_editor, GTK_TYPE_BOX,
- G_ADD_PRIVATE (GtkColorEditor)
G_IMPLEMENT_INTERFACE (GTK_TYPE_COLOR_CHOOSER,
gtk_color_editor_iface_init))
@@ -106,8 +114,8 @@ entry_set_rgba (GtkColorEditor *editor,
scale_round (color->red, 255),
scale_round (color->green, 255),
scale_round (color->blue, 255));
- gtk_editable_set_text (GTK_EDITABLE (editor->priv->entry), text);
- editor->priv->text_changed = FALSE;
+ gtk_editable_set_text (GTK_EDITABLE (editor->entry), text);
+ editor->text_changed = FALSE;
g_free (text);
}
@@ -118,17 +126,17 @@ entry_apply (GtkWidget *entry,
GdkRGBA color;
gchar *text;
- if (!editor->priv->text_changed)
+ if (!editor->text_changed)
return;
- text = gtk_editable_get_chars (GTK_EDITABLE (editor->priv->entry), 0, -1);
+ text = gtk_editable_get_chars (GTK_EDITABLE (editor->entry), 0, -1);
if (gdk_rgba_parse (&color, text))
{
- color.alpha = gtk_adjustment_get_value (editor->priv->a_adj);
+ color.alpha = gtk_adjustment_get_value (editor->a_adj);
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (editor), &color);
}
- editor->priv->text_changed = FALSE;
+ editor->text_changed = FALSE;
g_free (text);
}
@@ -147,7 +155,7 @@ entry_text_changed (GtkWidget *entry,
GParamSpec *pspec,
GtkColorEditor *editor)
{
- editor->priv->text_changed = TRUE;
+ editor->text_changed = TRUE;
}
static void
@@ -156,16 +164,16 @@ hsv_changed (GtkColorEditor *editor)
GdkRGBA color;
gdouble h, s, v, a;
- h = gtk_adjustment_get_value (editor->priv->h_adj);
- s = gtk_adjustment_get_value (editor->priv->s_adj);
- v = gtk_adjustment_get_value (editor->priv->v_adj);
- a = gtk_adjustment_get_value (editor->priv->a_adj);
+ h = gtk_adjustment_get_value (editor->h_adj);
+ s = gtk_adjustment_get_value (editor->s_adj);
+ v = gtk_adjustment_get_value (editor->v_adj);
+ a = gtk_adjustment_get_value (editor->a_adj);
gtk_hsv_to_rgb (h, s, v, &color.red, &color.green, &color.blue);
color.alpha = a;
- gtk_color_swatch_set_rgba (GTK_COLOR_SWATCH (editor->priv->swatch), &color);
- gtk_color_scale_set_rgba (GTK_COLOR_SCALE (editor->priv->a_slider), &color);
+ gtk_color_swatch_set_rgba (GTK_COLOR_SWATCH (editor->swatch), &color);
+ gtk_color_scale_set_rgba (GTK_COLOR_SCALE (editor->a_slider), &color);
entry_set_rgba (editor, &color);
g_object_notify (G_OBJECT (editor), "rgba");
@@ -174,16 +182,16 @@ hsv_changed (GtkColorEditor *editor)
static void
dismiss_current_popup (GtkColorEditor *editor)
{
- if (editor->priv->current_popup)
+ if (editor->current_popup)
{
- gtk_widget_hide (editor->priv->current_popup);
- editor->priv->current_popup = NULL;
- editor->priv->popup_position = 0;
- if (editor->priv->popdown_focus)
+ gtk_widget_hide (editor->current_popup);
+ editor->current_popup = NULL;
+ editor->popup_position = 0;
+ if (editor->popdown_focus)
{
- if (gtk_widget_is_visible (editor->priv->popdown_focus))
- gtk_widget_grab_focus (editor->priv->popdown_focus);
- g_clear_object (&editor->priv->popdown_focus);
+ if (gtk_widget_is_visible (editor->popdown_focus))
+ gtk_widget_grab_focus (editor->popdown_focus);
+ g_clear_object (&editor->popdown_focus);
}
}
}
@@ -205,22 +213,22 @@ popup_edit (GtkWidget *widget,
if (strcmp (param, "sv") == 0)
{
- popup = editor->priv->sv_popup;
- focus = editor->priv->s_entry;
+ popup = editor->sv_popup;
+ focus = editor->s_entry;
position = 0;
}
else if (strcmp (param, "h") == 0)
{
- popup = editor->priv->h_popup;
- focus = editor->priv->h_entry;
- gtk_range_get_slider_range (GTK_RANGE (editor->priv->h_slider), &s, &e);
+ popup = editor->h_popup;
+ focus = editor->h_entry;
+ gtk_range_get_slider_range (GTK_RANGE (editor->h_slider), &s, &e);
position = (s + e) / 2;
}
else if (strcmp (param, "a") == 0)
{
- popup = editor->priv->a_popup;
- focus = editor->priv->a_entry;
- gtk_range_get_slider_range (GTK_RANGE (editor->priv->a_slider), &s, &e);
+ popup = editor->a_popup;
+ focus = editor->a_entry;
+ gtk_range_get_slider_range (GTK_RANGE (editor->a_slider), &s, &e);
position = (s + e) / 2;
}
else
@@ -228,15 +236,15 @@ popup_edit (GtkWidget *widget,
g_warning ("unsupported popup_edit parameter %s", param);
}
- if (popup == editor->priv->current_popup)
+ if (popup == editor->current_popup)
dismiss_current_popup (editor);
else if (popup)
{
dismiss_current_popup (editor);
root = gtk_widget_get_root (GTK_WIDGET (editor));
- g_set_object (&editor->priv->popdown_focus, gtk_root_get_focus (root));
- editor->priv->current_popup = popup;
- editor->priv->popup_position = position;
+ g_set_object (&editor->popdown_focus, gtk_root_get_focus (root));
+ editor->current_popup = popup;
+ editor->popup_position = position;
gtk_widget_show (popup);
gtk_widget_grab_focus (focus);
}
@@ -275,10 +283,10 @@ get_child_position (GtkOverlay *overlay,
allocation->width = req.width;
allocation->height = req.height;
- if (widget == editor->priv->sv_popup)
+ if (widget == editor->sv_popup)
{
- gtk_widget_translate_coordinates (editor->priv->sv_plane,
- gtk_widget_get_parent (editor->priv->grid),
+ gtk_widget_translate_coordinates (editor->sv_plane,
+ gtk_widget_get_parent (editor->grid),
0, -6,
&allocation->x, &allocation->y);
if (gtk_widget_get_direction (GTK_WIDGET (overlay)) == GTK_TEXT_DIR_RTL)
@@ -286,30 +294,30 @@ get_child_position (GtkOverlay *overlay,
else
allocation->x = gtk_widget_get_width (GTK_WIDGET (overlay)) - req.width;
}
- else if (widget == editor->priv->h_popup)
+ else if (widget == editor->h_popup)
{
- gtk_widget_get_allocation (editor->priv->h_slider, &alloc);
- gtk_range_get_slider_range (GTK_RANGE (editor->priv->h_slider), &s, &e);
+ gtk_widget_get_allocation (editor->h_slider, &alloc);
+ gtk_range_get_slider_range (GTK_RANGE (editor->h_slider), &s, &e);
if (gtk_widget_get_direction (GTK_WIDGET (overlay)) == GTK_TEXT_DIR_RTL)
- gtk_widget_translate_coordinates (editor->priv->h_slider,
- gtk_widget_get_parent (editor->priv->grid),
- - req.width - 6, editor->priv->popup_position - req.height / 2,
+ gtk_widget_translate_coordinates (editor->h_slider,
+ gtk_widget_get_parent (editor->grid),
+ - req.width - 6, editor->popup_position - req.height / 2,
&allocation->x, &allocation->y);
else
- gtk_widget_translate_coordinates (editor->priv->h_slider,
- gtk_widget_get_parent (editor->priv->grid),
- alloc.width + 6, editor->priv->popup_position - req.height / 2,
+ gtk_widget_translate_coordinates (editor->h_slider,
+ gtk_widget_get_parent (editor->grid),
+ alloc.width + 6, editor->popup_position - req.height / 2,
&allocation->x, &allocation->y);
}
- else if (widget == editor->priv->a_popup)
+ else if (widget == editor->a_popup)
{
- gtk_widget_get_allocation (editor->priv->a_slider, &alloc);
- gtk_range_get_slider_range (GTK_RANGE (editor->priv->a_slider), &s, &e);
+ gtk_widget_get_allocation (editor->a_slider, &alloc);
+ gtk_range_get_slider_range (GTK_RANGE (editor->a_slider), &s, &e);
- gtk_widget_translate_coordinates (editor->priv->a_slider,
- gtk_widget_get_parent (editor->priv->grid),
- editor->priv->popup_position - req.width / 2, - req.height - 6,
+ gtk_widget_translate_coordinates (editor->a_slider,
+ gtk_widget_get_parent (editor->grid),
+ editor->popup_position - req.width / 2, - req.height - 6,
&allocation->x, &allocation->y);
}
else
@@ -378,7 +386,7 @@ static void
pick_color (GtkButton *button,
GtkColorEditor *editor)
{
- gtk_color_picker_pick (editor->priv->picker, color_picked, editor);
+ gtk_color_picker_pick (editor->picker, color_picked, editor);
}
static void
@@ -386,51 +394,50 @@ gtk_color_editor_init (GtkColorEditor *editor)
{
GtkEventController *controller;
- editor->priv = gtk_color_editor_get_instance_private (editor);
- editor->priv->use_alpha = TRUE;
+ editor->use_alpha = TRUE;
g_type_ensure (GTK_TYPE_COLOR_SCALE);
g_type_ensure (GTK_TYPE_COLOR_PLANE);
g_type_ensure (GTK_TYPE_COLOR_SWATCH);
gtk_widget_init_template (GTK_WIDGET (editor));
- if (gtk_widget_get_direction (editor->priv->h_slider) == GTK_TEXT_DIR_RTL)
- gtk_widget_add_css_class (editor->priv->h_slider, "marks-before");
+ if (gtk_widget_get_direction (editor->h_slider) == GTK_TEXT_DIR_RTL)
+ gtk_widget_add_css_class (editor->h_slider, "marks-before");
else
- gtk_widget_add_css_class (editor->priv->h_slider, "marks-after");
+ gtk_widget_add_css_class (editor->h_slider, "marks-after");
/* Create the scaled popup adjustments manually here because connecting user data is not
* supported by template GtkBuilder xml (it would be possible to set this up in the xml
* but require 4 separate callbacks and would be rather ugly).
*/
- gtk_spin_button_set_adjustment (GTK_SPIN_BUTTON (editor->priv->h_entry), scaled_adjustment (editor->priv->h_adj, 360));
- gtk_spin_button_set_adjustment (GTK_SPIN_BUTTON (editor->priv->s_entry), scaled_adjustment (editor->priv->s_adj, 100));
- gtk_spin_button_set_adjustment (GTK_SPIN_BUTTON (editor->priv->v_entry), scaled_adjustment (editor->priv->v_adj, 100));
- gtk_spin_button_set_adjustment (GTK_SPIN_BUTTON (editor->priv->a_entry), scaled_adjustment (editor->priv->a_adj, 100));
+ gtk_spin_button_set_adjustment (GTK_SPIN_BUTTON (editor->h_entry), scaled_adjustment (editor->h_adj, 360));
+ gtk_spin_button_set_adjustment (GTK_SPIN_BUTTON (editor->s_entry), scaled_adjustment (editor->s_adj, 100));
+ gtk_spin_button_set_adjustment (GTK_SPIN_BUTTON (editor->v_entry), scaled_adjustment (editor->v_adj, 100));
+ gtk_spin_button_set_adjustment (GTK_SPIN_BUTTON (editor->a_entry), scaled_adjustment (editor->a_adj, 100));
/* This can be setup in the .ui file, but requires work in Glade otherwise it cannot be edited there */
- gtk_overlay_add_overlay (GTK_OVERLAY (editor->priv->overlay), editor->priv->sv_popup);
- gtk_overlay_add_overlay (GTK_OVERLAY (editor->priv->overlay), editor->priv->h_popup);
- gtk_overlay_add_overlay (GTK_OVERLAY (editor->priv->overlay), editor->priv->a_popup);
+ gtk_overlay_add_overlay (GTK_OVERLAY (editor->overlay), editor->sv_popup);
+ gtk_overlay_add_overlay (GTK_OVERLAY (editor->overlay), editor->h_popup);
+ gtk_overlay_add_overlay (GTK_OVERLAY (editor->overlay), editor->a_popup);
controller = gtk_event_controller_key_new ();
g_signal_connect (controller, "key-pressed", G_CALLBACK (popup_key_pressed), editor);
- gtk_widget_add_controller (editor->priv->h_entry, controller);
+ gtk_widget_add_controller (editor->h_entry, controller);
controller = gtk_event_controller_key_new ();
g_signal_connect (controller, "key-pressed", G_CALLBACK (popup_key_pressed), editor);
- gtk_widget_add_controller (editor->priv->s_entry, controller);
+ gtk_widget_add_controller (editor->s_entry, controller);
controller = gtk_event_controller_key_new ();
g_signal_connect (controller, "key-pressed", G_CALLBACK (popup_key_pressed), editor);
- gtk_widget_add_controller (editor->priv->v_entry, controller);
+ gtk_widget_add_controller (editor->v_entry, controller);
controller = gtk_event_controller_key_new ();
g_signal_connect (controller, "key-pressed", G_CALLBACK (popup_key_pressed), editor);
- gtk_widget_add_controller (editor->priv->a_entry, controller);
+ gtk_widget_add_controller (editor->a_entry, controller);
- gtk_widget_remove_css_class (editor->priv->swatch, "activatable");
+ gtk_widget_remove_css_class (editor->swatch, "activatable");
- editor->priv->picker = gtk_color_picker_new ();
- if (editor->priv->picker == NULL)
- gtk_widget_hide (editor->priv->picker_button);
+ editor->picker = gtk_color_picker_new ();
+ if (editor->picker == NULL)
+ gtk_widget_hide (editor->picker_button);
}
static void
@@ -439,10 +446,10 @@ gtk_color_editor_dispose (GObject *object)
GtkColorEditor *editor = GTK_COLOR_EDITOR (object);
dismiss_current_popup (editor);
- g_clear_object (&editor->priv->picker);
- g_clear_object (&editor->priv->h_adj);
- g_clear_object (&editor->priv->s_adj);
- g_clear_object (&editor->priv->v_adj);
+ g_clear_object (&editor->picker);
+ g_clear_object (&editor->h_adj);
+ g_clear_object (&editor->s_adj);
+ g_clear_object (&editor->v_adj);
G_OBJECT_CLASS (gtk_color_editor_parent_class)->dispose (object);
}
@@ -466,7 +473,7 @@ gtk_color_editor_get_property (GObject *object,
}
break;
case PROP_USE_ALPHA:
- g_value_set_boolean (value, gtk_widget_get_visible (ce->priv->a_slider));
+ g_value_set_boolean (value, gtk_widget_get_visible (ce->a_slider));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -478,11 +485,11 @@ static void
gtk_color_editor_set_use_alpha (GtkColorEditor *editor,
gboolean use_alpha)
{
- if (editor->priv->use_alpha != use_alpha)
+ if (editor->use_alpha != use_alpha)
{
- editor->priv->use_alpha = use_alpha;
- gtk_widget_set_visible (editor->priv->a_slider, use_alpha);
- gtk_color_swatch_set_use_alpha (GTK_COLOR_SWATCH (editor->priv->swatch), use_alpha);
+ editor->use_alpha = use_alpha;
+ gtk_widget_set_visible (editor->a_slider, use_alpha);
+ gtk_color_swatch_set_use_alpha (GTK_COLOR_SWATCH (editor->swatch), use_alpha);
}
}
@@ -527,25 +534,25 @@ gtk_color_editor_class_init (GtkColorEditorClass *class)
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gtk/libgtk/ui/gtkcoloreditor.ui");
- gtk_widget_class_bind_template_child_private (widget_class, GtkColorEditor, overlay);
- gtk_widget_class_bind_template_child_private (widget_class, GtkColorEditor, grid);
- gtk_widget_class_bind_template_child_private (widget_class, GtkColorEditor, swatch);
- gtk_widget_class_bind_template_child_private (widget_class, GtkColorEditor, entry);
- gtk_widget_class_bind_template_child_private (widget_class, GtkColorEditor, h_slider);
- gtk_widget_class_bind_template_child_private (widget_class, GtkColorEditor, h_popup);
- gtk_widget_class_bind_template_child_private (widget_class, GtkColorEditor, h_entry);
- gtk_widget_class_bind_template_child_private (widget_class, GtkColorEditor, a_slider);
- gtk_widget_class_bind_template_child_private (widget_class, GtkColorEditor, a_popup);
- gtk_widget_class_bind_template_child_private (widget_class, GtkColorEditor, a_entry);
- gtk_widget_class_bind_template_child_private (widget_class, GtkColorEditor, sv_plane);
- gtk_widget_class_bind_template_child_private (widget_class, GtkColorEditor, sv_popup);
- gtk_widget_class_bind_template_child_private (widget_class, GtkColorEditor, s_entry);
- gtk_widget_class_bind_template_child_private (widget_class, GtkColorEditor, v_entry);
- gtk_widget_class_bind_template_child_private (widget_class, GtkColorEditor, h_adj);
- gtk_widget_class_bind_template_child_private (widget_class, GtkColorEditor, s_adj);
- gtk_widget_class_bind_template_child_private (widget_class, GtkColorEditor, v_adj);
- gtk_widget_class_bind_template_child_private (widget_class, GtkColorEditor, a_adj);
- gtk_widget_class_bind_template_child_private (widget_class, GtkColorEditor, picker_button);
+ gtk_widget_class_bind_template_child (widget_class, GtkColorEditor, overlay);
+ gtk_widget_class_bind_template_child (widget_class, GtkColorEditor, grid);
+ gtk_widget_class_bind_template_child (widget_class, GtkColorEditor, swatch);
+ gtk_widget_class_bind_template_child (widget_class, GtkColorEditor, entry);
+ gtk_widget_class_bind_template_child (widget_class, GtkColorEditor, h_slider);
+ gtk_widget_class_bind_template_child (widget_class, GtkColorEditor, h_popup);
+ gtk_widget_class_bind_template_child (widget_class, GtkColorEditor, h_entry);
+ gtk_widget_class_bind_template_child (widget_class, GtkColorEditor, a_slider);
+ gtk_widget_class_bind_template_child (widget_class, GtkColorEditor, a_popup);
+ gtk_widget_class_bind_template_child (widget_class, GtkColorEditor, a_entry);
+ gtk_widget_class_bind_template_child (widget_class, GtkColorEditor, sv_plane);
+ gtk_widget_class_bind_template_child (widget_class, GtkColorEditor, sv_popup);
+ gtk_widget_class_bind_template_child (widget_class, GtkColorEditor, s_entry);
+ gtk_widget_class_bind_template_child (widget_class, GtkColorEditor, v_entry);
+ gtk_widget_class_bind_template_child (widget_class, GtkColorEditor, h_adj);
+ gtk_widget_class_bind_template_child (widget_class, GtkColorEditor, s_adj);
+ gtk_widget_class_bind_template_child (widget_class, GtkColorEditor, v_adj);
+ gtk_widget_class_bind_template_child (widget_class, GtkColorEditor, a_adj);
+ gtk_widget_class_bind_template_child (widget_class, GtkColorEditor, picker_button);
gtk_widget_class_bind_template_callback (widget_class, hsv_changed);
gtk_widget_class_bind_template_callback (widget_class, dismiss_current_popup);
@@ -568,11 +575,11 @@ gtk_color_editor_get_rgba (GtkColorChooser *chooser,
GtkColorEditor *editor = GTK_COLOR_EDITOR (chooser);
float h, s, v;
- h = gtk_adjustment_get_value (editor->priv->h_adj);
- s = gtk_adjustment_get_value (editor->priv->s_adj);
- v = gtk_adjustment_get_value (editor->priv->v_adj);
+ h = gtk_adjustment_get_value (editor->h_adj);
+ s = gtk_adjustment_get_value (editor->s_adj);
+ v = gtk_adjustment_get_value (editor->v_adj);
gtk_hsv_to_rgb (h, s, v, &color->red, &color->green, &color->blue);
- color->alpha = gtk_adjustment_get_value (editor->priv->a_adj);
+ color->alpha = gtk_adjustment_get_value (editor->a_adj);
}
static void
@@ -584,13 +591,13 @@ gtk_color_editor_set_rgba (GtkColorChooser *chooser,
gtk_rgb_to_hsv (color->red, color->green, color->blue, &h, &s, &v);
- gtk_adjustment_set_value (editor->priv->h_adj, h);
- gtk_adjustment_set_value (editor->priv->s_adj, s);
- gtk_adjustment_set_value (editor->priv->v_adj, v);
- gtk_adjustment_set_value (editor->priv->a_adj, color->alpha);
+ gtk_adjustment_set_value (editor->h_adj, h);
+ gtk_adjustment_set_value (editor->s_adj, s);
+ gtk_adjustment_set_value (editor->v_adj, v);
+ gtk_adjustment_set_value (editor->a_adj, color->alpha);
- gtk_color_swatch_set_rgba (GTK_COLOR_SWATCH (editor->priv->swatch), color);
- gtk_color_scale_set_rgba (GTK_COLOR_SCALE (editor->priv->a_slider), color);
+ gtk_color_swatch_set_rgba (GTK_COLOR_SWATCH (editor->swatch), color);
+ gtk_color_scale_set_rgba (GTK_COLOR_SCALE (editor->a_slider), color);
entry_set_rgba (editor, color);
g_object_notify (G_OBJECT (editor), "rgba");
diff --git a/gtk/gtkcoloreditorprivate.h b/gtk/gtkcoloreditorprivate.h
index c0d40b3510..97bb8b7066 100644
--- a/gtk/gtkcoloreditorprivate.h
+++ b/gtk/gtkcoloreditorprivate.h
@@ -31,27 +31,6 @@ G_BEGIN_DECLS
typedef struct _GtkColorEditor GtkColorEditor;
-typedef struct _GtkColorEditorClass GtkColorEditorClass;
-typedef struct _GtkColorEditorPrivate GtkColorEditorPrivate;
-
-struct _GtkColorEditor
-{
- GtkBox parent_instance;
-
- GtkColorEditorPrivate *priv;
-};
-
-struct _GtkColorEditorClass
-{
- GtkBoxClass parent_class;
-
- /* Padding for future expansion */
- void (*_gtk_reserved1) (void);
- void (*_gtk_reserved2) (void);
- void (*_gtk_reserved3) (void);
- void (*_gtk_reserved4) (void);
-};
-
GType gtk_color_editor_get_type (void) G_GNUC_CONST;
GtkWidget * gtk_color_editor_new (void);
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index 6ce83d1891..f62b861e71 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -213,26 +213,18 @@ typedef enum {
DATE_FORMAT_WITH_TIME
} DateFormat;
-typedef struct _GtkFileChooserWidgetPrivate GtkFileChooserWidgetPrivate;
-typedef struct _GtkFileChooserWidgetClass GtkFileChooserWidgetClass;
-
-struct _GtkFileChooserWidget
-{
- GtkWidget parent_instance;
-};
-
-struct _GtkFileChooserWidgetClass
-{
- GtkWidgetClass parent_class;
-};
-
typedef enum {
TYPE_FORMAT_MIME,
TYPE_FORMAT_DESCRIPTION,
TYPE_FORMAT_CATEGORY
} TypeFormat;
-struct _GtkFileChooserWidgetPrivate {
+typedef struct _GtkFileChooserWidgetClass GtkFileChooserWidgetClass;
+
+struct _GtkFileChooserWidget
+{
+ GtkWidget parent_instance;
+
GtkFileChooserAction action;
GtkFileSystem *file_system;
@@ -371,6 +363,11 @@ struct _GtkFileChooserWidgetPrivate {
guint starting_search : 1;
};
+struct _GtkFileChooserWidgetClass
+{
+ GtkWidgetClass parent_class;
+};
+
#define MAX_LOADING_TIME 500
#define DEFAULT_NEW_FOLDER_NAME _("Type name of new folder")
@@ -600,7 +597,6 @@ static void set_show_hidden (GtkFileChooserWidget *impl,
G_DEFINE_TYPE_WITH_CODE (GtkFileChooserWidget, gtk_file_chooser_widget, GTK_TYPE_WIDGET,
- G_ADD_PRIVATE (GtkFileChooserWidget)
G_IMPLEMENT_INTERFACE (GTK_TYPE_FILE_CHOOSER,
gtk_file_chooser_widget_iface_init)
G_IMPLEMENT_INTERFACE (GTK_TYPE_FILE_CHOOSER_EMBED,
@@ -641,53 +637,48 @@ gtk_file_chooser_embed_default_iface_init (GtkFileChooserEmbedIface *iface)
static void
pending_select_files_free (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- g_slist_free_full (priv->pending_select_files, g_object_unref);
- priv->pending_select_files = NULL;
+ g_slist_free_full (impl->pending_select_files, g_object_unref);
+ impl->pending_select_files = NULL;
}
static void
pending_select_files_add (GtkFileChooserWidget *impl,
GFile *file)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- priv->pending_select_files =
- g_slist_prepend (priv->pending_select_files, g_object_ref (file));
+ impl->pending_select_files =
+ g_slist_prepend (impl->pending_select_files, g_object_ref (file));
}
static void
gtk_file_chooser_widget_finalize (GObject *object)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (object);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
- g_clear_object (&priv->item_actions);
+ g_clear_object (&impl->item_actions);
- g_clear_pointer (&priv->choices, g_hash_table_unref);
+ g_clear_pointer (&impl->choices, g_hash_table_unref);
- if (priv->location_changed_id > 0)
- g_source_remove (priv->location_changed_id);
+ if (impl->location_changed_id > 0)
+ g_source_remove (impl->location_changed_id);
- g_clear_object (&priv->file_system);
+ g_clear_object (&impl->file_system);
- g_free (priv->browse_files_last_selected_name);
+ g_free (impl->browse_files_last_selected_name);
- g_slist_free_full (priv->filters, g_object_unref);
- g_clear_object (&priv->current_filter);
- g_clear_object (&priv->current_folder);
- g_clear_object (&priv->browse_path_bar_size_group);
- g_clear_object (&priv->renamed_file);
+ g_slist_free_full (impl->filters, g_object_unref);
+ g_clear_object (&impl->current_filter);
+ g_clear_object (&impl->current_folder);
+ g_clear_object (&impl->browse_path_bar_size_group);
+ g_clear_object (&impl->renamed_file);
/* Free all the Models we have */
stop_loading_and_clear_list_model (impl, FALSE);
search_clear_model (impl, FALSE);
recent_clear_model (impl, FALSE);
- g_clear_object (&priv->model_for_search);
+ g_clear_object (&impl->model_for_search);
/* stopping the load above should have cleared this */
- g_assert (priv->load_timeout_id == 0);
+ g_assert (impl->load_timeout_id == 0);
G_OBJECT_CLASS (gtk_file_chooser_widget_parent_class)->finalize (object);
}
@@ -906,11 +897,9 @@ new_folder_popover_active (GtkWidget *button,
GParamSpec *pspec,
GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- gtk_editable_set_text (GTK_EDITABLE (priv->new_folder_name_entry), "");
- gtk_widget_set_sensitive (priv->new_folder_create_button, FALSE);
- gtk_file_chooser_error_stack_set_error (GTK_FILE_CHOOSER_ERROR_STACK (priv->new_folder_error_stack),
+ gtk_editable_set_text (GTK_EDITABLE (impl->new_folder_name_entry), "");
+ gtk_widget_set_sensitive (impl->new_folder_create_button, FALSE);
+ gtk_file_chooser_error_stack_set_error (GTK_FILE_CHOOSER_ERROR_STACK (impl->new_folder_error_stack),
FALSE,
"no-error");
}
@@ -933,12 +922,11 @@ name_exists_get_info_cb (GCancellable *cancellable,
{
struct FileExistsData *data = user_data;
GtkFileChooserWidget *impl = data->impl;
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
- if (cancellable != priv->file_exists_get_info_cancellable)
+ if (cancellable != impl->file_exists_get_info_cancellable)
goto out;
- priv->file_exists_get_info_cancellable = NULL;
+ impl->file_exists_get_info_cancellable = NULL;
if (g_cancellable_is_cancelled (cancellable))
goto out;
@@ -972,7 +960,6 @@ check_valid_child_name (GtkFileChooserWidget *impl,
GtkWidget *error_stack,
GtkWidget *button)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GtkFileChooserErrorStack *stack = GTK_FILE_CHOOSER_ERROR_STACK (error_stack);
gtk_widget_set_sensitive (button, FALSE);
@@ -1021,11 +1008,11 @@ check_valid_child_name (GtkFileChooserWidget *impl,
data->error_stack = error_stack;
data->button = button;
- if (priv->file_exists_get_info_cancellable)
- g_cancellable_cancel (priv->file_exists_get_info_cancellable);
+ if (impl->file_exists_get_info_cancellable)
+ g_cancellable_cancel (impl->file_exists_get_info_cancellable);
- priv->file_exists_get_info_cancellable =
- _gtk_file_system_get_info (priv->file_system,
+ impl->file_exists_get_info_cancellable =
+ _gtk_file_system_get_info (impl->file_system,
file,
"standard::type",
name_exists_get_info_cb,
@@ -1040,30 +1027,27 @@ static void
new_folder_name_changed (GtkEditable *editable,
GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
check_valid_child_name (impl,
- priv->current_folder,
+ impl->current_folder,
gtk_editable_get_text (editable),
TRUE,
NULL,
- priv->new_folder_error_stack,
- priv->new_folder_create_button);
+ impl->new_folder_error_stack,
+ impl->new_folder_create_button);
}
static void
new_folder_create_clicked (GtkButton *button,
GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GError *error = NULL;
GFile *file;
const gchar *name;
- name = gtk_editable_get_text (GTK_EDITABLE (priv->new_folder_name_entry));
- file = g_file_get_child_for_display_name (priv->current_folder, name, &error);
+ name = gtk_editable_get_text (GTK_EDITABLE (impl->new_folder_name_entry));
+ file = g_file_get_child_for_display_name (impl->current_folder, name, &error);
- gtk_popover_popdown (GTK_POPOVER (priv->new_folder_popover));
+ gtk_popover_popdown (GTK_POPOVER (impl->new_folder_popover));
if (file)
{
@@ -1119,7 +1103,6 @@ selection_check (GtkFileChooserWidget *impl,
gboolean *all_files,
gboolean *all_folders)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
struct selection_check_closure closure;
GtkTreeSelection *selection;
@@ -1128,7 +1111,7 @@ selection_check (GtkFileChooserWidget *impl,
closure.all_files = TRUE;
closure.all_folders = TRUE;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
gtk_tree_selection_selected_foreach (selection,
selection_check_foreach_cb,
&closure);
@@ -1164,13 +1147,12 @@ places_sidebar_open_location_cb (GtkPlacesSidebar *sidebar,
GtkPlacesOpenFlags open_flags,
GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
gboolean clear_entry;
/* In the Save modes, we want to preserve what the user typed in the filename
* entry, so that he may choose another folder without erasing his typed name.
*/
- if (priv->location_entry && priv->action != GTK_FILE_CHOOSER_ACTION_SAVE)
+ if (impl->location_entry && impl->action != GTK_FILE_CHOOSER_ACTION_SAVE)
clear_entry = TRUE;
else
clear_entry = FALSE;
@@ -1199,13 +1181,12 @@ trigger_location_entry (GtkWidget *widget,
gpointer unused)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (widget);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
- if (priv->operation_mode == OPERATION_MODE_SEARCH)
+ if (impl->operation_mode == OPERATION_MODE_SEARCH)
return FALSE;
- if (priv->action != GTK_FILE_CHOOSER_ACTION_OPEN &&
- priv->action != GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ if (impl->action != GTK_FILE_CHOOSER_ACTION_OPEN &&
+ impl->action != GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
return FALSE;
location_popup_handler (impl, g_variant_get_string (arguments, NULL));
@@ -1222,14 +1203,13 @@ add_bookmark_foreach_cb (GtkTreeModel *model,
gpointer data)
{
GtkFileChooserWidget *impl = (GtkFileChooserWidget *) data;
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GFile *file;
gtk_tree_model_get (model, iter,
MODEL_COL_FILE, &file,
-1);
- _gtk_bookmarks_manager_insert_bookmark (priv->bookmarks_manager, file, 0, NULL); /* NULL-GError */
+ _gtk_bookmarks_manager_insert_bookmark (impl->bookmarks_manager, file, 0, NULL); /* NULL-GError */
g_object_unref (file);
}
@@ -1241,10 +1221,9 @@ add_to_shortcuts_cb (GSimpleAction *action,
gpointer data)
{
GtkFileChooserWidget *impl = data;
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GtkTreeSelection *selection;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
gtk_tree_selection_selected_foreach (selection,
add_bookmark_foreach_cb,
@@ -1313,10 +1292,9 @@ delete_file_cb (GSimpleAction *action,
gpointer data)
{
GtkFileChooserWidget *impl = data;
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GtkTreeSelection *selection;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
gtk_tree_selection_selected_foreach (selection, delete_selected_cb, impl);
}
@@ -1343,10 +1321,9 @@ trash_file_cb (GSimpleAction *action,
gpointer data)
{
GtkFileChooserWidget *impl = data;
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GtkTreeSelection *selection;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
gtk_tree_selection_selected_foreach (selection, trash_selected_cb, impl);
}
@@ -1354,43 +1331,40 @@ static void
rename_file_name_changed (GtkEntry *entry,
GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GFileType file_type;
- file_type = g_file_query_file_type (priv->rename_file_source_file,
+ file_type = g_file_query_file_type (impl->rename_file_source_file,
G_FILE_QUERY_INFO_NONE, NULL);
check_valid_child_name (impl,
- priv->current_folder,
+ impl->current_folder,
gtk_editable_get_text (GTK_EDITABLE (entry)),
file_type == G_FILE_TYPE_DIRECTORY,
- priv->rename_file_source_file,
- priv->rename_file_error_stack,
- priv->rename_file_rename_button);
+ impl->rename_file_source_file,
+ impl->rename_file_error_stack,
+ impl->rename_file_rename_button);
}
static void
rename_file_end (GtkPopover *popover,
GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
- g_object_unref (priv->rename_file_source_file);
+ g_object_unref (impl->rename_file_source_file);
}
static void
rename_file_rename_clicked (GtkButton *button,
GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GFile *dest;
const gchar* new_name;
- gtk_popover_popdown (GTK_POPOVER (priv->rename_file_popover));
+ gtk_popover_popdown (GTK_POPOVER (impl->rename_file_popover));
- new_name = gtk_editable_get_text (GTK_EDITABLE (priv->rename_file_name_entry));
- dest = g_file_get_parent (priv->rename_file_source_file);
+ new_name = gtk_editable_get_text (GTK_EDITABLE (impl->rename_file_name_entry));
+ dest = g_file_get_parent (impl->rename_file_source_file);
- g_clear_object (&priv->renamed_file);
+ g_clear_object (&impl->renamed_file);
if (dest)
{
@@ -1400,14 +1374,14 @@ rename_file_rename_clicked (GtkButton *button,
child = g_file_get_child (dest, new_name);
if (child)
{
- if (!g_file_move (priv->rename_file_source_file, child, G_FILE_COPY_NONE,
+ if (!g_file_move (impl->rename_file_source_file, child, G_FILE_COPY_NONE,
NULL, NULL, NULL, &error))
error_dialog (impl, _("The file could not be renamed"), error);
else
{
/* Rename succeded, save renamed file so it will
* be revealed by our "row-changed" handler */
- priv->renamed_file = g_object_ref (child);
+ impl->renamed_file = g_object_ref (child);
}
g_object_unref (child);
@@ -1424,32 +1398,31 @@ rename_selected_cb (GtkTreeModel *model,
gpointer data)
{
GtkFileChooserWidget *impl = data;
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GdkRectangle rect;
gchar *filename;
gtk_tree_model_get (model, iter,
- MODEL_COL_FILE, &priv->rename_file_source_file,
+ MODEL_COL_FILE, &impl->rename_file_source_file,
-1);
- gtk_tree_view_get_cell_area (GTK_TREE_VIEW (priv->browse_files_tree_view),
- path, priv->list_name_column, &rect);
+ gtk_tree_view_get_cell_area (GTK_TREE_VIEW (impl->browse_files_tree_view),
+ path, impl->list_name_column, &rect);
- gtk_tree_view_convert_bin_window_to_widget_coords (GTK_TREE_VIEW (priv->browse_files_tree_view),
+ gtk_tree_view_convert_bin_window_to_widget_coords (GTK_TREE_VIEW (impl->browse_files_tree_view),
rect.x, rect.y,
&rect.x, &rect.y);
- gtk_widget_translate_coordinates (priv->browse_files_tree_view,
+ gtk_widget_translate_coordinates (impl->browse_files_tree_view,
GTK_WIDGET (impl),
rect.x, rect.y,
&rect.x, &rect.y);
- filename = g_file_get_basename (priv->rename_file_source_file);
- gtk_editable_set_text (GTK_EDITABLE (priv->rename_file_name_entry), filename);
+ filename = g_file_get_basename (impl->rename_file_source_file);
+ gtk_editable_set_text (GTK_EDITABLE (impl->rename_file_name_entry), filename);
g_free (filename);
- gtk_popover_set_pointing_to (GTK_POPOVER (priv->rename_file_popover), &rect);
- gtk_popover_popup (GTK_POPOVER (priv->rename_file_popover));
- gtk_widget_grab_focus (priv->rename_file_popover);
+ gtk_popover_set_pointing_to (GTK_POPOVER (impl->rename_file_popover), &rect);
+ gtk_popover_popup (GTK_POPOVER (impl->rename_file_popover));
+ gtk_widget_grab_focus (impl->rename_file_popover);
}
static void
@@ -1458,13 +1431,12 @@ rename_file_cb (GSimpleAction *action,
gpointer data)
{
GtkFileChooserWidget *impl = data;
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GtkTreeSelection *selection;
/* insensitive until we change the name */
- gtk_widget_set_sensitive (priv->rename_file_rename_button, FALSE);
+ gtk_widget_set_sensitive (impl->rename_file_rename_button, FALSE);
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
gtk_tree_selection_selected_foreach (selection, rename_selected_cb, impl);
}
@@ -1556,13 +1528,12 @@ change_show_size_state (GSimpleAction *action,
gpointer data)
{
GtkFileChooserWidget *impl = data;
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
g_simple_action_set_state (action, state);
- priv->show_size_column = g_variant_get_boolean (state);
+ impl->show_size_column = g_variant_get_boolean (state);
- gtk_tree_view_column_set_visible (priv->list_size_column,
- priv->show_size_column);
+ gtk_tree_view_column_set_visible (impl->list_size_column,
+ impl->show_size_column);
}
/* Callback used when the "Show Type Column" menu item is toggled */
@@ -1572,13 +1543,12 @@ change_show_type_state (GSimpleAction *action,
gpointer data)
{
GtkFileChooserWidget *impl = data;
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
g_simple_action_set_state (action, state);
- priv->show_type_column = g_variant_get_boolean (state);
+ impl->show_type_column = g_variant_get_boolean (state);
- gtk_tree_view_column_set_visible (priv->list_type_column,
- priv->show_type_column);
+ gtk_tree_view_column_set_visible (impl->list_type_column,
+ impl->show_type_column);
}
static void
@@ -1587,68 +1557,61 @@ change_sort_directories_first_state (GSimpleAction *action,
gpointer data)
{
GtkFileChooserWidget *impl = data;
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GtkTreeSortable *sortable;
g_simple_action_set_state (action, state);
- priv->sort_directories_first = g_variant_get_boolean (state);
+ impl->sort_directories_first = g_variant_get_boolean (state);
/* force resorting */
- sortable = GTK_TREE_SORTABLE (priv->browse_files_model);
+ sortable = GTK_TREE_SORTABLE (impl->browse_files_model);
if (sortable == NULL)
return;
gtk_tree_sortable_set_sort_column_id (sortable,
GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID,
- priv->sort_order);
+ impl->sort_order);
gtk_tree_sortable_set_sort_column_id (sortable,
- priv->sort_column,
- priv->sort_order);
+ impl->sort_column,
+ impl->sort_order);
}
static void
clear_model_cache (GtkFileChooserWidget *impl,
gint column)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- if (priv->browse_files_model)
- _gtk_file_system_model_clear_cache (priv->browse_files_model, column);
+ if (impl->browse_files_model)
+ _gtk_file_system_model_clear_cache (impl->browse_files_model, column);
- if (priv->search_model)
- _gtk_file_system_model_clear_cache (priv->search_model, column);
+ if (impl->search_model)
+ _gtk_file_system_model_clear_cache (impl->search_model, column);
- if (priv->recent_model)
- _gtk_file_system_model_clear_cache (priv->recent_model, column);
+ if (impl->recent_model)
+ _gtk_file_system_model_clear_cache (impl->recent_model, column);
}
static void
set_model_filter (GtkFileChooserWidget *impl,
GtkFileFilter *filter)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
+ if (impl->browse_files_model)
+ _gtk_file_system_model_set_filter (impl->browse_files_model, filter);
- if (priv->browse_files_model)
- _gtk_file_system_model_set_filter (priv->browse_files_model, filter);
+ if (impl->search_model)
+ _gtk_file_system_model_set_filter (impl->search_model, filter);
- if (priv->search_model)
- _gtk_file_system_model_set_filter (priv->search_model, filter);
-
- if (priv->recent_model)
- _gtk_file_system_model_set_filter (priv->recent_model, filter);
+ if (impl->recent_model)
+ _gtk_file_system_model_set_filter (impl->recent_model, filter);
}
static void
update_time_renderer_visible (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- g_object_set (priv->list_time_renderer,
- "visible", priv->show_time,
+ g_object_set (impl->list_time_renderer,
+ "visible", impl->show_time,
NULL);
clear_model_cache (impl, MODEL_COL_DATE_TEXT);
clear_model_cache (impl, MODEL_COL_TIME_TEXT);
- gtk_widget_queue_draw (priv->browse_files_tree_view);
+ gtk_widget_queue_draw (impl->browse_files_tree_view);
}
static void
@@ -1657,10 +1620,9 @@ change_show_time_state (GSimpleAction *action,
gpointer data)
{
GtkFileChooserWidget *impl = data;
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
g_simple_action_set_state (action, state);
- priv->show_time = g_variant_get_boolean (state);
+ impl->show_time = g_variant_get_boolean (state);
update_time_renderer_visible (impl);
}
@@ -1707,19 +1669,19 @@ file_list_drag_data_received_get_info_cb (GCancellable *cancellable,
{
gboolean cancelled = g_cancellable_is_cancelled (cancellable);
FileListDragData *data = user_data;
- GtkFileChooser *chooser = GTK_FILE_CHOOSER (data->impl);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (data->impl);
+ GtkFileChooserWidget *impl = data->impl;
+ GtkFileChooser *chooser = GTK_FILE_CHOOSER (impl);
- if (cancellable != priv->file_list_drag_data_received_cancellable)
+ if (cancellable != impl->file_list_drag_data_received_cancellable)
goto out;
- priv->file_list_drag_data_received_cancellable = NULL;
+ impl->file_list_drag_data_received_cancellable = NULL;
if (cancelled || error)
goto out;
- if ((priv->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
- priv->action == GTK_FILE_CHOOSER_ACTION_SAVE) &&
+ if ((impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+ impl->action == GTK_FILE_CHOOSER_ACTION_SAVE) &&
data->files->next == NULL && !error && _gtk_file_info_consider_as_directory (info))
change_folder_and_display_error (data->impl, data->files->data, FALSE);
else
@@ -1734,7 +1696,7 @@ file_list_drag_data_received_get_info_cb (GCancellable *cancellable,
browse_files_center_selected_row (data->impl);
}
- if (priv->select_multiple)
+ if (impl->select_multiple)
file_list_drag_data_select_files (data->impl, data->files->next);
out:
@@ -1752,7 +1714,6 @@ file_list_drag_drop_cb (GtkDropTarget *dest,
double y,
GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GSList *files;
FileListDragData *data;
@@ -1762,11 +1723,11 @@ file_list_drag_drop_cb (GtkDropTarget *dest,
data->impl = g_object_ref (impl);
data->files = g_slist_copy_deep (files, (GCopyFunc) g_object_ref, NULL);
- if (priv->file_list_drag_data_received_cancellable)
- g_cancellable_cancel (priv->file_list_drag_data_received_cancellable);
+ if (impl->file_list_drag_data_received_cancellable)
+ g_cancellable_cancel (impl->file_list_drag_data_received_cancellable);
- priv->file_list_drag_data_received_cancellable =
- _gtk_file_system_get_info (priv->file_system, data->files->data,
+ impl->file_list_drag_data_received_cancellable =
+ _gtk_file_system_get_info (impl->file_system, data->files->data,
"standard::type",
file_list_drag_data_received_get_info_cb,
data);
@@ -1780,7 +1741,6 @@ file_list_drag_drop_cb (GtkDropTarget *dest,
static void
check_file_list_popover_sensitivity (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
gint num_selected;
gboolean all_files;
gboolean all_folders;
@@ -1791,19 +1751,19 @@ check_file_list_popover_sensitivity (GtkFileChooserWidget *impl)
active = (num_selected != 0);
- action = g_action_map_lookup_action (G_ACTION_MAP (priv->item_actions), "copy-location");
+ action = g_action_map_lookup_action (G_ACTION_MAP (impl->item_actions), "copy-location");
g_simple_action_set_enabled (G_SIMPLE_ACTION (action), active);
- action = g_action_map_lookup_action (G_ACTION_MAP (priv->item_actions), "add-shortcut");
+ action = g_action_map_lookup_action (G_ACTION_MAP (impl->item_actions), "add-shortcut");
g_simple_action_set_enabled (G_SIMPLE_ACTION (action), active && all_folders);
- action = g_action_map_lookup_action (G_ACTION_MAP (priv->item_actions), "visit");
+ action = g_action_map_lookup_action (G_ACTION_MAP (impl->item_actions), "visit");
g_simple_action_set_enabled (G_SIMPLE_ACTION (action), active);
- action = g_action_map_lookup_action (G_ACTION_MAP (priv->item_actions), "open");
+ action = g_action_map_lookup_action (G_ACTION_MAP (impl->item_actions), "open");
g_simple_action_set_enabled (G_SIMPLE_ACTION (action), (num_selected == 1) && all_folders);
- action = g_action_map_lookup_action (G_ACTION_MAP (priv->item_actions), "rename");
+ action = g_action_map_lookup_action (G_ACTION_MAP (impl->item_actions), "rename");
if (num_selected == 1)
{
GSList *infos;
@@ -1820,8 +1780,8 @@ check_file_list_popover_sensitivity (GtkFileChooserWidget *impl)
else
g_simple_action_set_enabled (G_SIMPLE_ACTION (action), FALSE);
- action = g_action_map_lookup_action (G_ACTION_MAP (priv->item_actions), "delete");
- action2 = g_action_map_lookup_action (G_ACTION_MAP (priv->item_actions), "trash");
+ action = g_action_map_lookup_action (G_ACTION_MAP (impl->item_actions), "delete");
+ action2 = g_action_map_lookup_action (G_ACTION_MAP (impl->item_actions), "trash");
if (num_selected == 1)
{
@@ -1876,11 +1836,10 @@ static GActionEntry entries[] = {
static void
file_list_build_popover (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GMenu *menu, *section;
GMenuItem *item;
- if (priv->browse_files_popover)
+ if (impl->browse_files_popover)
return;
menu = g_menu_new ();
@@ -1941,8 +1900,8 @@ file_list_build_popover (GtkFileChooserWidget *impl)
g_menu_append_section (menu, NULL, G_MENU_MODEL (section));
g_object_unref (section);
- priv->browse_files_popover = gtk_popover_menu_new_from_model (G_MENU_MODEL (menu));
- gtk_widget_set_parent (priv->browse_files_popover, GTK_WIDGET (impl));
+ impl->browse_files_popover = gtk_popover_menu_new_from_model (G_MENU_MODEL (menu));
+ gtk_widget_set_parent (impl->browse_files_popover, GTK_WIDGET (impl));
g_object_unref (menu);
}
@@ -1950,7 +1909,6 @@ file_list_build_popover (GtkFileChooserWidget *impl)
static void
file_list_update_popover (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GAction *action;
gboolean state;
@@ -1960,36 +1918,36 @@ file_list_update_popover (GtkFileChooserWidget *impl)
/* The sensitivity of the Add to Bookmarks item is set in
* bookmarks_check_add_sensitivity()
*/
- state = priv->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
- priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER ||
- priv->operation_mode != OPERATION_MODE_BROWSE;
+ state = impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+ impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER ||
+ impl->operation_mode != OPERATION_MODE_BROWSE;
- action = g_action_map_lookup_action (G_ACTION_MAP (priv->item_actions), "rename");
+ action = g_action_map_lookup_action (G_ACTION_MAP (impl->item_actions), "rename");
g_simple_action_set_enabled (G_SIMPLE_ACTION (action), !state);
- action = g_action_map_lookup_action (G_ACTION_MAP (priv->item_actions), "delete");
+ action = g_action_map_lookup_action (G_ACTION_MAP (impl->item_actions), "delete");
g_simple_action_set_enabled (G_SIMPLE_ACTION (action), !state);
- action = g_action_map_lookup_action (G_ACTION_MAP (priv->item_actions), "trash");
+ action = g_action_map_lookup_action (G_ACTION_MAP (impl->item_actions), "trash");
g_simple_action_set_enabled (G_SIMPLE_ACTION (action), !state);
- action = g_action_map_lookup_action (G_ACTION_MAP (priv->item_actions), "visit");
- g_simple_action_set_enabled (G_SIMPLE_ACTION (action), (priv->operation_mode != OPERATION_MODE_BROWSE));
+ action = g_action_map_lookup_action (G_ACTION_MAP (impl->item_actions), "visit");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), (impl->operation_mode != OPERATION_MODE_BROWSE));
- action = g_action_map_lookup_action (G_ACTION_MAP (priv->item_actions), "toggle-show-hidden");
- g_simple_action_set_state (G_SIMPLE_ACTION (action), g_variant_new_boolean (priv->show_hidden));
+ action = g_action_map_lookup_action (G_ACTION_MAP (impl->item_actions), "toggle-show-hidden");
+ g_simple_action_set_state (G_SIMPLE_ACTION (action), g_variant_new_boolean (impl->show_hidden));
- action = g_action_map_lookup_action (G_ACTION_MAP (priv->item_actions), "toggle-show-size");
- g_simple_action_set_state (G_SIMPLE_ACTION (action), g_variant_new_boolean (priv->show_size_column));
+ action = g_action_map_lookup_action (G_ACTION_MAP (impl->item_actions), "toggle-show-size");
+ g_simple_action_set_state (G_SIMPLE_ACTION (action), g_variant_new_boolean (impl->show_size_column));
- action = g_action_map_lookup_action (G_ACTION_MAP (priv->item_actions), "toggle-show-type");
- g_simple_action_set_state (G_SIMPLE_ACTION (action), g_variant_new_boolean (priv->show_type_column));
+ action = g_action_map_lookup_action (G_ACTION_MAP (impl->item_actions), "toggle-show-type");
+ g_simple_action_set_state (G_SIMPLE_ACTION (action), g_variant_new_boolean (impl->show_type_column));
- action = g_action_map_lookup_action (G_ACTION_MAP (priv->item_actions), "toggle-show-time");
- g_simple_action_set_state (G_SIMPLE_ACTION (action), g_variant_new_boolean (priv->show_time));
+ action = g_action_map_lookup_action (G_ACTION_MAP (impl->item_actions), "toggle-show-time");
+ g_simple_action_set_state (G_SIMPLE_ACTION (action), g_variant_new_boolean (impl->show_time));
- action = g_action_map_lookup_action (G_ACTION_MAP (priv->item_actions), "toggle-sort-dirs-first");
- g_simple_action_set_state (G_SIMPLE_ACTION (action), g_variant_new_boolean (priv->sort_directories_first));
+ action = g_action_map_lookup_action (G_ACTION_MAP (impl->item_actions), "toggle-sort-dirs-first");
+ g_simple_action_set_state (G_SIMPLE_ACTION (action), g_variant_new_boolean (impl->sort_directories_first));
}
static void
@@ -1997,7 +1955,6 @@ file_list_show_popover (GtkFileChooserWidget *impl,
gdouble x,
gdouble y)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GdkRectangle rect;
GtkTreeSelection *selection;
GtkTreeModel *model;
@@ -2005,23 +1962,23 @@ file_list_show_popover (GtkFileChooserWidget *impl,
GtkTreePath *path;
graphene_rect_t bounds;
- if (!gtk_widget_compute_bounds (priv->browse_files_tree_view,
- priv->browse_files_tree_view,
+ if (!gtk_widget_compute_bounds (impl->browse_files_tree_view,
+ impl->browse_files_tree_view,
&bounds))
return;
file_list_update_popover (impl);
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
list = gtk_tree_selection_get_selected_rows (selection, &model);
if (list)
{
path = list->data;
- gtk_tree_view_get_cell_area (GTK_TREE_VIEW (priv->browse_files_tree_view), path, NULL, &rect);
- gtk_tree_view_convert_bin_window_to_widget_coords (GTK_TREE_VIEW (priv->browse_files_tree_view),
+ gtk_tree_view_get_cell_area (GTK_TREE_VIEW (impl->browse_files_tree_view), path, NULL, &rect);
+ gtk_tree_view_convert_bin_window_to_widget_coords (GTK_TREE_VIEW (impl->browse_files_tree_view),
rect.x, rect.y,
&rect.x, &rect.y);
- gtk_widget_translate_coordinates (priv->browse_files_tree_view,
+ gtk_widget_translate_coordinates (impl->browse_files_tree_view,
GTK_WIDGET (impl),
rect.x, rect.y,
&rect.x, &rect.y);
@@ -2039,8 +1996,8 @@ file_list_show_popover (GtkFileChooserWidget *impl,
rect.height = 1;
}
- gtk_popover_set_pointing_to (GTK_POPOVER (priv->browse_files_popover), &rect);
- gtk_popover_popup (GTK_POPOVER (priv->browse_files_popover));
+ gtk_popover_set_pointing_to (GTK_POPOVER (impl->browse_files_popover), &rect);
+ gtk_popover_popup (GTK_POPOVER (impl->browse_files_popover));
}
static gboolean
@@ -2049,11 +2006,10 @@ list_popup_menu_cb (GtkWidget *widget,
gpointer user_data)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (user_data);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
graphene_rect_t bounds;
- if (gtk_widget_compute_bounds (priv->browse_files_tree_view,
- priv->browse_files_tree_view,
+ if (gtk_widget_compute_bounds (impl->browse_files_tree_view,
+ impl->browse_files_tree_view,
&bounds))
{
file_list_show_popover (impl, 0.5 * bounds.size.width, 0.5 * bounds.size.height);
@@ -2101,13 +2057,12 @@ click_cb (GtkGesture *gesture,
double y,
GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
PopoverData *pd;
int xx, yy;
pd = g_new (PopoverData, 1);
pd->impl = impl;
- gtk_widget_translate_coordinates (priv->browse_files_tree_view,
+ gtk_widget_translate_coordinates (impl->browse_files_tree_view,
GTK_WIDGET (impl),
x, y, &xx, &yy);
pd->x = xx;
@@ -2137,15 +2092,14 @@ typedef struct {
static void
file_list_set_sort_column_ids (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
- gtk_tree_view_set_search_column (GTK_TREE_VIEW (priv->browse_files_tree_view), -1);
+ gtk_tree_view_set_search_column (GTK_TREE_VIEW (impl->browse_files_tree_view), -1);
- gtk_tree_view_column_set_sort_column_id (priv->list_name_column, MODEL_COL_NAME);
- gtk_tree_view_column_set_sort_column_id (priv->list_time_column, MODEL_COL_TIME);
- gtk_tree_view_column_set_sort_column_id (priv->list_size_column, MODEL_COL_SIZE);
- gtk_tree_view_column_set_sort_column_id (priv->list_type_column, MODEL_COL_TYPE);
- gtk_tree_view_column_set_sort_column_id (priv->list_location_column, MODEL_COL_LOCATION_TEXT);
+ gtk_tree_view_column_set_sort_column_id (impl->list_name_column, MODEL_COL_NAME);
+ gtk_tree_view_column_set_sort_column_id (impl->list_time_column, MODEL_COL_TIME);
+ gtk_tree_view_column_set_sort_column_id (impl->list_size_column, MODEL_COL_SIZE);
+ gtk_tree_view_column_set_sort_column_id (impl->list_type_column, MODEL_COL_TYPE);
+ gtk_tree_view_column_set_sort_column_id (impl->list_location_column, MODEL_COL_LOCATION_TEXT);
}
static gboolean
@@ -2157,18 +2111,17 @@ file_list_query_tooltip_cb (GtkWidget *widget,
gpointer user_data)
{
GtkFileChooserWidget *impl = user_data;
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GtkTreeModel *model;
GtkTreePath *path;
GtkTreeIter iter;
GFile *file;
gchar *filename;
- if (priv->operation_mode == OPERATION_MODE_BROWSE)
+ if (impl->operation_mode == OPERATION_MODE_BROWSE)
return FALSE;
- if (!gtk_tree_view_get_tooltip_context (GTK_TREE_VIEW (priv->browse_files_tree_view),
+ if (!gtk_tree_view_get_tooltip_context (GTK_TREE_VIEW (impl->browse_files_tree_view),
&x, &y,
keyboard_tip,
&model, &path, &iter))
@@ -2186,7 +2139,7 @@ file_list_query_tooltip_cb (GtkWidget *widget,
filename = g_file_get_path (file);
gtk_tooltip_set_text (tooltip, filename);
- gtk_tree_view_set_tooltip_row (GTK_TREE_VIEW (priv->browse_files_tree_view),
+ gtk_tree_view_set_tooltip_row (GTK_TREE_VIEW (impl->browse_files_tree_view),
tooltip,
path);
@@ -2200,11 +2153,10 @@ file_list_query_tooltip_cb (GtkWidget *widget,
static void
set_icon_cell_renderer_fixed_size (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
gint xpad, ypad;
- gtk_cell_renderer_get_padding (priv->list_pixbuf_renderer, &xpad, &ypad);
- gtk_cell_renderer_set_fixed_size (priv->list_pixbuf_renderer,
+ gtk_cell_renderer_get_padding (impl->list_pixbuf_renderer, &xpad, &ypad);
+ gtk_cell_renderer_set_fixed_size (impl->list_pixbuf_renderer,
xpad * 2 + ICON_SIZE,
ypad * 2 + ICON_SIZE);
}
@@ -2213,12 +2165,11 @@ static gboolean
location_changed_timeout_cb (gpointer user_data)
{
GtkFileChooserWidget *impl = user_data;
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
gtk_file_chooser_unselect_all (GTK_FILE_CHOOSER (impl));
g_signal_emit_by_name (impl, "selection-changed", 0);
- priv->location_changed_id = 0;
+ impl->location_changed_id = 0;
return G_SOURCE_REMOVE;
}
@@ -2227,27 +2178,25 @@ static void
location_entry_changed_cb (GtkEditable *editable,
GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- if (priv->operation_mode == OPERATION_MODE_SEARCH)
+ if (impl->operation_mode == OPERATION_MODE_SEARCH)
{
operation_mode_set (impl, OPERATION_MODE_BROWSE);
- if (priv->current_folder)
- change_folder_and_display_error (impl, priv->current_folder, FALSE);
+ if (impl->current_folder)
+ change_folder_and_display_error (impl, impl->current_folder, FALSE);
else
switch_to_home_dir (impl);
}
- if (priv->action != GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ if (impl->action != GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
{
/* Reset location timeout */
- if (priv->location_changed_id > 0)
- g_source_remove (priv->location_changed_id);
+ if (impl->location_changed_id > 0)
+ g_source_remove (impl->location_changed_id);
- priv->location_changed_id = g_timeout_add (LOCATION_CHANGED_TIMEOUT,
+ impl->location_changed_id = g_timeout_add (LOCATION_CHANGED_TIMEOUT,
location_changed_timeout_cb,
impl);
- g_source_set_name_by_id (priv->location_changed_id, "[gtk] location_changed_timeout_cb");
+ g_source_set_name_by_id (impl->location_changed_id, "[gtk] location_changed_timeout_cb");
}
}
@@ -2261,47 +2210,41 @@ location_entry_close_clicked (GtkFileChooserWidget *impl)
static void
location_entry_setup (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
+ if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+ impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ gtk_entry_set_placeholder_text (GTK_ENTRY (impl->location_entry), _("Location"));
- if (priv->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
- priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
- gtk_entry_set_placeholder_text (GTK_ENTRY (priv->location_entry), _("Location"));
-
- g_signal_connect (priv->location_entry, "changed",
+ g_signal_connect (impl->location_entry, "changed",
G_CALLBACK (location_entry_changed_cb), impl);
- g_signal_connect_swapped (priv->location_entry, "hide-entry",
+ g_signal_connect_swapped (impl->location_entry, "hide-entry",
G_CALLBACK (location_entry_close_clicked), impl);
- _gtk_file_chooser_entry_set_action (GTK_FILE_CHOOSER_ENTRY (priv->location_entry), priv->action);
- _gtk_file_chooser_entry_set_file_filter (GTK_FILE_CHOOSER_ENTRY (priv->location_entry),
- priv->current_filter);
- gtk_editable_set_width_chars (GTK_EDITABLE (priv->location_entry), 45);
- gtk_entry_set_activates_default (GTK_ENTRY (priv->location_entry), TRUE);
- gtk_widget_set_hexpand (priv->location_entry, TRUE);
+ _gtk_file_chooser_entry_set_action (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), impl->action);
+ _gtk_file_chooser_entry_set_file_filter (GTK_FILE_CHOOSER_ENTRY (impl->location_entry),
+ impl->current_filter);
+ gtk_editable_set_width_chars (GTK_EDITABLE (impl->location_entry), 45);
+ gtk_entry_set_activates_default (GTK_ENTRY (impl->location_entry), TRUE);
+ gtk_widget_set_hexpand (impl->location_entry, TRUE);
}
static void
location_entry_disconnect (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- if (priv->location_entry)
- g_signal_handlers_disconnect_by_func (priv->location_entry, location_entry_changed_cb, impl);
+ if (impl->location_entry)
+ g_signal_handlers_disconnect_by_func (impl->location_entry, location_entry_changed_cb, impl);
}
static void
location_entry_create (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- if (!priv->location_entry)
+ if (!impl->location_entry)
{
gboolean eat_escape;
- eat_escape = priv->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
- priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER;
+ eat_escape = impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+ impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER;
- priv->location_entry = _gtk_file_chooser_entry_new (TRUE, eat_escape);
+ impl->location_entry = _gtk_file_chooser_entry_new (TRUE, eat_escape);
location_entry_setup (impl);
}
}
@@ -2323,25 +2266,24 @@ forward_key (GtkEventControllerKey *key,
static void
save_widgets_create (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GtkWidget *vbox;
GtkWidget *widget;
- if (priv->save_widgets != NULL ||
- (priv->external_entry && priv->location_entry == priv->external_entry))
+ if (impl->save_widgets != NULL ||
+ (impl->external_entry && impl->location_entry == impl->external_entry))
return;
location_switch_to_path_bar (impl);
- gtk_places_sidebar_set_location (GTK_PLACES_SIDEBAR (priv->places_sidebar), priv->current_folder);
+ gtk_places_sidebar_set_location (GTK_PLACES_SIDEBAR (impl->places_sidebar), impl->current_folder);
- if (priv->external_entry)
+ if (impl->external_entry)
{
location_entry_disconnect (impl);
- priv->location_entry = priv->external_entry;
+ impl->location_entry = impl->external_entry;
location_entry_setup (impl);
- g_signal_connect_after (gtk_entry_get_key_controller (GTK_ENTRY (priv->external_entry)),
+ g_signal_connect_after (gtk_entry_get_key_controller (GTK_ENTRY (impl->external_entry)),
"key-pressed",
G_CALLBACK (forward_key), impl);
return;
@@ -2350,52 +2292,50 @@ save_widgets_create (GtkFileChooserWidget *impl)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_style_context_add_class (gtk_widget_get_style_context (vbox), "search-bar");
- priv->save_widgets_table = gtk_grid_new ();
- gtk_container_add (GTK_CONTAINER (vbox), priv->save_widgets_table);
- gtk_grid_set_row_spacing (GTK_GRID (priv->save_widgets_table), 12);
- gtk_grid_set_column_spacing (GTK_GRID (priv->save_widgets_table), 12);
+ impl->save_widgets_table = gtk_grid_new ();
+ gtk_container_add (GTK_CONTAINER (vbox), impl->save_widgets_table);
+ gtk_grid_set_row_spacing (GTK_GRID (impl->save_widgets_table), 12);
+ gtk_grid_set_column_spacing (GTK_GRID (impl->save_widgets_table), 12);
/* Label */
widget = gtk_label_new_with_mnemonic (_("_Name:"));
gtk_widget_set_halign (widget, GTK_ALIGN_START);
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
- gtk_grid_attach (GTK_GRID (priv->save_widgets_table), widget, 0, 0, 1, 1);
+ gtk_grid_attach (GTK_GRID (impl->save_widgets_table), widget, 0, 0, 1, 1);
/* Location entry */
location_entry_create (impl);
- gtk_widget_set_hexpand (priv->location_entry, TRUE);
- gtk_grid_attach (GTK_GRID (priv->save_widgets_table), priv->location_entry, 1, 0, 1, 1);
- gtk_widget_show (priv->location_entry);
- gtk_label_set_mnemonic_widget (GTK_LABEL (widget), priv->location_entry);
+ gtk_widget_set_hexpand (impl->location_entry, TRUE);
+ gtk_grid_attach (GTK_GRID (impl->save_widgets_table), impl->location_entry, 1, 0, 1, 1);
+ gtk_widget_show (impl->location_entry);
+ gtk_label_set_mnemonic_widget (GTK_LABEL (widget), impl->location_entry);
- priv->save_widgets = vbox;
- gtk_box_insert_child_after (GTK_BOX (priv->box), priv->save_widgets, NULL);
+ impl->save_widgets = vbox;
+ gtk_box_insert_child_after (GTK_BOX (impl->box), impl->save_widgets, NULL);
}
/* Destroys the widgets specific to Save mode */
static void
save_widgets_destroy (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- if (priv->external_entry && priv->external_entry == priv->location_entry)
+ if (impl->external_entry && impl->external_entry == impl->location_entry)
{
- g_signal_handlers_disconnect_by_func (gtk_entry_get_key_controller (GTK_ENTRY (priv->external_entry)),
+ g_signal_handlers_disconnect_by_func (gtk_entry_get_key_controller (GTK_ENTRY (impl->external_entry)),
forward_key, impl);
location_entry_disconnect (impl);
- priv->location_entry = NULL;
+ impl->location_entry = NULL;
}
- if (priv->save_widgets == NULL)
+ if (impl->save_widgets == NULL)
return;
- gtk_widget_destroy (priv->save_widgets);
- priv->save_widgets = NULL;
- priv->save_widgets_table = NULL;
- priv->location_entry = NULL;
+ gtk_widget_destroy (impl->save_widgets);
+ impl->save_widgets = NULL;
+ impl->save_widgets_table = NULL;
+ impl->location_entry = NULL;
}
/* Turns on the path bar widget. Can be called even if we are already in that
@@ -2404,16 +2344,14 @@ save_widgets_destroy (GtkFileChooserWidget *impl)
static void
location_switch_to_path_bar (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- if (priv->location_entry)
+ if (impl->location_entry)
{
- gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (priv->location_entry)),
- priv->location_entry);
- priv->location_entry = NULL;
+ gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (impl->location_entry)),
+ impl->location_entry);
+ impl->location_entry = NULL;
}
- gtk_stack_set_visible_child_name (GTK_STACK (priv->browse_header_stack), "pathbar");
+ gtk_stack_set_visible_child_name (GTK_STACK (impl->browse_header_stack), "pathbar");
}
/* Turns on the location entry. Can be called even if we are already in that
@@ -2422,30 +2360,28 @@ location_switch_to_path_bar (GtkFileChooserWidget *impl)
static void
location_switch_to_filename_entry (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
/* when in search mode, we are not showing the
* browse_header_box container, so there's no point in switching
* to it.
*/
- if (priv->operation_mode == OPERATION_MODE_SEARCH)
+ if (impl->operation_mode == OPERATION_MODE_SEARCH)
return;
- gtk_revealer_set_reveal_child (GTK_REVEALER (priv->browse_header_revealer), TRUE);
+ gtk_revealer_set_reveal_child (GTK_REVEALER (impl->browse_header_revealer), TRUE);
- if (!priv->location_entry)
+ if (!impl->location_entry)
{
location_entry_create (impl);
- gtk_container_add (GTK_CONTAINER (priv->location_entry_box), priv->location_entry);
+ gtk_container_add (GTK_CONTAINER (impl->location_entry_box), impl->location_entry);
}
- _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (priv->location_entry), priv->current_folder);
+ _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), impl->current_folder);
- gtk_widget_show (priv->location_entry);
+ gtk_widget_show (impl->location_entry);
- gtk_stack_set_visible_child_name (GTK_STACK (priv->browse_header_stack), "location");
+ gtk_stack_set_visible_child_name (GTK_STACK (impl->browse_header_stack), "location");
- gtk_widget_grab_focus (priv->location_entry);
+ gtk_widget_grab_focus (impl->location_entry);
}
/* Sets a new location mode.
@@ -2454,10 +2390,8 @@ static void
location_mode_set (GtkFileChooserWidget *impl,
LocationMode new_mode)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- if (priv->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
- priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+ impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
{
GtkWindow *toplevel;
GtkWidget *current_focus;
@@ -2476,14 +2410,14 @@ location_mode_set (GtkFileChooserWidget *impl,
if (toplevel)
{
current_focus = gtk_root_get_focus (GTK_ROOT (toplevel));
- if (!current_focus || current_focus == priv->location_entry)
+ if (!current_focus || current_focus == impl->location_entry)
switch_to_file_list = TRUE;
}
location_switch_to_path_bar (impl);
if (switch_to_file_list)
- gtk_widget_grab_focus (priv->browse_files_tree_view);
+ gtk_widget_grab_focus (impl->browse_files_tree_view);
break;
@@ -2497,7 +2431,7 @@ location_mode_set (GtkFileChooserWidget *impl,
}
}
- priv->location_mode = new_mode;
+ impl->location_mode = new_mode;
g_object_notify (G_OBJECT (impl), "subtitle");
}
@@ -2513,12 +2447,10 @@ places_sidebar_show_other_locations_with_flags_cb (GtkPlacesSidebar *sidebar
static void
location_toggle_popup_handler (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- if ((priv->operation_mode == OPERATION_MODE_RECENT ||
- priv->operation_mode == OPERATION_MODE_SEARCH) &&
- (priv->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
- priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER))
+ if ((impl->operation_mode == OPERATION_MODE_RECENT ||
+ impl->operation_mode == OPERATION_MODE_SEARCH) &&
+ (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+ impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER))
operation_mode_set (impl, OPERATION_MODE_BROWSE);
/* If the file entry is not visible, show it (it is _always_
@@ -2526,23 +2458,23 @@ location_toggle_popup_handler (GtkFileChooserWidget *impl)
* If it is visible, turn it off only if it is focused.
* Otherwise, switch to the entry.
*/
- if (priv->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+ if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
{
- gtk_widget_grab_focus (priv->location_entry);
+ gtk_widget_grab_focus (impl->location_entry);
}
- else if (priv->location_mode == LOCATION_MODE_PATH_BAR)
+ else if (impl->location_mode == LOCATION_MODE_PATH_BAR)
{
location_mode_set (impl, LOCATION_MODE_FILENAME_ENTRY);
}
- else if (priv->location_mode == LOCATION_MODE_FILENAME_ENTRY)
+ else if (impl->location_mode == LOCATION_MODE_FILENAME_ENTRY)
{
- if (gtk_widget_has_focus (priv->location_entry))
+ if (gtk_widget_has_focus (impl->location_entry))
{
location_mode_set (impl, LOCATION_MODE_PATH_BAR);
}
else
{
- gtk_widget_grab_focus (priv->location_entry);
+ gtk_widget_grab_focus (impl->location_entry);
}
}
}
@@ -2551,13 +2483,12 @@ static void
gtk_file_chooser_widget_constructed (GObject *object)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (object);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
profile_start ("start", NULL);
G_OBJECT_CLASS (gtk_file_chooser_widget_parent_class)->constructed (object);
- g_assert (priv->file_system);
+ g_assert (impl->file_system);
update_appearance (impl);
@@ -2567,11 +2498,9 @@ gtk_file_chooser_widget_constructed (GObject *object)
static void
update_extra_and_filters (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- gtk_widget_set_visible (priv->extra_and_filters,
- gtk_widget_get_visible (priv->extra_align) ||
- gtk_widget_get_visible (priv->filter_combo_hbox));
+ gtk_widget_set_visible (impl->extra_and_filters,
+ gtk_widget_get_visible (impl->extra_align) ||
+ gtk_widget_get_visible (impl->filter_combo_hbox));
}
/* Sets the extra_widget by packing it in the appropriate place */
@@ -2579,28 +2508,26 @@ static void
set_extra_widget (GtkFileChooserWidget *impl,
GtkWidget *extra_widget)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
if (extra_widget)
g_object_ref (extra_widget);
- if (priv->extra_widget)
+ if (impl->extra_widget)
{
- gtk_container_remove (GTK_CONTAINER (priv->extra_align), priv->extra_widget);
- g_object_unref (priv->extra_widget);
+ gtk_container_remove (GTK_CONTAINER (impl->extra_align), impl->extra_widget);
+ g_object_unref (impl->extra_widget);
}
- priv->extra_widget = extra_widget;
- if (priv->extra_widget)
+ impl->extra_widget = extra_widget;
+ if (impl->extra_widget)
{
- gtk_container_add (GTK_CONTAINER (priv->extra_align), priv->extra_widget);
- gtk_widget_show (priv->extra_align);
+ gtk_container_add (GTK_CONTAINER (impl->extra_align), impl->extra_widget);
+ gtk_widget_show (impl->extra_align);
}
else
- gtk_widget_hide (priv->extra_align);
+ gtk_widget_hide (impl->extra_align);
/* Calls update_extra_and_filters */
- show_filters (impl, priv->filters != NULL);
+ show_filters (impl, impl->filters != NULL);
}
static void
@@ -2624,21 +2551,20 @@ static void
set_select_multiple (GtkFileChooserWidget *impl,
gboolean select_multiple)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GtkTreeSelection *selection;
GtkSelectionMode mode;
- if (select_multiple == priv->select_multiple)
+ if (select_multiple == impl->select_multiple)
return;
mode = select_multiple ? GTK_SELECTION_MULTIPLE : GTK_SELECTION_SINGLE;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
gtk_tree_selection_set_mode (selection, mode);
- gtk_tree_view_set_rubber_banding (GTK_TREE_VIEW (priv->browse_files_tree_view), select_multiple);
+ gtk_tree_view_set_rubber_banding (GTK_TREE_VIEW (impl->browse_files_tree_view), select_multiple);
- priv->select_multiple = select_multiple;
+ impl->select_multiple = select_multiple;
g_object_notify (G_OBJECT (impl), "select-multiple");
}
@@ -2646,13 +2572,12 @@ set_select_multiple (GtkFileChooserWidget *impl,
static void
put_recent_folder_in_pathbar (GtkFileChooserWidget *impl, GtkTreeIter *iter)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GFile *file;
- gtk_tree_model_get (GTK_TREE_MODEL (priv->recent_model), iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (impl->recent_model), iter,
MODEL_COL_FILE, &file,
-1);
- _gtk_path_bar_set_file (GTK_PATH_BAR (priv->browse_path_bar), file, FALSE);
+ _gtk_path_bar_set_file (GTK_PATH_BAR (impl->browse_path_bar), file, FALSE);
g_object_unref (file);
}
@@ -2665,11 +2590,10 @@ put_recent_folder_in_pathbar (GtkFileChooserWidget *impl, GtkTreeIter *iter)
static void
location_bar_update (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
gboolean visible = TRUE;
gboolean create_folder_visible = FALSE;
- switch (priv->operation_mode)
+ switch (impl->operation_mode)
{
case OPERATION_MODE_ENTER_LOCATION:
break;
@@ -2681,13 +2605,13 @@ location_bar_update (GtkFileChooserWidget *impl)
break;
case OPERATION_MODE_RECENT:
- if (priv->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+ if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
{
GtkTreeSelection *selection;
gboolean have_selected;
GtkTreeIter iter;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
/* Save mode means single-selection mode, so the following is valid */
have_selected = gtk_tree_selection_get_selected (selection, NULL, &iter);
@@ -2708,147 +2632,137 @@ location_bar_update (GtkFileChooserWidget *impl)
if (visible)
{
- if (priv->create_folders
- && priv->action != GTK_FILE_CHOOSER_ACTION_OPEN
- && priv->operation_mode != OPERATION_MODE_RECENT)
+ if (impl->create_folders
+ && impl->action != GTK_FILE_CHOOSER_ACTION_OPEN
+ && impl->operation_mode != OPERATION_MODE_RECENT)
create_folder_visible = TRUE;
}
- gtk_widget_set_visible (priv->browse_new_folder_button, create_folder_visible);
+ gtk_widget_set_visible (impl->browse_new_folder_button, create_folder_visible);
}
static void
operation_mode_stop (GtkFileChooserWidget *impl,
OperationMode mode)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
if (mode == OPERATION_MODE_SEARCH)
{
- g_clear_object (&priv->model_for_search);
+ g_clear_object (&impl->model_for_search);
search_stop_searching (impl, TRUE);
search_clear_model (impl, TRUE);
- gtk_widget_hide (priv->remote_warning_bar);
+ gtk_widget_hide (impl->remote_warning_bar);
}
}
static void
operation_mode_set_enter_location (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- gtk_stack_set_visible_child_name (GTK_STACK (priv->browse_files_stack), "list");
- gtk_stack_set_visible_child_name (GTK_STACK (priv->browse_header_stack), "location");
- gtk_revealer_set_reveal_child (GTK_REVEALER (priv->browse_header_revealer), TRUE);
+ gtk_stack_set_visible_child_name (GTK_STACK (impl->browse_files_stack), "list");
+ gtk_stack_set_visible_child_name (GTK_STACK (impl->browse_header_stack), "location");
+ gtk_revealer_set_reveal_child (GTK_REVEALER (impl->browse_header_revealer), TRUE);
location_bar_update (impl);
- gtk_widget_set_sensitive (priv->filter_combo, TRUE);
+ gtk_widget_set_sensitive (impl->filter_combo, TRUE);
location_mode_set (impl, LOCATION_MODE_FILENAME_ENTRY);
}
static void
operation_mode_set_browse (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GtkRevealerTransitionType old_revealer_transition_type;
- gtk_places_sidebar_set_location (GTK_PLACES_SIDEBAR (priv->places_sidebar), priv->current_folder);
- gtk_stack_set_visible_child_name (GTK_STACK (priv->browse_files_stack), "list");
+ gtk_places_sidebar_set_location (GTK_PLACES_SIDEBAR (impl->places_sidebar), impl->current_folder);
+ gtk_stack_set_visible_child_name (GTK_STACK (impl->browse_files_stack), "list");
location_mode_set (impl, LOCATION_MODE_PATH_BAR);
- gtk_stack_set_visible_child_name (GTK_STACK (priv->browse_header_stack), "pathbar");
+ gtk_stack_set_visible_child_name (GTK_STACK (impl->browse_header_stack), "pathbar");
- old_revealer_transition_type = gtk_revealer_get_transition_type (GTK_REVEALER (priv->browse_header_revealer));
- gtk_revealer_set_transition_type (GTK_REVEALER (priv->browse_header_revealer),
+ old_revealer_transition_type = gtk_revealer_get_transition_type (GTK_REVEALER (impl->browse_header_revealer));
+ gtk_revealer_set_transition_type (GTK_REVEALER (impl->browse_header_revealer),
GTK_REVEALER_TRANSITION_TYPE_NONE);
- gtk_revealer_set_reveal_child (GTK_REVEALER (priv->browse_header_revealer), TRUE);
- gtk_revealer_set_transition_type (GTK_REVEALER (priv->browse_header_revealer),
+ gtk_revealer_set_reveal_child (GTK_REVEALER (impl->browse_header_revealer), TRUE);
+ gtk_revealer_set_transition_type (GTK_REVEALER (impl->browse_header_revealer),
old_revealer_transition_type);
- gtk_widget_set_sensitive (priv->filter_combo, TRUE);
+ gtk_widget_set_sensitive (impl->filter_combo, TRUE);
g_object_notify (G_OBJECT (impl), "subtitle");
}
static void
operation_mode_set_search (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GtkWidget *visible_widget;
- g_assert (priv->search_model == NULL);
+ g_assert (impl->search_model == NULL);
- visible_widget = gtk_stack_get_visible_child (GTK_STACK (priv->browse_files_stack));
+ visible_widget = gtk_stack_get_visible_child (GTK_STACK (impl->browse_files_stack));
- if (visible_widget != priv->places_view &&
- visible_widget != priv->browse_files_swin)
+ if (visible_widget != impl->places_view &&
+ visible_widget != impl->browse_files_swin)
{
- gtk_stack_set_visible_child_name (GTK_STACK (priv->browse_files_stack), "list");
+ gtk_stack_set_visible_child_name (GTK_STACK (impl->browse_files_stack), "list");
}
- gtk_widget_grab_focus (priv->search_entry);
- gtk_stack_set_visible_child_name (GTK_STACK (priv->browse_header_stack), "search");
- gtk_revealer_set_reveal_child (GTK_REVEALER (priv->browse_header_revealer), TRUE);
+ gtk_widget_grab_focus (impl->search_entry);
+ gtk_stack_set_visible_child_name (GTK_STACK (impl->browse_header_stack), "search");
+ gtk_revealer_set_reveal_child (GTK_REVEALER (impl->browse_header_revealer), TRUE);
location_bar_update (impl);
search_setup_widgets (impl);
- gtk_widget_set_sensitive (priv->filter_combo, FALSE);
+ gtk_widget_set_sensitive (impl->filter_combo, FALSE);
}
static void
operation_mode_set_recent (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GFile *file;
GtkRevealerTransitionType old_revealer_transition_type;
- if (!priv->recent_manager)
- priv->recent_manager = gtk_recent_manager_get_default ();
+ if (!impl->recent_manager)
+ impl->recent_manager = gtk_recent_manager_get_default ();
- gtk_stack_set_visible_child_name (GTK_STACK (priv->browse_files_stack), "list");
- gtk_stack_set_visible_child_name (GTK_STACK (priv->browse_header_stack), "pathbar");
+ gtk_stack_set_visible_child_name (GTK_STACK (impl->browse_files_stack), "list");
+ gtk_stack_set_visible_child_name (GTK_STACK (impl->browse_header_stack), "pathbar");
/* Hide browse_header without a transition */
- old_revealer_transition_type = gtk_revealer_get_transition_type (GTK_REVEALER (priv->browse_header_revealer));
- gtk_revealer_set_transition_type (GTK_REVEALER (priv->browse_header_revealer),
+ old_revealer_transition_type = gtk_revealer_get_transition_type (GTK_REVEALER (impl->browse_header_revealer));
+ gtk_revealer_set_transition_type (GTK_REVEALER (impl->browse_header_revealer),
GTK_REVEALER_TRANSITION_TYPE_NONE);
- gtk_revealer_set_reveal_child (GTK_REVEALER (priv->browse_header_revealer), FALSE);
- gtk_revealer_set_transition_type (GTK_REVEALER (priv->browse_header_revealer),
+ gtk_revealer_set_reveal_child (GTK_REVEALER (impl->browse_header_revealer), FALSE);
+ gtk_revealer_set_transition_type (GTK_REVEALER (impl->browse_header_revealer),
old_revealer_transition_type);
location_bar_update (impl);
recent_start_loading (impl);
file = g_file_new_for_uri ("recent:///");
- gtk_places_sidebar_set_location (GTK_PLACES_SIDEBAR (priv->places_sidebar), file);
+ gtk_places_sidebar_set_location (GTK_PLACES_SIDEBAR (impl->places_sidebar), file);
g_object_notify (G_OBJECT (impl), "subtitle");
g_object_unref (file);
- gtk_widget_set_sensitive (priv->filter_combo, TRUE);
+ gtk_widget_set_sensitive (impl->filter_combo, TRUE);
}
static void
operation_mode_set_other_locations (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- gtk_stack_set_visible_child_name (GTK_STACK (priv->browse_files_stack), "other_locations");
- gtk_stack_set_visible_child_name (GTK_STACK (priv->browse_header_stack), "pathbar");
- gtk_revealer_set_reveal_child (GTK_REVEALER (priv->browse_header_revealer), FALSE);
+ gtk_stack_set_visible_child_name (GTK_STACK (impl->browse_files_stack), "other_locations");
+ gtk_stack_set_visible_child_name (GTK_STACK (impl->browse_header_stack), "pathbar");
+ gtk_revealer_set_reveal_child (GTK_REVEALER (impl->browse_header_revealer), FALSE);
location_bar_update (impl);
stop_loading_and_clear_list_model (impl, TRUE);
search_stop_searching (impl, TRUE);
recent_clear_model (impl, TRUE);
search_clear_model (impl, TRUE);
- gtk_widget_set_sensitive (priv->filter_combo, FALSE);
+ gtk_widget_set_sensitive (impl->filter_combo, FALSE);
}
static void
operation_mode_set (GtkFileChooserWidget *impl, OperationMode mode)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
OperationMode old_mode;
- operation_mode_stop (impl, priv->operation_mode);
+ operation_mode_stop (impl, impl->operation_mode);
- old_mode = priv->operation_mode;
- priv->operation_mode = mode;
+ old_mode = impl->operation_mode;
+ impl->operation_mode = mode;
- switch (priv->operation_mode)
+ switch (impl->operation_mode)
{
case OPERATION_MODE_ENTER_LOCATION:
operation_mode_set_enter_location (impl);
@@ -2889,15 +2803,13 @@ operation_mode_set (GtkFileChooserWidget *impl, OperationMode mode)
static void
update_appearance (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- if (priv->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+ if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
{
save_widgets_create (impl);
- gtk_places_sidebar_set_show_recent (GTK_PLACES_SIDEBAR (priv->places_sidebar), FALSE);
- gtk_places_sidebar_set_show_trash (GTK_PLACES_SIDEBAR (priv->places_sidebar), FALSE);
+ gtk_places_sidebar_set_show_recent (GTK_PLACES_SIDEBAR (impl->places_sidebar), FALSE);
+ gtk_places_sidebar_set_show_trash (GTK_PLACES_SIDEBAR (impl->places_sidebar), FALSE);
- if (priv->select_multiple)
+ if (impl->select_multiple)
{
g_warning ("Save mode cannot be set in conjunction with multiple selection mode. "
"Re-setting to single selection mode.");
@@ -2905,46 +2817,45 @@ update_appearance (GtkFileChooserWidget *impl)
}
}
- else if (priv->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
- priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ else if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+ impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
{
save_widgets_destroy (impl);
- gtk_places_sidebar_set_show_recent (GTK_PLACES_SIDEBAR (priv->places_sidebar), recent_files_setting_is_enabled (impl));
- location_mode_set (impl, priv->location_mode);
+ gtk_places_sidebar_set_show_recent (GTK_PLACES_SIDEBAR (impl->places_sidebar), recent_files_setting_is_enabled (impl));
+ location_mode_set (impl, impl->location_mode);
}
- if (priv->location_entry)
- _gtk_file_chooser_entry_set_action (GTK_FILE_CHOOSER_ENTRY (priv->location_entry), priv->action);
+ if (impl->location_entry)
+ _gtk_file_chooser_entry_set_action (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), impl->action);
location_bar_update (impl);
/* This *is* needed; we need to redraw the file list because the "sensitivity"
* of files may change depending whether we are in a file or folder-only mode.
*/
- gtk_widget_queue_draw (priv->browse_files_tree_view);
+ gtk_widget_queue_draw (impl->browse_files_tree_view);
}
static gchar *
gtk_file_chooser_widget_get_subtitle (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
gchar *subtitle = NULL;
- if (priv->operation_mode == OPERATION_MODE_SEARCH)
+ if (impl->operation_mode == OPERATION_MODE_SEARCH)
{
gchar *location;
- location = gtk_places_sidebar_get_location_title (GTK_PLACES_SIDEBAR (priv->places_sidebar));
+ location = gtk_places_sidebar_get_location_title (GTK_PLACES_SIDEBAR (impl->places_sidebar));
if (location)
{
subtitle = g_strdup_printf (_("Searching in %s"), location);
g_free (location);
}
- else if (priv->current_folder)
+ else if (impl->current_folder)
{
GFileInfo *info;
- info = g_file_query_info (priv->current_folder,
+ info = g_file_query_info (impl->current_folder,
G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
G_FILE_QUERY_INFO_NONE,
NULL,
@@ -2959,9 +2870,9 @@ gtk_file_chooser_widget_get_subtitle (GtkFileChooserWidget *impl)
if (subtitle == NULL)
subtitle = g_strdup (_("Searching"));
}
- else if (priv->operation_mode == OPERATION_MODE_ENTER_LOCATION ||
- (priv->operation_mode == OPERATION_MODE_BROWSE &&
- priv->location_mode == LOCATION_MODE_FILENAME_ENTRY))
+ else if (impl->operation_mode == OPERATION_MODE_ENTER_LOCATION ||
+ (impl->operation_mode == OPERATION_MODE_BROWSE &&
+ impl->location_mode == LOCATION_MODE_FILENAME_ENTRY))
{
subtitle = g_strdup (_("Enter location or URL"));
}
@@ -2973,14 +2884,12 @@ static void
set_show_hidden (GtkFileChooserWidget *impl,
gboolean show_hidden)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- if (priv->show_hidden != show_hidden)
+ if (impl->show_hidden != show_hidden)
{
- priv->show_hidden = show_hidden;
+ impl->show_hidden = show_hidden;
- if (priv->browse_files_model)
- _gtk_file_system_model_set_show_hidden (priv->browse_files_model, show_hidden);
+ if (impl->browse_files_model)
+ _gtk_file_system_model_set_show_hidden (impl->browse_files_model, show_hidden);
}
}
@@ -2992,7 +2901,6 @@ gtk_file_chooser_widget_set_property (GObject *object,
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (object);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
switch (prop_id)
{
@@ -3001,12 +2909,12 @@ gtk_file_chooser_widget_set_property (GObject *object,
operation_mode_set (impl, OPERATION_MODE_SEARCH);
else
{
- if (gtk_stack_get_visible_child (GTK_STACK (priv->browse_files_stack)) != priv->places_view)
+ if (gtk_stack_get_visible_child (GTK_STACK (impl->browse_files_stack)) != impl->places_view)
{
operation_mode_set (impl, OPERATION_MODE_BROWSE);
- if (priv->current_folder)
- change_folder_and_display_error (impl, priv->current_folder, FALSE);
+ if (impl->current_folder)
+ change_folder_and_display_error (impl, impl->current_folder, FALSE);
else
switch_to_home_dir (impl);
}
@@ -3021,12 +2929,12 @@ gtk_file_chooser_widget_set_property (GObject *object,
{
GtkFileChooserAction action = g_value_get_enum (value);
- if (action != priv->action)
+ if (action != impl->action)
{
gtk_file_chooser_widget_unselect_all (GTK_FILE_CHOOSER (impl));
if (action == GTK_FILE_CHOOSER_ACTION_SAVE &&
- priv->select_multiple)
+ impl->select_multiple)
{
g_warning ("Tried to change the file chooser action to SAVE, "
"but this is not allowed in multiple selection "
@@ -3034,7 +2942,7 @@ gtk_file_chooser_widget_set_property (GObject *object,
"selection mode.");
set_select_multiple (impl, FALSE);
}
- priv->action = action;
+ impl->action = action;
update_cell_renderer_attributes (impl);
update_appearance (impl);
settings_load (impl);
@@ -3049,7 +2957,7 @@ gtk_file_chooser_widget_set_property (GObject *object,
case GTK_FILE_CHOOSER_PROP_SELECT_MULTIPLE:
{
gboolean select_multiple = g_value_get_boolean (value);
- if (priv->action == GTK_FILE_CHOOSER_ACTION_SAVE &&
+ if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE &&
select_multiple)
{
g_warning ("Tried to set the file chooser to multiple selection "
@@ -3066,7 +2974,7 @@ gtk_file_chooser_widget_set_property (GObject *object,
case GTK_FILE_CHOOSER_PROP_CREATE_FOLDERS:
{
gboolean create_folders = g_value_get_boolean (value);
- priv->create_folders = create_folders;
+ impl->create_folders = create_folders;
update_appearance (impl);
}
break;
@@ -3084,12 +2992,11 @@ gtk_file_chooser_widget_get_property (GObject *object,
GParamSpec *pspec)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (object);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
switch (prop_id)
{
case PROP_SEARCH_MODE:
- g_value_set_boolean (value, priv->operation_mode == OPERATION_MODE_SEARCH);
+ g_value_set_boolean (value, impl->operation_mode == OPERATION_MODE_SEARCH);
break;
case PROP_SUBTITLE:
@@ -3097,19 +3004,19 @@ gtk_file_chooser_widget_get_property (GObject *object,
break;
case GTK_FILE_CHOOSER_PROP_ACTION:
- g_value_set_enum (value, priv->action);
+ g_value_set_enum (value, impl->action);
break;
case GTK_FILE_CHOOSER_PROP_FILTER:
- g_value_set_object (value, priv->current_filter);
+ g_value_set_object (value, impl->current_filter);
break;
case GTK_FILE_CHOOSER_PROP_SELECT_MULTIPLE:
- g_value_set_boolean (value, priv->select_multiple);
+ g_value_set_boolean (value, impl->select_multiple);
break;
case GTK_FILE_CHOOSER_PROP_CREATE_FOLDERS:
- g_value_set_boolean (value, priv->create_folders);
+ g_value_set_boolean (value, impl->create_folders);
break;
default:
@@ -3122,14 +3029,12 @@ gtk_file_chooser_widget_get_property (GObject *object,
static void
cancel_all_operations (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
pending_select_files_free (impl);
- g_clear_pointer (&priv->file_list_drag_data_received_cancellable, g_cancellable_cancel);
- g_clear_pointer (&priv->update_current_folder_cancellable, g_cancellable_cancel);
- g_clear_pointer (&priv->should_respond_get_info_cancellable, g_cancellable_cancel);
- g_clear_pointer (&priv->file_exists_get_info_cancellable, g_cancellable_cancel);
+ g_clear_pointer (&impl->file_list_drag_data_received_cancellable, g_cancellable_cancel);
+ g_clear_pointer (&impl->update_current_folder_cancellable, g_cancellable_cancel);
+ g_clear_pointer (&impl->should_respond_get_info_cancellable, g_cancellable_cancel);
+ g_clear_pointer (&impl->file_exists_get_info_cancellable, g_cancellable_cancel);
search_stop_searching (impl, TRUE);
}
@@ -3139,16 +3044,14 @@ static void
remove_settings_signal (GtkFileChooserWidget *impl,
GdkDisplay *display)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- if (priv->settings_signal_id)
+ if (impl->settings_signal_id)
{
GtkSettings *settings;
settings = gtk_settings_get_for_display (display);
g_signal_handler_disconnect (settings,
- priv->settings_signal_id);
- priv->settings_signal_id = 0;
+ impl->settings_signal_id);
+ impl->settings_signal_id = 0;
}
}
@@ -3156,22 +3059,21 @@ static void
gtk_file_chooser_widget_dispose (GObject *object)
{
GtkFileChooserWidget *impl = (GtkFileChooserWidget *) object;
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
cancel_all_operations (impl);
- g_clear_pointer (&priv->rename_file_popover, gtk_widget_unparent);
- g_clear_pointer (&priv->browse_files_popover, gtk_widget_destroy);
- g_clear_object (&priv->extra_widget);
- g_clear_pointer (&priv->bookmarks_manager, _gtk_bookmarks_manager_free);
+ g_clear_pointer (&impl->rename_file_popover, gtk_widget_unparent);
+ g_clear_pointer (&impl->browse_files_popover, gtk_widget_destroy);
+ g_clear_object (&impl->extra_widget);
+ g_clear_pointer (&impl->bookmarks_manager, _gtk_bookmarks_manager_free);
- if (priv->external_entry && priv->location_entry == priv->external_entry)
+ if (impl->external_entry && impl->location_entry == impl->external_entry)
{
location_entry_disconnect (impl);
- priv->external_entry = NULL;
+ impl->external_entry = NULL;
}
- g_clear_pointer (&priv->box, gtk_widget_unparent);
+ g_clear_pointer (&impl->box, gtk_widget_unparent);
G_OBJECT_CLASS (gtk_file_chooser_widget_parent_class)->dispose (object);
}
@@ -3184,10 +3086,8 @@ toplevel_set_focus_cb (GtkWindow *window,
GParamSpec *pspec,
GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- priv->toplevel_last_focus_widget = priv->toplevel_current_focus_widget;
- priv->toplevel_current_focus_widget = gtk_root_get_focus (GTK_ROOT (window));
+ impl->toplevel_last_focus_widget = impl->toplevel_current_focus_widget;
+ impl->toplevel_current_focus_widget = gtk_root_get_focus (GTK_ROOT (window));
}
/* We monitor the focus widget on our toplevel to be able to know which widget
@@ -3197,34 +3097,32 @@ static void
gtk_file_chooser_widget_root (GtkWidget *widget)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (widget);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GtkWidget *toplevel;
GTK_WIDGET_CLASS (gtk_file_chooser_widget_parent_class)->root (widget);
toplevel = GTK_WIDGET (gtk_widget_get_root (widget));
- g_assert (priv->toplevel_set_focus_id == 0);
- priv->toplevel_set_focus_id = g_signal_connect (toplevel, "notify::focus-widget",
+ g_assert (impl->toplevel_set_focus_id == 0);
+ impl->toplevel_set_focus_id = g_signal_connect (toplevel, "notify::focus-widget",
G_CALLBACK (toplevel_set_focus_cb), impl);
- priv->toplevel_last_focus_widget = NULL;
- priv->toplevel_current_focus_widget = gtk_root_get_focus (GTK_ROOT (toplevel));
+ impl->toplevel_last_focus_widget = NULL;
+ impl->toplevel_current_focus_widget = gtk_root_get_focus (GTK_ROOT (toplevel));
}
static void
gtk_file_chooser_widget_unroot (GtkWidget *widget)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (widget);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GtkWidget *toplevel;
toplevel = GTK_WIDGET (gtk_widget_get_root (widget));
- if (toplevel && priv->toplevel_set_focus_id != 0)
+ if (toplevel && impl->toplevel_set_focus_id != 0)
{
- g_signal_handler_disconnect (toplevel, priv->toplevel_set_focus_id);
- priv->toplevel_set_focus_id = 0;
- priv->toplevel_last_focus_widget = NULL;
- priv->toplevel_current_focus_widget = NULL;
+ g_signal_handler_disconnect (toplevel, impl->toplevel_set_focus_id);
+ impl->toplevel_set_focus_id = 0;
+ impl->toplevel_last_focus_widget = NULL;
+ impl->toplevel_current_focus_widget = NULL;
}
GTK_WIDGET_CLASS (gtk_file_chooser_widget_parent_class)->unroot (widget);
@@ -3234,15 +3132,13 @@ gtk_file_chooser_widget_unroot (GtkWidget *widget)
static void
change_icon_theme (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
profile_start ("start", NULL);
/* the first cell in the first column is the icon column, and we have a fixed size there */
set_icon_cell_renderer_fixed_size (impl);
clear_model_cache (impl, MODEL_COL_ICON);
- gtk_widget_queue_resize (priv->browse_files_tree_view);
+ gtk_widget_queue_resize (impl->browse_files_tree_view);
profile_end ("end", NULL);
}
@@ -3271,19 +3167,18 @@ settings_notify_cb (GObject *object,
static void
check_icon_theme (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GtkSettings *settings;
profile_start ("start", NULL);
- if (priv->settings_signal_id)
+ if (impl->settings_signal_id)
{
profile_end ("end", NULL);
return;
}
settings = gtk_widget_get_settings (GTK_WIDGET (impl));
- priv->settings_signal_id = g_signal_connect (settings, "notify",
+ impl->settings_signal_id = g_signal_connect (settings, "notify",
G_CALLBACK (settings_notify_cb), impl);
change_icon_theme (impl);
@@ -3313,24 +3208,22 @@ gtk_file_chooser_widget_css_changed (GtkWidget *widget,
static void
set_sort_column (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GtkTreeSortable *sortable;
- sortable = GTK_TREE_SORTABLE (gtk_tree_view_get_model (GTK_TREE_VIEW (priv->browse_files_tree_view)));
+ sortable = GTK_TREE_SORTABLE (gtk_tree_view_get_model (GTK_TREE_VIEW (impl->browse_files_tree_view)));
/* can happen when we're still populating the model */
if (sortable == NULL)
return;
gtk_tree_sortable_set_sort_column_id (sortable,
- priv->sort_column,
- priv->sort_order);
+ impl->sort_column,
+ impl->sort_order);
}
static void
settings_load (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
gboolean show_hidden;
gboolean show_size_column;
gboolean show_type_column;
@@ -3358,18 +3251,18 @@ settings_load (GtkFileChooserWidget *impl)
set_show_hidden (impl, show_hidden);
- priv->show_size_column = show_size_column;
- gtk_tree_view_column_set_visible (priv->list_size_column, show_size_column);
- priv->show_type_column = show_type_column;
- gtk_tree_view_column_set_visible (priv->list_type_column, show_type_column);
+ impl->show_size_column = show_size_column;
+ gtk_tree_view_column_set_visible (impl->list_size_column, show_size_column);
+ impl->show_type_column = show_type_column;
+ gtk_tree_view_column_set_visible (impl->list_type_column, show_type_column);
- priv->sort_column = sort_column;
- priv->sort_order = sort_order;
- priv->startup_mode = startup_mode;
- priv->sort_directories_first = sort_directories_first;
- priv->show_time = date_format == DATE_FORMAT_WITH_TIME;
- priv->clock_format = g_settings_get_enum (settings, "clock-format");
- priv->type_format = type_format;
+ impl->sort_column = sort_column;
+ impl->sort_order = sort_order;
+ impl->startup_mode = startup_mode;
+ impl->sort_directories_first = sort_directories_first;
+ impl->show_time = date_format == DATE_FORMAT_WITH_TIME;
+ impl->clock_format = g_settings_get_enum (settings, "clock-format");
+ impl->type_format = type_format;
/* We don't call set_sort_column() here as the models may not have been
* created yet. The individual functions that create and set the models will
@@ -3379,36 +3272,35 @@ settings_load (GtkFileChooserWidget *impl)
update_time_renderer_visible (impl);
if (sidebar_width < 0)
{
- GtkWidget *sidebar = gtk_paned_get_child1 (GTK_PANED (priv->browse_widgets_hpaned));
+ GtkWidget *sidebar = gtk_paned_get_child1 (GTK_PANED (impl->browse_widgets_hpaned));
gtk_widget_measure (sidebar, GTK_ORIENTATION_HORIZONTAL, -1,
NULL, &sidebar_width, NULL, NULL);
}
- gtk_paned_set_position (GTK_PANED (priv->browse_widgets_hpaned), sidebar_width);
+ gtk_paned_set_position (GTK_PANED (impl->browse_widgets_hpaned), sidebar_width);
}
static void
settings_save (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GSettings *settings;
settings = _gtk_file_chooser_get_settings_for_widget (GTK_WIDGET (impl));
/* All the other state */
- g_settings_set_enum (settings, SETTINGS_KEY_LOCATION_MODE, priv->location_mode);
- g_settings_set_boolean (settings, SETTINGS_KEY_SHOW_HIDDEN, priv->show_hidden);
- g_settings_set_boolean (settings, SETTINGS_KEY_SHOW_SIZE_COLUMN, priv->show_size_column);
- g_settings_set_boolean (settings, SETTINGS_KEY_SHOW_TYPE_COLUMN, priv->show_type_column);
- g_settings_set_boolean (settings, SETTINGS_KEY_SORT_DIRECTORIES_FIRST, priv->sort_directories_first);
- g_settings_set_enum (settings, SETTINGS_KEY_SORT_COLUMN, priv->sort_column);
- g_settings_set_enum (settings, SETTINGS_KEY_SORT_ORDER, priv->sort_order);
+ g_settings_set_enum (settings, SETTINGS_KEY_LOCATION_MODE, impl->location_mode);
+ g_settings_set_boolean (settings, SETTINGS_KEY_SHOW_HIDDEN, impl->show_hidden);
+ g_settings_set_boolean (settings, SETTINGS_KEY_SHOW_SIZE_COLUMN, impl->show_size_column);
+ g_settings_set_boolean (settings, SETTINGS_KEY_SHOW_TYPE_COLUMN, impl->show_type_column);
+ g_settings_set_boolean (settings, SETTINGS_KEY_SORT_DIRECTORIES_FIRST, impl->sort_directories_first);
+ g_settings_set_enum (settings, SETTINGS_KEY_SORT_COLUMN, impl->sort_column);
+ g_settings_set_enum (settings, SETTINGS_KEY_SORT_ORDER, impl->sort_order);
g_settings_set_int (settings, SETTINGS_KEY_SIDEBAR_WIDTH,
- gtk_paned_get_position (GTK_PANED (priv->browse_widgets_hpaned)));
- g_settings_set_enum (settings, SETTINGS_KEY_DATE_FORMAT, priv->show_time ? DATE_FORMAT_WITH_TIME : DATE_FORMAT_REGULAR);
- g_settings_set_enum (settings, SETTINGS_KEY_TYPE_FORMAT, priv->type_format);
+ gtk_paned_get_position (GTK_PANED (impl->browse_widgets_hpaned)));
+ g_settings_set_enum (settings, SETTINGS_KEY_DATE_FORMAT, impl->show_time ? DATE_FORMAT_WITH_TIME : DATE_FORMAT_REGULAR);
+ g_settings_set_enum (settings, SETTINGS_KEY_TYPE_FORMAT, impl->type_format);
/* Now apply the settings */
g_settings_apply (settings);
@@ -3444,24 +3336,23 @@ recent_files_setting_is_enabled (GtkFileChooserWidget *impl)
static void
set_startup_mode (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GtkRevealerTransitionType revealer_transition;
GtkStackTransitionType stack_transition;
/* turn off animations for this setup */
revealer_transition
- = gtk_revealer_get_transition_type (GTK_REVEALER (priv->browse_header_revealer));
- gtk_revealer_set_transition_type (GTK_REVEALER (priv->browse_header_revealer),
+ = gtk_revealer_get_transition_type (GTK_REVEALER (impl->browse_header_revealer));
+ gtk_revealer_set_transition_type (GTK_REVEALER (impl->browse_header_revealer),
GTK_REVEALER_TRANSITION_TYPE_NONE);
stack_transition
- = gtk_stack_get_transition_type (GTK_STACK (priv->browse_header_stack));
- gtk_stack_set_transition_type (GTK_STACK (priv->browse_header_stack),
+ = gtk_stack_get_transition_type (GTK_STACK (impl->browse_header_stack));
+ gtk_stack_set_transition_type (GTK_STACK (impl->browse_header_stack),
GTK_STACK_TRANSITION_TYPE_NONE);
- switch (priv->startup_mode)
+ switch (impl->startup_mode)
{
case STARTUP_MODE_RECENT:
- if (gtk_places_sidebar_get_show_recent (GTK_PLACES_SIDEBAR (priv->places_sidebar)))
+ if (gtk_places_sidebar_get_show_recent (GTK_PLACES_SIDEBAR (impl->places_sidebar)))
{
operation_mode_set (impl, OPERATION_MODE_RECENT);
break;
@@ -3476,23 +3367,22 @@ set_startup_mode (GtkFileChooserWidget *impl)
g_assert_not_reached ();
}
- gtk_stack_set_transition_type (GTK_STACK (priv->browse_header_stack),
+ gtk_stack_set_transition_type (GTK_STACK (impl->browse_header_stack),
stack_transition);
- gtk_revealer_set_transition_type (GTK_REVEALER (priv->browse_header_revealer),
+ gtk_revealer_set_transition_type (GTK_REVEALER (impl->browse_header_revealer),
revealer_transition);
}
static gboolean
shortcut_exists (GtkFileChooserWidget *impl, GFile *needle)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GSList *haystack;
GSList *l;
gboolean exists;
exists = FALSE;
- haystack = gtk_places_sidebar_list_shortcuts (GTK_PLACES_SIDEBAR (priv->places_sidebar));
+ haystack = gtk_places_sidebar_list_shortcuts (GTK_PLACES_SIDEBAR (impl->places_sidebar));
for (l = haystack; l; l = l->next)
{
GFile *hay;
@@ -3512,7 +3402,6 @@ shortcut_exists (GtkFileChooserWidget *impl, GFile *needle)
static void
add_cwd_to_sidebar_if_needed (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
char *cwd;
GFile *cwd_file;
GFile *home_file;
@@ -3533,7 +3422,7 @@ add_cwd_to_sidebar_if_needed (GtkFileChooserWidget *impl)
* $HOME) won't get any extra clutter in the sidebar.
*/
if (!g_file_equal (home_file, cwd_file))
- gtk_places_sidebar_add_shortcut (GTK_PLACES_SIDEBAR (priv->places_sidebar), cwd_file);
+ gtk_places_sidebar_add_shortcut (GTK_PLACES_SIDEBAR (impl->places_sidebar), cwd_file);
g_object_unref (home_file);
@@ -3546,7 +3435,6 @@ static void
gtk_file_chooser_widget_map (GtkWidget *widget)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (widget);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
profile_start ("start", NULL);
@@ -3556,9 +3444,9 @@ gtk_file_chooser_widget_map (GtkWidget *widget)
add_cwd_to_sidebar_if_needed (impl);
- if (priv->operation_mode == OPERATION_MODE_BROWSE)
+ if (impl->operation_mode == OPERATION_MODE_BROWSE)
{
- switch (priv->reload_state)
+ switch (impl->reload_state)
{
case RELOAD_EMPTY:
set_startup_mode (impl);
@@ -3583,12 +3471,11 @@ static void
gtk_file_chooser_widget_unmap (GtkWidget *widget)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (widget);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
settings_save (impl);
cancel_all_operations (impl);
- priv->reload_state = RELOAD_EMPTY;
+ impl->reload_state = RELOAD_EMPTY;
GTK_WIDGET_CLASS (gtk_file_chooser_widget_parent_class)->unmap (widget);
}
@@ -3599,14 +3486,13 @@ compare_directory (GtkFileSystemModel *model,
GtkTreeIter *b,
GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
gboolean dir_a, dir_b;
dir_a = g_value_get_boolean (_gtk_file_system_model_get_value (model, a, MODEL_COL_IS_FOLDER));
dir_b = g_value_get_boolean (_gtk_file_system_model_get_value (model, b, MODEL_COL_IS_FOLDER));
- if (priv->sort_directories_first && dir_a != dir_b)
- return priv->list_sort_ascending ? (dir_a ? -1 : 1) : (dir_a ? 1 : -1);
+ if (impl->sort_directories_first && dir_a != dir_b)
+ return impl->list_sort_ascending ? (dir_a ? -1 : 1) : (dir_a ? 1 : -1);
return 0;
}
@@ -3816,15 +3702,14 @@ static void
list_sort_column_changed_cb (GtkTreeSortable *sortable,
GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
gint sort_column_id;
GtkSortType sort_type;
if (gtk_tree_sortable_get_sort_column_id (sortable, &sort_column_id, &sort_type))
{
- priv->list_sort_ascending = (sort_type == GTK_SORT_ASCENDING);
- priv->sort_column = sort_column_id;
- priv->sort_order = sort_type;
+ impl->list_sort_ascending = (sort_type == GTK_SORT_ASCENDING);
+ impl->sort_column = sort_column_id;
+ impl->sort_order = sort_type;
}
}
@@ -3851,27 +3736,26 @@ update_columns (GtkFileChooserWidget *impl,
gboolean location_visible,
const gchar *time_title)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
gboolean need_resize = FALSE;
- if (gtk_tree_view_column_get_visible (priv->list_location_column) != location_visible)
+ if (gtk_tree_view_column_get_visible (impl->list_location_column) != location_visible)
{
- gtk_tree_view_column_set_visible (priv->list_location_column, location_visible);
+ gtk_tree_view_column_set_visible (impl->list_location_column, location_visible);
need_resize = TRUE;
}
- if (g_strcmp0 (gtk_tree_view_column_get_title (priv->list_time_column), time_title) != 0)
+ if (g_strcmp0 (gtk_tree_view_column_get_title (impl->list_time_column), time_title) != 0)
{
- gtk_tree_view_column_set_title (priv->list_time_column, time_title);
+ gtk_tree_view_column_set_title (impl->list_time_column, time_title);
need_resize = TRUE;
}
if (need_resize)
{
/* This undoes user resizing of columns when the columns change. */
- gtk_tree_view_column_set_expand (priv->list_name_column, TRUE);
- gtk_tree_view_column_set_expand (priv->list_location_column, TRUE);
- gtk_tree_view_columns_autosize (GTK_TREE_VIEW (priv->browse_files_tree_view));
+ gtk_tree_view_column_set_expand (impl->list_name_column, TRUE);
+ gtk_tree_view_column_set_expand (impl->list_location_column, TRUE);
+ gtk_tree_view_columns_autosize (GTK_TREE_VIEW (impl->browse_files_tree_view));
}
}
@@ -3879,22 +3763,20 @@ update_columns (GtkFileChooserWidget *impl,
static void
load_set_model (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
profile_start ("start", NULL);
- g_assert (priv->browse_files_model != NULL);
+ g_assert (impl->browse_files_model != NULL);
profile_msg (" gtk_tree_view_set_model start", NULL);
- gtk_tree_view_set_model (GTK_TREE_VIEW (priv->browse_files_tree_view),
- GTK_TREE_MODEL (priv->browse_files_model));
+ gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_files_tree_view),
+ GTK_TREE_MODEL (impl->browse_files_model));
update_columns (impl, FALSE, _("Modified"));
file_list_set_sort_column_ids (impl);
set_sort_column (impl);
profile_msg (" gtk_tree_view_set_model end", NULL);
- priv->list_sort_ascending = TRUE;
+ impl->list_sort_ascending = TRUE;
- g_set_object (&priv->model_for_search, priv->browse_files_model);
+ g_set_object (&impl->model_for_search, impl->browse_files_model);
profile_end ("end", NULL);
}
@@ -3904,16 +3786,15 @@ static gboolean
load_timeout_cb (gpointer data)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (data);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
profile_start ("start", NULL);
- g_assert (priv->load_state == LOAD_PRELOAD);
- g_assert (priv->load_timeout_id != 0);
- g_assert (priv->browse_files_model != NULL);
+ g_assert (impl->load_state == LOAD_PRELOAD);
+ g_assert (impl->load_timeout_id != 0);
+ g_assert (impl->browse_files_model != NULL);
- priv->load_timeout_id = 0;
- priv->load_state = LOAD_LOADING;
+ impl->load_timeout_id = 0;
+ impl->load_state = LOAD_LOADING;
load_set_model (impl);
@@ -3926,50 +3807,45 @@ load_timeout_cb (gpointer data)
static void
load_setup_timer (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- g_assert (priv->load_timeout_id == 0);
- g_assert (priv->load_state != LOAD_PRELOAD);
+ g_assert (impl->load_timeout_id == 0);
+ g_assert (impl->load_state != LOAD_PRELOAD);
- priv->load_timeout_id = g_timeout_add (MAX_LOADING_TIME, load_timeout_cb, impl);
- g_source_set_name_by_id (priv->load_timeout_id, "[gtk] load_timeout_cb");
- priv->load_state = LOAD_PRELOAD;
+ impl->load_timeout_id = g_timeout_add (MAX_LOADING_TIME, load_timeout_cb, impl);
+ g_source_set_name_by_id (impl->load_timeout_id, "[gtk] load_timeout_cb");
+ impl->load_state = LOAD_PRELOAD;
}
/* Removes the load timeout; changes the impl->load_state to the specified value. */
static void
load_remove_timer (GtkFileChooserWidget *impl, LoadState new_load_state)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- if (priv->load_timeout_id != 0)
+ if (impl->load_timeout_id != 0)
{
- g_assert (priv->load_state == LOAD_PRELOAD);
+ g_assert (impl->load_state == LOAD_PRELOAD);
- g_source_remove (priv->load_timeout_id);
- priv->load_timeout_id = 0;
+ g_source_remove (impl->load_timeout_id);
+ impl->load_timeout_id = 0;
}
else
- g_assert (priv->load_state == LOAD_EMPTY ||
- priv->load_state == LOAD_LOADING ||
- priv->load_state == LOAD_FINISHED);
+ g_assert (impl->load_state == LOAD_EMPTY ||
+ impl->load_state == LOAD_LOADING ||
+ impl->load_state == LOAD_FINISHED);
g_assert (new_load_state == LOAD_EMPTY ||
new_load_state == LOAD_LOADING ||
new_load_state == LOAD_FINISHED);
- priv->load_state = new_load_state;
+ impl->load_state = new_load_state;
}
/* Selects the first row in the file list */
static void
browse_files_select_first_row (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GtkTreePath *path;
GtkTreeIter dummy_iter;
GtkTreeModel *tree_model;
- tree_model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->browse_files_tree_view));
+ tree_model = gtk_tree_view_get_model (GTK_TREE_VIEW (impl->browse_files_tree_view));
if (!tree_model)
return;
@@ -3986,11 +3862,11 @@ browse_files_select_first_row (GtkFileChooserWidget *impl)
* is changed. This entire function, browse_files_select_first_row(), may
* go away when that bug is fixed in GtkTreeView.
*/
- priv->auto_selecting_first_row = TRUE;
+ impl->auto_selecting_first_row = TRUE;
- gtk_tree_view_set_cursor (GTK_TREE_VIEW (priv->browse_files_tree_view), path, NULL, FALSE);
+ gtk_tree_view_set_cursor (GTK_TREE_VIEW (impl->browse_files_tree_view), path, NULL, FALSE);
- priv->auto_selecting_first_row = FALSE;
+ impl->auto_selecting_first_row = FALSE;
}
gtk_tree_path_free (path);
}
@@ -4010,12 +3886,11 @@ center_selected_row_foreach_cb (GtkTreeModel *model,
gpointer data)
{
struct center_selected_row_closure *closure = data;
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (closure->impl);
if (closure->already_centered)
return;
- gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (priv->browse_files_tree_view), path, NULL, TRUE, 0.5, 0.0);
+ gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (closure->impl->browse_files_tree_view), path, NULL, TRUE, 0.5, 0.0);
closure->already_centered = TRUE;
}
@@ -4023,14 +3898,13 @@ center_selected_row_foreach_cb (GtkTreeModel *model,
static void
browse_files_center_selected_row (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
struct center_selected_row_closure closure;
GtkTreeSelection *selection;
closure.impl = impl;
closure.already_centered = FALSE;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
gtk_tree_selection_selected_foreach (selection, center_selected_row_foreach_cb, &closure);
}
@@ -4038,23 +3912,22 @@ static gboolean
show_and_select_files (GtkFileChooserWidget *impl,
GSList *files)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GtkTreeSelection *selection;
GtkFileSystemModel *fsmodel;
gboolean enabled_hidden, removed_filters;
gboolean selected_a_file;
GSList *walk;
- g_assert (priv->load_state == LOAD_FINISHED);
- g_assert (priv->browse_files_model != NULL);
+ g_assert (impl->load_state == LOAD_FINISHED);
+ g_assert (impl->browse_files_model != NULL);
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->browse_files_tree_view));
- fsmodel = GTK_FILE_SYSTEM_MODEL (gtk_tree_view_get_model (GTK_TREE_VIEW (priv->browse_files_tree_view)));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
+ fsmodel = GTK_FILE_SYSTEM_MODEL (gtk_tree_view_get_model (GTK_TREE_VIEW (impl->browse_files_tree_view)));
- g_assert (fsmodel == priv->browse_files_model);
+ g_assert (fsmodel == impl->browse_files_model);
- enabled_hidden = priv->show_hidden;
- removed_filters = (priv->current_filter == NULL);
+ enabled_hidden = impl->show_hidden;
+ removed_filters = (impl->current_filter == NULL);
selected_a_file = FALSE;
@@ -4107,7 +3980,7 @@ show_and_select_files (GtkFileChooserWidget *impl,
gtk_tree_selection_select_iter (selection, &iter);
path = gtk_tree_model_get_path (GTK_TREE_MODEL (fsmodel), &iter);
- gtk_tree_view_set_cursor (GTK_TREE_VIEW (priv->browse_files_tree_view),
+ gtk_tree_view_set_cursor (GTK_TREE_VIEW (impl->browse_files_tree_view),
path, NULL, FALSE);
gtk_tree_path_free (path);
@@ -4124,14 +3997,12 @@ show_and_select_files (GtkFileChooserWidget *impl,
static void
pending_select_files_process (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- g_assert (priv->load_state == LOAD_FINISHED);
- g_assert (priv->browse_files_model != NULL);
+ g_assert (impl->load_state == LOAD_FINISHED);
+ g_assert (impl->browse_files_model != NULL);
- if (priv->pending_select_files)
+ if (impl->pending_select_files)
{
- show_and_select_files (impl, priv->pending_select_files);
+ show_and_select_files (impl, impl->pending_select_files);
pending_select_files_free (impl);
browse_files_center_selected_row (impl);
}
@@ -4144,22 +4015,21 @@ pending_select_files_process (GtkFileChooserWidget *impl)
* that case, the chooser's selection should be what the caller expects,
* as the user can't see that something else got selected. See bug #165264.
*/
- if (priv->action == GTK_FILE_CHOOSER_ACTION_OPEN &&
+ if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN &&
gtk_widget_get_mapped (GTK_WIDGET (impl)))
browse_files_select_first_row (impl);
}
- g_assert (priv->pending_select_files == NULL);
+ g_assert (impl->pending_select_files == NULL);
}
static void
show_error_on_reading_current_folder (GtkFileChooserWidget *impl, GError *error)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GFileInfo *info;
char *msg;
- info = g_file_query_info (priv->current_folder,
+ info = g_file_query_info (impl->current_folder,
G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
G_FILE_QUERY_INFO_NONE,
NULL,
@@ -4182,8 +4052,6 @@ browse_files_model_finished_loading_cb (GtkFileSystemModel *model,
GError *error,
GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
profile_start ("start", NULL);
if (error)
@@ -4192,12 +4060,12 @@ browse_files_model_finished_loading_cb (GtkFileSystemModel *model,
show_error_on_reading_current_folder (impl, error);
}
- if (priv->load_state == LOAD_PRELOAD)
+ if (impl->load_state == LOAD_PRELOAD)
{
load_remove_timer (impl, LOAD_FINISHED);
load_set_model (impl);
}
- else if (priv->load_state == LOAD_LOADING)
+ else if (impl->load_state == LOAD_LOADING)
{
/* Nothing */
}
@@ -4210,9 +4078,9 @@ browse_files_model_finished_loading_cb (GtkFileSystemModel *model,
return;
}
- g_assert (priv->load_timeout_id == 0);
+ g_assert (impl->load_timeout_id == 0);
- priv->load_state = LOAD_FINISHED;
+ impl->load_state = LOAD_FINISHED;
pending_select_files_process (impl);
set_busy_cursor (impl, FALSE);
@@ -4231,16 +4099,15 @@ browse_files_model_row_changed_cb (GtkTreeModel *model,
GtkTreeIter *iter,
GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GFile *file;
GSList files;
- if (priv->renamed_file)
+ if (impl->renamed_file)
{
gtk_tree_model_get (model, iter, MODEL_COL_FILE, &file, -1);
- if (g_file_equal (priv->renamed_file, file))
+ if (g_file_equal (impl->renamed_file, file))
{
- g_clear_object (&priv->renamed_file);
+ g_clear_object (&impl->renamed_file);
files.data = (gpointer) file;
files.next = NULL;
@@ -4256,14 +4123,12 @@ static void
stop_loading_and_clear_list_model (GtkFileChooserWidget *impl,
gboolean remove)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
load_remove_timer (impl, LOAD_EMPTY);
- g_set_object (&priv->browse_files_model, NULL);
+ g_set_object (&impl->browse_files_model, NULL);
if (remove)
- gtk_tree_view_set_model (GTK_TREE_VIEW (priv->browse_files_tree_view), NULL);
+ gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_files_tree_view), NULL);
}
/* Replace 'target' with 'replacement' in the input string. */
@@ -4298,7 +4163,6 @@ static char *
my_g_format_date_for_display (GtkFileChooserWidget *impl,
glong secs)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GDateTime *now, *time;
GDateTime *now_date, *date;
const gchar *format;
@@ -4320,9 +4184,9 @@ my_g_format_date_for_display (GtkFileChooserWidget *impl,
if (days_ago < 1)
{
- if (priv->show_time)
+ if (impl->show_time)
format = "";
- else if (priv->clock_format == CLOCK_FORMAT_24)
+ else if (impl->clock_format == CLOCK_FORMAT_24)
/* Translators: see g_date_time_format() for details on the format */
format = _("%H:%M");
else
@@ -4360,14 +4224,13 @@ static char *
my_g_format_time_for_display (GtkFileChooserWidget *impl,
glong secs)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GDateTime *time;
const gchar *format;
gchar *date_str;
time = g_date_time_new_from_unix_local (secs);
- if (priv->clock_format == CLOCK_FORMAT_24)
+ if (impl->clock_format == CLOCK_FORMAT_24)
format = _("%H:%M");
else
format = _("%l:%M %p");
@@ -4492,14 +4355,13 @@ get_type_information (GtkFileChooserWidget *impl,
char *mime_type;
char *description;
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
content_type = g_file_info_get_content_type (info);
if (!content_type)
content_type = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE);
if (!content_type)
goto end;
- switch (priv->type_format)
+ switch (impl->type_format)
{
case TYPE_FORMAT_MIME:
mime_type = g_content_type_get_mime_type (content_type);
@@ -4529,7 +4391,6 @@ file_system_model_set (GtkFileSystemModel *model,
gpointer data)
{
GtkFileChooserWidget *impl = data;
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
switch (column)
{
@@ -4556,7 +4417,7 @@ file_system_model_set (GtkFileSystemModel *model,
{
gboolean sensitive = TRUE;
- if (priv->action != GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ if (impl->action != GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
{
sensitive = TRUE; /* for file modes... */
}
@@ -4592,18 +4453,18 @@ file_system_model_set (GtkFileSystemModel *model,
GtkTreeIter iter;
gboolean visible;
- if (priv->browse_files_tree_view == NULL ||
+ if (impl->browse_files_tree_view == NULL ||
g_file_info_has_attribute (info, "filechooser::queried"))
return FALSE;
- tree_model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->browse_files_tree_view));
+ tree_model = gtk_tree_view_get_model (GTK_TREE_VIEW (impl->browse_files_tree_view));
if (tree_model != GTK_TREE_MODEL (model))
return FALSE;
if (!_gtk_file_system_model_get_iter_for_file (model, &iter, file))
g_assert_not_reached ();
- if (gtk_tree_view_get_visible_range (GTK_TREE_VIEW (priv->browse_files_tree_view), &start, &end))
+ if (gtk_tree_view_get_visible_range (GTK_TREE_VIEW (impl->browse_files_tree_view), &start, &end))
{
GtkTreePath *path;
@@ -4659,7 +4520,7 @@ file_system_model_set (GtkFileSystemModel *model,
glong time;
if (info == NULL)
break;
- if (priv->operation_mode == OPERATION_MODE_RECENT)
+ if (impl->operation_mode == OPERATION_MODE_RECENT)
time = (glong) g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_ACCESS);
else
time = (glong) g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED);
@@ -4702,7 +4563,7 @@ file_system_model_set (GtkFileSystemModel *model,
if (!dir_location)
location = g_strdup ("/");
- else if (priv->current_folder && g_file_equal (priv->current_folder, dir_location))
+ else if (impl->current_folder && g_file_equal (impl->current_folder, dir_location))
location = g_strdup ("");
else if (g_file_equal (home_location, dir_location))
location = g_strdup (_("Home"));
@@ -4738,12 +4599,10 @@ static gboolean
set_list_model (GtkFileChooserWidget *impl,
GError **error)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- g_assert (priv->current_folder != NULL);
+ g_assert (impl->current_folder != NULL);
- if (priv->browse_files_model &&
- _gtk_file_system_model_get_directory (priv->browse_files_model) == priv->current_folder)
+ if (impl->browse_files_model &&
+ _gtk_file_system_model_get_directory (impl->browse_files_model) == impl->current_folder)
return TRUE;
profile_start ("start", NULL);
@@ -4752,35 +4611,35 @@ set_list_model (GtkFileChooserWidget *impl,
set_busy_cursor (impl, TRUE);
- priv->browse_files_model =
- _gtk_file_system_model_new_for_directory (priv->current_folder,
+ impl->browse_files_model =
+ _gtk_file_system_model_new_for_directory (impl->current_folder,
MODEL_ATTRIBUTES,
file_system_model_set,
impl,
MODEL_COLUMN_TYPES);
- _gtk_file_system_model_set_show_hidden (priv->browse_files_model, priv->show_hidden);
+ _gtk_file_system_model_set_show_hidden (impl->browse_files_model, impl->show_hidden);
profile_msg (" set sort function", NULL);
- gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (priv->browse_files_model), MODEL_COL_NAME, name_sort_func, impl, NULL);
- gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (priv->browse_files_model), MODEL_COL_SIZE, size_sort_func, impl, NULL);
- gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (priv->browse_files_model), MODEL_COL_TYPE, type_sort_func, impl, NULL);
- gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (priv->browse_files_model), MODEL_COL_TIME, time_sort_func, impl, NULL);
- gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (priv->browse_files_model), NULL, NULL, NULL);
+ gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->browse_files_model), MODEL_COL_NAME, name_sort_func, impl, NULL);
+ gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->browse_files_model), MODEL_COL_SIZE, size_sort_func, impl, NULL);
+ gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->browse_files_model), MODEL_COL_TYPE, type_sort_func, impl, NULL);
+ gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->browse_files_model), MODEL_COL_TIME, time_sort_func, impl, NULL);
+ gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (impl->browse_files_model), NULL, NULL, NULL);
set_sort_column (impl);
- priv->list_sort_ascending = TRUE;
- g_signal_connect (priv->browse_files_model, "sort-column-changed",
+ impl->list_sort_ascending = TRUE;
+ g_signal_connect (impl->browse_files_model, "sort-column-changed",
G_CALLBACK (list_sort_column_changed_cb), impl);
load_setup_timer (impl); /* This changes the state to LOAD_PRELOAD */
- g_signal_connect (priv->browse_files_model, "finished-loading",
+ g_signal_connect (impl->browse_files_model, "finished-loading",
G_CALLBACK (browse_files_model_finished_loading_cb), impl);
- g_signal_connect (priv->browse_files_model, "row-changed",
+ g_signal_connect (impl->browse_files_model, "row-changed",
G_CALLBACK (browse_files_model_row_changed_cb), impl);
- _gtk_file_system_model_set_filter (priv->browse_files_model, priv->current_filter);
+ _gtk_file_system_model_set_filter (impl->browse_files_model, impl->current_filter);
profile_end ("end", NULL);
@@ -4828,42 +4687,41 @@ update_chooser_entry_selected_foreach (GtkTreeModel *model,
static void
update_chooser_entry (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GtkTreeSelection *selection;
struct update_chooser_entry_selected_foreach_closure closure;
/* no need to update the file chooser's entry if there's no entry */
- if (priv->operation_mode == OPERATION_MODE_SEARCH ||
- !priv->location_entry)
+ if (impl->operation_mode == OPERATION_MODE_SEARCH ||
+ !impl->location_entry)
return;
- if (!(priv->action == GTK_FILE_CHOOSER_ACTION_SAVE
- || ((priv->action == GTK_FILE_CHOOSER_ACTION_OPEN
- || priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
- && priv->location_mode == LOCATION_MODE_FILENAME_ENTRY)))
+ if (!(impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
+ || ((impl->action == GTK_FILE_CHOOSER_ACTION_OPEN
+ || impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ && impl->location_mode == LOCATION_MODE_FILENAME_ENTRY)))
return;
- g_assert (priv->location_entry != NULL);
+ g_assert (impl->location_entry != NULL);
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
closure.num_selected = 0;
gtk_tree_selection_selected_foreach (selection, update_chooser_entry_selected_foreach, &closure);
if (closure.num_selected == 0)
{
- if (priv->operation_mode == OPERATION_MODE_RECENT)
- _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (priv->location_entry), NULL);
+ if (impl->operation_mode == OPERATION_MODE_RECENT)
+ _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), NULL);
else
goto maybe_clear_entry;
}
else if (closure.num_selected == 1)
{
- if (priv->operation_mode == OPERATION_MODE_BROWSE)
+ if (impl->operation_mode == OPERATION_MODE_BROWSE)
{
GFileInfo *info;
gboolean change_entry;
- info = _gtk_file_system_model_get_info (priv->browse_files_model, &closure.first_selected_iter);
+ info = _gtk_file_system_model_get_info (impl->browse_files_model, &closure.first_selected_iter);
/* If the cursor moved to the row of the newly created folder,
* retrieving info will return NULL.
@@ -4871,12 +4729,12 @@ update_chooser_entry (GtkFileChooserWidget *impl)
if (!info)
return;
- g_free (priv->browse_files_last_selected_name);
- priv->browse_files_last_selected_name =
+ g_free (impl->browse_files_last_selected_name);
+ impl->browse_files_last_selected_name =
g_strdup (g_file_info_get_display_name (info));
- if (priv->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
- priv->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+ if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+ impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
{
/* Don't change the name when clicking on a folder... */
change_entry = !_gtk_file_info_consider_as_directory (info);
@@ -4884,57 +4742,57 @@ update_chooser_entry (GtkFileChooserWidget *impl)
else
change_entry = TRUE; /* ... unless we are in SELECT_FOLDER mode */
- if (change_entry && !priv->auto_selecting_first_row)
+ if (change_entry && !impl->auto_selecting_first_row)
{
- g_signal_handlers_block_by_func (priv->location_entry, G_CALLBACK (location_entry_changed_cb), impl);
- gtk_editable_set_text (GTK_EDITABLE (priv->location_entry), priv->browse_files_last_selected_name);
- g_signal_handlers_unblock_by_func (priv->location_entry, G_CALLBACK (location_entry_changed_cb), impl);
+ g_signal_handlers_block_by_func (impl->location_entry, G_CALLBACK (location_entry_changed_cb), impl);
+ gtk_editable_set_text (GTK_EDITABLE (impl->location_entry), impl->browse_files_last_selected_name);
+ g_signal_handlers_unblock_by_func (impl->location_entry, G_CALLBACK (location_entry_changed_cb), impl);
- if (priv->action == GTK_FILE_CHOOSER_ACTION_SAVE)
- _gtk_file_chooser_entry_select_filename (GTK_FILE_CHOOSER_ENTRY (priv->location_entry));
+ if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+ _gtk_file_chooser_entry_select_filename (GTK_FILE_CHOOSER_ENTRY (impl->location_entry));
}
return;
}
- else if (priv->operation_mode == OPERATION_MODE_RECENT
- && priv->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+ else if (impl->operation_mode == OPERATION_MODE_RECENT
+ && impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
{
GFile *folder;
/* Set the base folder on the name entry, so it will do completion relative to the correct recent-folder */
- gtk_tree_model_get (GTK_TREE_MODEL (priv->recent_model), &closure.first_selected_iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (impl->recent_model), &closure.first_selected_iter,
MODEL_COL_FILE, &folder,
-1);
- _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (priv->location_entry), folder);
+ _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), folder);
g_object_unref (folder);
return;
}
}
else
{
- g_assert (priv->action != GTK_FILE_CHOOSER_ACTION_SAVE);
+ g_assert (impl->action != GTK_FILE_CHOOSER_ACTION_SAVE);
/* Multiple selection, so just clear the entry. */
- g_free (priv->browse_files_last_selected_name);
- priv->browse_files_last_selected_name = NULL;
+ g_free (impl->browse_files_last_selected_name);
+ impl->browse_files_last_selected_name = NULL;
- g_signal_handlers_block_by_func (priv->location_entry, G_CALLBACK (location_entry_changed_cb), impl);
- gtk_editable_set_text (GTK_EDITABLE (priv->location_entry), "");
- g_signal_handlers_unblock_by_func (priv->location_entry, G_CALLBACK (location_entry_changed_cb), impl);
+ g_signal_handlers_block_by_func (impl->location_entry, G_CALLBACK (location_entry_changed_cb), impl);
+ gtk_editable_set_text (GTK_EDITABLE (impl->location_entry), "");
+ g_signal_handlers_unblock_by_func (impl->location_entry, G_CALLBACK (location_entry_changed_cb), impl);
return;
}
maybe_clear_entry:
- if ((priv->action == GTK_FILE_CHOOSER_ACTION_OPEN || priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
- && priv->browse_files_last_selected_name)
+ if ((impl->action == GTK_FILE_CHOOSER_ACTION_OPEN || impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ && impl->browse_files_last_selected_name)
{
const char *entry_text;
int len;
gboolean clear_entry;
- entry_text = gtk_editable_get_text (GTK_EDITABLE (priv->location_entry));
+ entry_text = gtk_editable_get_text (GTK_EDITABLE (impl->location_entry));
len = strlen (entry_text);
if (len != 0)
{
@@ -4946,20 +4804,20 @@ update_chooser_entry (GtkFileChooserWidget *impl)
gchar *tmp;
tmp = g_strndup (entry_text, len - 1);
- clear_entry = (compare_utf8_filenames (priv->browse_files_last_selected_name, tmp) == 0);
+ clear_entry = (compare_utf8_filenames (impl->browse_files_last_selected_name, tmp) == 0);
g_free (tmp);
}
else
- clear_entry = (compare_utf8_filenames (priv->browse_files_last_selected_name, entry_text) == 0);
+ clear_entry = (compare_utf8_filenames (impl->browse_files_last_selected_name, entry_text) == 0);
}
else
clear_entry = FALSE;
if (clear_entry)
{
- g_signal_handlers_block_by_func (priv->location_entry, G_CALLBACK (location_entry_changed_cb), impl);
- gtk_editable_set_text (GTK_EDITABLE (priv->location_entry), "");
- g_signal_handlers_unblock_by_func (priv->location_entry, G_CALLBACK (location_entry_changed_cb), impl);
+ g_signal_handlers_block_by_func (impl->location_entry, G_CALLBACK (location_entry_changed_cb), impl);
+ gtk_editable_set_text (GTK_EDITABLE (impl->location_entry), "");
+ g_signal_handlers_unblock_by_func (impl->location_entry, G_CALLBACK (location_entry_changed_cb), impl);
}
}
}
@@ -4991,13 +4849,12 @@ update_current_folder_mount_enclosing_volume_cb (GCancellable *cancellabl
{
struct UpdateCurrentFolderData *data = user_data;
GtkFileChooserWidget *impl = data->impl;
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
gboolean cancelled = g_cancellable_is_cancelled (cancellable);
- if (cancellable != priv->update_current_folder_cancellable)
+ if (cancellable != impl->update_current_folder_cancellable)
goto out;
- priv->update_current_folder_cancellable = NULL;
+ impl->update_current_folder_cancellable = NULL;
set_busy_cursor (impl, FALSE);
if (cancelled)
@@ -5006,7 +4863,7 @@ update_current_folder_mount_enclosing_volume_cb (GCancellable *cancellabl
if (error)
{
error_changing_folder_dialog (data->impl, data->file, g_error_copy (error));
- priv->reload_state = RELOAD_EMPTY;
+ impl->reload_state = RELOAD_EMPTY;
goto out;
}
@@ -5029,13 +4886,12 @@ update_current_folder_get_info_cb (GCancellable *cancellable,
gboolean cancelled = g_cancellable_is_cancelled (cancellable);
struct UpdateCurrentFolderData *data = user_data;
GtkFileChooserWidget *impl = data->impl;
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
- if (cancellable != priv->update_current_folder_cancellable)
+ if (cancellable != impl->update_current_folder_cancellable)
goto out;
- priv->update_current_folder_cancellable = NULL;
- priv->reload_state = RELOAD_EMPTY;
+ impl->update_current_folder_cancellable = NULL;
+ impl->reload_state = RELOAD_EMPTY;
set_busy_cursor (impl, FALSE);
@@ -5058,8 +4914,8 @@ update_current_folder_get_info_cb (GCancellable *cancellable,
set_busy_cursor (impl, TRUE);
- priv->update_current_folder_cancellable =
- _gtk_file_system_mount_enclosing_volume (priv->file_system, data->file,
+ impl->update_current_folder_cancellable =
+ _gtk_file_system_mount_enclosing_volume (impl->file_system, data->file,
mount_operation,
update_current_folder_mount_enclosing_volume_cb,
data);
@@ -5084,10 +4940,10 @@ update_current_folder_get_info_cb (GCancellable *cancellable,
g_object_unref (cancellable);
/* restart the update current folder operation */
- priv->reload_state = RELOAD_HAS_FOLDER;
+ impl->reload_state = RELOAD_HAS_FOLDER;
- priv->update_current_folder_cancellable =
- _gtk_file_system_get_info (priv->file_system, data->file,
+ impl->update_current_folder_cancellable =
+ _gtk_file_system_get_info (impl->file_system, data->file,
"standard::type",
update_current_folder_get_info_cb,
data);
@@ -5128,27 +4984,27 @@ update_current_folder_get_info_cb (GCancellable *cancellable,
if (! _gtk_file_info_consider_as_directory (info))
goto out;
- _gtk_path_bar_set_file (GTK_PATH_BAR (priv->browse_path_bar), data->file, data->keep_trail);
+ _gtk_path_bar_set_file (GTK_PATH_BAR (impl->browse_path_bar), data->file, data->keep_trail);
- if (priv->current_folder != data->file)
+ if (impl->current_folder != data->file)
{
- if (priv->current_folder)
- g_object_unref (priv->current_folder);
+ if (impl->current_folder)
+ g_object_unref (impl->current_folder);
- priv->current_folder = g_object_ref (data->file);
+ impl->current_folder = g_object_ref (data->file);
}
- priv->reload_state = RELOAD_HAS_FOLDER;
+ impl->reload_state = RELOAD_HAS_FOLDER;
/* Set the folder on the save entry */
- if (priv->location_entry)
+ if (impl->location_entry)
{
- _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (priv->location_entry),
- priv->current_folder);
+ _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (impl->location_entry),
+ impl->current_folder);
if (data->clear_entry)
- gtk_editable_set_text (GTK_EDITABLE (priv->location_entry), "");
+ gtk_editable_set_text (GTK_EDITABLE (impl->location_entry), "");
}
/* Create a new list model. This is slightly evil; we store the result value
@@ -5159,7 +5015,7 @@ update_current_folder_get_info_cb (GCancellable *cancellable,
/* Refresh controls */
- gtk_places_sidebar_set_location (GTK_PLACES_SIDEBAR (priv->places_sidebar), priv->current_folder);
+ gtk_places_sidebar_set_location (GTK_PLACES_SIDEBAR (impl->places_sidebar), impl->current_folder);
g_object_notify (G_OBJECT (impl), "subtitle");
@@ -5183,7 +5039,6 @@ gtk_file_chooser_widget_update_current_folder (GtkFileChooser *chooser,
GError **error)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (chooser);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
struct UpdateCurrentFolderData *data;
profile_start ("start", NULL);
@@ -5192,8 +5047,8 @@ gtk_file_chooser_widget_update_current_folder (GtkFileChooser *chooser,
operation_mode_set (impl, OPERATION_MODE_BROWSE);
- if (priv->update_current_folder_cancellable)
- g_cancellable_cancel (priv->update_current_folder_cancellable);
+ if (impl->update_current_folder_cancellable)
+ g_cancellable_cancel (impl->update_current_folder_cancellable);
/* Test validity of path here. */
data = g_new0 (struct UpdateCurrentFolderData, 1);
@@ -5202,10 +5057,10 @@ gtk_file_chooser_widget_update_current_folder (GtkFileChooser *chooser,
data->keep_trail = keep_trail;
data->clear_entry = clear_entry;
- priv->reload_state = RELOAD_HAS_FOLDER;
+ impl->reload_state = RELOAD_HAS_FOLDER;
- priv->update_current_folder_cancellable =
- _gtk_file_system_get_info (priv->file_system, file,
+ impl->update_current_folder_cancellable =
+ _gtk_file_system_get_info (impl->file_system, file,
"standard::type",
update_current_folder_get_info_cb,
data);
@@ -5221,13 +5076,12 @@ static GFile *
gtk_file_chooser_widget_get_current_folder (GtkFileChooser *chooser)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (chooser);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
- if (priv->operation_mode == OPERATION_MODE_RECENT)
+ if (impl->operation_mode == OPERATION_MODE_RECENT)
return NULL;
- if (priv->current_folder)
- return g_object_ref (priv->current_folder);
+ if (impl->current_folder)
+ return g_object_ref (impl->current_folder);
return NULL;
}
@@ -5237,23 +5091,21 @@ gtk_file_chooser_widget_set_current_name (GtkFileChooser *chooser,
const gchar *name)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (chooser);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
- g_return_if_fail (priv->action == GTK_FILE_CHOOSER_ACTION_SAVE);
+ g_return_if_fail (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE);
pending_select_files_free (impl);
- gtk_editable_set_text (GTK_EDITABLE (priv->location_entry), name);
+ gtk_editable_set_text (GTK_EDITABLE (impl->location_entry), name);
}
static gchar *
gtk_file_chooser_widget_get_current_name (GtkFileChooser *chooser)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (chooser);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
- g_return_val_if_fail (priv->action == GTK_FILE_CHOOSER_ACTION_SAVE, NULL);
+ g_return_val_if_fail (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE, NULL);
- return g_strdup (gtk_editable_get_text (GTK_EDITABLE (priv->location_entry)));
+ return g_strdup (gtk_editable_get_text (GTK_EDITABLE (impl->location_entry)));
}
static gboolean
@@ -5262,7 +5114,6 @@ gtk_file_chooser_widget_select_file (GtkFileChooser *chooser,
GError **error)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (chooser);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GFile *parent_file;
gboolean same_path;
GtkFileSystemModel *fsmodel;
@@ -5272,23 +5123,23 @@ gtk_file_chooser_widget_select_file (GtkFileChooser *chooser,
if (!parent_file)
return gtk_file_chooser_set_current_folder (chooser, file, error);
- fsmodel = GTK_FILE_SYSTEM_MODEL (gtk_tree_view_get_model (GTK_TREE_VIEW (priv->browse_files_tree_view)));
+ fsmodel = GTK_FILE_SYSTEM_MODEL (gtk_tree_view_get_model (GTK_TREE_VIEW (impl->browse_files_tree_view)));
- if (priv->operation_mode == OPERATION_MODE_SEARCH ||
- priv->operation_mode == OPERATION_MODE_RECENT ||
- priv->load_state == LOAD_EMPTY ||
- priv->browse_files_model != fsmodel)
+ if (impl->operation_mode == OPERATION_MODE_SEARCH ||
+ impl->operation_mode == OPERATION_MODE_RECENT ||
+ impl->load_state == LOAD_EMPTY ||
+ impl->browse_files_model != fsmodel)
{
same_path = FALSE;
}
else
{
- g_assert (priv->current_folder != NULL);
+ g_assert (impl->current_folder != NULL);
- same_path = g_file_equal (parent_file, priv->current_folder);
+ same_path = g_file_equal (parent_file, impl->current_folder);
}
- if (same_path && priv->load_state == LOAD_FINISHED)
+ if (same_path && impl->load_state == LOAD_FINISHED)
{
gboolean result;
GSList files;
@@ -5297,7 +5148,7 @@ gtk_file_chooser_widget_select_file (GtkFileChooser *chooser,
files.next = NULL;
/* Prevent the file chooser from loading a different folder when it is mapped */
- priv->reload_state = RELOAD_HAS_FOLDER;
+ impl->reload_state = RELOAD_HAS_FOLDER;
result = show_and_select_files (impl, &files);
g_object_unref (parent_file);
@@ -5324,12 +5175,11 @@ gtk_file_chooser_widget_unselect_file (GtkFileChooser *chooser,
GFile *file)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (chooser);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GtkTreeView *tree_view;
GtkTreeModel *model;
GtkTreeIter iter;
- tree_view = GTK_TREE_VIEW (priv->browse_files_tree_view);
+ tree_view = GTK_TREE_VIEW (impl->browse_files_tree_view);
model = gtk_tree_view_get_model (tree_view);
if (!model)
return;
@@ -5347,12 +5197,11 @@ maybe_select (GtkTreeModel *model,
gpointer data)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (data);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GtkTreeSelection *selection;
gboolean is_sensitive;
gboolean is_folder;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
gtk_tree_model_get (model, iter,
MODEL_COL_IS_FOLDER, &is_folder,
@@ -5360,8 +5209,8 @@ maybe_select (GtkTreeModel *model,
-1);
if (is_sensitive &&
- ((is_folder && priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER) ||
- (!is_folder && priv->action == GTK_FILE_CHOOSER_ACTION_OPEN)))
+ ((is_folder && impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER) ||
+ (!is_folder && impl->action == GTK_FILE_CHOOSER_ACTION_OPEN)))
gtk_tree_selection_select_iter (selection, iter);
else
gtk_tree_selection_unselect_iter (selection, iter);
@@ -5373,20 +5222,19 @@ static void
gtk_file_chooser_widget_select_all (GtkFileChooser *chooser)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (chooser);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
- if (priv->operation_mode == OPERATION_MODE_SEARCH ||
- priv->operation_mode == OPERATION_MODE_RECENT)
+ if (impl->operation_mode == OPERATION_MODE_SEARCH ||
+ impl->operation_mode == OPERATION_MODE_RECENT)
{
GtkTreeSelection *selection;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
gtk_tree_selection_select_all (selection);
return;
}
- if (priv->select_multiple)
- gtk_tree_model_foreach (GTK_TREE_MODEL (priv->browse_files_model),
+ if (impl->select_multiple)
+ gtk_tree_model_foreach (GTK_TREE_MODEL (impl->browse_files_model),
maybe_select, impl);
}
@@ -5394,8 +5242,7 @@ static void
gtk_file_chooser_widget_unselect_all (GtkFileChooser *chooser)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (chooser);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
- GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->browse_files_tree_view));
+ GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
gtk_tree_selection_unselect_all (selection);
pending_select_files_free (impl);
@@ -5418,7 +5265,6 @@ check_save_entry (GtkFileChooserWidget *impl,
gboolean *is_file_part_empty_ret,
gboolean *is_folder)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GtkFileChooserEntry *chooser_entry;
GFile *current_folder;
const char *file_part;
@@ -5426,12 +5272,12 @@ check_save_entry (GtkFileChooserWidget *impl,
GFile *file;
GError *error;
- g_assert (priv->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
- ((priv->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
- priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER) &&
- priv->location_mode == LOCATION_MODE_FILENAME_ENTRY));
+ g_assert (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
+ ((impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+ impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER) &&
+ impl->location_mode == LOCATION_MODE_FILENAME_ENTRY));
- chooser_entry = GTK_FILE_CHOOSER_ENTRY (priv->location_entry);
+ chooser_entry = GTK_FILE_CHOOSER_ENTRY (impl->location_entry);
if (strlen (gtk_editable_get_text (GTK_EDITABLE (chooser_entry))) == 0)
{
@@ -5521,7 +5367,6 @@ static GSList *
gtk_file_chooser_widget_get_files (GtkFileChooser *chooser)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (chooser);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
struct get_files_closure info;
GtkWindow *toplevel;
GtkWidget *current_focus;
@@ -5531,12 +5376,12 @@ gtk_file_chooser_widget_get_files (GtkFileChooser *chooser)
info.result = NULL;
info.file_from_entry = NULL;
- if (priv->operation_mode == OPERATION_MODE_SEARCH)
+ if (impl->operation_mode == OPERATION_MODE_SEARCH)
return get_selected_files (impl);
- if (priv->operation_mode == OPERATION_MODE_RECENT)
+ if (impl->operation_mode == OPERATION_MODE_RECENT)
{
- if (priv->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+ if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
{
file_list_seen = TRUE;
goto file_entry;
@@ -5552,14 +5397,14 @@ gtk_file_chooser_widget_get_files (GtkFileChooser *chooser)
current_focus = NULL;
file_list_seen = FALSE;
- if (current_focus == priv->browse_files_tree_view)
+ if (current_focus == impl->browse_files_tree_view)
{
GtkTreeSelection *selection;
file_list:
file_list_seen = TRUE;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
gtk_tree_selection_selected_foreach (selection, get_files_foreach, &info);
/* If there is no selection in the file list, we probably have this situation:
@@ -5570,10 +5415,10 @@ gtk_file_chooser_widget_get_files (GtkFileChooser *chooser)
* So we want the selection to be "bar/foo.txt". Jump to the case for the
* filename entry to see if that is the case.
*/
- if (info.result == NULL && priv->location_entry)
+ if (info.result == NULL && impl->location_entry)
goto file_entry;
}
- else if (priv->location_entry && current_focus == priv->location_entry)
+ else if (impl->location_entry && current_focus == impl->location_entry)
{
gboolean is_well_formed, is_empty, is_file_part_empty, is_folder;
@@ -5594,14 +5439,14 @@ gtk_file_chooser_widget_get_files (GtkFileChooser *chooser)
else
return NULL;
}
- else if (priv->toplevel_last_focus_widget == priv->browse_files_tree_view)
+ else if (impl->toplevel_last_focus_widget == impl->browse_files_tree_view)
goto file_list;
- else if (priv->location_entry && priv->toplevel_last_focus_widget == priv->location_entry)
+ else if (impl->location_entry && impl->toplevel_last_focus_widget == impl->location_entry)
goto file_entry;
else
{
/* The focus is on a dialog's action area button or something else */
- if (priv->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+ if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
goto file_entry;
else
goto file_list;
@@ -5612,7 +5457,7 @@ gtk_file_chooser_widget_get_files (GtkFileChooser *chooser)
/* If there's no folder selected, and we're in SELECT_FOLDER mode,
* then we fall back to the current directory
*/
- if (priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER &&
+ if (impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER &&
info.result == NULL)
{
GFile *current_folder;
@@ -5630,9 +5475,8 @@ static GtkFileSystem *
gtk_file_chooser_widget_get_file_system (GtkFileChooser *chooser)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (chooser);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
- return priv->file_system;
+ return impl->file_system;
}
/* Shows or hides the filter widgets */
@@ -5640,9 +5484,7 @@ static void
show_filters (GtkFileChooserWidget *impl,
gboolean show)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- gtk_widget_set_visible (priv->filter_combo_hbox, show);
+ gtk_widget_set_visible (impl->filter_combo_hbox, show);
update_extra_and_filters (impl);
}
@@ -5651,25 +5493,24 @@ gtk_file_chooser_widget_add_filter (GtkFileChooser *chooser,
GtkFileFilter *filter)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (chooser);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
const gchar *name;
- if (g_slist_find (priv->filters, filter))
+ if (g_slist_find (impl->filters, filter))
{
g_warning ("gtk_file_chooser_add_filter() called on filter already in list");
return;
}
g_object_ref_sink (filter);
- priv->filters = g_slist_append (priv->filters, filter);
+ impl->filters = g_slist_append (impl->filters, filter);
name = gtk_file_filter_get_name (filter);
if (!name)
name = "Untitled filter"; /* Place-holder, doesn't need to be marked for translation */
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (priv->filter_combo), name);
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (impl->filter_combo), name);
- if (!g_slist_find (priv->filters, priv->current_filter))
+ if (!g_slist_find (impl->filters, impl->current_filter))
set_current_filter (impl, filter);
show_filters (impl, TRUE);
@@ -5680,12 +5521,11 @@ gtk_file_chooser_widget_remove_filter (GtkFileChooser *chooser,
GtkFileFilter *filter)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (chooser);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GtkTreeModel *model;
GtkTreeIter iter;
gint filter_index;
- filter_index = g_slist_index (priv->filters, filter);
+ filter_index = g_slist_index (impl->filters, filter);
if (filter_index < 0)
{
@@ -5693,18 +5533,18 @@ gtk_file_chooser_widget_remove_filter (GtkFileChooser *chooser,
return;
}
- priv->filters = g_slist_remove (priv->filters, filter);
+ impl->filters = g_slist_remove (impl->filters, filter);
- if (filter == priv->current_filter)
+ if (filter == impl->current_filter)
{
- if (priv->filters)
- set_current_filter (impl, priv->filters->data);
+ if (impl->filters)
+ set_current_filter (impl, impl->filters->data);
else
set_current_filter (impl, NULL);
}
/* Remove row from the combo box */
- model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->filter_combo));
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (impl->filter_combo));
if (!gtk_tree_model_iter_nth_child (model, &iter, NULL, filter_index))
g_assert_not_reached ();
@@ -5712,7 +5552,7 @@ gtk_file_chooser_widget_remove_filter (GtkFileChooser *chooser,
g_object_unref (filter);
- if (!priv->filters)
+ if (!impl->filters)
show_filters (impl, FALSE);
}
@@ -5720,9 +5560,8 @@ static GSList *
gtk_file_chooser_widget_list_filters (GtkFileChooser *chooser)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (chooser);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
- return g_slist_copy (priv->filters);
+ return g_slist_copy (impl->filters);
}
static gboolean
@@ -5731,9 +5570,8 @@ gtk_file_chooser_widget_add_shortcut_folder (GtkFileChooser *chooser,
GError **error)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (chooser);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
- gtk_places_sidebar_add_shortcut (GTK_PLACES_SIDEBAR (priv->places_sidebar), file);
+ gtk_places_sidebar_add_shortcut (GTK_PLACES_SIDEBAR (impl->places_sidebar), file);
return TRUE;
}
@@ -5743,9 +5581,8 @@ gtk_file_chooser_widget_remove_shortcut_folder (GtkFileChooser *chooser,
GError **error)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (chooser);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
- gtk_places_sidebar_remove_shortcut (GTK_PLACES_SIDEBAR (priv->places_sidebar), file);
+ gtk_places_sidebar_remove_shortcut (GTK_PLACES_SIDEBAR (impl->places_sidebar), file);
return TRUE;
}
@@ -5753,9 +5590,8 @@ static GSList *
gtk_file_chooser_widget_list_shortcut_folders (GtkFileChooser *chooser)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (chooser);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
- return gtk_places_sidebar_list_shortcuts (GTK_PLACES_SIDEBAR (priv->places_sidebar));
+ return gtk_places_sidebar_list_shortcuts (GTK_PLACES_SIDEBAR (impl->places_sidebar));
}
struct switch_folder_closure {
@@ -5783,7 +5619,6 @@ switch_folder_foreach_cb (GtkTreeModel *model,
static void
switch_to_selected_folder (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GtkTreeSelection *selection;
struct switch_folder_closure closure;
@@ -5795,7 +5630,7 @@ switch_to_selected_folder (GtkFileChooserWidget *impl)
closure.file = NULL;
closure.num_selected = 0;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
gtk_tree_selection_selected_foreach (selection, switch_folder_foreach_cb, &closure);
g_assert (closure.file && closure.num_selected == 1);
@@ -5810,14 +5645,13 @@ static GFileInfo *
get_selected_file_info_from_file_list (GtkFileChooserWidget *impl,
gboolean *had_selection)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GtkTreeSelection *selection;
GtkTreeIter iter;
GFileInfo *info;
GtkTreeModel *model;
- g_assert (!priv->select_multiple);
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->browse_files_tree_view));
+ g_assert (!impl->select_multiple);
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
if (!gtk_tree_selection_get_selected (selection, &model, &iter))
{
*had_selection = FALSE;
@@ -5922,12 +5756,11 @@ confirmation_confirm_get_info_cb (GCancellable *cancellable,
gboolean cancelled = g_cancellable_is_cancelled (cancellable);
gboolean should_respond = FALSE;
struct GetDisplayNameData *data = user_data;
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (data->impl);
- if (cancellable != priv->should_respond_get_info_cancellable)
+ if (cancellable != data->impl->should_respond_get_info_cancellable)
goto out;
- priv->should_respond_get_info_cancellable = NULL;
+ data->impl->should_respond_get_info_cancellable = NULL;
if (cancelled)
goto out;
@@ -5958,7 +5791,6 @@ should_respond_after_confirm_overwrite (GtkFileChooserWidget *impl,
const gchar *file_part,
GFile *parent_file)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
struct GetDisplayNameData *data;
g_assert (file_part != NULL);
@@ -5967,11 +5799,11 @@ should_respond_after_confirm_overwrite (GtkFileChooserWidget *impl,
data->impl = g_object_ref (impl);
data->file_part = g_strdup (file_part);
- if (priv->should_respond_get_info_cancellable)
- g_cancellable_cancel (priv->should_respond_get_info_cancellable);
+ if (impl->should_respond_get_info_cancellable)
+ g_cancellable_cancel (impl->should_respond_get_info_cancellable);
- priv->should_respond_get_info_cancellable =
- _gtk_file_system_get_info (priv->file_system, parent_file,
+ impl->should_respond_get_info_cancellable =
+ _gtk_file_system_get_info (impl->file_system, parent_file,
"standard::display-name",
confirmation_confirm_get_info_cb,
data);
@@ -5990,12 +5822,11 @@ name_entry_get_parent_info_cb (GCancellable *cancellable,
gboolean cancelled = g_cancellable_is_cancelled (cancellable);
struct FileExistsData *data = user_data;
GtkFileChooserWidget *impl = data->impl;
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
- if (cancellable != priv->should_respond_get_info_cancellable)
+ if (cancellable != impl->should_respond_get_info_cancellable)
goto out;
- priv->should_respond_get_info_cancellable = NULL;
+ impl->should_respond_get_info_cancellable = NULL;
set_busy_cursor (impl, FALSE);
@@ -6015,11 +5846,11 @@ name_entry_get_parent_info_cb (GCancellable *cancellable,
if (parent_is_folder && parent_is_accessible)
{
- if (priv->action == GTK_FILE_CHOOSER_ACTION_OPEN)
+ if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN)
{
request_response_and_add_to_recent_list (impl); /* even if the file doesn't exist, apps can make good use of that (e.g. Emacs) */
}
- else if (priv->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+ else if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
{
if (data->file_exists_and_is_not_folder)
{
@@ -6030,7 +5861,7 @@ name_entry_get_parent_info_cb (GCancellable *cancellable,
* depending on what clients do in the confirm-overwrite
* signal and this corrupts the pointer
*/
- file_part = g_strdup (_gtk_file_chooser_entry_get_file_part (GTK_FILE_CHOOSER_ENTRY (priv->location_entry)));
+ file_part = g_strdup (_gtk_file_chooser_entry_get_file_part (GTK_FILE_CHOOSER_ENTRY (impl->location_entry)));
retval = should_respond_after_confirm_overwrite (impl, file_part, data->parent_file);
g_free (file_part);
@@ -6040,7 +5871,7 @@ name_entry_get_parent_info_cb (GCancellable *cancellable,
else
request_response_and_add_to_recent_list (impl);
}
- else if (priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ else if (impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
{
GError *mkdir_error = NULL;
@@ -6109,12 +5940,11 @@ file_exists_get_info_cb (GCancellable *cancellable,
gboolean needs_parent_check = FALSE;
struct FileExistsData *data = user_data;
GtkFileChooserWidget *impl = data->impl;
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
- if (cancellable != priv->file_exists_get_info_cancellable)
+ if (cancellable != impl->file_exists_get_info_cancellable)
goto out;
- priv->file_exists_get_info_cancellable = NULL;
+ impl->file_exists_get_info_cancellable = NULL;
set_busy_cursor (impl, FALSE);
@@ -6124,7 +5954,7 @@ file_exists_get_info_cb (GCancellable *cancellable,
file_exists = (info != NULL);
is_folder = (file_exists && _gtk_file_info_consider_as_directory (info));
- if (priv->action == GTK_FILE_CHOOSER_ACTION_OPEN)
+ if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN)
{
if (is_folder)
change_folder_and_display_error (impl, data->file, TRUE);
@@ -6136,7 +5966,7 @@ file_exists_get_info_cb (GCancellable *cancellable,
needs_parent_check = TRUE; /* file doesn't exist; see if its parent exists */
}
}
- else if (priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ else if (impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
{
if (!file_exists)
{
@@ -6153,7 +5983,7 @@ file_exists_get_info_cb (GCancellable *cancellable,
error_selecting_folder_over_existing_file_dialog (impl);
}
}
- else if (priv->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+ else if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
{
if (is_folder)
change_folder_and_display_error (impl, data->file, TRUE);
@@ -6175,11 +6005,11 @@ file_exists_get_info_cb (GCancellable *cancellable,
data->file_exists_and_is_not_folder = file_exists && !is_folder;
data_ownership_taken = TRUE;
- if (priv->should_respond_get_info_cancellable)
- g_cancellable_cancel (priv->should_respond_get_info_cancellable);
+ if (impl->should_respond_get_info_cancellable)
+ g_cancellable_cancel (impl->should_respond_get_info_cancellable);
- priv->should_respond_get_info_cancellable =
- _gtk_file_system_get_info (priv->file_system,
+ impl->should_respond_get_info_cancellable =
+ _gtk_file_system_get_info (impl->file_system,
data->parent_file,
"standard::type,access::can-execute",
name_entry_get_parent_info_cb,
@@ -6237,15 +6067,14 @@ location_popup_on_paste_handler (GtkFileChooserWidget *impl)
static void
add_selection_to_recent_list (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GSList *files;
GSList *l;
files = gtk_file_chooser_widget_get_files (GTK_FILE_CHOOSER (impl));
- if (!priv->recent_manager)
- priv->recent_manager = gtk_recent_manager_get_default ();
+ if (!impl->recent_manager)
+ impl->recent_manager = gtk_recent_manager_get_default ();
for (l = files; l; l = l->next)
{
@@ -6255,7 +6084,7 @@ add_selection_to_recent_list (GtkFileChooserWidget *impl)
uri = g_file_get_uri (file);
if (uri)
{
- gtk_recent_manager_add_item (priv->recent_manager, uri);
+ gtk_recent_manager_add_item (impl->recent_manager, uri);
g_free (uri);
}
}
@@ -6267,7 +6096,6 @@ static gboolean
gtk_file_chooser_widget_should_respond (GtkFileChooserEmbed *chooser_embed)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (chooser_embed);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GtkWidget *toplevel;
GtkWidget *current_focus;
gboolean retval;
@@ -6279,9 +6107,9 @@ gtk_file_chooser_widget_should_respond (GtkFileChooserEmbed *chooser_embed)
current_focus = gtk_root_get_focus (GTK_ROOT (toplevel));
- if (current_focus == priv->browse_files_tree_view)
+ if (current_focus == impl->browse_files_tree_view)
{
- /* The following array encodes what we do based on the priv->action and the
+ /* The following array encodes what we do based on the impl->action and the
* number of files selected.
*/
typedef enum {
@@ -6307,11 +6135,11 @@ gtk_file_chooser_widget_should_respond (GtkFileChooserEmbed *chooser_embed)
file_list:
- g_assert (priv->action >= GTK_FILE_CHOOSER_ACTION_OPEN && priv->action < GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
+ g_assert (impl->action >= GTK_FILE_CHOOSER_ACTION_OPEN && impl->action < GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
- if (priv->operation_mode == OPERATION_MODE_RECENT)
+ if (impl->operation_mode == OPERATION_MODE_RECENT)
{
- if (priv->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+ if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
goto save_entry;
else
{
@@ -6327,7 +6155,7 @@ gtk_file_chooser_widget_should_respond (GtkFileChooserEmbed *chooser_embed)
else
k = num_selected;
- action = what_to_do [priv->action] [k];
+ action = what_to_do [impl->action] [k];
switch (action)
{
@@ -6346,11 +6174,11 @@ gtk_file_chooser_widget_should_respond (GtkFileChooserEmbed *chooser_embed)
switch_to_selected_folder (impl);
return FALSE;
}
- else if (priv->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+ else if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
{
retval = should_respond_after_confirm_overwrite (impl,
get_display_name_from_file_list (impl),
- priv->current_folder);
+ impl->current_folder);
goto out;
}
else
@@ -6375,7 +6203,7 @@ gtk_file_chooser_widget_should_respond (GtkFileChooserEmbed *chooser_embed)
g_assert_not_reached ();
}
}
- else if ((priv->location_entry != NULL) && (current_focus == priv->location_entry))
+ else if ((impl->location_entry != NULL) && (current_focus == impl->location_entry))
{
GFile *file;
gboolean is_well_formed, is_empty, is_file_part_empty;
@@ -6384,19 +6212,19 @@ gtk_file_chooser_widget_should_respond (GtkFileChooserEmbed *chooser_embed)
save_entry:
- g_assert (priv->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
- ((priv->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
- priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER) &&
- priv->location_mode == LOCATION_MODE_FILENAME_ENTRY));
+ g_assert (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
+ ((impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+ impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER) &&
+ impl->location_mode == LOCATION_MODE_FILENAME_ENTRY));
- entry = GTK_FILE_CHOOSER_ENTRY (priv->location_entry);
+ entry = GTK_FILE_CHOOSER_ENTRY (impl->location_entry);
check_save_entry (impl, &file, &is_well_formed, &is_empty, &is_file_part_empty, &is_folder);
if (!is_well_formed)
{
if (!is_empty &&
- priv->action == GTK_FILE_CHOOSER_ACTION_SAVE &&
- priv->operation_mode == OPERATION_MODE_RECENT)
+ impl->action == GTK_FILE_CHOOSER_ACTION_SAVE &&
+ impl->operation_mode == OPERATION_MODE_RECENT)
{
/* FIXME: ERROR_NO_FOLDER */
#if 0
@@ -6405,7 +6233,7 @@ gtk_file_chooser_widget_should_respond (GtkFileChooserEmbed *chooser_embed)
* a selection causes the error message from path_bar_set_mode() to go away,
* but we want the user to see that message!
*/
- gtk_widget_grab_focus (priv->browse_files_tree_view);
+ gtk_widget_grab_focus (impl->browse_files_tree_view);
#endif
}
/* FIXME: else show an "invalid filename" error as the pathbar mode? */
@@ -6415,10 +6243,10 @@ gtk_file_chooser_widget_should_respond (GtkFileChooserEmbed *chooser_embed)
if (is_empty)
{
- if (priv->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+ if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
{
/* FIXME: ERROR_NO_FILENAME */
- gtk_widget_grab_focus (priv->location_entry);
+ gtk_widget_grab_focus (impl->location_entry);
return FALSE;
}
@@ -6429,12 +6257,12 @@ gtk_file_chooser_widget_should_respond (GtkFileChooserEmbed *chooser_embed)
if (is_folder)
{
- if (priv->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
- priv->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+ if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+ impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
{
change_folder_and_display_error (impl, file, TRUE);
}
- else if (priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ else if (impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
{
/* The folder already exists, so we do not need to create it.
* Just respond to terminate the dialog.
@@ -6461,11 +6289,11 @@ gtk_file_chooser_widget_should_respond (GtkFileChooserEmbed *chooser_embed)
data->file = g_object_ref (file);
data->parent_file = _gtk_file_chooser_entry_get_current_folder (entry);
- if (priv->file_exists_get_info_cancellable)
- g_cancellable_cancel (priv->file_exists_get_info_cancellable);
+ if (impl->file_exists_get_info_cancellable)
+ g_cancellable_cancel (impl->file_exists_get_info_cancellable);
- priv->file_exists_get_info_cancellable =
- _gtk_file_system_get_info (priv->file_system, file,
+ impl->file_exists_get_info_cancellable =
+ _gtk_file_system_get_info (impl->file_system, file,
"standard::type",
file_exists_get_info_cb,
data);
@@ -6475,19 +6303,19 @@ gtk_file_chooser_widget_should_respond (GtkFileChooserEmbed *chooser_embed)
g_object_unref (file);
}
- else if (priv->toplevel_last_focus_widget == priv->browse_files_tree_view)
+ else if (impl->toplevel_last_focus_widget == impl->browse_files_tree_view)
{
/* The focus is on a dialog's action area button, *and* the widget that
* was focused immediately before it is the file list.
*/
goto file_list;
}
- else if (priv->operation_mode == OPERATION_MODE_SEARCH && priv->toplevel_last_focus_widget == priv->search_entry)
+ else if (impl->operation_mode == OPERATION_MODE_SEARCH && impl->toplevel_last_focus_widget == impl->search_entry)
{
search_entry_activate_cb (impl);
return FALSE;
}
- else if (priv->location_entry && priv->toplevel_last_focus_widget == priv->location_entry)
+ else if (impl->location_entry && impl->toplevel_last_focus_widget == impl->location_entry)
{
/* The focus is on a dialog's action area button, *and* the widget that
* was focused immediately before it is the location entry.
@@ -6496,7 +6324,7 @@ gtk_file_chooser_widget_should_respond (GtkFileChooserEmbed *chooser_embed)
}
else
/* The focus is on a dialog's action area button or something else */
- if (priv->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+ if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
goto save_entry;
else
goto file_list;
@@ -6514,20 +6342,19 @@ static void
gtk_file_chooser_widget_initial_focus (GtkFileChooserEmbed *chooser_embed)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (chooser_embed);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GtkWidget *widget;
- if (priv->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
- priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+ impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
{
- if (priv->location_mode == LOCATION_MODE_PATH_BAR
- || priv->operation_mode == OPERATION_MODE_RECENT)
- widget = priv->browse_files_tree_view;
+ if (impl->location_mode == LOCATION_MODE_PATH_BAR
+ || impl->operation_mode == OPERATION_MODE_RECENT)
+ widget = impl->browse_files_tree_view;
else
- widget = priv->location_entry;
+ widget = impl->location_entry;
}
- else if (priv->action == GTK_FILE_CHOOSER_ACTION_SAVE)
- widget = priv->location_entry;
+ else if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+ widget = impl->location_entry;
else
{
g_assert_not_reached ();
@@ -6559,13 +6386,12 @@ selected_foreach_get_file_cb (GtkTreeModel *model,
static GSList *
get_selected_files (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GSList *result;
GtkTreeSelection *selection;
result = NULL;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
gtk_tree_selection_selected_foreach (selection, selected_foreach_get_file_cb, &result);
result = g_slist_reverse (result);
@@ -6590,13 +6416,12 @@ selected_foreach_get_info_cb (GtkTreeModel *model,
static GSList *
get_selected_infos (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GSList *result;
GtkTreeSelection *selection;
result = NULL;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
gtk_tree_selection_selected_foreach (selection, selected_foreach_get_info_cb, &result);
result = g_slist_reverse (result);
@@ -6609,7 +6434,6 @@ search_engine_hits_added_cb (GtkSearchEngine *engine,
GList *hits,
GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GList *l, *files, *files_with_info, *infos;
GFile *file;
@@ -6629,16 +6453,16 @@ search_engine_hits_added_cb (GtkSearchEngine *engine,
files = g_list_prepend (files, file);
}
- _gtk_file_system_model_update_files (priv->search_model,
+ _gtk_file_system_model_update_files (impl->search_model,
files_with_info, infos);
- _gtk_file_system_model_add_and_query_files (priv->search_model,
+ _gtk_file_system_model_add_and_query_files (impl->search_model,
files, MODEL_ATTRIBUTES);
g_list_free_full (files, g_object_unref);
g_list_free_full (files_with_info, g_object_unref);
g_list_free_full (infos, g_object_unref);
- gtk_stack_set_visible_child_name (GTK_STACK (priv->browse_files_stack), "list");
+ gtk_stack_set_visible_child_name (GTK_STACK (impl->browse_files_stack), "list");
}
/* Callback used from GtkSearchEngine when the query is done running */
@@ -6647,21 +6471,20 @@ search_engine_finished_cb (GtkSearchEngine *engine,
gpointer data)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (data);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
set_busy_cursor (impl, FALSE);
- gtk_widget_hide (priv->search_spinner);
+ gtk_widget_hide (impl->search_spinner);
- if (priv->show_progress_timeout)
+ if (impl->show_progress_timeout)
{
- g_source_remove (priv->show_progress_timeout);
- priv->show_progress_timeout = 0;
+ g_source_remove (impl->show_progress_timeout);
+ impl->show_progress_timeout = 0;
}
- if (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (priv->search_model), NULL) == 0)
+ if (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (impl->search_model), NULL) == 0)
{
- gtk_stack_set_visible_child_name (GTK_STACK (priv->browse_files_stack), "empty");
- gtk_widget_grab_focus (priv->search_entry);
+ gtk_stack_set_visible_child_name (GTK_STACK (impl->browse_files_stack), "empty");
+ gtk_widget_grab_focus (impl->search_entry);
}
}
@@ -6681,16 +6504,14 @@ static void
search_clear_model (GtkFileChooserWidget *impl,
gboolean remove)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- if (!priv->search_model)
+ if (!impl->search_model)
return;
if (remove &&
- gtk_tree_view_get_model (GTK_TREE_VIEW (priv->browse_files_tree_view)) == GTK_TREE_MODEL (priv->search_model))
- gtk_tree_view_set_model (GTK_TREE_VIEW (priv->browse_files_tree_view), NULL);
+ gtk_tree_view_get_model (GTK_TREE_VIEW (impl->browse_files_tree_view)) == GTK_TREE_MODEL (impl->search_model))
+ gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_files_tree_view), NULL);
- g_clear_object (&priv->search_model);
+ g_clear_object (&impl->search_model);
}
/* Stops any ongoing searches; does not touch the search_model */
@@ -6698,27 +6519,25 @@ static void
search_stop_searching (GtkFileChooserWidget *impl,
gboolean remove_query)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- if (remove_query && priv->search_entry)
+ if (remove_query && impl->search_entry)
{
- gtk_editable_set_text (GTK_EDITABLE (priv->search_entry), "");
+ gtk_editable_set_text (GTK_EDITABLE (impl->search_entry), "");
}
- if (priv->search_engine)
+ if (impl->search_engine)
{
- _gtk_search_engine_stop (priv->search_engine);
- g_signal_handlers_disconnect_by_data (priv->search_engine, impl);
- g_clear_object (&priv->search_engine);
+ _gtk_search_engine_stop (impl->search_engine);
+ g_signal_handlers_disconnect_by_data (impl->search_engine, impl);
+ g_clear_object (&impl->search_engine);
set_busy_cursor (impl, FALSE);
- gtk_widget_hide (priv->search_spinner);
+ gtk_widget_hide (impl->search_spinner);
}
- if (priv->show_progress_timeout)
+ if (impl->show_progress_timeout)
{
- g_source_remove (priv->show_progress_timeout);
- priv->show_progress_timeout = 0;
+ g_source_remove (impl->show_progress_timeout);
+ impl->show_progress_timeout = 0;
}
}
@@ -6726,29 +6545,27 @@ search_stop_searching (GtkFileChooserWidget *impl,
static void
search_setup_model (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
+ g_assert (impl->search_model == NULL);
- g_assert (priv->search_model == NULL);
-
- priv->search_model = _gtk_file_system_model_new (file_system_model_set,
+ impl->search_model = _gtk_file_system_model_new (file_system_model_set,
impl,
MODEL_COLUMN_TYPES);
- gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (priv->search_model),
+ gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (impl->search_model),
search_sort_func,
impl, NULL);
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (priv->search_model),
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (impl->search_model),
GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
GTK_SORT_ASCENDING);
- gtk_tree_view_set_model (GTK_TREE_VIEW (priv->browse_files_tree_view),
- GTK_TREE_MODEL (priv->search_model));
+ gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_files_tree_view),
+ GTK_TREE_MODEL (impl->search_model));
- gtk_tree_view_column_set_sort_column_id (priv->list_name_column, -1);
- gtk_tree_view_column_set_sort_column_id (priv->list_time_column, -1);
- gtk_tree_view_column_set_sort_column_id (priv->list_size_column, -1);
- gtk_tree_view_column_set_sort_column_id (priv->list_type_column, -1);
- gtk_tree_view_column_set_sort_column_id (priv->list_location_column, -1);
+ gtk_tree_view_column_set_sort_column_id (impl->list_name_column, -1);
+ gtk_tree_view_column_set_sort_column_id (impl->list_time_column, -1);
+ gtk_tree_view_column_set_sort_column_id (impl->list_size_column, -1);
+ gtk_tree_view_column_set_sort_column_id (impl->list_type_column, -1);
+ gtk_tree_view_column_set_sort_column_id (impl->list_location_column, -1);
update_columns (impl, TRUE, _("Modified"));
}
@@ -6757,11 +6574,10 @@ static gboolean
show_spinner (gpointer data)
{
GtkFileChooserWidget *impl = data;
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
- gtk_widget_show (priv->search_spinner);
- gtk_spinner_start (GTK_SPINNER (priv->search_spinner));
- priv->show_progress_timeout = 0;
+ gtk_widget_show (impl->search_spinner);
+ gtk_spinner_start (GTK_SPINNER (impl->search_spinner));
+ impl->show_progress_timeout = 0;
return G_SOURCE_REMOVE;
}
@@ -6771,10 +6587,9 @@ static void
search_start_query (GtkFileChooserWidget *impl,
const gchar *query_text)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GFile *file;
- if (gtk_stack_get_visible_child (GTK_STACK (priv->browse_files_stack)) == priv->places_view)
+ if (gtk_stack_get_visible_child (GTK_STACK (impl->browse_files_stack)) == impl->places_view)
return;
stop_loading_and_clear_list_model (impl, TRUE);
@@ -6785,41 +6600,41 @@ search_start_query (GtkFileChooserWidget *impl,
search_setup_model (impl);
set_busy_cursor (impl, TRUE);
- priv->show_progress_timeout = g_timeout_add (1500, show_spinner, impl);
+ impl->show_progress_timeout = g_timeout_add (1500, show_spinner, impl);
- if (priv->search_engine == NULL)
- priv->search_engine = _gtk_search_engine_new ();
+ if (impl->search_engine == NULL)
+ impl->search_engine = _gtk_search_engine_new ();
- if (!priv->search_query)
+ if (!impl->search_query)
{
- priv->search_query = gtk_query_new ();
- gtk_query_set_text (priv->search_query, query_text);
+ impl->search_query = gtk_query_new ();
+ gtk_query_set_text (impl->search_query, query_text);
}
- file = gtk_places_sidebar_get_location (GTK_PLACES_SIDEBAR (priv->places_sidebar));
+ file = gtk_places_sidebar_get_location (GTK_PLACES_SIDEBAR (impl->places_sidebar));
if (file)
{
- gtk_query_set_location (priv->search_query, file);
+ gtk_query_set_location (impl->search_query, file);
g_object_unref (file);
}
else
- gtk_query_set_location (priv->search_query, priv->current_folder);
+ gtk_query_set_location (impl->search_query, impl->current_folder);
- _gtk_search_engine_set_model (priv->search_engine, priv->model_for_search);
- _gtk_search_engine_set_query (priv->search_engine, priv->search_query);
+ _gtk_search_engine_set_model (impl->search_engine, impl->model_for_search);
+ _gtk_search_engine_set_query (impl->search_engine, impl->search_query);
- g_signal_connect (priv->search_engine, "hits-added",
+ g_signal_connect (impl->search_engine, "hits-added",
G_CALLBACK (search_engine_hits_added_cb), impl);
- g_signal_connect (priv->search_engine, "finished",
+ g_signal_connect (impl->search_engine, "finished",
G_CALLBACK (search_engine_finished_cb), impl);
- g_signal_connect (priv->search_engine, "error",
+ g_signal_connect (impl->search_engine, "error",
G_CALLBACK (search_engine_error_cb), impl);
- _gtk_search_engine_start (priv->search_engine);
+ _gtk_search_engine_start (impl->search_engine);
- if (gtk_query_get_location (priv->search_query) &&
- _gtk_file_consider_as_remote (gtk_query_get_location (priv->search_query)))
- gtk_widget_show (priv->remote_warning_bar);
+ if (gtk_query_get_location (impl->search_query) &&
+ _gtk_file_consider_as_remote (gtk_query_get_location (impl->search_query)))
+ gtk_widget_show (impl->remote_warning_bar);
/* We're not showing the file list here already and instead rely on the
* GtkSearchEntry timout and the ::hits-added signal from above to
@@ -6832,18 +6647,17 @@ search_start_query (GtkFileChooserWidget *impl,
static void
search_entry_activate_cb (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
const char *text;
- if (priv->operation_mode != OPERATION_MODE_SEARCH)
+ if (impl->operation_mode != OPERATION_MODE_SEARCH)
return;
- text = gtk_editable_get_text (GTK_EDITABLE (priv->search_entry));
+ text = gtk_editable_get_text (GTK_EDITABLE (impl->search_entry));
/* reset any existing query object */
- g_set_object (&priv->search_query, NULL);
+ g_set_object (&impl->search_query, NULL);
- gtk_places_view_set_search_query (GTK_PLACES_VIEW (priv->places_view), text);
+ gtk_places_view_set_search_query (GTK_PLACES_VIEW (impl->places_view), text);
if (text[0] != '\0')
search_start_query (impl, text);
@@ -6854,37 +6668,33 @@ search_entry_activate_cb (GtkFileChooserWidget *impl)
static void
search_entry_stop_cb (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- if (priv->search_engine)
+ if (impl->search_engine)
search_stop_searching (impl, FALSE);
else
g_object_set (impl, "search-mode", FALSE, NULL);
- priv->starting_search = FALSE;
+ impl->starting_search = FALSE;
}
/* Hides the path bar and creates the search entry */
static void
search_setup_widgets (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
/* if there already is a query, restart it */
- if (priv->search_query)
+ if (impl->search_query)
{
const gchar *query;
- query = gtk_query_get_text (priv->search_query);
+ query = gtk_query_get_text (impl->search_query);
if (query)
{
- gtk_editable_set_text (GTK_EDITABLE (priv->search_entry), query);
+ gtk_editable_set_text (GTK_EDITABLE (impl->search_entry), query);
search_start_query (impl, query);
}
else
{
- g_object_unref (priv->search_query);
- priv->search_query = NULL;
+ g_object_unref (impl->search_query);
+ impl->search_query = NULL;
}
}
}
@@ -6898,49 +6708,46 @@ static void
recent_clear_model (GtkFileChooserWidget *impl,
gboolean remove)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- if (!priv->recent_model)
+ if (!impl->recent_model)
return;
if (remove)
- gtk_tree_view_set_model (GTK_TREE_VIEW (priv->browse_files_tree_view), NULL);
+ gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_files_tree_view), NULL);
- g_set_object (&priv->recent_model, NULL);
+ g_set_object (&impl->recent_model, NULL);
}
static void
recent_start_loading (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GList *items;
recent_clear_model (impl, TRUE);
/* Setup recent model */
- g_assert (priv->recent_model == NULL);
+ g_assert (impl->recent_model == NULL);
- priv->recent_model = _gtk_file_system_model_new (file_system_model_set,
+ impl->recent_model = _gtk_file_system_model_new (file_system_model_set,
impl,
MODEL_COLUMN_TYPES);
- _gtk_file_system_model_set_filter (priv->recent_model, priv->current_filter);
- gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (priv->recent_model),
+ _gtk_file_system_model_set_filter (impl->recent_model, impl->current_filter);
+ gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (impl->recent_model),
recent_sort_func,
impl, NULL);
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (priv->recent_model),
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (impl->recent_model),
GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
GTK_SORT_DESCENDING);
- if (!priv->recent_manager)
+ if (!impl->recent_manager)
return;
- items = gtk_recent_manager_get_items (priv->recent_manager);
+ items = gtk_recent_manager_get_items (impl->recent_manager);
if (!items)
return;
- if (priv->action == GTK_FILE_CHOOSER_ACTION_OPEN)
+ if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN)
{
const int limit = DEFAULT_RECENT_FILES_LIMIT;
const char *app_name = g_get_application_name ();
@@ -6960,7 +6767,7 @@ recent_start_loading (GtkFileChooserWidget *impl)
file = g_file_new_for_uri (gtk_recent_info_get_uri (info));
- _gtk_file_system_model_add_and_query_file (priv->recent_model,
+ _gtk_file_system_model_add_and_query_file (impl->recent_model,
file,
MODEL_ATTRIBUTES);
g_object_unref (file);
@@ -6970,7 +6777,7 @@ recent_start_loading (GtkFileChooserWidget *impl)
break;
}
- g_set_object (&priv->model_for_search, priv->recent_model);
+ g_set_object (&impl->model_for_search, impl->recent_model);
}
else
{
@@ -6980,7 +6787,7 @@ recent_start_loading (GtkFileChooserWidget *impl)
folders = _gtk_file_chooser_extract_recent_folders (items);
for (l = folders; l; l = l->next)
- _gtk_file_system_model_add_and_query_file (priv->recent_model,
+ _gtk_file_system_model_add_and_query_file (impl->recent_model,
G_FILE (l->data),
MODEL_ATTRIBUTES);
@@ -6989,15 +6796,15 @@ recent_start_loading (GtkFileChooserWidget *impl)
g_list_free_full (items, (GDestroyNotify) gtk_recent_info_unref);
- gtk_tree_view_set_model (GTK_TREE_VIEW (priv->browse_files_tree_view),
- GTK_TREE_MODEL (priv->recent_model));
- gtk_tree_view_set_search_column (GTK_TREE_VIEW (priv->browse_files_tree_view), -1);
+ gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_files_tree_view),
+ GTK_TREE_MODEL (impl->recent_model));
+ gtk_tree_view_set_search_column (GTK_TREE_VIEW (impl->browse_files_tree_view), -1);
- gtk_tree_view_column_set_sort_column_id (priv->list_name_column, -1);
- gtk_tree_view_column_set_sort_column_id (priv->list_time_column, -1);
- gtk_tree_view_column_set_sort_column_id (priv->list_size_column, -1);
- gtk_tree_view_column_set_sort_column_id (priv->list_type_column, -1);
- gtk_tree_view_column_set_sort_column_id (priv->list_location_column, -1);
+ gtk_tree_view_column_set_sort_column_id (impl->list_name_column, -1);
+ gtk_tree_view_column_set_sort_column_id (impl->list_time_column, -1);
+ gtk_tree_view_column_set_sort_column_id (impl->list_size_column, -1);
+ gtk_tree_view_column_set_sort_column_id (impl->list_type_column, -1);
+ gtk_tree_view_column_set_sort_column_id (impl->list_location_column, -1);
update_columns (impl, TRUE, _("Accessed"));
}
@@ -7008,12 +6815,11 @@ recent_start_loading (GtkFileChooserWidget *impl)
static gboolean
recent_should_respond (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GtkTreeSelection *selection;
- g_assert (priv->operation_mode == OPERATION_MODE_RECENT);
+ g_assert (impl->operation_mode == OPERATION_MODE_RECENT);
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
return (gtk_tree_selection_count_selected_rows (selection) != 0);
}
@@ -7021,28 +6827,26 @@ static void
set_current_filter (GtkFileChooserWidget *impl,
GtkFileFilter *filter)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- if (priv->current_filter != filter)
+ if (impl->current_filter != filter)
{
int filter_index;
/* NULL filters are allowed to reset to non-filtered status */
- filter_index = g_slist_index (priv->filters, filter);
- if (priv->filters && filter && filter_index < 0)
+ filter_index = g_slist_index (impl->filters, filter);
+ if (impl->filters && filter && filter_index < 0)
return;
- if (priv->current_filter)
- g_object_unref (priv->current_filter);
- priv->current_filter = filter;
- if (priv->current_filter)
- g_object_ref_sink (priv->current_filter);
+ if (impl->current_filter)
+ g_object_unref (impl->current_filter);
+ impl->current_filter = filter;
+ if (impl->current_filter)
+ g_object_ref_sink (impl->current_filter);
- if (priv->filters)
- gtk_combo_box_set_active (GTK_COMBO_BOX (priv->filter_combo), filter_index);
+ if (impl->filters)
+ gtk_combo_box_set_active (GTK_COMBO_BOX (impl->filter_combo), filter_index);
clear_model_cache (impl, MODEL_COL_IS_SENSITIVE);
- set_model_filter (impl, priv->current_filter);
+ set_model_filter (impl, impl->current_filter);
g_object_notify (G_OBJECT (impl), "filter");
}
}
@@ -7051,16 +6855,15 @@ static void
filter_combo_changed (GtkComboBox *combo_box,
GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
gint new_index;
GtkFileFilter *new_filter;
new_index = gtk_combo_box_get_active (combo_box);
- new_filter = g_slist_nth_data (priv->filters, new_index);
+ new_filter = g_slist_nth_data (impl->filters, new_index);
set_current_filter (impl, new_filter);
- if (priv->location_entry != NULL)
- _gtk_file_chooser_entry_set_file_filter (GTK_FILE_CHOOSER_ENTRY (priv->location_entry),
+ if (impl->location_entry != NULL)
+ _gtk_file_chooser_entry_set_file_filter (GTK_FILE_CHOOSER_ENTRY (impl->location_entry),
new_filter);
}
@@ -7072,9 +6875,8 @@ list_select_func (GtkTreeSelection *selection,
gpointer data)
{
GtkFileChooserWidget *impl = data;
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
- if (priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ if (impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
{
GtkTreeIter iter;
gboolean is_sensitive;
@@ -7097,13 +6899,11 @@ static void
list_selection_changed (GtkTreeSelection *selection,
GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- if (gtk_tree_view_get_model (GTK_TREE_VIEW (priv->browse_files_tree_view)) == NULL)
+ if (gtk_tree_view_get_model (GTK_TREE_VIEW (impl->browse_files_tree_view)) == NULL)
return;
- if (priv->location_entry &&
- priv->browse_files_model)
+ if (impl->location_entry &&
+ impl->browse_files_model)
update_chooser_entry (impl);
location_bar_update (impl);
@@ -7116,12 +6916,11 @@ browse_files_tree_view_keynav_failed_cb (GtkWidget *widget,
GtkDirectionType direction,
gpointer user_data)
{
- GtkFileChooserWidget *self = user_data;
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (self);
+ GtkFileChooserWidget *impl = user_data;
- if (direction == GTK_DIR_UP && priv->operation_mode == OPERATION_MODE_SEARCH)
+ if (direction == GTK_DIR_UP && impl->operation_mode == OPERATION_MODE_SEARCH)
{
- gtk_widget_grab_focus (priv->search_entry);
+ gtk_widget_grab_focus (impl->search_entry);
return TRUE;
}
@@ -7136,7 +6935,6 @@ list_row_activated (GtkTreeView *tree_view,
GtkTreeViewColumn *column,
GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GFile *file;
GtkTreeIter iter;
GtkTreeModel *model;
@@ -7160,8 +6958,8 @@ list_row_activated (GtkTreeView *tree_view,
goto out;
}
- if (priv->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
- priv->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+ if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+ impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
g_signal_emit_by_name (impl, "file-activated");
out:
@@ -7194,46 +6992,44 @@ path_bar_clicked (GtkPathBar *path_bar,
static void
update_cell_renderer_attributes (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- gtk_tree_view_column_set_attributes (priv->list_name_column,
- priv->list_pixbuf_renderer,
+ gtk_tree_view_column_set_attributes (impl->list_name_column,
+ impl->list_pixbuf_renderer,
"gicon", MODEL_COL_ICON,
"sensitive", MODEL_COL_IS_SENSITIVE,
NULL);
- gtk_tree_view_column_set_attributes (priv->list_name_column,
- priv->list_name_renderer,
+ gtk_tree_view_column_set_attributes (impl->list_name_column,
+ impl->list_name_renderer,
"text", MODEL_COL_NAME,
"ellipsize", MODEL_COL_ELLIPSIZE,
"sensitive", MODEL_COL_IS_SENSITIVE,
NULL);
- gtk_tree_view_column_set_attributes (priv->list_size_column,
- priv->list_size_renderer,
+ gtk_tree_view_column_set_attributes (impl->list_size_column,
+ impl->list_size_renderer,
"text", MODEL_COL_SIZE_TEXT,
"sensitive", MODEL_COL_IS_SENSITIVE,
NULL);
- gtk_tree_view_column_set_attributes (priv->list_type_column,
- priv->list_type_renderer,
+ gtk_tree_view_column_set_attributes (impl->list_type_column,
+ impl->list_type_renderer,
"text", MODEL_COL_TYPE,
"sensitive", MODEL_COL_IS_SENSITIVE,
NULL);
- gtk_tree_view_column_set_attributes (priv->list_time_column,
- priv->list_date_renderer,
+ gtk_tree_view_column_set_attributes (impl->list_time_column,
+ impl->list_date_renderer,
"text", MODEL_COL_DATE_TEXT,
"sensitive", MODEL_COL_IS_SENSITIVE,
NULL);
- gtk_tree_view_column_set_attributes (priv->list_time_column,
- priv->list_time_renderer,
+ gtk_tree_view_column_set_attributes (impl->list_time_column,
+ impl->list_time_renderer,
"text", MODEL_COL_TIME_TEXT,
"sensitive", MODEL_COL_IS_SENSITIVE,
NULL);
- gtk_tree_view_column_set_attributes (priv->list_location_column,
- priv->list_location_renderer,
+ gtk_tree_view_column_set_attributes (impl->list_location_column,
+ impl->list_location_renderer,
"text", MODEL_COL_LOCATION_TEXT,
"sensitive", MODEL_COL_IS_SENSITIVE,
NULL);
@@ -7245,29 +7041,25 @@ static void
location_set_user_text (GtkFileChooserWidget *impl,
const gchar *path)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- gtk_editable_set_text (GTK_EDITABLE (priv->location_entry), path);
- gtk_editable_set_position (GTK_EDITABLE (priv->location_entry), -1);
+ gtk_editable_set_text (GTK_EDITABLE (impl->location_entry), path);
+ gtk_editable_set_position (GTK_EDITABLE (impl->location_entry), -1);
}
static void
location_popup_handler (GtkFileChooserWidget *impl,
const gchar *path)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- if (priv->operation_mode != OPERATION_MODE_BROWSE)
+ if (impl->operation_mode != OPERATION_MODE_BROWSE)
{
operation_mode_set (impl, OPERATION_MODE_BROWSE);
- if (priv->current_folder)
- change_folder_and_display_error (impl, priv->current_folder, FALSE);
+ if (impl->current_folder)
+ change_folder_and_display_error (impl, impl->current_folder, FALSE);
else
switch_to_home_dir (impl);
}
- if (priv->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
- priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+ impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
{
if (!path)
return;
@@ -7275,9 +7067,9 @@ location_popup_handler (GtkFileChooserWidget *impl,
location_mode_set (impl, LOCATION_MODE_FILENAME_ENTRY);
location_set_user_text (impl, path);
}
- else if (priv->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+ else if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
{
- gtk_widget_grab_focus (priv->location_entry);
+ gtk_widget_grab_focus (impl->location_entry);
if (path != NULL)
location_set_user_text (impl, path);
}
@@ -7289,18 +7081,14 @@ location_popup_handler (GtkFileChooserWidget *impl,
static void
up_folder_handler (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- _gtk_path_bar_up (GTK_PATH_BAR (priv->browse_path_bar));
+ _gtk_path_bar_up (GTK_PATH_BAR (impl->browse_path_bar));
}
/* Handler for the "down-folder" keybinding signal */
static void
down_folder_handler (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- _gtk_path_bar_down (GTK_PATH_BAR (priv->browse_path_bar));
+ _gtk_path_bar_down (GTK_PATH_BAR (impl->browse_path_bar));
}
/* Handler for the "home-folder" keybinding signal */
@@ -7333,13 +7121,11 @@ desktop_folder_handler (GtkFileChooserWidget *impl)
static void
search_shortcut_handler (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- if (priv->operation_mode == OPERATION_MODE_SEARCH)
+ if (impl->operation_mode == OPERATION_MODE_SEARCH)
{
operation_mode_set (impl, OPERATION_MODE_BROWSE);
- if (priv->current_folder)
- change_folder_and_display_error (impl, priv->current_folder, FALSE);
+ if (impl->current_folder)
+ change_folder_and_display_error (impl, impl->current_folder, FALSE);
else
switch_to_home_dir (impl);
}
@@ -7358,19 +7144,16 @@ recent_shortcut_handler (GtkFileChooserWidget *impl)
static void
places_shortcut_handler (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- gtk_widget_child_focus (priv->places_sidebar, GTK_DIR_LEFT);
+ gtk_widget_child_focus (impl->places_sidebar, GTK_DIR_LEFT);
}
static void
quick_bookmark_handler (GtkFileChooserWidget *impl,
gint bookmark_index)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GFile *file;
- file = gtk_places_sidebar_get_nth_bookmark (GTK_PLACES_SIDEBAR (priv->places_sidebar), bookmark_index);
+ file = gtk_places_sidebar_get_nth_bookmark (GTK_PLACES_SIDEBAR (impl->places_sidebar), bookmark_index);
if (file)
{
@@ -7382,9 +7165,7 @@ quick_bookmark_handler (GtkFileChooserWidget *impl,
static void
show_hidden_handler (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
- set_show_hidden (impl, !priv->show_hidden);
+ set_show_hidden (impl, !impl->show_hidden);
}
static void
@@ -7411,13 +7192,12 @@ gtk_file_chooser_widget_size_allocate (GtkWidget *widget,
int baseline)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (widget);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GTK_WIDGET_CLASS (gtk_file_chooser_widget_parent_class)->size_allocate (widget, width, height, baseline);
- if (priv->browse_files_popover)
- gtk_native_check_resize (GTK_NATIVE (priv->browse_files_popover));
- if (priv->rename_file_popover)
- gtk_native_check_resize (GTK_NATIVE (priv->rename_file_popover));
+ if (impl->browse_files_popover)
+ gtk_native_check_resize (GTK_NATIVE (impl->browse_files_popover));
+ if (impl->rename_file_popover)
+ gtk_native_check_resize (GTK_NATIVE (impl->rename_file_popover));
}
static void
@@ -7809,46 +7589,46 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
"/org/gtk/libgtk/ui/gtkfilechooserwidget.ui");
/* A *lot* of widgets that we need to handle .... */
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, browse_widgets_hpaned);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, browse_files_stack);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, places_sidebar);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, places_view);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, browse_files_tree_view);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, browse_files_swin);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, browse_header_revealer);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, browse_header_stack);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, browse_new_folder_button);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, browse_path_bar_size_group);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, browse_path_bar);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, filter_combo_hbox);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, filter_combo);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, extra_align);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, extra_and_filters);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, location_entry_box);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, search_entry);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, search_spinner);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, list_name_column);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, list_pixbuf_renderer);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, list_name_renderer);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, list_time_column);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, list_date_renderer);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, list_time_renderer);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, list_size_column);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, list_size_renderer);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, list_type_column);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, list_type_renderer);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, list_location_column);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, list_location_renderer);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, new_folder_name_entry);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, new_folder_create_button);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, new_folder_error_stack);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, new_folder_popover);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, rename_file_name_entry);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, rename_file_rename_button);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, rename_file_error_stack);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, rename_file_popover);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, remote_warning_bar);
- gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, box);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, browse_widgets_hpaned);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, browse_files_stack);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, places_sidebar);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, places_view);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, browse_files_tree_view);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, browse_files_swin);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, browse_header_revealer);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, browse_header_stack);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, browse_new_folder_button);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, browse_path_bar_size_group);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, browse_path_bar);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, filter_combo_hbox);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, filter_combo);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, extra_align);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, extra_and_filters);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, location_entry_box);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, search_entry);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, search_spinner);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, list_name_column);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, list_pixbuf_renderer);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, list_name_renderer);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, list_time_column);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, list_date_renderer);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, list_time_renderer);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, list_size_column);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, list_size_renderer);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, list_type_column);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, list_type_renderer);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, list_location_column);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, list_location_renderer);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, new_folder_name_entry);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, new_folder_create_button);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, new_folder_error_stack);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, new_folder_popover);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, rename_file_name_entry);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, rename_file_rename_button);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, rename_file_error_stack);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, rename_file_popover);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, remote_warning_bar);
+ gtk_widget_class_bind_template_child (widget_class, GtkFileChooserWidget, box);
/* And a *lot* of callbacks to bind ... */
gtk_widget_class_bind_template_callback (widget_class, file_list_query_tooltip_cb);
@@ -7879,7 +7659,6 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
static void
post_process_ui (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GdkContentFormats *drag_formats;
GtkTreeSelection *selection;
GtkCellRenderer *cell;
@@ -7893,13 +7672,13 @@ post_process_ui (GtkFileChooserWidget *impl)
GtkShortcut *shortcut;
/* Setup file list treeview */
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
gtk_tree_selection_set_select_function (selection,
list_select_func,
impl, NULL);
drag_formats = gdk_content_formats_new_for_gtype (GDK_TYPE_FILE_LIST);
- gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (priv->browse_files_tree_view),
+ gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (impl->browse_files_tree_view),
GDK_BUTTON1_MASK,
drag_formats,
GDK_ACTION_COPY | GDK_ACTION_MOVE);
@@ -7907,7 +7686,7 @@ post_process_ui (GtkFileChooserWidget *impl)
target = gtk_drop_target_new (GDK_TYPE_FILE_LIST, GDK_ACTION_COPY | GDK_ACTION_MOVE);
g_signal_connect (target, "drop", G_CALLBACK (file_list_drag_drop_cb), impl);
- gtk_widget_add_controller (priv->browse_files_tree_view, GTK_EVENT_CONTROLLER (target));
+ gtk_widget_add_controller (impl->browse_files_tree_view, GTK_EVENT_CONTROLLER (target));
/* File browser treemodel columns are shared between GtkFileChooser implementations,
* so we don't set cell renderer attributes in GtkBuilder, but rather keep that
@@ -7921,7 +7700,7 @@ post_process_ui (GtkFileChooserWidget *impl)
* as an 'internal-child', then we could configure it in GtkBuilder
* instead of hard coding it here.
*/
- cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (priv->filter_combo));
+ cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (impl->filter_combo));
g_assert (cells);
cell = cells->data;
g_object_set (G_OBJECT (cell),
@@ -7931,35 +7710,35 @@ post_process_ui (GtkFileChooserWidget *impl)
g_list_free (cells);
/* Set the GtkPathBar file system backend */
- _gtk_path_bar_set_file_system (GTK_PATH_BAR (priv->browse_path_bar), priv->file_system);
+ _gtk_path_bar_set_file_system (GTK_PATH_BAR (impl->browse_path_bar), impl->file_system);
file = g_file_new_for_path ("/");
- _gtk_path_bar_set_file (GTK_PATH_BAR (priv->browse_path_bar), file, FALSE);
+ _gtk_path_bar_set_file (GTK_PATH_BAR (impl->browse_path_bar), file, FALSE);
g_object_unref (file);
/* Set the fixed size icon renderer, this requires
- * that priv->icon_size be already setup.
+ * that impl->icon_size be already setup.
*/
set_icon_cell_renderer_fixed_size (impl);
- gtk_popover_set_default_widget (GTK_POPOVER (priv->new_folder_popover), priv->new_folder_create_button);
- gtk_popover_set_default_widget (GTK_POPOVER (priv->rename_file_popover), priv->rename_file_rename_button);
+ gtk_popover_set_default_widget (GTK_POPOVER (impl->new_folder_popover), impl->new_folder_create_button);
+ gtk_popover_set_default_widget (GTK_POPOVER (impl->rename_file_popover), impl->rename_file_rename_button);
- priv->item_actions = G_ACTION_GROUP (g_simple_action_group_new ());
- g_action_map_add_action_entries (G_ACTION_MAP (priv->item_actions),
+ impl->item_actions = G_ACTION_GROUP (g_simple_action_group_new ());
+ g_action_map_add_action_entries (G_ACTION_MAP (impl->item_actions),
entries, G_N_ELEMENTS (entries),
impl);
gtk_widget_insert_action_group (GTK_WIDGET (impl),
"item",
- priv->item_actions);
+ impl->item_actions);
- gtk_search_entry_set_key_capture_widget (GTK_SEARCH_ENTRY (priv->search_entry), priv->search_entry);
+ gtk_search_entry_set_key_capture_widget (GTK_SEARCH_ENTRY (impl->search_entry), impl->search_entry);
- gtk_widget_set_parent (priv->rename_file_popover, GTK_WIDGET (impl));
+ gtk_widget_set_parent (impl->rename_file_popover, GTK_WIDGET (impl));
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
g_signal_connect (gesture, "pressed", G_CALLBACK (files_list_clicked), impl);
- gtk_widget_add_controller (GTK_WIDGET (priv->browse_files_tree_view), GTK_EVENT_CONTROLLER (gesture));
+ gtk_widget_add_controller (GTK_WIDGET (impl->browse_files_tree_view), GTK_EVENT_CONTROLLER (gesture));
controller = gtk_shortcut_controller_new ();
trigger = gtk_alternative_trigger_new (gtk_keyval_trigger_new (GDK_KEY_F10, GDK_SHIFT_MASK),
@@ -7967,21 +7746,19 @@ post_process_ui (GtkFileChooserWidget *impl)
action = gtk_callback_action_new (list_popup_menu_cb, impl, NULL);
shortcut = gtk_shortcut_new (trigger, action);
gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller), shortcut);
- gtk_widget_add_controller (GTK_WIDGET (priv->browse_files_tree_view), controller);
+ gtk_widget_add_controller (GTK_WIDGET (impl->browse_files_tree_view), controller);
}
void
gtk_file_chooser_widget_set_save_entry (GtkFileChooserWidget *impl,
GtkWidget *entry)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
g_return_if_fail (GTK_IS_FILE_CHOOSER_WIDGET (impl));
g_return_if_fail (entry == NULL || GTK_IS_FILE_CHOOSER_ENTRY (entry));
- priv->external_entry = entry;
+ impl->external_entry = entry;
- if (priv->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+ if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
{
save_widgets_destroy (impl);
save_widgets_create (impl);
@@ -8000,28 +7777,26 @@ display_changed_cb (GtkWidget *wiget,
static void
gtk_file_chooser_widget_init (GtkFileChooserWidget *impl)
{
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-
profile_start ("start", NULL);
#ifdef PROFILE_FILE_CHOOSER
access ("MARK: *** CREATE FILE CHOOSER", F_OK);
#endif
- priv->select_multiple = FALSE;
- priv->show_hidden = FALSE;
- priv->show_size_column = TRUE;
- priv->show_type_column = TRUE;
- priv->type_format = TYPE_FORMAT_MIME;
- priv->load_state = LOAD_EMPTY;
- priv->reload_state = RELOAD_EMPTY;
- priv->pending_select_files = NULL;
- priv->location_mode = LOCATION_MODE_PATH_BAR;
- priv->operation_mode = OPERATION_MODE_BROWSE;
- priv->sort_column = MODEL_COL_NAME;
- priv->sort_order = GTK_SORT_ASCENDING;
- priv->create_folders = TRUE;
- priv->auto_selecting_first_row = FALSE;
- priv->renamed_file = NULL;
+ impl->select_multiple = FALSE;
+ impl->show_hidden = FALSE;
+ impl->show_size_column = TRUE;
+ impl->show_type_column = TRUE;
+ impl->type_format = TYPE_FORMAT_MIME;
+ impl->load_state = LOAD_EMPTY;
+ impl->reload_state = RELOAD_EMPTY;
+ impl->pending_select_files = NULL;
+ impl->location_mode = LOCATION_MODE_PATH_BAR;
+ impl->operation_mode = OPERATION_MODE_BROWSE;
+ impl->sort_column = MODEL_COL_NAME;
+ impl->sort_order = GTK_SORT_ASCENDING;
+ impl->create_folders = TRUE;
+ impl->auto_selecting_first_row = FALSE;
+ impl->renamed_file = NULL;
/* Ensure GTK+ private types used by the template
* definition before calling gtk_widget_init_template()
@@ -8032,13 +7807,13 @@ gtk_file_chooser_widget_init (GtkFileChooserWidget *impl)
g_type_ensure (GTK_TYPE_FILE_CHOOSER_ERROR_STACK);
gtk_widget_init_template (GTK_WIDGET (impl));
- gtk_widget_set_size_request (priv->browse_files_tree_view, 280, -1);
+ gtk_widget_set_size_request (impl->browse_files_tree_view, 280, -1);
g_signal_connect (impl, "notify::display,", G_CALLBACK (display_changed_cb), impl);
check_icon_theme (impl);
- priv->file_system = _gtk_file_system_new ();
- priv->bookmarks_manager = _gtk_bookmarks_manager_new (NULL, NULL);
+ impl->file_system = _gtk_file_system_new ();
+ impl->bookmarks_manager = _gtk_bookmarks_manager_new (NULL, NULL);
/* Setup various attributes and callbacks in the UI
* which cannot be done with GtkBuilder
@@ -8074,16 +7849,15 @@ gtk_file_chooser_widget_add_choice (GtkFileChooser *chooser,
const char **option_labels)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (chooser);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GtkWidget *widget;
- if (priv->choices == NULL)
+ if (impl->choices == NULL)
{
- priv->choices = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
- priv->choice_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
- set_extra_widget (impl, priv->choice_box);
+ impl->choices = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+ impl->choice_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
+ set_extra_widget (impl, impl->choice_box);
}
- else if (g_hash_table_lookup (priv->choices, id))
+ else if (g_hash_table_lookup (impl->choices, id))
{
g_warning ("Duplicate choice %s", id);
return;
@@ -8099,7 +7873,7 @@ gtk_file_chooser_widget_add_choice (GtkFileChooser *chooser,
gtk_container_add (GTK_CONTAINER (box), gtk_label_new (label));
combo = gtk_combo_box_text_new ();
- g_hash_table_insert (priv->choices, g_strdup (id), combo);
+ g_hash_table_insert (impl->choices, g_strdup (id), combo);
gtk_container_add (GTK_CONTAINER (box), combo);
for (i = 0; options[i]; i++)
@@ -8113,12 +7887,12 @@ gtk_file_chooser_widget_add_choice (GtkFileChooser *chooser,
GtkWidget *check;
check = gtk_check_button_new_with_label (label);
- g_hash_table_insert (priv->choices, g_strdup (id), check);
+ g_hash_table_insert (impl->choices, g_strdup (id), check);
widget = check;
}
- gtk_container_add (GTK_CONTAINER (priv->choice_box), widget);
+ gtk_container_add (GTK_CONTAINER (impl->choice_box), widget);
}
static void
@@ -8126,22 +7900,21 @@ gtk_file_chooser_widget_remove_choice (GtkFileChooser *chooser,
const char *id)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (chooser);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GtkWidget *widget;
- if (priv->choices == NULL)
+ if (impl->choices == NULL)
return;
- widget = (GtkWidget *)g_hash_table_lookup (priv->choices, id);
- g_hash_table_remove (priv->choices, id);
- gtk_container_remove (GTK_CONTAINER (priv->choice_box), widget);
+ widget = (GtkWidget *)g_hash_table_lookup (impl->choices, id);
+ g_hash_table_remove (impl->choices, id);
+ gtk_container_remove (GTK_CONTAINER (impl->choice_box), widget);
- if (g_hash_table_size (priv->choices) == 0)
+ if (g_hash_table_size (impl->choices) == 0)
{
set_extra_widget (impl, NULL);
- g_hash_table_unref (priv->choices);
- priv->choices = NULL;
- priv->choice_box = NULL;
+ g_hash_table_unref (impl->choices);
+ impl->choices = NULL;
+ impl->choice_box = NULL;
}
}
@@ -8151,13 +7924,12 @@ gtk_file_chooser_widget_set_choice (GtkFileChooser *chooser,
const char *option)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (chooser);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GtkWidget *widget;
- if (priv->choices == NULL)
+ if (impl->choices == NULL)
return;
- widget = (GtkWidget *)g_hash_table_lookup (priv->choices, id);
+ widget = (GtkWidget *)g_hash_table_lookup (impl->choices, id);
if (GTK_IS_COMBO_BOX (widget))
gtk_combo_box_set_active_id (GTK_COMBO_BOX (widget), option);
@@ -8170,13 +7942,12 @@ gtk_file_chooser_widget_get_choice (GtkFileChooser *chooser,
const char *id)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (chooser);
- GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
GtkWidget *widget;
- if (priv->choices == NULL)
+ if (impl->choices == NULL)
return NULL;
- widget = (GtkWidget *)g_hash_table_lookup (priv->choices, id);
+ widget = (GtkWidget *)g_hash_table_lookup (impl->choices, id);
if (GTK_IS_COMBO_BOX (widget))
return gtk_combo_box_get_active_id (GTK_COMBO_BOX (widget));
else if (GTK_IS_TOGGLE_BUTTON (widget))
diff --git a/gtk/gtklevelbar.c b/gtk/gtklevelbar.c
index 98bc590526..c34fcc5364 100644
--- a/gtk/gtklevelbar.c
+++ b/gtk/gtklevelbar.c
@@ -160,6 +160,8 @@ enum {
static GParamSpec *properties[LAST_PROPERTY] = { NULL, };
static guint signals[NUM_SIGNALS] = { 0, };
+typedef struct _GtkLevelBarClass GtkLevelBarClass;
+
typedef struct {
gchar *name;
gdouble value;
@@ -167,18 +169,7 @@ typedef struct {
struct _GtkLevelBar {
GtkWidget parent_instance;
-};
-
-typedef struct _GtkLevelBarClass GtkLevelBarClass;
-struct _GtkLevelBarClass {
- GtkWidgetClass parent_class;
-
- void (* offset_changed) (GtkLevelBar *self,
- const gchar *name);
-};
-typedef struct _GtkLevelBarPrivate GtkLevelBarPrivate;
-struct _GtkLevelBarPrivate {
GtkOrientation orientation;
GtkLevelBarMode bar_mode;
@@ -196,13 +187,19 @@ struct _GtkLevelBarPrivate {
guint inverted : 1;
};
+struct _GtkLevelBarClass {
+ GtkWidgetClass parent_class;
+
+ void (* offset_changed) (GtkLevelBar *self,
+ const gchar *name);
+};
+
static void gtk_level_bar_set_value_internal (GtkLevelBar *self,
gdouble value);
static void gtk_level_bar_buildable_init (GtkBuildableIface *iface);
G_DEFINE_TYPE_WITH_CODE (GtkLevelBar, gtk_level_bar, GTK_TYPE_WIDGET,
- G_ADD_PRIVATE (GtkLevelBar)
G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, NULL)
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
gtk_level_bar_buildable_init))
@@ -251,12 +248,11 @@ gtk_level_bar_ensure_offset (GtkLevelBar *self,
const gchar *name,
gdouble value)
{
- GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
GList *existing;
GtkLevelBarOffset *offset = NULL;
GtkLevelBarOffset *new_offset;
- existing = g_list_find_custom (priv->offsets, name, offset_find_func);
+ existing = g_list_find_custom (self->offsets, name, offset_find_func);
if (existing)
offset = existing->data;
@@ -268,10 +264,10 @@ gtk_level_bar_ensure_offset (GtkLevelBar *self,
if (offset)
{
gtk_level_bar_offset_free (offset);
- priv->offsets = g_list_delete_link (priv->offsets, existing);
+ self->offsets = g_list_delete_link (self->offsets, existing);
}
- priv->offsets = g_list_insert_sorted (priv->offsets, new_offset, offset_sort_func);
+ self->offsets = g_list_insert_sorted (self->offsets, new_offset, offset_sort_func);
return TRUE;
}
@@ -281,22 +277,18 @@ static gboolean
gtk_level_bar_value_in_interval (GtkLevelBar *self,
gdouble value)
{
- GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
-
- return ((value >= priv->min_value) &&
- (value <= priv->max_value));
+ return ((value >= self->min_value) &&
+ (value <= self->max_value));
}
#endif
static gint
gtk_level_bar_get_num_blocks (GtkLevelBar *self)
{
- GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
-
- if (priv->bar_mode == GTK_LEVEL_BAR_MODE_CONTINUOUS)
+ if (self->bar_mode == GTK_LEVEL_BAR_MODE_CONTINUOUS)
return 1;
- else if (priv->bar_mode == GTK_LEVEL_BAR_MODE_DISCRETE)
- return MAX (1, (gint) (round (priv->max_value) - round (priv->min_value)));
+ else if (self->bar_mode == GTK_LEVEL_BAR_MODE_DISCRETE)
+ return MAX (1, (gint) (round (self->max_value) - round (self->min_value)));
return 0;
}
@@ -304,8 +296,7 @@ gtk_level_bar_get_num_blocks (GtkLevelBar *self)
static gint
gtk_level_bar_get_num_block_nodes (GtkLevelBar *self)
{
- GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
- if (priv->bar_mode == GTK_LEVEL_BAR_MODE_CONTINUOUS)
+ if (self->bar_mode == GTK_LEVEL_BAR_MODE_CONTINUOUS)
return 2;
else
return gtk_level_bar_get_num_blocks (self);
@@ -316,7 +307,6 @@ gtk_level_bar_get_min_block_size (GtkLevelBar *self,
gint *block_width,
gint *block_height)
{
- GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
guint i, n_blocks;
gint width, height;
@@ -325,12 +315,12 @@ gtk_level_bar_get_min_block_size (GtkLevelBar *self,
for (i = 0; i < n_blocks; i++)
{
- gtk_widget_measure (priv->block_widget[i],
+ gtk_widget_measure (self->block_widget[i],
GTK_ORIENTATION_HORIZONTAL,
-1,
&width, NULL,
NULL, NULL);
- gtk_widget_measure (priv->block_widget[i],
+ gtk_widget_measure (self->block_widget[i],
GTK_ORIENTATION_VERTICAL,
-1,
&height, NULL,
@@ -344,12 +334,11 @@ gtk_level_bar_get_min_block_size (GtkLevelBar *self,
static gboolean
gtk_level_bar_get_real_inverted (GtkLevelBar *self)
{
- GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
if (gtk_widget_get_direction (GTK_WIDGET (self)) == GTK_TEXT_DIR_RTL &&
- priv->orientation == GTK_ORIENTATION_HORIZONTAL)
- return !priv->inverted;
+ self->orientation == GTK_ORIENTATION_HORIZONTAL)
+ return !self->inverted;
- return priv->inverted;
+ return self->inverted;
}
static void
@@ -358,20 +347,19 @@ gtk_level_bar_render_trough (GtkGizmo *gizmo,
{
GtkWidget *widget = GTK_WIDGET (gizmo);
GtkLevelBar *self = GTK_LEVEL_BAR (gtk_widget_get_parent (GTK_WIDGET (gizmo)));
- GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
- if (priv->bar_mode == GTK_LEVEL_BAR_MODE_CONTINUOUS)
+ if (self->bar_mode == GTK_LEVEL_BAR_MODE_CONTINUOUS)
{
gboolean inverted;
inverted = gtk_level_bar_get_real_inverted (self);
/* render the empty (unfilled) part */
- gtk_widget_snapshot_child (widget, priv->block_widget[inverted ? 0 : 1], snapshot);
+ gtk_widget_snapshot_child (widget, self->block_widget[inverted ? 0 : 1], snapshot);
/* now render the filled part on top of it */
- if (priv->cur_value != 0)
- gtk_widget_snapshot_child (widget, priv->block_widget[inverted ? 1 : 0], snapshot);
+ if (self->cur_value != 0)
+ gtk_widget_snapshot_child (widget, self->block_widget[inverted ? 1 : 0], snapshot);
}
else
{
@@ -380,7 +368,7 @@ gtk_level_bar_render_trough (GtkGizmo *gizmo,
num_blocks = gtk_level_bar_get_num_blocks (self);
for (i = 0; i < num_blocks; i++)
- gtk_widget_snapshot_child (widget, priv->block_widget[i], snapshot);
+ gtk_widget_snapshot_child (widget, self->block_widget[i], snapshot);
}
}
@@ -395,7 +383,6 @@ gtk_level_bar_measure_trough (GtkGizmo *gizmo,
{
GtkWidget *widget = GTK_WIDGET (gizmo);
GtkLevelBar *self = GTK_LEVEL_BAR (gtk_widget_get_parent (widget));
- GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
gint num_blocks, size;
gint block_width, block_height;
@@ -404,14 +391,14 @@ gtk_level_bar_measure_trough (GtkGizmo *gizmo,
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
- if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
+ if (self->orientation == GTK_ORIENTATION_HORIZONTAL)
size = num_blocks * block_width;
else
size = block_width;
}
else
{
- if (priv->orientation == GTK_ORIENTATION_VERTICAL)
+ if (self->orientation == GTK_ORIENTATION_VERTICAL)
size = num_blocks * block_height;
else
size = block_height;
@@ -427,7 +414,6 @@ gtk_level_bar_allocate_trough_continuous (GtkLevelBar *self,
int height,
int baseline)
{
- GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
GtkAllocation block_area;
gdouble fill_percentage;
gboolean inverted;
@@ -436,24 +422,24 @@ gtk_level_bar_allocate_trough_continuous (GtkLevelBar *self,
inverted = gtk_level_bar_get_real_inverted (self);
/* allocate the empty (unfilled) part */
- gtk_widget_size_allocate (priv->block_widget[inverted ? 0 : 1],
+ gtk_widget_size_allocate (self->block_widget[inverted ? 0 : 1],
&(GtkAllocation) {0, 0, width, height},
baseline);
- if (priv->cur_value == 0)
+ if (self->cur_value == 0)
return;
/* now allocate the filled part */
block_area = (GtkAllocation) {0, 0, width, height};
- fill_percentage = (priv->cur_value - priv->min_value) /
- (priv->max_value - priv->min_value);
+ fill_percentage = (self->cur_value - self->min_value) /
+ (self->max_value - self->min_value);
- gtk_widget_measure (priv->block_widget[inverted ? 1 : 0],
- priv->orientation, -1,
+ gtk_widget_measure (self->block_widget[inverted ? 1 : 0],
+ self->orientation, -1,
&block_min, NULL,
NULL, NULL);
- if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
+ if (self->orientation == GTK_ORIENTATION_HORIZONTAL)
{
block_area.width = (gint) floor (block_area.width * fill_percentage);
block_area.width = MAX (block_area.width, block_min);
@@ -470,7 +456,7 @@ gtk_level_bar_allocate_trough_continuous (GtkLevelBar *self,
block_area.y += height - block_area.height;
}
- gtk_widget_size_allocate (priv->block_widget[inverted ? 1 : 0],
+ gtk_widget_size_allocate (self->block_widget[inverted ? 1 : 0],
&block_area,
baseline);
}
@@ -481,7 +467,6 @@ gtk_level_bar_allocate_trough_discrete (GtkLevelBar *self,
int height,
int baseline)
{
- GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
GtkAllocation block_area;
gint num_blocks, i;
gint block_width, block_height;
@@ -492,7 +477,7 @@ gtk_level_bar_allocate_trough_discrete (GtkLevelBar *self,
if (num_blocks == 0)
return;
- if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
+ if (self->orientation == GTK_ORIENTATION_HORIZONTAL)
{
block_width = MAX (block_width, (gint) floor (width / num_blocks));
block_height = height;
@@ -510,11 +495,11 @@ gtk_level_bar_allocate_trough_discrete (GtkLevelBar *self,
for (i = 0; i < num_blocks; i++)
{
- gtk_widget_size_allocate (priv->block_widget[i],
+ gtk_widget_size_allocate (self->block_widget[i],
&block_area,
baseline);
- if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
+ if (self->orientation == GTK_ORIENTATION_HORIZONTAL)
block_area.x += block_area.width;
else
block_area.y += block_area.height;
@@ -529,9 +514,8 @@ gtk_level_bar_allocate_trough (GtkGizmo *gizmo,
{
GtkWidget *widget = GTK_WIDGET (gizmo);
GtkLevelBar *self = GTK_LEVEL_BAR (gtk_widget_get_parent (widget));
- GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
- if (priv->bar_mode == GTK_LEVEL_BAR_MODE_CONTINUOUS)
+ if (self->bar_mode == GTK_LEVEL_BAR_MODE_CONTINUOUS)
gtk_level_bar_allocate_trough_continuous (self, width, height, baseline);
else
gtk_level_bar_allocate_trough_discrete (self, width, height, baseline);
@@ -540,48 +524,46 @@ gtk_level_bar_allocate_trough (GtkGizmo *gizmo,
static void
update_block_nodes (GtkLevelBar *self)
{
- GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
guint n_blocks;
guint i;
n_blocks = gtk_level_bar_get_num_block_nodes (self);
- if (priv->n_blocks == n_blocks)
+ if (self->n_blocks == n_blocks)
return;
- else if (n_blocks < priv->n_blocks)
+ else if (n_blocks < self->n_blocks)
{
- for (i = n_blocks; i < priv->n_blocks; i++)
+ for (i = n_blocks; i < self->n_blocks; i++)
{
- gtk_widget_unparent (priv->block_widget[i]);
+ gtk_widget_unparent (self->block_widget[i]);
}
- priv->block_widget = g_renew (GtkWidget*, priv->block_widget, n_blocks);
- priv->n_blocks = n_blocks;
+ self->block_widget = g_renew (GtkWidget*, self->block_widget, n_blocks);
+ self->n_blocks = n_blocks;
}
else
{
- priv->block_widget = g_renew (GtkWidget*, priv->block_widget, n_blocks);
- for (i = priv->n_blocks; i < n_blocks; i++)
+ self->block_widget = g_renew (GtkWidget*, self->block_widget, n_blocks);
+ for (i = self->n_blocks; i < n_blocks; i++)
{
- priv->block_widget[i] = gtk_gizmo_new ("block", NULL, NULL, NULL, NULL);
- gtk_widget_insert_before (priv->block_widget[i], GTK_WIDGET (priv->trough_widget), NULL);
+ self->block_widget[i] = gtk_gizmo_new ("block", NULL, NULL, NULL, NULL);
+ gtk_widget_insert_before (self->block_widget[i], GTK_WIDGET (self->trough_widget), NULL);
}
- priv->n_blocks = n_blocks;
+ self->n_blocks = n_blocks;
}
}
static void
update_mode_style_classes (GtkLevelBar *self)
{
- GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
GtkCssNode *widget_node;
widget_node = gtk_widget_get_css_node (GTK_WIDGET (self));
- if (priv->bar_mode == GTK_LEVEL_BAR_MODE_CONTINUOUS)
+ if (self->bar_mode == GTK_LEVEL_BAR_MODE_CONTINUOUS)
{
gtk_css_node_remove_class (widget_node, g_quark_from_static_string ("discrete"));
gtk_css_node_add_class (widget_node, g_quark_from_static_string ("continuous"));
}
- else if (priv->bar_mode == GTK_LEVEL_BAR_MODE_DISCRETE)
+ else if (self->bar_mode == GTK_LEVEL_BAR_MODE_DISCRETE)
{
gtk_css_node_add_class (widget_node, g_quark_from_static_string ("discrete"));
gtk_css_node_remove_class (widget_node, g_quark_from_static_string ("continuous"));
@@ -591,7 +573,6 @@ update_mode_style_classes (GtkLevelBar *self)
static void
update_level_style_classes (GtkLevelBar *self)
{
- GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
gdouble value;
const gchar *value_class = NULL;
GtkLevelBarOffset *offset, *prev_offset;
@@ -601,7 +582,7 @@ update_level_style_classes (GtkLevelBar *self)
value = gtk_level_bar_get_value (self);
- for (l = priv->offsets; l != NULL; l = l->next)
+ for (l = self->offsets; l != NULL; l = l->next)
{
offset = l->data;
@@ -627,14 +608,14 @@ update_level_style_classes (GtkLevelBar *self)
inverted = gtk_level_bar_get_real_inverted (self);
num_blocks = gtk_level_bar_get_num_block_nodes (self);
- if (priv->bar_mode == GTK_LEVEL_BAR_MODE_CONTINUOUS)
+ if (self->bar_mode == GTK_LEVEL_BAR_MODE_CONTINUOUS)
num_filled = 1;
else
- num_filled = MIN (num_blocks, (gint) round (priv->cur_value) - (gint) round (priv->min_value));
+ num_filled = MIN (num_blocks, (gint) round (self->cur_value) - (gint) round (self->min_value));
for (i = 0; i < num_filled; i++)
{
- GtkCssNode *node = gtk_widget_get_css_node (priv->block_widget[inverted ? num_blocks - 1 - i : i]);
+ GtkCssNode *node = gtk_widget_get_css_node (self->block_widget[inverted ? num_blocks - 1 - i : i]);
gtk_css_node_set_classes (node, NULL);
gtk_css_node_add_class (node, g_quark_from_static_string ("filled"));
@@ -645,7 +626,7 @@ update_level_style_classes (GtkLevelBar *self)
for (; i < num_blocks; i++)
{
- GtkCssNode *node = gtk_widget_get_css_node (priv->block_widget[inverted ? num_blocks - 1 - i : i]);
+ GtkCssNode *node = gtk_widget_get_css_node (self->block_widget[inverted ? num_blocks - 1 - i : i]);
gtk_css_node_set_classes (node, NULL);
gtk_css_node_add_class (node, g_quark_from_static_string ("empty"));
@@ -666,19 +647,18 @@ gtk_level_bar_direction_changed (GtkWidget *widget,
static void
gtk_level_bar_ensure_offsets_in_range (GtkLevelBar *self)
{
- GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
GtkLevelBarOffset *offset;
- GList *l = priv->offsets;
+ GList *l = self->offsets;
while (l != NULL)
{
offset = l->data;
l = l->next;
- if (offset->value < priv->min_value)
- gtk_level_bar_ensure_offset (self, offset->name, priv->min_value);
- else if (offset->value > priv->max_value)
- gtk_level_bar_ensure_offset (self, offset->name, priv->max_value);
+ if (offset->value < self->min_value)
+ gtk_level_bar_ensure_offset (self, offset->name, self->min_value);
+ else if (offset->value > self->max_value)
+ gtk_level_bar_ensure_offset (self, offset->name, self->max_value);
}
}
@@ -815,10 +795,9 @@ static void
gtk_level_bar_set_orientation (GtkLevelBar *self,
GtkOrientation orientation)
{
- GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
- if (priv->orientation != orientation)
+ if (self->orientation != orientation)
{
- priv->orientation = orientation;
+ self->orientation = orientation;
_gtk_orientable_set_style_classes (GTK_ORIENTABLE (self));
gtk_widget_queue_resize (GTK_WIDGET (self));
g_object_notify (G_OBJECT (self), "orientation");
@@ -832,7 +811,6 @@ gtk_level_bar_get_property (GObject *obj,
GParamSpec *pspec)
{
GtkLevelBar *self = GTK_LEVEL_BAR (obj);
- GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
switch (property_id)
{
@@ -852,7 +830,7 @@ gtk_level_bar_get_property (GObject *obj,
g_value_set_boolean (value, gtk_level_bar_get_inverted (self));
break;
case PROP_ORIENTATION:
- g_value_set_enum (value, priv->orientation);
+ g_value_set_enum (value, self->orientation);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, property_id, pspec);
@@ -898,17 +876,16 @@ static void
gtk_level_bar_finalize (GObject *obj)
{
GtkLevelBar *self = GTK_LEVEL_BAR (obj);
- GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
gint i;
- g_list_free_full (priv->offsets, (GDestroyNotify) gtk_level_bar_offset_free);
+ g_list_free_full (self->offsets, (GDestroyNotify) gtk_level_bar_offset_free);
- for (i = 0; i < priv->n_blocks; i++)
- gtk_widget_unparent (priv->block_widget[i]);
+ for (i = 0; i < self->n_blocks; i++)
+ gtk_widget_unparent (self->block_widget[i]);
- g_free (priv->block_widget);
+ g_free (self->block_widget);
- gtk_widget_unparent (priv->trough_widget);
+ gtk_widget_unparent (self->trough_widget);
G_OBJECT_CLASS (gtk_level_bar_parent_class)->finalize (obj);
}
@@ -1031,33 +1008,31 @@ gtk_level_bar_class_init (GtkLevelBarClass *klass)
static void
gtk_level_bar_init (GtkLevelBar *self)
{
- GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
-
- priv->cur_value = 0.0;
- priv->min_value = 0.0;
- priv->max_value = 1.0;
+ self->cur_value = 0.0;
+ self->min_value = 0.0;
+ self->max_value = 1.0;
/* set initial orientation and style classes */
- priv->orientation = GTK_ORIENTATION_HORIZONTAL;
+ self->orientation = GTK_ORIENTATION_HORIZONTAL;
_gtk_orientable_set_style_classes (GTK_ORIENTABLE (self));
- priv->inverted = FALSE;
+ self->inverted = FALSE;
- priv->trough_widget = gtk_gizmo_new ("trough",
+ self->trough_widget = gtk_gizmo_new ("trough",
gtk_level_bar_measure_trough,
gtk_level_bar_allocate_trough,
gtk_level_bar_render_trough,
NULL);
- gtk_widget_set_parent (priv->trough_widget, GTK_WIDGET (self));
+ gtk_widget_set_parent (self->trough_widget, GTK_WIDGET (self));
gtk_level_bar_ensure_offset (self, GTK_LEVEL_BAR_OFFSET_LOW, 0.25);
gtk_level_bar_ensure_offset (self, GTK_LEVEL_BAR_OFFSET_HIGH, 0.75);
gtk_level_bar_ensure_offset (self, GTK_LEVEL_BAR_OFFSET_FULL, 1.0);
- priv->block_widget = NULL;
- priv->n_blocks = 0;
+ self->block_widget = NULL;
+ self->n_blocks = 0;
- priv->bar_mode = GTK_LEVEL_BAR_MODE_CONTINUOUS;
+ self->bar_mode = GTK_LEVEL_BAR_MODE_CONTINUOUS;
update_mode_style_classes (self);
update_block_nodes (self);
update_level_style_classes (self);
@@ -1107,11 +1082,9 @@ gtk_level_bar_new_for_interval (gdouble min_value,
gdouble
gtk_level_bar_get_min_value (GtkLevelBar *self)
{
- GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
-
g_return_val_if_fail (GTK_IS_LEVEL_BAR (self), 0.0);
- return priv->min_value;
+ return self->min_value;
}
/**
@@ -1125,11 +1098,9 @@ gtk_level_bar_get_min_value (GtkLevelBar *self)
gdouble
gtk_level_bar_get_max_value (GtkLevelBar *self)
{
- GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
-
g_return_val_if_fail (GTK_IS_LEVEL_BAR (self), 0.0);
- return priv->max_value;
+ return self->max_value;
}
/**
@@ -1144,22 +1115,18 @@ gtk_level_bar_get_max_value (GtkLevelBar *self)
gdouble
gtk_level_bar_get_value (GtkLevelBar *self)
{
- GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
-
g_return_val_if_fail (GTK_IS_LEVEL_BAR (self), 0.0);
- return priv->cur_value;
+ return self->cur_value;
}
static void
gtk_level_bar_set_value_internal (GtkLevelBar *self,
gdouble value)
{
- GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
-
- priv->cur_value = value;
+ self->cur_value = value;
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_VALUE]);
- gtk_widget_queue_allocate (GTK_WIDGET (priv->trough_widget));
+ gtk_widget_queue_allocate (GTK_WIDGET (self->trough_widget));
}
/**
@@ -1176,18 +1143,16 @@ void
gtk_level_bar_set_min_value (GtkLevelBar *self,
gdouble value)
{
- GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
-
g_return_if_fail (GTK_IS_LEVEL_BAR (self));
g_return_if_fail (value >= 0.0);
- if (value == priv->min_value)
+ if (value == self->min_value)
return;
- priv->min_value = value;
+ self->min_value = value;
- if (priv->min_value > priv->cur_value)
- gtk_level_bar_set_value_internal (self, priv->min_value);
+ if (self->min_value > self->cur_value)
+ gtk_level_bar_set_value_internal (self, self->min_value);
update_block_nodes (self);
update_level_style_classes (self);
@@ -1208,18 +1173,16 @@ void
gtk_level_bar_set_max_value (GtkLevelBar *self,
gdouble value)
{
- GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
-
g_return_if_fail (GTK_IS_LEVEL_BAR (self));
g_return_if_fail (value >= 0.0);
- if (value == priv->max_value)
+ if (value == self->max_value)
return;
- priv->max_value = value;
+ self->max_value = value;
- if (priv->max_value < priv->cur_value)
- gtk_level_bar_set_value_internal (self, priv->max_value);
+ if (self->max_value < self->cur_value)
+ gtk_level_bar_set_value_internal (self, self->max_value);
gtk_level_bar_ensure_offsets_in_range (self);
update_block_nodes (self);
@@ -1239,11 +1202,9 @@ void
gtk_level_bar_set_value (GtkLevelBar *self,
gdouble value)
{
- GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
-
g_return_if_fail (GTK_IS_LEVEL_BAR (self));
- if (value == priv->cur_value)
+ if (value == self->cur_value)
return;
gtk_level_bar_set_value_internal (self, value);
@@ -1261,11 +1222,9 @@ gtk_level_bar_set_value (GtkLevelBar *self,
GtkLevelBarMode
gtk_level_bar_get_mode (GtkLevelBar *self)
{
- GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
-
g_return_val_if_fail (GTK_IS_LEVEL_BAR (self), 0);
- return priv->bar_mode;
+ return self->bar_mode;
}
/**
@@ -1279,14 +1238,12 @@ void
gtk_level_bar_set_mode (GtkLevelBar *self,
GtkLevelBarMode mode)
{
- GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
-
g_return_if_fail (GTK_IS_LEVEL_BAR (self));
- if (priv->bar_mode == mode)
+ if (self->bar_mode == mode)
return;
- priv->bar_mode = mode;
+ self->bar_mode = mode;
update_mode_style_classes (self);
update_block_nodes (self);
@@ -1307,11 +1264,9 @@ gtk_level_bar_set_mode (GtkLevelBar *self,
gboolean
gtk_level_bar_get_inverted (GtkLevelBar *self)
{
- GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
-
g_return_val_if_fail (GTK_IS_LEVEL_BAR (self), FALSE);
- return priv->inverted;
+ return self->inverted;
}
/**
@@ -1325,14 +1280,12 @@ void
gtk_level_bar_set_inverted (GtkLevelBar *self,
gboolean inverted)
{
- GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
-
g_return_if_fail (GTK_IS_LEVEL_BAR (self));
- if (priv->inverted == inverted)
+ if (self->inverted == inverted)
return;
- priv->inverted = inverted;
+ self->inverted = inverted;
gtk_widget_queue_resize (GTK_WIDGET (self));
update_level_style_classes (self);
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_INVERTED]);
@@ -1350,16 +1303,15 @@ void
gtk_level_bar_remove_offset_value (GtkLevelBar *self,
const gchar *name)
{
- GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
GList *existing;
g_return_if_fail (GTK_IS_LEVEL_BAR (self));
- existing = g_list_find_custom (priv->offsets, name, offset_find_func);
+ existing = g_list_find_custom (self->offsets, name, offset_find_func);
if (existing)
{
gtk_level_bar_offset_free (existing->data);
- priv->offsets = g_list_delete_link (priv->offsets, existing);
+ self->offsets = g_list_delete_link (self->offsets, existing);
update_level_style_classes (self);
}
@@ -1413,13 +1365,12 @@ gtk_level_bar_get_offset_value (GtkLevelBar *self,
const gchar *name,
gdouble *value)
{
- GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (self);
GList *existing;
GtkLevelBarOffset *offset = NULL;
g_return_val_if_fail (GTK_IS_LEVEL_BAR (self), FALSE);
- existing = g_list_find_custom (priv->offsets, name, offset_find_func);
+ existing = g_list_find_custom (self->offsets, name, offset_find_func);
if (existing)
offset = existing->data;
diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c
index c5de939513..def3c27e05 100644
--- a/gtk/gtklistbox.c
+++ b/gtk/gtklistbox.c
@@ -92,28 +92,7 @@ typedef struct _GtkListBoxClass GtkListBoxClass;
struct _GtkListBox
{
GtkContainer parent_instance;
-};
-
-struct _GtkListBoxClass
-{
- GtkContainerClass parent_class;
- void (*row_selected) (GtkListBox *box,
- GtkListBoxRow *row);
- void (*row_activated) (GtkListBox *box,
- GtkListBoxRow *row);
- void (*activate_cursor_row) (GtkListBox *box);
- void (*toggle_cursor_row) (GtkListBox *box);
- void (*move_cursor) (GtkListBox *box,
- GtkMovementStep step,
- gint count);
- void (*selected_rows_changed) (GtkListBox *box);
- void (*select_all) (GtkListBox *box);
- void (*unselect_all) (GtkListBox *box);
-};
-
-typedef struct
-{
GSequence *children;
GHashTable *header_hash;
@@ -154,7 +133,25 @@ typedef struct
GtkListBoxCreateWidgetFunc create_widget_func;
gpointer create_widget_func_data;
GDestroyNotify create_widget_func_data_destroy;
-} GtkListBoxPrivate;
+};
+
+struct _GtkListBoxClass
+{
+ GtkContainerClass parent_class;
+
+ void (*row_selected) (GtkListBox *box,
+ GtkListBoxRow *row);
+ void (*row_activated) (GtkListBox *box,
+ GtkListBoxRow *row);
+ void (*activate_cursor_row) (GtkListBox *box);
+ void (*toggle_cursor_row) (GtkListBox *box);
+ void (*move_cursor) (GtkListBox *box,
+ GtkMovementStep step,
+ gint count);
+ void (*selected_rows_changed) (GtkListBox *box);
+ void (*select_all) (GtkListBox *box);
+ void (*unselect_all) (GtkListBox *box);
+};
typedef struct
{
@@ -207,7 +204,6 @@ enum {
LAST_ROW_PROPERTY = ROW_PROP_ACTION_NAME
};
-#define BOX_PRIV(box) ((GtkListBoxPrivate*)gtk_list_box_get_instance_private ((GtkListBox*)(box)))
#define ROW_PRIV(row) ((GtkListBoxRowPrivate*)gtk_list_box_row_get_instance_private ((GtkListBoxRow*)(row)))
static GtkBuildableIface *parent_buildable_iface;
@@ -217,7 +213,6 @@ static void gtk_list_box_buildable_interface_init (GtkBuildableIface *ifac
static void gtk_list_box_row_actionable_iface_init (GtkActionableInterface *iface);
G_DEFINE_TYPE_WITH_CODE (GtkListBox, gtk_list_box, GTK_TYPE_CONTAINER,
- G_ADD_PRIVATE (GtkListBox)
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
gtk_list_box_buildable_interface_init))
G_DEFINE_TYPE_WITH_CODE (GtkListBoxRow, gtk_list_box_row, GTK_TYPE_BIN,
@@ -349,21 +344,21 @@ gtk_list_box_get_property (GObject *obj,
GValue *value,
GParamSpec *pspec)
{
- GtkListBoxPrivate *priv = BOX_PRIV (obj);
+ GtkListBox *box = GTK_LIST_BOX (obj);
switch (property_id)
{
case PROP_SELECTION_MODE:
- g_value_set_enum (value, priv->selection_mode);
+ g_value_set_enum (value, box->selection_mode);
break;
case PROP_ACTIVATE_ON_SINGLE_CLICK:
- g_value_set_boolean (value, priv->activate_single_click);
+ g_value_set_boolean (value, box->activate_single_click);
break;
case PROP_ACCEPT_UNPAIRED_RELEASE:
- g_value_set_boolean (value, priv->accept_unpaired_release);
+ g_value_set_boolean (value, box->accept_unpaired_release);
break;
case PROP_SHOW_SEPARATORS:
- g_value_set_boolean (value, priv->show_separators);
+ g_value_set_boolean (value, box->show_separators);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, property_id, pspec);
@@ -402,28 +397,28 @@ gtk_list_box_set_property (GObject *obj,
static void
gtk_list_box_finalize (GObject *obj)
{
- GtkListBoxPrivate *priv = BOX_PRIV (obj);
+ GtkListBox *box = GTK_LIST_BOX (obj);
- if (priv->sort_func_target_destroy_notify != NULL)
- priv->sort_func_target_destroy_notify (priv->sort_func_target);
- if (priv->filter_func_target_destroy_notify != NULL)
- priv->filter_func_target_destroy_notify (priv->filter_func_target);
- if (priv->update_header_func_target_destroy_notify != NULL)
- priv->update_header_func_target_destroy_notify (priv->update_header_func_target);
+ if (box->sort_func_target_destroy_notify != NULL)
+ box->sort_func_target_destroy_notify (box->sort_func_target);
+ if (box->filter_func_target_destroy_notify != NULL)
+ box->filter_func_target_destroy_notify (box->filter_func_target);
+ if (box->update_header_func_target_destroy_notify != NULL)
+ box->update_header_func_target_destroy_notify (box->update_header_func_target);
- g_clear_object (&priv->adjustment);
- g_clear_object (&priv->drag_highlighted_row);
+ g_clear_object (&box->adjustment);
+ g_clear_object (&box->drag_highlighted_row);
- g_sequence_free (priv->children);
- g_hash_table_unref (priv->header_hash);
+ g_sequence_free (box->children);
+ g_hash_table_unref (box->header_hash);
- if (priv->bound_model)
+ if (box->bound_model)
{
- if (priv->create_widget_func_data_destroy)
- priv->create_widget_func_data_destroy (priv->create_widget_func_data);
+ if (box->create_widget_func_data_destroy)
+ box->create_widget_func_data_destroy (box->create_widget_func_data);
- g_signal_handlers_disconnect_by_func (priv->bound_model, gtk_list_box_bound_model_changed, obj);
- g_clear_object (&priv->bound_model);
+ g_signal_handlers_disconnect_by_func (box->bound_model, gtk_list_box_bound_model_changed, obj);
+ g_clear_object (&box->bound_model);
}
G_OBJECT_CLASS (gtk_list_box_parent_class)->finalize (obj);
@@ -658,15 +653,14 @@ gtk_list_box_class_init (GtkListBoxClass *klass)
static void
gtk_list_box_init (GtkListBox *box)
{
- GtkListBoxPrivate *priv = BOX_PRIV (box);
GtkWidget *widget = GTK_WIDGET (box);
GtkGesture *gesture;
- priv->selection_mode = GTK_SELECTION_SINGLE;
- priv->activate_single_click = TRUE;
+ box->selection_mode = GTK_SELECTION_SINGLE;
+ box->activate_single_click = TRUE;
- priv->children = g_sequence_new (NULL);
- priv->header_hash = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, NULL);
+ box->children = g_sequence_new (NULL);
+ box->header_hash = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, NULL);
gesture = gtk_gesture_click_new ();
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
@@ -705,7 +699,7 @@ gtk_list_box_get_selected_row (GtkListBox *box)
{
g_return_val_if_fail (GTK_IS_LIST_BOX (box), NULL);
- return BOX_PRIV (box)->selected_row;
+ return box->selected_row;
}
/**
@@ -727,7 +721,7 @@ gtk_list_box_get_row_at_index (GtkListBox *box,
g_return_val_if_fail (GTK_IS_LIST_BOX (box), NULL);
- iter = g_sequence_get_iter_at_pos (BOX_PRIV (box)->children, index_);
+ iter = g_sequence_get_iter_at_pos (box->children, index_);
if (!g_sequence_iter_is_end (iter))
return g_sequence_get (iter);
@@ -769,7 +763,7 @@ gtk_list_box_get_row_at_y (GtkListBox *box,
g_return_val_if_fail (GTK_IS_LIST_BOX (box), NULL);
- iter = g_sequence_lookup (BOX_PRIV (box)->children,
+ iter = g_sequence_lookup (box->children,
GINT_TO_POINTER (y),
row_y_cmp_func,
NULL);
@@ -836,10 +830,10 @@ gtk_list_box_select_all (GtkListBox *box)
{
g_return_if_fail (GTK_IS_LIST_BOX (box));
- if (BOX_PRIV (box)->selection_mode != GTK_SELECTION_MULTIPLE)
+ if (box->selection_mode != GTK_SELECTION_MULTIPLE)
return;
- if (g_sequence_get_length (BOX_PRIV (box)->children) > 0)
+ if (g_sequence_get_length (box->children) > 0)
{
gtk_list_box_select_all_between (box, NULL, NULL, FALSE);
g_signal_emit (box, signals[SELECTED_ROWS_CHANGED], 0);
@@ -859,7 +853,7 @@ gtk_list_box_unselect_all (GtkListBox *box)
g_return_if_fail (GTK_IS_LIST_BOX (box));
- if (BOX_PRIV (box)->selection_mode == GTK_SELECTION_BROWSE)
+ if (box->selection_mode == GTK_SELECTION_BROWSE)
return;
dirty = gtk_list_box_unselect_all_internal (box);
@@ -907,7 +901,7 @@ gtk_list_box_selected_foreach (GtkListBox *box,
g_return_if_fail (GTK_IS_LIST_BOX (box));
- for (iter = g_sequence_get_begin_iter (BOX_PRIV (box)->children);
+ for (iter = g_sequence_get_begin_iter (box->children);
!g_sequence_iter_is_end (iter);
iter = g_sequence_iter_next (iter))
{
@@ -936,7 +930,7 @@ gtk_list_box_get_selected_rows (GtkListBox *box)
g_return_val_if_fail (GTK_IS_LIST_BOX (box), NULL);
- for (iter = g_sequence_get_begin_iter (BOX_PRIV (box)->children);
+ for (iter = g_sequence_get_begin_iter (box->children);
!g_sequence_iter_is_end (iter);
iter = g_sequence_iter_next (iter))
{
@@ -960,23 +954,21 @@ void
gtk_list_box_set_placeholder (GtkListBox *box,
GtkWidget *placeholder)
{
- GtkListBoxPrivate *priv = BOX_PRIV (box);
-
g_return_if_fail (GTK_IS_LIST_BOX (box));
- if (priv->placeholder)
+ if (box->placeholder)
{
- gtk_widget_unparent (priv->placeholder);
+ gtk_widget_unparent (box->placeholder);
gtk_widget_queue_resize (GTK_WIDGET (box));
}
- priv->placeholder = placeholder;
+ box->placeholder = placeholder;
if (placeholder)
{
gtk_widget_set_parent (placeholder, GTK_WIDGET (box));
gtk_widget_set_child_visible (placeholder,
- priv->n_visible_rows == 0);
+ box->n_visible_rows == 0);
}
}
@@ -999,16 +991,14 @@ void
gtk_list_box_set_adjustment (GtkListBox *box,
GtkAdjustment *adjustment)
{
- GtkListBoxPrivate *priv = BOX_PRIV (box);
-
g_return_if_fail (GTK_IS_LIST_BOX (box));
g_return_if_fail (adjustment == NULL || GTK_IS_ADJUSTMENT (adjustment));
if (adjustment)
g_object_ref_sink (adjustment);
- if (priv->adjustment)
- g_object_unref (priv->adjustment);
- priv->adjustment = adjustment;
+ if (box->adjustment)
+ g_object_unref (box->adjustment);
+ box->adjustment = adjustment;
}
/**
@@ -1025,7 +1015,7 @@ gtk_list_box_get_adjustment (GtkListBox *box)
{
g_return_val_if_fail (GTK_IS_LIST_BOX (box), NULL);
- return BOX_PRIV (box)->adjustment;
+ return box->adjustment;
}
static void
@@ -1044,30 +1034,30 @@ gtk_list_box_parent_cb (GObject *object,
GParamSpec *pspec,
gpointer user_data)
{
- GtkListBoxPrivate *priv = BOX_PRIV (object);
+ GtkListBox *box = GTK_LIST_BOX (object);
GtkWidget *parent;
parent = gtk_widget_get_parent (GTK_WIDGET (object));
- if (priv->adjustment_changed_id != 0 &&
- priv->scrollable_parent != NULL)
+ if (box->adjustment_changed_id != 0 &&
+ box->scrollable_parent != NULL)
{
- g_signal_handler_disconnect (priv->scrollable_parent,
- priv->adjustment_changed_id);
+ g_signal_handler_disconnect (box->scrollable_parent,
+ box->adjustment_changed_id);
}
if (parent && GTK_IS_SCROLLABLE (parent))
{
adjustment_changed (G_OBJECT (parent), NULL, object);
- priv->scrollable_parent = parent;
- priv->adjustment_changed_id = g_signal_connect (parent, "notify::vadjustment",
+ box->scrollable_parent = parent;
+ box->adjustment_changed_id = g_signal_connect (parent, "notify::vadjustment",
G_CALLBACK (adjustment_changed), object);
}
else
{
gtk_list_box_set_adjustment (GTK_LIST_BOX (object), NULL);
- priv->adjustment_changed_id = 0;
- priv->scrollable_parent = NULL;
+ box->adjustment_changed_id = 0;
+ box->scrollable_parent = NULL;
}
}
@@ -1083,19 +1073,18 @@ void
gtk_list_box_set_selection_mode (GtkListBox *box,
GtkSelectionMode mode)
{
- GtkListBoxPrivate *priv = BOX_PRIV (box);
gboolean dirty = FALSE;
g_return_if_fail (GTK_IS_LIST_BOX (box));
- if (priv->selection_mode == mode)
+ if (box->selection_mode == mode)
return;
if (mode == GTK_SELECTION_NONE ||
- priv->selection_mode == GTK_SELECTION_MULTIPLE)
+ box->selection_mode == GTK_SELECTION_MULTIPLE)
dirty = gtk_list_box_unselect_all_internal (box);
- priv->selection_mode = mode;
+ box->selection_mode = mode;
gtk_list_box_update_row_styles (box);
@@ -1121,7 +1110,7 @@ gtk_list_box_get_selection_mode (GtkListBox *box)
{
g_return_val_if_fail (GTK_IS_LIST_BOX (box), GTK_SELECTION_NONE);
- return BOX_PRIV (box)->selection_mode;
+ return box->selection_mode;
}
/**
@@ -1148,16 +1137,14 @@ gtk_list_box_set_filter_func (GtkListBox *box,
gpointer user_data,
GDestroyNotify destroy)
{
- GtkListBoxPrivate *priv = BOX_PRIV (box);
-
g_return_if_fail (GTK_IS_LIST_BOX (box));
- if (priv->filter_func_target_destroy_notify != NULL)
- priv->filter_func_target_destroy_notify (priv->filter_func_target);
+ if (box->filter_func_target_destroy_notify != NULL)
+ box->filter_func_target_destroy_notify (box->filter_func_target);
- priv->filter_func = filter_func;
- priv->filter_func_target = user_data;
- priv->filter_func_target_destroy_notify = destroy;
+ box->filter_func = filter_func;
+ box->filter_func_target = user_data;
+ box->filter_func_target_destroy_notify = destroy;
gtk_list_box_check_model_compat (box);
@@ -1196,16 +1183,14 @@ gtk_list_box_set_header_func (GtkListBox *box,
gpointer user_data,
GDestroyNotify destroy)
{
- GtkListBoxPrivate *priv = BOX_PRIV (box);
-
g_return_if_fail (GTK_IS_LIST_BOX (box));
- if (priv->update_header_func_target_destroy_notify != NULL)
- priv->update_header_func_target_destroy_notify (priv->update_header_func_target);
+ if (box->update_header_func_target_destroy_notify != NULL)
+ box->update_header_func_target_destroy_notify (box->update_header_func_target);
- priv->update_header_func = update_header;
- priv->update_header_func_target = user_data;
- priv->update_header_func_target_destroy_notify = destroy;
+ box->update_header_func = update_header;
+ box->update_header_func_target = user_data;
+ box->update_header_func_target_destroy_notify = destroy;
gtk_list_box_invalidate_headers (box);
}
@@ -1234,9 +1219,7 @@ do_sort (GtkListBoxRow *a,
GtkListBoxRow *b,
GtkListBox *box)
{
- GtkListBoxPrivate *priv = BOX_PRIV (box);
-
- return priv->sort_func (a, b, priv->sort_func_target);
+ return box->sort_func (a, b, box->sort_func_target);
}
static void
@@ -1271,16 +1254,15 @@ gtk_list_box_css_node_foreach (gpointer data,
void
gtk_list_box_invalidate_sort (GtkListBox *box)
{
- GtkListBoxPrivate *priv = BOX_PRIV (box);
GtkWidget *previous = NULL;
g_return_if_fail (GTK_IS_LIST_BOX (box));
- if (priv->sort_func == NULL)
+ if (box->sort_func == NULL)
return;
- g_sequence_sort (priv->children, (GCompareDataFunc)do_sort, box);
- g_sequence_foreach (priv->children, gtk_list_box_css_node_foreach, &previous);
+ g_sequence_sort (box->children, (GCompareDataFunc)do_sort, box);
+ g_sequence_foreach (box->children, gtk_list_box_css_node_foreach, &previous);
gtk_list_box_invalidate_headers (box);
gtk_widget_queue_resize (GTK_WIDGET (box));
@@ -1291,7 +1273,7 @@ gtk_list_box_do_reseparate (GtkListBox *box)
{
GSequenceIter *iter;
- for (iter = g_sequence_get_begin_iter (BOX_PRIV (box)->children);
+ for (iter = g_sequence_get_begin_iter (box->children);
!g_sequence_iter_is_end (iter);
iter = g_sequence_iter_next (iter))
gtk_list_box_update_header (box, iter);
@@ -1342,16 +1324,14 @@ gtk_list_box_set_sort_func (GtkListBox *box,
gpointer user_data,
GDestroyNotify destroy)
{
- GtkListBoxPrivate *priv = BOX_PRIV (box);
-
g_return_if_fail (GTK_IS_LIST_BOX (box));
- if (priv->sort_func_target_destroy_notify != NULL)
- priv->sort_func_target_destroy_notify (priv->sort_func_target);
+ if (box->sort_func_target_destroy_notify != NULL)
+ box->sort_func_target_destroy_notify (box->sort_func_target);
- priv->sort_func = sort_func;
- priv->sort_func_target = user_data;
- priv->sort_func_target_destroy_notify = destroy;
+ box->sort_func = sort_func;
+ box->sort_func_target = user_data;
+ box->sort_func_target_destroy_notify = destroy;
gtk_list_box_check_model_compat (box);
@@ -1362,7 +1342,6 @@ static void
gtk_list_box_got_row_changed (GtkListBox *box,
GtkListBoxRow *row)
{
- GtkListBoxPrivate *priv = BOX_PRIV (box);
GtkListBoxRowPrivate *row_priv = ROW_PRIV (row);
GSequenceIter *prev_next, *next;
@@ -1370,7 +1349,7 @@ gtk_list_box_got_row_changed (GtkListBox *box,
g_return_if_fail (GTK_IS_LIST_BOX_ROW (row));
prev_next = gtk_list_box_get_next_visible (box, row_priv->iter);
- if (priv->sort_func != NULL)
+ if (box->sort_func != NULL)
{
g_sequence_sort_changed (row_priv->iter,
(GCompareDataFunc)do_sort,
@@ -1403,10 +1382,10 @@ gtk_list_box_set_activate_on_single_click (GtkListBox *box,
single = single != FALSE;
- if (BOX_PRIV (box)->activate_single_click == single)
+ if (box->activate_single_click == single)
return;
- BOX_PRIV (box)->activate_single_click = single;
+ box->activate_single_click = single;
g_object_notify_by_pspec (G_OBJECT (box), properties[PROP_ACTIVATE_ON_SINGLE_CLICK]);
}
@@ -1424,17 +1403,17 @@ gtk_list_box_get_activate_on_single_click (GtkListBox *box)
{
g_return_val_if_fail (GTK_IS_LIST_BOX (box), FALSE);
- return BOX_PRIV (box)->activate_single_click;
+ return box->activate_single_click;
}
void
gtk_list_box_set_accept_unpaired_release (GtkListBox *box,
gboolean accept)
{
- if (BOX_PRIV (box)->accept_unpaired_release == accept)
+ if (box->accept_unpaired_release == accept)
return;
- BOX_PRIV (box)->accept_unpaired_release = accept;
+ box->accept_unpaired_release = accept;
g_object_notify_by_pspec (G_OBJECT (box), properties[PROP_ACCEPT_UNPAIRED_RELEASE]);
}
@@ -1481,12 +1460,11 @@ static void
ensure_row_visible (GtkListBox *box,
GtkListBoxRow *row)
{
- GtkListBoxPrivate *priv = BOX_PRIV (box);
GtkWidget *header;
gint y, height;
graphene_rect_t rect;
- if (!priv->adjustment)
+ if (!box->adjustment)
return;
if (!gtk_widget_compute_bounds (GTK_WIDGET (row), GTK_WIDGET (box), &rect))
@@ -1506,7 +1484,7 @@ ensure_row_visible (GtkListBox *box,
}
}
- gtk_adjustment_clamp_page (priv->adjustment, y, y + height);
+ gtk_adjustment_clamp_page (box->adjustment, y, y + height);
}
static void
@@ -1514,7 +1492,7 @@ gtk_list_box_update_cursor (GtkListBox *box,
GtkListBoxRow *row,
gboolean grab_focus)
{
- BOX_PRIV (box)->cursor_row = row;
+ box->cursor_row = row;
ensure_row_visible (box, row);
if (grab_focus)
gtk_widget_grab_focus (GTK_WIDGET (row));
@@ -1570,10 +1548,10 @@ gtk_list_box_unselect_all_internal (GtkListBox *box)
GSequenceIter *iter;
gboolean dirty = FALSE;
- if (BOX_PRIV (box)->selection_mode == GTK_SELECTION_NONE)
+ if (box->selection_mode == GTK_SELECTION_NONE)
return FALSE;
- for (iter = g_sequence_get_begin_iter (BOX_PRIV (box)->children);
+ for (iter = g_sequence_get_begin_iter (box->children);
!g_sequence_iter_is_end (iter);
iter = g_sequence_iter_next (iter))
{
@@ -1581,7 +1559,7 @@ gtk_list_box_unselect_all_internal (GtkListBox *box)
dirty |= gtk_list_box_row_set_selected (row, FALSE);
}
- BOX_PRIV (box)->selected_row = NULL;
+ box->selected_row = NULL;
return dirty;
}
@@ -1593,9 +1571,9 @@ gtk_list_box_unselect_row_internal (GtkListBox *box,
if (!ROW_PRIV (row)->selected)
return;
- if (BOX_PRIV (box)->selection_mode == GTK_SELECTION_NONE)
+ if (box->selection_mode == GTK_SELECTION_NONE)
return;
- else if (BOX_PRIV (box)->selection_mode != GTK_SELECTION_MULTIPLE)
+ else if (box->selection_mode != GTK_SELECTION_MULTIPLE)
gtk_list_box_unselect_all_internal (box);
else
gtk_list_box_row_set_selected (row, FALSE);
@@ -1614,14 +1592,14 @@ gtk_list_box_select_row_internal (GtkListBox *box,
if (ROW_PRIV (row)->selected)
return;
- if (BOX_PRIV (box)->selection_mode == GTK_SELECTION_NONE)
+ if (box->selection_mode == GTK_SELECTION_NONE)
return;
- if (BOX_PRIV (box)->selection_mode != GTK_SELECTION_MULTIPLE)
+ if (box->selection_mode != GTK_SELECTION_MULTIPLE)
gtk_list_box_unselect_all_internal (box);
gtk_list_box_row_set_selected (row, TRUE);
- BOX_PRIV (box)->selected_row = row;
+ box->selected_row = row;
g_signal_emit (box, signals[ROW_SELECTED], 0, row);
g_signal_emit (box, signals[SELECTED_ROWS_CHANGED], 0);
@@ -1638,12 +1616,12 @@ gtk_list_box_select_all_between (GtkListBox *box,
if (row1)
iter1 = ROW_PRIV (row1)->iter;
else
- iter1 = g_sequence_get_begin_iter (BOX_PRIV (box)->children);
+ iter1 = g_sequence_get_begin_iter (box->children);
if (row2)
iter2 = ROW_PRIV (row2)->iter;
else
- iter2 = g_sequence_get_end_iter (BOX_PRIV (box)->children);
+ iter2 = g_sequence_get_end_iter (box->children);
if (g_sequence_iter_compare (iter2, iter1) < 0)
{
@@ -1681,32 +1659,30 @@ gtk_list_box_update_selection_full (GtkListBox *box,
gboolean extend,
gboolean grab_cursor)
{
- GtkListBoxPrivate *priv = BOX_PRIV (box);
-
gtk_list_box_update_cursor (box, row, grab_cursor);
- if (priv->selection_mode == GTK_SELECTION_NONE)
+ if (box->selection_mode == GTK_SELECTION_NONE)
return;
if (!ROW_PRIV (row)->selectable)
return;
- if (priv->selection_mode == GTK_SELECTION_BROWSE)
+ if (box->selection_mode == GTK_SELECTION_BROWSE)
{
gtk_list_box_unselect_all_internal (box);
gtk_list_box_row_set_selected (row, TRUE);
- priv->selected_row = row;
+ box->selected_row = row;
g_signal_emit (box, signals[ROW_SELECTED], 0, row);
}
- else if (priv->selection_mode == GTK_SELECTION_SINGLE)
+ else if (box->selection_mode == GTK_SELECTION_SINGLE)
{
gboolean was_selected;
was_selected = ROW_PRIV (row)->selected;
gtk_list_box_unselect_all_internal (box);
gtk_list_box_row_set_selected (row, modify ? !was_selected : TRUE);
- priv->selected_row = ROW_PRIV (row)->selected ? row : NULL;
- g_signal_emit (box, signals[ROW_SELECTED], 0, priv->selected_row);
+ box->selected_row = ROW_PRIV (row)->selected ? row : NULL;
+ g_signal_emit (box, signals[ROW_SELECTED], 0, box->selected_row);
}
else /* GTK_SELECTION_MULTIPLE */
{
@@ -1714,14 +1690,14 @@ gtk_list_box_update_selection_full (GtkListBox *box,
{
GtkListBoxRow *selected_row;
- selected_row = priv->selected_row;
+ selected_row = box->selected_row;
gtk_list_box_unselect_all_internal (box);
if (selected_row == NULL)
{
gtk_list_box_row_set_selected (row, TRUE);
- priv->selected_row = row;
+ box->selected_row = row;
g_signal_emit (box, signals[ROW_SELECTED], 0, row);
}
else
@@ -1739,7 +1715,7 @@ gtk_list_box_update_selection_full (GtkListBox *box,
{
gtk_list_box_unselect_all_internal (box);
gtk_list_box_row_set_selected (row, !ROW_PRIV (row)->selected);
- priv->selected_row = row;
+ box->selected_row = row;
g_signal_emit (box, signals[ROW_SELECTED], 0, row);
}
}
@@ -1752,13 +1728,11 @@ static void
gtk_list_box_activate (GtkListBox *box,
GtkListBoxRow *row)
{
- GtkListBoxRowPrivate *priv = ROW_PRIV (row);
-
if (!gtk_list_box_row_get_activatable (row))
return;
- if (priv->action_helper)
- gtk_action_helper_activate (priv->action_helper);
+ if (ROW_PRIV (row)->action_helper)
+ gtk_action_helper_activate (ROW_PRIV (row)->action_helper);
else
g_signal_emit (box, signals[ROW_ACTIVATED], 0, row);
}
@@ -1785,17 +1759,16 @@ gtk_list_box_click_gesture_pressed (GtkGestureClick *gesture,
gdouble y,
GtkListBox *box)
{
- GtkListBoxPrivate *priv = BOX_PRIV (box);
GtkListBoxRow *row;
- priv->active_row = NULL;
+ box->active_row = NULL;
row = gtk_list_box_get_row_at_y (box, y);
if (row != NULL && gtk_widget_is_sensitive (GTK_WIDGET (row)))
{
- priv->active_row = row;
+ box->active_row = row;
- if (n_press == 2 && !priv->activate_single_click)
+ if (n_press == 2 && !box->activate_single_click)
gtk_list_box_activate (box, row);
}
}
@@ -1830,10 +1803,9 @@ gtk_list_box_click_unpaired_release (GtkGestureClick *gesture,
GdkEventSequence *sequence,
GtkListBox *box)
{
- GtkListBoxPrivate *priv = BOX_PRIV (box);
GtkListBoxRow *row;
- if (!priv->activate_single_click || !priv->accept_unpaired_release)
+ if (!box->activate_single_click || !box->accept_unpaired_release)
return;
row = gtk_list_box_get_row_at_y (box, y);
@@ -1849,20 +1821,18 @@ gtk_list_box_click_gesture_released (GtkGestureClick *gesture,
gdouble y,
GtkListBox *box)
{
- GtkListBoxPrivate *priv = BOX_PRIV (box);
-
/* Take a ref to protect against reentrancy
* (the activation may destroy the widget)
*/
g_object_ref (box);
- if (priv->active_row != NULL &&
- priv->active_row == gtk_list_box_get_row_at_y (box, y))
+ if (box->active_row != NULL &&
+ box->active_row == gtk_list_box_get_row_at_y (box, y))
{
- gboolean focus_on_click = gtk_widget_get_focus_on_click (GTK_WIDGET (priv->active_row));
+ gboolean focus_on_click = gtk_widget_get_focus_on_click (GTK_WIDGET (box->active_row));
- if (n_press == 1 && priv->activate_single_click)
- gtk_list_box_select_and_activate_full (box, priv->active_row, focus_on_click);
+ if (n_press == 1 && box->activate_single_click)
+ gtk_list_box_select_and_activate_full (box, box->active_row, focus_on_click);
else
{
GdkEventSequence *sequence;
@@ -1883,13 +1853,13 @@ gtk_list_box_click_gesture_released (GtkGestureClick *gesture,
if (source == GDK_SOURCE_TOUCHSCREEN)
modify = !modify;
- gtk_list_box_update_selection_full (box, priv->active_row, modify, extend, focus_on_click);
+ gtk_list_box_update_selection_full (box, box->active_row, modify, extend, focus_on_click);
}
}
- if (priv->active_row)
+ if (box->active_row)
{
- priv->active_row = NULL;
+ box->active_row = NULL;
}
g_object_unref (box);
@@ -1899,11 +1869,9 @@ static void
gtk_list_box_click_gesture_stopped (GtkGestureClick *gesture,
GtkListBox *box)
{
- GtkListBoxPrivate *priv = BOX_PRIV (box);
-
- if (priv->active_row)
+ if (box->active_row)
{
- priv->active_row = NULL;
+ box->active_row = NULL;
gtk_widget_queue_draw (GTK_WIDGET (box));
}
}
@@ -1921,7 +1889,6 @@ gtk_list_box_focus (GtkWidget *widget,
GtkDirectionType direction)
{
GtkListBox *box = GTK_LIST_BOX (widget);
- GtkListBoxPrivate *priv = BOX_PRIV (box);
GtkWidget *focus_child;
GtkListBoxRow *next_focus_row;
GtkWidget *row;
@@ -1949,7 +1916,7 @@ gtk_list_box_focus (GtkWidget *widget,
if (GTK_IS_LIST_BOX_ROW (focus_child))
row = focus_child;
else
- row = g_hash_table_lookup (priv->header_hash, focus_child);
+ row = g_hash_table_lookup (box->header_hash, focus_child);
if (GTK_IS_LIST_BOX_ROW (row))
i = gtk_list_box_get_previous_visible (box, ROW_PRIV (GTK_LIST_BOX_ROW (row))->iter);
@@ -1973,7 +1940,7 @@ gtk_list_box_focus (GtkWidget *widget,
i = gtk_list_box_get_next_visible (box, ROW_PRIV (GTK_LIST_BOX_ROW (focus_child))->iter);
else
{
- row = g_hash_table_lookup (priv->header_hash, focus_child);
+ row = g_hash_table_lookup (box->header_hash, focus_child);
if (GTK_IS_LIST_BOX_ROW (row))
i = ROW_PRIV (GTK_LIST_BOX_ROW (row))->iter;
else
@@ -1999,7 +1966,7 @@ gtk_list_box_focus (GtkWidget *widget,
{
case GTK_DIR_UP:
case GTK_DIR_TAB_BACKWARD:
- next_focus_row = priv->selected_row;
+ next_focus_row = box->selected_row;
if (next_focus_row == NULL)
next_focus_row = gtk_list_box_get_last_focusable (box);
break;
@@ -2008,7 +1975,7 @@ gtk_list_box_focus (GtkWidget *widget,
case GTK_DIR_LEFT:
case GTK_DIR_RIGHT:
default:
- next_focus_row = priv->selected_row;
+ next_focus_row = box->selected_row;
if (next_focus_row == NULL)
next_focus_row = gtk_list_box_get_first_focusable (box);
break;
@@ -2043,16 +2010,15 @@ static void
list_box_add_visible_rows (GtkListBox *box,
gint n)
{
- GtkListBoxPrivate *priv = BOX_PRIV (box);
int was_zero;
- was_zero = priv->n_visible_rows == 0;
- priv->n_visible_rows += n;
+ was_zero = box->n_visible_rows == 0;
+ box->n_visible_rows += n;
- if (priv->placeholder &&
- (was_zero || priv->n_visible_rows == 0))
- gtk_widget_set_child_visible (GTK_WIDGET (priv->placeholder),
- priv->n_visible_rows == 0);
+ if (box->placeholder &&
+ (was_zero || box->n_visible_rows == 0))
+ gtk_widget_set_child_visible (GTK_WIDGET (box->placeholder),
+ box->n_visible_rows == 0);
}
/* Children are visible if they are shown by the app (visible)
@@ -2081,12 +2047,11 @@ static void
gtk_list_box_apply_filter (GtkListBox *box,
GtkListBoxRow *row)
{
- GtkListBoxPrivate *priv = BOX_PRIV (box);
gboolean do_show;
do_show = TRUE;
- if (priv->filter_func != NULL)
- do_show = priv->filter_func (row, priv->filter_func_target);
+ if (box->filter_func != NULL)
+ do_show = box->filter_func (row, box->filter_func_target);
gtk_widget_set_child_visible (GTK_WIDGET (row), do_show);
@@ -2099,7 +2064,7 @@ gtk_list_box_apply_filter_all (GtkListBox *box)
GtkListBoxRow *row;
GSequenceIter *iter;
- for (iter = g_sequence_get_begin_iter (BOX_PRIV (box)->children);
+ for (iter = g_sequence_get_begin_iter (box->children);
!g_sequence_iter_is_end (iter);
iter = g_sequence_iter_next (iter))
{
@@ -2114,7 +2079,7 @@ gtk_list_box_get_first_focusable (GtkListBox *box)
GtkListBoxRow *row;
GSequenceIter *iter;
- for (iter = g_sequence_get_begin_iter (BOX_PRIV (box)->children);
+ for (iter = g_sequence_get_begin_iter (box->children);
!g_sequence_iter_is_end (iter);
iter = g_sequence_iter_next (iter))
{
@@ -2132,7 +2097,7 @@ gtk_list_box_get_last_focusable (GtkListBox *box)
GtkListBoxRow *row;
GSequenceIter *iter;
- iter = g_sequence_get_end_iter (BOX_PRIV (box)->children);
+ iter = g_sequence_get_end_iter (box->children);
while (!g_sequence_iter_is_begin (iter))
{
iter = g_sequence_iter_prev (iter);
@@ -2214,7 +2179,6 @@ static void
gtk_list_box_update_header (GtkListBox *box,
GSequenceIter *iter)
{
- GtkListBoxPrivate *priv = BOX_PRIV (box);
GtkListBoxRow *row;
GSequenceIter *before_iter;
GtkListBoxRow *before_row;
@@ -2235,29 +2199,29 @@ gtk_list_box_update_header (GtkListBox *box,
g_object_ref (before_row);
}
- if (priv->update_header_func != NULL &&
+ if (box->update_header_func != NULL &&
row_is_visible (row))
{
old_header = ROW_PRIV (row)->header;
if (old_header)
g_object_ref (old_header);
- priv->update_header_func (row,
+ box->update_header_func (row,
before_row,
- priv->update_header_func_target);
+ box->update_header_func_target);
new_header = ROW_PRIV (row)->header;
if (old_header != new_header)
{
if (old_header != NULL &&
- g_hash_table_lookup (priv->header_hash, old_header) == row)
+ g_hash_table_lookup (box->header_hash, old_header) == row)
{
/* Only unparent the @old_header if it hasn’t been re-used as the
* header for a different row. */
gtk_widget_unparent (old_header);
- g_hash_table_remove (priv->header_hash, old_header);
+ g_hash_table_remove (box->header_hash, old_header);
}
if (new_header != NULL)
{
- g_hash_table_insert (priv->header_hash, new_header, row);
+ g_hash_table_insert (box->header_hash, new_header, row);
gtk_widget_unparent (new_header);
gtk_widget_set_parent (new_header, GTK_WIDGET (box));
gtk_widget_show (new_header);
@@ -2271,7 +2235,7 @@ gtk_list_box_update_header (GtkListBox *box,
{
if (ROW_PRIV (row)->header != NULL)
{
- g_hash_table_remove (priv->header_hash, ROW_PRIV (row)->header);
+ g_hash_table_remove (box->header_hash, ROW_PRIV (row)->header);
gtk_widget_unparent (ROW_PRIV (row)->header);
gtk_list_box_row_set_header (row, NULL);
gtk_widget_queue_resize (GTK_WIDGET (box));
@@ -2309,7 +2273,6 @@ gtk_list_box_remove (GtkContainer *container,
{
GtkWidget *widget = GTK_WIDGET (container);
GtkListBox *box = GTK_LIST_BOX (container);
- GtkListBoxPrivate *priv = BOX_PRIV (box);
gboolean was_visible;
gboolean was_selected;
GtkListBoxRow *row;
@@ -2318,10 +2281,10 @@ gtk_list_box_remove (GtkContainer *container,
was_visible = gtk_widget_get_visible (child);
- if (child == priv->placeholder)
+ if (child == box->placeholder)
{
gtk_widget_unparent (child);
- priv->placeholder = NULL;
+ box->placeholder = NULL;
if (was_visible && gtk_widget_get_visible (widget))
gtk_widget_queue_resize (widget);
@@ -2330,10 +2293,10 @@ gtk_list_box_remove (GtkContainer *container,
if (!GTK_IS_LIST_BOX_ROW (child))
{
- row = g_hash_table_lookup (priv->header_hash, child);
+ row = g_hash_table_lookup (box->header_hash, child);
if (row != NULL)
{
- g_hash_table_remove (priv->header_hash, child);
+ g_hash_table_remove (box->header_hash, child);
g_clear_object (&ROW_PRIV (row)->header);
gtk_widget_unparent (child);
if (was_visible && gtk_widget_get_visible (widget))
@@ -2348,7 +2311,7 @@ gtk_list_box_remove (GtkContainer *container,
row = GTK_LIST_BOX_ROW (child);
iter = ROW_PRIV (row)->iter;
- if (g_sequence_iter_get_sequence (iter) != priv->children)
+ if (g_sequence_iter_get_sequence (iter) != box->children)
{
g_warning ("Tried to remove non-child %p", child);
return;
@@ -2361,19 +2324,19 @@ gtk_list_box_remove (GtkContainer *container,
if (ROW_PRIV (row)->header != NULL)
{
- g_hash_table_remove (priv->header_hash, ROW_PRIV (row)->header);
+ g_hash_table_remove (box->header_hash, ROW_PRIV (row)->header);
gtk_widget_unparent (ROW_PRIV (row)->header);
g_clear_object (&ROW_PRIV (row)->header);
}
- if (row == priv->selected_row)
- priv->selected_row = NULL;
- if (row == priv->cursor_row)
- priv->cursor_row = NULL;
- if (row == priv->active_row)
- priv->active_row = NULL;
+ if (row == box->selected_row)
+ box->selected_row = NULL;
+ if (row == box->cursor_row)
+ box->cursor_row = NULL;
+ if (row == box->active_row)
+ box->active_row = NULL;
- if (row == priv->drag_highlighted_row)
+ if (row == box->drag_highlighted_row)
gtk_list_box_drag_unhighlight_row (box);
next = gtk_list_box_get_next_visible (box, iter);
@@ -2403,14 +2366,14 @@ gtk_list_box_forall (GtkContainer *container,
GtkCallback callback,
gpointer callback_target)
{
- GtkListBoxPrivate *priv = BOX_PRIV (container);
+ GtkListBox *box = GTK_LIST_BOX (container);
GSequenceIter *iter;
GtkListBoxRow *row;
- if (priv->placeholder != NULL)
- callback (priv->placeholder, callback_target);
+ if (box->placeholder != NULL)
+ callback (box->placeholder, callback_target);
- iter = g_sequence_get_begin_iter (priv->children);
+ iter = g_sequence_get_begin_iter (box->children);
while (!g_sequence_iter_is_end (iter))
{
row = g_sequence_get (iter);
@@ -2457,7 +2420,7 @@ gtk_list_box_measure (GtkWidget *widget,
int *minimum_baseline,
int *natural_baseline)
{
- GtkListBoxPrivate *priv = BOX_PRIV (widget);
+ GtkListBox *box = GTK_LIST_BOX (widget);
GSequenceIter *iter;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
@@ -2465,12 +2428,12 @@ gtk_list_box_measure (GtkWidget *widget,
*minimum = 0;
*natural = 0;
- if (priv->placeholder && gtk_widget_get_child_visible (priv->placeholder))
- gtk_widget_measure (priv->placeholder, GTK_ORIENTATION_HORIZONTAL, -1,
+ if (box->placeholder && gtk_widget_get_child_visible (box->placeholder))
+ gtk_widget_measure (box->placeholder, GTK_ORIENTATION_HORIZONTAL, -1,
minimum, natural,
NULL, NULL);
- for (iter = g_sequence_get_begin_iter (priv->children);
+ for (iter = g_sequence_get_begin_iter (box->children);
!g_sequence_iter_is_end (iter);
iter = g_sequence_iter_next (iter))
{
@@ -2514,12 +2477,12 @@ gtk_list_box_measure (GtkWidget *widget,
*minimum = 0;
- if (priv->placeholder && gtk_widget_get_child_visible (priv->placeholder))
- gtk_widget_measure (priv->placeholder, orientation, for_size,
+ if (box->placeholder && gtk_widget_get_child_visible (box->placeholder))
+ gtk_widget_measure (box->placeholder, orientation, for_size,
minimum, NULL,
NULL, NULL);
- for (iter = g_sequence_get_begin_iter (priv->children);
+ for (iter = g_sequence_get_begin_iter (box->children);
!g_sequence_iter_is_end (iter);
iter = g_sequence_iter_next (iter))
{
@@ -2557,7 +2520,7 @@ gtk_list_box_size_allocate (GtkWidget *widget,
int height,
int baseline)
{
- GtkListBoxPrivate *priv = BOX_PRIV (widget);
+ GtkListBox *box = GTK_LIST_BOX (widget);
GtkAllocation child_allocation;
GtkAllocation header_allocation;
GtkListBoxRow *row;
@@ -2575,18 +2538,18 @@ gtk_list_box_size_allocate (GtkWidget *widget,
header_allocation.width = width;
header_allocation.height = 0;
- if (priv->placeholder && gtk_widget_get_child_visible (priv->placeholder))
+ if (box->placeholder && gtk_widget_get_child_visible (box->placeholder))
{
- gtk_widget_measure (priv->placeholder, GTK_ORIENTATION_VERTICAL,
+ gtk_widget_measure (box->placeholder, GTK_ORIENTATION_VERTICAL,
width,
&child_min, NULL, NULL, NULL);
header_allocation.height = height;
header_allocation.y = child_allocation.y;
- gtk_widget_size_allocate (priv->placeholder, &header_allocation, -1);
+ gtk_widget_size_allocate (box->placeholder, &header_allocation, -1);
child_allocation.y += child_min;
}
- for (iter = g_sequence_get_begin_iter (priv->children);
+ for (iter = g_sequence_get_begin_iter (box->children);
!g_sequence_iter_is_end (iter);
iter = g_sequence_iter_next (iter))
{
@@ -2658,7 +2621,6 @@ gtk_list_box_insert (GtkListBox *box,
GtkWidget *child,
gint position)
{
- GtkListBoxPrivate *priv = BOX_PRIV (box);
GtkListBoxRow *row;
GSequenceIter *prev = NULL;
GSequenceIter *iter = NULL;
@@ -2674,18 +2636,18 @@ gtk_list_box_insert (GtkListBox *box,
gtk_container_add (GTK_CONTAINER (row), child);
}
- if (priv->sort_func != NULL)
- iter = g_sequence_insert_sorted (priv->children, row,
+ if (box->sort_func != NULL)
+ iter = g_sequence_insert_sorted (box->children, row,
(GCompareDataFunc)do_sort, box);
else if (position == 0)
- iter = g_sequence_prepend (priv->children, row);
+ iter = g_sequence_prepend (box->children, row);
else if (position == -1)
- iter = g_sequence_append (priv->children, row);
+ iter = g_sequence_append (box->children, row);
else
{
GSequenceIter *current_iter;
- current_iter = g_sequence_get_iter_at_pos (priv->children, position);
+ current_iter = g_sequence_get_iter_at_pos (box->children, position);
iter = g_sequence_insert_before (current_iter, row);
}
@@ -2718,15 +2680,13 @@ gtk_list_box_insert (GtkListBox *box,
void
gtk_list_box_drag_unhighlight_row (GtkListBox *box)
{
- GtkListBoxPrivate *priv = BOX_PRIV (box);
-
g_return_if_fail (GTK_IS_LIST_BOX (box));
- if (priv->drag_highlighted_row == NULL)
+ if (box->drag_highlighted_row == NULL)
return;
- gtk_widget_unset_state_flags (GTK_WIDGET (priv->drag_highlighted_row), GTK_STATE_FLAG_DROP_ACTIVE);
- g_clear_object (&priv->drag_highlighted_row);
+ gtk_widget_unset_state_flags (GTK_WIDGET (box->drag_highlighted_row), GTK_STATE_FLAG_DROP_ACTIVE);
+ g_clear_object (&box->drag_highlighted_row);
}
/**
@@ -2745,39 +2705,35 @@ void
gtk_list_box_drag_highlight_row (GtkListBox *box,
GtkListBoxRow *row)
{
- GtkListBoxPrivate *priv = BOX_PRIV (box);
-
g_return_if_fail (GTK_IS_LIST_BOX (box));
g_return_if_fail (GTK_IS_LIST_BOX_ROW (row));
- if (priv->drag_highlighted_row == row)
+ if (box->drag_highlighted_row == row)
return;
gtk_list_box_drag_unhighlight_row (box);
gtk_widget_set_state_flags (GTK_WIDGET (row), GTK_STATE_FLAG_DROP_ACTIVE, FALSE);
- priv->drag_highlighted_row = g_object_ref (row);
+ box->drag_highlighted_row = g_object_ref (row);
}
static void
gtk_list_box_activate_cursor_row (GtkListBox *box)
{
- gtk_list_box_select_and_activate (box, BOX_PRIV (box)->cursor_row);
+ gtk_list_box_select_and_activate (box, box->cursor_row);
}
static void
gtk_list_box_toggle_cursor_row (GtkListBox *box)
{
- GtkListBoxPrivate *priv = BOX_PRIV (box);
-
- if (priv->cursor_row == NULL)
+ if (box->cursor_row == NULL)
return;
- if ((priv->selection_mode == GTK_SELECTION_SINGLE ||
- priv->selection_mode == GTK_SELECTION_MULTIPLE) &&
- ROW_PRIV (priv->cursor_row)->selected)
- gtk_list_box_unselect_row_internal (box, priv->cursor_row);
+ if ((box->selection_mode == GTK_SELECTION_SINGLE ||
+ box->selection_mode == GTK_SELECTION_MULTIPLE) &&
+ ROW_PRIV (box->cursor_row)->selected)
+ gtk_list_box_unselect_row_internal (box, box->cursor_row);
else
- gtk_list_box_select_and_activate (box, priv->cursor_row);
+ gtk_list_box_select_and_activate (box, box->cursor_row);
}
static void
@@ -2785,7 +2741,6 @@ gtk_list_box_move_cursor (GtkListBox *box,
GtkMovementStep step,
gint count)
{
- GtkListBoxPrivate *priv = BOX_PRIV (box);
gboolean modify;
gboolean extend;
GtkListBoxRow *row;
@@ -2805,11 +2760,11 @@ gtk_list_box_move_cursor (GtkListBox *box,
row = gtk_list_box_get_last_focusable (box);
break;
case GTK_MOVEMENT_DISPLAY_LINES:
- if (priv->cursor_row != NULL)
+ if (box->cursor_row != NULL)
{
gint i = count;
- iter = ROW_PRIV (priv->cursor_row)->iter;
+ iter = ROW_PRIV (box->cursor_row)->iter;
while (i < 0 && iter != NULL)
{
@@ -2828,12 +2783,12 @@ gtk_list_box_move_cursor (GtkListBox *box,
break;
case GTK_MOVEMENT_PAGES:
page_size = 100;
- if (priv->adjustment != NULL)
- page_size = gtk_adjustment_get_page_increment (priv->adjustment);
+ if (box->adjustment != NULL)
+ page_size = gtk_adjustment_get_page_increment (box->adjustment);
- if (priv->cursor_row != NULL)
+ if (box->cursor_row != NULL)
{
- start_y = ROW_PRIV (priv->cursor_row)->y;
+ start_y = ROW_PRIV (box->cursor_row)->y;
height = gtk_widget_get_height (GTK_WIDGET (box));
end_y = CLAMP (start_y + page_size * count, 0, height - 1);
row = gtk_list_box_get_row_at_y (box, end_y);
@@ -2845,7 +2800,7 @@ gtk_list_box_move_cursor (GtkListBox *box,
if (count > 0)
{
- cursor_iter = ROW_PRIV (priv->cursor_row)->iter;
+ cursor_iter = ROW_PRIV (box->cursor_row)->iter;
next_iter = gtk_list_box_get_last_visible (box, cursor_iter);
if (next_iter)
@@ -2860,7 +2815,7 @@ gtk_list_box_move_cursor (GtkListBox *box,
end_y = ROW_PRIV (row)->y;
}
}
- else if (row == priv->cursor_row)
+ else if (row == box->cursor_row)
{
iter = ROW_PRIV (row)->iter;
@@ -2878,15 +2833,15 @@ gtk_list_box_move_cursor (GtkListBox *box,
}
}
- if (end_y != start_y && priv->adjustment != NULL)
- gtk_adjustment_animate_to_value (priv->adjustment, end_y);
+ if (end_y != start_y && box->adjustment != NULL)
+ gtk_adjustment_animate_to_value (box->adjustment, end_y);
}
break;
default:
return;
}
- if (row == NULL || row == priv->cursor_row)
+ if (row == NULL || row == box->cursor_row)
{
GtkDirectionType direction = count < 0 ? GTK_DIR_UP : GTK_DIR_DOWN;
@@ -3097,13 +3052,11 @@ void
gtk_list_box_row_set_header (GtkListBoxRow *row,
GtkWidget *header)
{
- GtkListBoxRowPrivate *priv;
+ GtkListBoxRowPrivate *priv = ROW_PRIV (row);
g_return_if_fail (GTK_IS_LIST_BOX_ROW (row));
g_return_if_fail (header == NULL || GTK_IS_WIDGET (header));
- priv = ROW_PRIV (row);
-
if (priv->header)
g_object_unref (priv->header);
@@ -3124,12 +3077,10 @@ gtk_list_box_row_set_header (GtkListBoxRow *row,
gint
gtk_list_box_row_get_index (GtkListBoxRow *row)
{
- GtkListBoxRowPrivate *priv;
+ GtkListBoxRowPrivate *priv = ROW_PRIV (row);
g_return_val_if_fail (GTK_IS_LIST_BOX_ROW (row), -1);
- priv = ROW_PRIV (row);
-
if (priv->iter != NULL)
return g_sequence_iter_get_position (priv->iter);
@@ -3159,7 +3110,7 @@ gtk_list_box_update_row_style (GtkListBox *box,
{
gboolean can_select;
- if (box && BOX_PRIV (box)->selection_mode != GTK_SELECTION_NONE)
+ if (box && box->selection_mode != GTK_SELECTION_NONE)
can_select = TRUE;
else
can_select = FALSE;
@@ -3177,7 +3128,7 @@ gtk_list_box_update_row_styles (GtkListBox *box)
GSequenceIter *iter;
GtkListBoxRow *row;
- for (iter = g_sequence_get_begin_iter (BOX_PRIV (box)->children);
+ for (iter = g_sequence_get_begin_iter (box->children);
!g_sequence_iter_is_end (iter);
iter = g_sequence_iter_next (iter))
{
@@ -3408,7 +3359,7 @@ gtk_list_box_row_grab_focus (GtkWidget *widget)
if (!GTK_WIDGET_CLASS (gtk_list_box_row_parent_class)->grab_focus (widget))
return FALSE;
- if (BOX_PRIV (box)->cursor_row != row)
+ if (box->cursor_row != row)
gtk_list_box_update_cursor (box, row, FALSE);
return TRUE;
@@ -3525,7 +3476,6 @@ gtk_list_box_bound_model_changed (GListModel *list,
gpointer user_data)
{
GtkListBox *box = user_data;
- GtkListBoxPrivate *priv = BOX_PRIV (user_data);
guint i;
while (removed--)
@@ -3542,7 +3492,7 @@ gtk_list_box_bound_model_changed (GListModel *list,
GtkWidget *widget;
item = g_list_model_get_item (list, position + i);
- widget = priv->create_widget_func (item, priv->create_widget_func_data);
+ widget = box->create_widget_func (item, box->create_widget_func_data);
/* We allow the create_widget_func to either return a full
* reference or a floating reference. If we got the floating
@@ -3565,10 +3515,8 @@ gtk_list_box_bound_model_changed (GListModel *list,
static void
gtk_list_box_check_model_compat (GtkListBox *box)
{
- GtkListBoxPrivate *priv = BOX_PRIV (box);
-
- if (priv->bound_model &&
- (priv->sort_func || priv->filter_func))
+ if (box->bound_model &&
+ (box->sort_func || box->filter_func))
g_warning ("GtkListBox with a model will ignore sort and filter functions");
}
@@ -3605,23 +3553,22 @@ gtk_list_box_bind_model (GtkListBox *box,
gpointer user_data,
GDestroyNotify user_data_free_func)
{
- GtkListBoxPrivate *priv = BOX_PRIV (box);
GSequenceIter *iter;
g_return_if_fail (GTK_IS_LIST_BOX (box));
g_return_if_fail (model == NULL || G_IS_LIST_MODEL (model));
g_return_if_fail (model == NULL || create_widget_func != NULL);
- if (priv->bound_model)
+ if (box->bound_model)
{
- if (priv->create_widget_func_data_destroy)
- priv->create_widget_func_data_destroy (priv->create_widget_func_data);
+ if (box->create_widget_func_data_destroy)
+ box->create_widget_func_data_destroy (box->create_widget_func_data);
- g_signal_handlers_disconnect_by_func (priv->bound_model, gtk_list_box_bound_model_changed, box);
- g_clear_object (&priv->bound_model);
+ g_signal_handlers_disconnect_by_func (box->bound_model, gtk_list_box_bound_model_changed, box);
+ g_clear_object (&box->bound_model);
}
- iter = g_sequence_get_begin_iter (priv->children);
+ iter = g_sequence_get_begin_iter (box->children);
while (!g_sequence_iter_is_end (iter))
{
GtkWidget *row = g_sequence_get (iter);
@@ -3633,14 +3580,14 @@ gtk_list_box_bind_model (GtkListBox *box,
if (model == NULL)
return;
- priv->bound_model = g_object_ref (model);
- priv->create_widget_func = create_widget_func;
- priv->create_widget_func_data = user_data;
- priv->create_widget_func_data_destroy = user_data_free_func;
+ box->bound_model = g_object_ref (model);
+ box->create_widget_func = create_widget_func;
+ box->create_widget_func_data = user_data;
+ box->create_widget_func_data_destroy = user_data_free_func;
gtk_list_box_check_model_compat (box);
- g_signal_connect (priv->bound_model, "items-changed", G_CALLBACK (gtk_list_box_bound_model_changed), box);
+ g_signal_connect (box->bound_model, "items-changed", G_CALLBACK (gtk_list_box_bound_model_changed), box);
gtk_list_box_bound_model_changed (model, 0, 0, g_list_model_get_n_items (model), box);
}
@@ -3656,14 +3603,12 @@ void
gtk_list_box_set_show_separators (GtkListBox *box,
gboolean show_separators)
{
- GtkListBoxPrivate *priv = BOX_PRIV (box);
-
g_return_if_fail (GTK_IS_LIST_BOX (box));
- if (priv->show_separators == show_separators)
+ if (box->show_separators == show_separators)
return;
- priv->show_separators = show_separators;
+ box->show_separators = show_separators;
if (show_separators)
gtk_widget_add_css_class (GTK_WIDGET (box), "separators");
@@ -3685,9 +3630,7 @@ gtk_list_box_set_show_separators (GtkListBox *box,
gboolean
gtk_list_box_get_show_separators (GtkListBox *box)
{
- GtkListBoxPrivate *priv = BOX_PRIV (box);
-
g_return_val_if_fail (GTK_IS_LIST_BOX (box), FALSE);
- return priv->show_separators;
+ return box->show_separators;
}
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index a625013109..3dd45e6535 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -176,16 +176,8 @@ enum {
#define GTK_NOTEBOOK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_NOTEBOOK, GtkNotebookClass))
#define GTK_NOTEBOOK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_NOTEBOOK, GtkNotebookClass))
-typedef struct _GtkNotebookPrivate GtkNotebookPrivate;
typedef struct _GtkNotebookClass GtkNotebookClass;
-struct _GtkNotebook
-{
- GtkContainer container;
-
- GtkNotebookPrivate *priv;
-};
-
struct _GtkNotebookClass
{
GtkContainerClass parent_class;
@@ -229,8 +221,10 @@ struct _GtkNotebookClass
guint page_num);
};
-struct _GtkNotebookPrivate
+struct _GtkNotebook
{
+ GtkContainer container;
+
GtkNotebookDragOperation operation;
GtkNotebookPage *cur_page;
GtkNotebookPage *detached_tab;
@@ -535,7 +529,7 @@ gtk_notebook_page_get_property (GObject *object,
notebook = GTK_NOTEBOOK (g_object_get_data (G_OBJECT (page->tab_widget), "notebook"));
if (notebook)
- g_value_set_int (value, g_list_index (notebook->priv->children, page));
+ g_value_set_int (value, g_list_index (notebook->children, page));
}
break;
@@ -682,10 +676,9 @@ gtk_notebook_root_content_write_mime_type_async (GdkContentProvider *provide
gpointer user_data)
{
GtkNotebookRootContent *self = GTK_NOTEBOOK_ROOT_CONTENT (provider);
- GtkNotebookPrivate *priv = self->notebook->priv;
GTask *task;
- priv->rootwindow_drop = TRUE;
+ self->notebook->rootwindow_drop = TRUE;
task = g_task_new (self, cancellable, callback, user_data);
g_task_set_priority (task, io_priority);
@@ -931,7 +924,6 @@ static void gtk_notebook_gesture_released (GtkGestureClick *gesture,
static guint notebook_signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE_WITH_CODE (GtkNotebook, gtk_notebook, GTK_TYPE_CONTAINER,
- G_ADD_PRIVATE (GtkNotebook)
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
gtk_notebook_buildable_init))
@@ -1007,7 +999,6 @@ gtk_notebook_compute_expand (GtkWidget *widget,
gboolean *vexpand_p)
{
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
- GtkNotebookPrivate *priv = notebook->priv;
gboolean hexpand;
gboolean vexpand;
GList *list;
@@ -1016,7 +1007,7 @@ gtk_notebook_compute_expand (GtkWidget *widget,
hexpand = FALSE;
vexpand = FALSE;
- for (list = priv->children; list; list = list->next)
+ for (list = notebook->children; list; list = list->next)
{
page = list->data;
@@ -1391,7 +1382,6 @@ gtk_notebook_class_init (GtkNotebookClass *class)
static void
gtk_notebook_init (GtkNotebook *notebook)
{
- GtkNotebookPrivate *priv;
GtkEventController *controller;
GtkGesture *gesture;
GtkLayoutManager *layout;
@@ -1399,56 +1389,53 @@ gtk_notebook_init (GtkNotebook *notebook)
gtk_widget_set_can_focus (GTK_WIDGET (notebook), TRUE);
- notebook->priv = gtk_notebook_get_instance_private (notebook);
- priv = notebook->priv;
-
- priv->cur_page = NULL;
- priv->children = NULL;
- priv->first_tab = NULL;
- priv->focus_tab = NULL;
- priv->menu = NULL;
-
- priv->show_tabs = TRUE;
- priv->show_border = TRUE;
- priv->tab_pos = GTK_POS_TOP;
- priv->scrollable = FALSE;
- priv->click_child = ARROW_NONE;
- priv->need_timer = 0;
- priv->child_has_focus = FALSE;
- priv->focus_out = FALSE;
-
- priv->group = 0;
- priv->pressed_button = 0;
- priv->dnd_timer = 0;
- priv->operation = DRAG_OPERATION_NONE;
- priv->detached_tab = NULL;
- priv->has_scrolled = FALSE;
-
- priv->header_widget = g_object_new (GTK_TYPE_BOX,
+ notebook->cur_page = NULL;
+ notebook->children = NULL;
+ notebook->first_tab = NULL;
+ notebook->focus_tab = NULL;
+ notebook->menu = NULL;
+
+ notebook->show_tabs = TRUE;
+ notebook->show_border = TRUE;
+ notebook->tab_pos = GTK_POS_TOP;
+ notebook->scrollable = FALSE;
+ notebook->click_child = ARROW_NONE;
+ notebook->need_timer = 0;
+ notebook->child_has_focus = FALSE;
+ notebook->focus_out = FALSE;
+
+ notebook->group = 0;
+ notebook->pressed_button = 0;
+ notebook->dnd_timer = 0;
+ notebook->operation = DRAG_OPERATION_NONE;
+ notebook->detached_tab = NULL;
+ notebook->has_scrolled = FALSE;
+
+ notebook->header_widget = g_object_new (GTK_TYPE_BOX,
"css-name", "header",
NULL);
- gtk_widget_add_css_class (priv->header_widget, GTK_STYLE_CLASS_TOP);
- gtk_widget_hide (priv->header_widget);
- gtk_widget_set_parent (priv->header_widget, GTK_WIDGET (notebook));
+ gtk_widget_add_css_class (notebook->header_widget, GTK_STYLE_CLASS_TOP);
+ gtk_widget_hide (notebook->header_widget);
+ gtk_widget_set_parent (notebook->header_widget, GTK_WIDGET (notebook));
- priv->tabs_widget = gtk_gizmo_new ("tabs",
+ notebook->tabs_widget = gtk_gizmo_new ("tabs",
gtk_notebook_measure_tabs,
gtk_notebook_allocate_tabs,
gtk_notebook_snapshot_tabs,
NULL);
- gtk_widget_set_hexpand (priv->tabs_widget, TRUE);
- gtk_container_add (GTK_CONTAINER (priv->header_widget), priv->tabs_widget);
+ gtk_widget_set_hexpand (notebook->tabs_widget, TRUE);
+ gtk_container_add (GTK_CONTAINER (notebook->header_widget), notebook->tabs_widget);
- priv->stack_widget = gtk_stack_new ();
- gtk_widget_set_hexpand (priv->stack_widget, TRUE);
- gtk_widget_set_vexpand (priv->stack_widget, TRUE);
- gtk_widget_set_parent (priv->stack_widget, GTK_WIDGET (notebook));
+ notebook->stack_widget = gtk_stack_new ();
+ gtk_widget_set_hexpand (notebook->stack_widget, TRUE);
+ gtk_widget_set_vexpand (notebook->stack_widget, TRUE);
+ gtk_widget_set_parent (notebook->stack_widget, GTK_WIDGET (notebook));
dest = gtk_drop_target_new (GTK_TYPE_NOTEBOOK_PAGE, GDK_ACTION_MOVE);
gtk_drop_target_set_preload (dest, TRUE);
g_signal_connect (dest, "motion", G_CALLBACK (gtk_notebook_drag_motion), notebook);
g_signal_connect (dest, "drop", G_CALLBACK (gtk_notebook_drag_drop), notebook);
- gtk_widget_add_controller (GTK_WIDGET (priv->tabs_widget), GTK_EVENT_CONTROLLER (dest));
+ gtk_widget_add_controller (GTK_WIDGET (notebook->tabs_widget), GTK_EVENT_CONTROLLER (dest));
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
@@ -1526,19 +1513,15 @@ gtk_notebook_buildable_add_child (GtkBuildable *buildable,
static gboolean
gtk_notebook_has_current_page (GtkNotebook *notebook)
{
- GtkNotebookPrivate *priv = notebook->priv;
-
- return priv->cur_page &&
- gtk_widget_get_visible (priv->cur_page->child);
+ return notebook->cur_page &&
+ gtk_widget_get_visible (notebook->cur_page->child);
}
static gboolean
gtk_notebook_select_page (GtkNotebook *notebook,
gboolean move_focus)
{
- GtkNotebookPrivate *priv = notebook->priv;
-
- if (gtk_widget_is_focus (GTK_WIDGET (notebook)) && priv->show_tabs)
+ if (gtk_widget_is_focus (GTK_WIDGET (notebook)) && notebook->show_tabs)
{
gtk_notebook_page_select (notebook, move_focus);
return TRUE;
@@ -1551,10 +1534,9 @@ static gboolean
gtk_notebook_focus_tab (GtkNotebook *notebook,
GtkNotebookTab type)
{
- GtkNotebookPrivate *priv = notebook->priv;
GList *list;
- if (gtk_widget_is_focus (GTK_WIDGET (notebook)) && priv->show_tabs)
+ if (gtk_widget_is_focus (GTK_WIDGET (notebook)) && notebook->show_tabs)
{
switch (type)
{
@@ -1583,14 +1565,13 @@ static gboolean
gtk_notebook_change_current_page (GtkNotebook *notebook,
gint offset)
{
- GtkNotebookPrivate *priv = notebook->priv;
GList *current = NULL;
- if (!priv->show_tabs)
+ if (!notebook->show_tabs)
return FALSE;
- if (priv->cur_page)
- current = g_list_find (priv->children, priv->cur_page);
+ if (notebook->cur_page)
+ current = g_list_find (notebook->children, notebook->cur_page);
while (offset != 0)
{
@@ -1620,8 +1601,6 @@ static GtkDirectionType
get_effective_direction (GtkNotebook *notebook,
GtkDirectionType direction)
{
- GtkNotebookPrivate *priv = notebook->priv;
-
/* Remap the directions into the effective direction it would be for a
* GTK_POS_TOP notebook
*/
@@ -1643,17 +1622,15 @@ get_effective_direction (GtkNotebook *notebook,
int text_dir = gtk_widget_get_direction (GTK_WIDGET (notebook)) == GTK_TEXT_DIR_RTL ? 1 : 0;
- return translate_direction[text_dir][priv->tab_pos][direction];
+ return translate_direction[text_dir][notebook->tab_pos][direction];
}
static GtkPositionType
get_effective_tab_pos (GtkNotebook *notebook)
{
- GtkNotebookPrivate *priv = notebook->priv;
-
if (gtk_widget_get_direction (GTK_WIDGET (notebook)) == GTK_TEXT_DIR_RTL)
{
- switch (priv->tab_pos)
+ switch (notebook->tab_pos)
{
case GTK_POS_LEFT:
return GTK_POS_RIGHT;
@@ -1663,14 +1640,13 @@ get_effective_tab_pos (GtkNotebook *notebook)
}
}
- return priv->tab_pos;
+ return notebook->tab_pos;
}
static void
gtk_notebook_move_focus_out (GtkNotebook *notebook,
GtkDirectionType direction_type)
{
- GtkNotebookPrivate *priv = notebook->priv;
GtkDirectionType effective_direction = get_effective_direction (notebook, direction_type);
GtkWidget *toplevel;
@@ -1690,9 +1666,9 @@ gtk_notebook_move_focus_out (GtkNotebook *notebook,
g_object_ref (notebook);
- priv->focus_out = TRUE;
+ notebook->focus_out = TRUE;
g_signal_emit_by_name (toplevel, "move-focus", direction_type);
- priv->focus_out = FALSE;
+ notebook->focus_out = FALSE;
g_object_unref (notebook);
}
@@ -1700,28 +1676,27 @@ gtk_notebook_move_focus_out (GtkNotebook *notebook,
static gint
reorder_tab (GtkNotebook *notebook, GList *position, GList *tab)
{
- GtkNotebookPrivate *priv = notebook->priv;
GList *elem;
if (position == tab)
- return g_list_position (priv->children, tab);
+ return g_list_position (notebook->children, tab);
/* check that we aren't inserting the tab in the
* same relative position, taking packing into account */
- elem = (position) ? position->prev : g_list_last (priv->children);
+ elem = (position) ? position->prev : g_list_last (notebook->children);
if (elem == tab)
- return g_list_position (priv->children, tab);
+ return g_list_position (notebook->children, tab);
/* now actually reorder the tab */
- if (priv->first_tab == tab)
- priv->first_tab = gtk_notebook_search_page (notebook, priv->first_tab,
+ if (notebook->first_tab == tab)
+ notebook->first_tab = gtk_notebook_search_page (notebook, notebook->first_tab,
STEP_NEXT, TRUE);
- priv->children = g_list_remove_link (priv->children, tab);
+ notebook->children = g_list_remove_link (notebook->children, tab);
if (!position)
- elem = g_list_last (priv->children);
+ elem = g_list_last (notebook->children);
else
{
elem = position->prev;
@@ -1731,12 +1706,12 @@ reorder_tab (GtkNotebook *notebook, GList *position, GList *tab)
if (elem)
elem->next = tab;
else
- priv->children = tab;
+ notebook->children = tab;
tab->prev = elem;
tab->next = position;
- return g_list_position (priv->children, tab);
+ return g_list_position (notebook->children, tab);
}
static gboolean
@@ -1744,16 +1719,15 @@ gtk_notebook_reorder_tab (GtkNotebook *notebook,
GtkDirectionType direction_type,
gboolean move_to_last)
{
- GtkNotebookPrivate *priv = notebook->priv;
GtkDirectionType effective_direction = get_effective_direction (notebook, direction_type);
GList *last, *child, *element;
gint page_num, old_page_num, i;
- if (!gtk_widget_is_focus (GTK_WIDGET (notebook)) || !priv->show_tabs)
+ if (!gtk_widget_is_focus (GTK_WIDGET (notebook)) || !notebook->show_tabs)
return FALSE;
if (!gtk_notebook_has_current_page (notebook) ||
- !priv->cur_page->reorderable)
+ !notebook->cur_page->reorderable)
return FALSE;
if (effective_direction != GTK_DIR_LEFT &&
@@ -1762,7 +1736,7 @@ gtk_notebook_reorder_tab (GtkNotebook *notebook,
if (move_to_last)
{
- child = priv->focus_tab;
+ child = notebook->focus_tab;
do
{
@@ -1776,21 +1750,21 @@ gtk_notebook_reorder_tab (GtkNotebook *notebook,
child = last;
}
else
- child = gtk_notebook_search_page (notebook, priv->focus_tab,
+ child = gtk_notebook_search_page (notebook, notebook->focus_tab,
(effective_direction == GTK_DIR_RIGHT) ? STEP_NEXT : STEP_PREV,
TRUE);
- if (!child || child->data == priv->cur_page)
+ if (!child || child->data == notebook->cur_page)
return FALSE;
- old_page_num = g_list_position (priv->children, priv->focus_tab);
+ old_page_num = g_list_position (notebook->children, notebook->focus_tab);
if (effective_direction == GTK_DIR_RIGHT)
- page_num = reorder_tab (notebook, child->next, priv->focus_tab);
+ page_num = reorder_tab (notebook, child->next, notebook->focus_tab);
else
- page_num = reorder_tab (notebook, child, priv->focus_tab);
+ page_num = reorder_tab (notebook, child, notebook->focus_tab);
- gtk_notebook_child_reordered (notebook, priv->focus_tab->data);
- for (element = priv->children, i = 0; element; element = element->next, i++)
+ gtk_notebook_child_reordered (notebook, notebook->focus_tab->data);
+ for (element = notebook->children, i = 0; element; element = element->next, i++)
{
if (MIN (old_page_num, page_num) <= i && i <= MAX (old_page_num, page_num))
g_object_notify (G_OBJECT (element->data), "position");
@@ -1798,7 +1772,7 @@ gtk_notebook_reorder_tab (GtkNotebook *notebook,
g_signal_emit (notebook,
notebook_signals[PAGE_REORDERED],
0,
- ((GtkNotebookPage *) priv->focus_tab->data)->child,
+ ((GtkNotebookPage *) notebook->focus_tab->data)->child,
page_num);
return TRUE;
@@ -1871,27 +1845,26 @@ gtk_notebook_get_property (GObject *object,
GParamSpec *pspec)
{
GtkNotebook *notebook = GTK_NOTEBOOK (object);
- GtkNotebookPrivate *priv = notebook->priv;
switch (prop_id)
{
case PROP_SHOW_TABS:
- g_value_set_boolean (value, priv->show_tabs);
+ g_value_set_boolean (value, notebook->show_tabs);
break;
case PROP_SHOW_BORDER:
- g_value_set_boolean (value, priv->show_border);
+ g_value_set_boolean (value, notebook->show_border);
break;
case PROP_SCROLLABLE:
- g_value_set_boolean (value, priv->scrollable);
+ g_value_set_boolean (value, notebook->scrollable);
break;
case PROP_ENABLE_POPUP:
- g_value_set_boolean (value, priv->menu != NULL);
+ g_value_set_boolean (value, notebook->menu != NULL);
break;
case PROP_PAGE:
g_value_set_int (value, gtk_notebook_get_current_page (notebook));
break;
case PROP_TAB_POS:
- g_value_set_enum (value, priv->tab_pos);
+ g_value_set_enum (value, notebook->tab_pos);
break;
case PROP_GROUP_NAME:
g_value_set_string (value, gtk_notebook_get_group_name (notebook));
@@ -1923,10 +1896,9 @@ static void
gtk_notebook_destroy (GtkWidget *widget)
{
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
- GtkNotebookPrivate *priv = notebook->priv;
- if (priv->pages)
- g_list_model_items_changed (G_LIST_MODEL (priv->pages), 0, g_list_length (priv->children), 0);
+ if (notebook->pages)
+ g_list_model_items_changed (G_LIST_MODEL (notebook->pages), 0, g_list_length (notebook->children), 0);
GTK_WIDGET_CLASS (gtk_notebook_parent_class)->destroy (widget);
}
@@ -1935,10 +1907,9 @@ static void
gtk_notebook_finalize (GObject *object)
{
GtkNotebook *notebook = GTK_NOTEBOOK (object);
- GtkNotebookPrivate *priv = notebook->priv;
- gtk_widget_unparent (priv->header_widget);
- gtk_widget_unparent (priv->stack_widget);
+ gtk_widget_unparent (notebook->header_widget);
+ gtk_widget_unparent (notebook->stack_widget);
G_OBJECT_CLASS (gtk_notebook_parent_class)->finalize (object);
}
@@ -1947,8 +1918,7 @@ static void
gtk_notebook_dispose (GObject *object)
{
GtkNotebook *notebook = GTK_NOTEBOOK (object);
- GtkNotebookPrivate *priv = notebook->priv;
- GList *l = priv->children;
+ GList *l = notebook->children;
while (l != NULL)
{
@@ -1965,11 +1935,9 @@ static gboolean
gtk_notebook_get_tab_area_position (GtkNotebook *notebook,
graphene_rect_t *rectangle)
{
- GtkNotebookPrivate *priv = notebook->priv;
-
- if (priv->show_tabs && gtk_notebook_has_current_page (notebook))
+ if (notebook->show_tabs && gtk_notebook_has_current_page (notebook))
{
- return gtk_widget_compute_bounds (priv->header_widget,
+ return gtk_widget_compute_bounds (notebook->header_widget,
GTK_WIDGET (notebook),
rectangle);
}
@@ -1998,30 +1966,29 @@ gtk_notebook_distribute_arrow_width (GtkNotebook *notebook,
gint *out_left,
gint *out_right)
{
- GtkNotebookPrivate *priv = notebook->priv;
GtkRequestedSize sizes[2];
- if (priv->arrow_widget[2 * type + 1] == NULL)
+ if (notebook->arrow_widget[2 * type + 1] == NULL)
{
- if (priv->arrow_widget[2 * type] == NULL)
+ if (notebook->arrow_widget[2 * type] == NULL)
*out_left = 0;
else
*out_left = size;
*out_right = 0;
}
- else if (priv->arrow_widget[2 * type] == NULL)
+ else if (notebook->arrow_widget[2 * type] == NULL)
{
*out_left = 0;
*out_right = size;
}
else
{
- gtk_widget_measure (priv->arrow_widget[2 * type],
+ gtk_widget_measure (notebook->arrow_widget[2 * type],
GTK_ORIENTATION_HORIZONTAL,
-1,
&sizes[0].minimum_size, &sizes[0].natural_size,
NULL, NULL);
- gtk_widget_measure (priv->arrow_widget[2 * type + 1],
+ gtk_widget_measure (notebook->arrow_widget[2 * type + 1],
GTK_ORIENTATION_HORIZONTAL,
-1,
&sizes[1].minimum_size, &sizes[1].natural_size,
@@ -2045,15 +2012,14 @@ gtk_notebook_measure_arrows (GtkNotebook *notebook,
gint *minimum_baseline,
gint *natural_baseline)
{
- GtkNotebookPrivate *priv = notebook->priv;
gint child1_min, child1_nat;
gint child2_min, child2_nat;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
- if (priv->arrow_widget[2 * type])
+ if (notebook->arrow_widget[2 * type])
{
- gtk_widget_measure (priv->arrow_widget[2 * type],
+ gtk_widget_measure (notebook->arrow_widget[2 * type],
orientation,
for_size,
&child1_min, &child1_nat,
@@ -2063,9 +2029,9 @@ gtk_notebook_measure_arrows (GtkNotebook *notebook,
{
child1_min = child1_nat = 0;
}
- if (priv->arrow_widget[2 * type + 1])
+ if (notebook->arrow_widget[2 * type + 1])
{
- gtk_widget_measure (priv->arrow_widget[2 * type + 1],
+ gtk_widget_measure (notebook->arrow_widget[2 * type + 1],
orientation,
for_size,
&child2_min, &child2_nat,
@@ -2091,9 +2057,9 @@ gtk_notebook_measure_arrows (GtkNotebook *notebook,
else
child1_size = child2_size = for_size;
- if (priv->arrow_widget[2 * type])
+ if (notebook->arrow_widget[2 * type])
{
- gtk_widget_measure (priv->arrow_widget[2 * type],
+ gtk_widget_measure (notebook->arrow_widget[2 * type],
orientation,
child1_size,
&child1_min, &child1_nat,
@@ -2103,9 +2069,9 @@ gtk_notebook_measure_arrows (GtkNotebook *notebook,
{
child1_min = child1_nat = 0;
}
- if (priv->arrow_widget[2 * type + 1])
+ if (notebook->arrow_widget[2 * type + 1])
{
- gtk_widget_measure (priv->arrow_widget[2 * type + 1],
+ gtk_widget_measure (notebook->arrow_widget[2 * type + 1],
orientation,
child2_size,
&child2_min, &child2_nat,
@@ -2128,7 +2094,6 @@ static void
gtk_notebook_get_preferred_tabs_size (GtkNotebook *notebook,
GtkRequisition *requisition)
{
- GtkNotebookPrivate *priv = notebook->priv;
gint tab_width = 0;
gint tab_height = 0;
gint tab_max = 0;
@@ -2137,7 +2102,7 @@ gtk_notebook_get_preferred_tabs_size (GtkNotebook *notebook,
GtkNotebookPage *page;
- for (children = priv->children; children;
+ for (children = notebook->children; children;
children = children->next)
{
page = children->data;
@@ -2160,7 +2125,7 @@ gtk_notebook_get_preferred_tabs_size (GtkNotebook *notebook,
&page->requisition.height, NULL,
NULL, NULL);
- switch (priv->tab_pos)
+ switch (notebook->tab_pos)
{
case GTK_POS_TOP:
case GTK_POS_BOTTOM:
@@ -2181,18 +2146,18 @@ gtk_notebook_get_preferred_tabs_size (GtkNotebook *notebook,
gtk_widget_hide (page->tab_label);
}
- children = priv->children;
+ children = notebook->children;
if (vis_pages)
{
- switch (priv->tab_pos)
+ switch (notebook->tab_pos)
{
case GTK_POS_TOP:
case GTK_POS_BOTTOM:
if (tab_height == 0)
break;
- if (priv->scrollable)
+ if (notebook->scrollable)
{
gint arrow_height, unused;
gtk_notebook_measure_arrows (notebook,
@@ -2223,7 +2188,7 @@ gtk_notebook_get_preferred_tabs_size (GtkNotebook *notebook,
page->requisition.height = tab_height;
}
- if (priv->scrollable)
+ if (notebook->scrollable)
{
gint start_arrow_width, end_arrow_width, unused;
@@ -2252,7 +2217,7 @@ gtk_notebook_get_preferred_tabs_size (GtkNotebook *notebook,
if (tab_width == 0)
break;
- if (priv->scrollable)
+ if (notebook->scrollable)
{
gint arrow_width, unused;
gtk_notebook_measure_arrows (notebook,
@@ -2284,7 +2249,7 @@ gtk_notebook_get_preferred_tabs_size (GtkNotebook *notebook,
tab_height += page->requisition.height;
}
- if (priv->scrollable)
+ if (notebook->scrollable)
{
gint start_arrow_height, end_arrow_height, unused;
@@ -2362,13 +2327,12 @@ gtk_notebook_allocate_tabs (GtkGizmo *gizmo,
static gboolean
gtk_notebook_show_arrows (GtkNotebook *notebook)
{
- GtkNotebookPrivate *priv = notebook->priv;
GList *children;
- if (!priv->scrollable)
+ if (!notebook->scrollable)
return FALSE;
- children = priv->children;
+ children = notebook->children;
while (children)
{
GtkNotebookPage *page = children->data;
@@ -2387,7 +2351,6 @@ gtk_notebook_get_arrow (GtkNotebook *notebook,
gint x,
gint y)
{
- GtkNotebookPrivate *priv = notebook->priv;
gint i;
if (gtk_notebook_show_arrows (notebook))
@@ -2396,10 +2359,10 @@ gtk_notebook_get_arrow (GtkNotebook *notebook,
{
graphene_rect_t arrow_bounds;
- if (priv->arrow_widget[i] == NULL)
+ if (notebook->arrow_widget[i] == NULL)
continue;
- if (!gtk_widget_compute_bounds (priv->arrow_widget[i],
+ if (!gtk_widget_compute_bounds (notebook->arrow_widget[i],
GTK_WIDGET (notebook),
&arrow_bounds))
continue;
@@ -2417,7 +2380,6 @@ static void
gtk_notebook_do_arrow (GtkNotebook *notebook,
GtkNotebookArrow arrow)
{
- GtkNotebookPrivate *priv = notebook->priv;
GtkWidget *widget = GTK_WIDGET (notebook);
gboolean is_rtl, left;
@@ -2425,8 +2387,8 @@ gtk_notebook_do_arrow (GtkNotebook *notebook,
left = (ARROW_IS_LEFT (arrow) && !is_rtl) ||
(!ARROW_IS_LEFT (arrow) && is_rtl);
- if (!priv->focus_tab ||
- gtk_notebook_search_page (notebook, priv->focus_tab,
+ if (!notebook->focus_tab ||
+ gtk_notebook_search_page (notebook, notebook->focus_tab,
left ? STEP_PREV : STEP_NEXT,
TRUE))
{
@@ -2440,20 +2402,19 @@ gtk_notebook_arrow_button_press (GtkNotebook *notebook,
GtkNotebookArrow arrow,
gint button)
{
- GtkNotebookPrivate *priv = notebook->priv;
GtkWidget *widget = GTK_WIDGET (notebook);
gboolean is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
gboolean left = (ARROW_IS_LEFT (arrow) && !is_rtl) ||
(!ARROW_IS_LEFT (arrow) && is_rtl);
- if (priv->pressed_button)
+ if (notebook->pressed_button)
return FALSE;
if (!gtk_widget_has_focus (widget))
gtk_widget_grab_focus (widget);
- priv->pressed_button = button;
- priv->click_child = arrow;
+ notebook->pressed_button = button;
+ notebook->click_child = arrow;
if (button == GDK_BUTTON_PRIMARY)
{
@@ -2487,10 +2448,9 @@ in_tabs (GtkNotebook *notebook,
gdouble x,
gdouble y)
{
- GtkNotebookPrivate *priv = notebook->priv;
graphene_rect_t tabs_bounds;
- if (!gtk_widget_compute_bounds (priv->tabs_widget, GTK_WIDGET (notebook), &tabs_bounds))
+ if (!gtk_widget_compute_bounds (notebook->tabs_widget, GTK_WIDGET (notebook), &tabs_bounds))
return FALSE;
return graphene_rect_contains_point (&tabs_bounds,
@@ -2502,11 +2462,10 @@ get_tab_at_pos (GtkNotebook *notebook,
gdouble x,
gdouble y)
{
- GtkNotebookPrivate *priv = notebook->priv;
GtkNotebookPage *page;
GList *children;
- for (children = priv->children; children; children = children->next)
+ for (children = notebook->children; children; children = children->next)
{
graphene_rect_t bounds;
@@ -2534,7 +2493,6 @@ gtk_notebook_gesture_pressed (GtkGestureClick *gesture,
{
GtkNotebook *notebook = user_data;
GtkWidget *widget = user_data;
- GtkNotebookPrivate *priv = notebook->priv;
GdkEventSequence *sequence;
GtkNotebookArrow arrow;
GtkNotebookPage *page;
@@ -2546,7 +2504,7 @@ gtk_notebook_gesture_pressed (GtkGestureClick *gesture,
button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture));
event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence);
- if (!priv->children)
+ if (!notebook->children)
return;
arrow = gtk_notebook_get_arrow (notebook, x, y);
@@ -2556,7 +2514,7 @@ gtk_notebook_gesture_pressed (GtkGestureClick *gesture,
return;
}
- if (in_tabs (notebook, x, y) && priv->menu && gdk_event_triggers_context_menu (event))
+ if (in_tabs (notebook, x, y) && notebook->menu && gdk_event_triggers_context_menu (event))
{
GdkRectangle rect;
@@ -2564,8 +2522,8 @@ gtk_notebook_gesture_pressed (GtkGestureClick *gesture,
rect.y = y;
rect.width = 1;
rect.height = 1;
- gtk_popover_set_pointing_to (GTK_POPOVER (priv->menu), &rect);
- gtk_popover_popup (GTK_POPOVER (priv->menu));
+ gtk_popover_set_pointing_to (GTK_POPOVER (notebook->menu), &rect);
+ gtk_popover_popup (GTK_POPOVER (notebook->menu));
return;
}
@@ -2577,7 +2535,7 @@ gtk_notebook_gesture_pressed (GtkGestureClick *gesture,
gboolean page_changed, was_focus;
page = tab->data;
- page_changed = page != priv->cur_page;
+ page_changed = page != notebook->cur_page;
was_focus = gtk_widget_is_focus (widget);
gtk_notebook_switch_focus_tab (notebook, tab);
@@ -2591,21 +2549,21 @@ gtk_notebook_gesture_pressed (GtkGestureClick *gesture,
{
graphene_rect_t tab_bounds;
- priv->pressed_button = button;
+ notebook->pressed_button = button;
- priv->mouse_x = x;
- priv->mouse_y = y;
+ notebook->mouse_x = x;
+ notebook->mouse_y = y;
- priv->drag_begin_x = priv->mouse_x;
- priv->drag_begin_y = priv->mouse_y;
+ notebook->drag_begin_x = notebook->mouse_x;
+ notebook->drag_begin_y = notebook->mouse_y;
/* tab bounds get set to empty, which is fine */
- priv->drag_offset_x = priv->drag_begin_x;
- priv->drag_offset_y = priv->drag_begin_y;
+ notebook->drag_offset_x = notebook->drag_begin_x;
+ notebook->drag_offset_y = notebook->drag_begin_y;
if (gtk_widget_compute_bounds (page->tab_widget, GTK_WIDGET (notebook), &tab_bounds))
{
- priv->drag_offset_x -= tab_bounds.origin.x;
- priv->drag_offset_y -= tab_bounds.origin.y;
+ notebook->drag_offset_x -= tab_bounds.origin.x;
+ notebook->drag_offset_y -= tab_bounds.origin.y;
}
}
}
@@ -2617,47 +2575,44 @@ gtk_notebook_popup_menu (GtkWidget *widget,
GVariant *parameters)
{
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
- GtkNotebookPrivate *priv = notebook->priv;
- if (priv->menu)
- gtk_popover_popup (GTK_POPOVER (priv->menu));
+ if (notebook->menu)
+ gtk_popover_popup (GTK_POPOVER (notebook->menu));
}
static void
stop_scrolling (GtkNotebook *notebook)
{
- GtkNotebookPrivate *priv = notebook->priv;
- if (priv->timer)
+ if (notebook->timer)
{
- g_source_remove (priv->timer);
- priv->timer = 0;
- priv->need_timer = FALSE;
+ g_source_remove (notebook->timer);
+ notebook->timer = 0;
+ notebook->need_timer = FALSE;
}
- priv->click_child = ARROW_NONE;
- priv->pressed_button = 0;
+ notebook->click_child = ARROW_NONE;
+ notebook->pressed_button = 0;
}
static GList*
get_drop_position (GtkNotebook *notebook)
{
- GtkNotebookPrivate *priv = notebook->priv;
GList *children, *last_child;
GtkNotebookPage *page;
gboolean is_rtl;
gint x, y;
- x = priv->mouse_x;
- y = priv->mouse_y;
+ x = notebook->mouse_x;
+ y = notebook->mouse_y;
is_rtl = gtk_widget_get_direction ((GtkWidget *) notebook) == GTK_TEXT_DIR_RTL;
last_child = NULL;
- for (children = priv->children; children; children = children->next)
+ for (children = notebook->children; children; children = children->next)
{
page = children->data;
- if ((priv->operation != DRAG_OPERATION_REORDER || page != priv->cur_page) &&
+ if ((notebook->operation != DRAG_OPERATION_REORDER || page != notebook->cur_page) &&
gtk_widget_get_visible (page->child) &&
page->tab_label &&
gtk_widget_get_mapped (page->tab_label))
@@ -2667,7 +2622,7 @@ get_drop_position (GtkNotebook *notebook)
if (!gtk_widget_compute_bounds (page->tab_widget, GTK_WIDGET (notebook), &tab_bounds))
continue;
- switch (priv->tab_pos)
+ switch (notebook->tab_pos)
{
case GTK_POS_TOP:
case GTK_POS_BOTTOM:
@@ -2729,34 +2684,33 @@ tab_drag_end (GtkNotebook *notebook,
static void
gtk_notebook_stop_reorder (GtkNotebook *notebook)
{
- GtkNotebookPrivate *priv = notebook->priv;
GtkNotebookPage *page;
- if (priv->operation == DRAG_OPERATION_DETACH)
- page = priv->detached_tab;
+ if (notebook->operation == DRAG_OPERATION_DETACH)
+ page = notebook->detached_tab;
else
- page = priv->cur_page;
+ page = notebook->cur_page;
if (!page || !page->tab_label)
return;
- priv->pressed_button = 0;
+ notebook->pressed_button = 0;
if (page->reorderable || page->detachable)
{
- if (priv->operation == DRAG_OPERATION_REORDER)
+ if (notebook->operation == DRAG_OPERATION_REORDER)
{
gint old_page_num, page_num, i;
GList *element;
element = get_drop_position (notebook);
- old_page_num = g_list_position (priv->children, priv->focus_tab);
- page_num = reorder_tab (notebook, element, priv->focus_tab);
+ old_page_num = g_list_position (notebook->children, notebook->focus_tab);
+ page_num = reorder_tab (notebook, element, notebook->focus_tab);
gtk_notebook_child_reordered (notebook, page);
- if (priv->has_scrolled || old_page_num != page_num)
+ if (notebook->has_scrolled || old_page_num != page_num)
{
- for (element = priv->children, i = 0; element; element = element->next, i++)
+ for (element = notebook->children, i = 0; element; element = element->next, i++)
{
if (MIN (old_page_num, page_num) <= i && i <= MAX (old_page_num, page_num))
g_object_notify (G_OBJECT (element->data), "position");
@@ -2767,16 +2721,16 @@ gtk_notebook_stop_reorder (GtkNotebook *notebook)
}
}
- priv->has_scrolled = FALSE;
+ notebook->has_scrolled = FALSE;
tab_drag_end (notebook, page);
- priv->operation = DRAG_OPERATION_NONE;
+ notebook->operation = DRAG_OPERATION_NONE;
- if (priv->dnd_timer)
+ if (notebook->dnd_timer)
{
- g_source_remove (priv->dnd_timer);
- priv->dnd_timer = 0;
+ g_source_remove (notebook->dnd_timer);
+ notebook->dnd_timer = 0;
}
gtk_widget_queue_allocate (GTK_WIDGET (notebook));
@@ -2791,7 +2745,6 @@ gtk_notebook_gesture_released (GtkGestureClick *gesture,
gpointer user_data)
{
GtkNotebook *notebook = user_data;
- GtkNotebookPrivate *priv = notebook->priv;
GdkEventSequence *sequence;
GdkEvent *event;
guint button;
@@ -2803,12 +2756,12 @@ gtk_notebook_gesture_released (GtkGestureClick *gesture,
if (!event)
return;
- if (priv->pressed_button != button)
+ if (notebook->pressed_button != button)
return;
- if (priv->operation == DRAG_OPERATION_REORDER &&
- priv->cur_page &&
- priv->cur_page->reorderable)
+ if (notebook->operation == DRAG_OPERATION_REORDER &&
+ notebook->cur_page &&
+ notebook->cur_page->reorderable)
gtk_notebook_stop_reorder (notebook);
stop_scrolling (notebook);
@@ -2817,23 +2770,22 @@ gtk_notebook_gesture_released (GtkGestureClick *gesture,
static GtkNotebookPointerPosition
get_pointer_position (GtkNotebook *notebook)
{
- GtkNotebookPrivate *priv = notebook->priv;
GtkWidget *widget = GTK_WIDGET (notebook);
graphene_rect_t area;
gint width, height;
gboolean is_rtl;
- if (!priv->scrollable)
+ if (!notebook->scrollable)
return POINTER_BETWEEN;
gtk_notebook_get_tab_area_position (notebook, &area);
width = area.size.width;
height = area.size.height;
- if (priv->tab_pos == GTK_POS_TOP ||
- priv->tab_pos == GTK_POS_BOTTOM)
+ if (notebook->tab_pos == GTK_POS_TOP ||
+ notebook->tab_pos == GTK_POS_BOTTOM)
{
- gint x = priv->mouse_x;
+ gint x = notebook->mouse_x;
is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
@@ -2846,7 +2798,7 @@ get_pointer_position (GtkNotebook *notebook)
}
else
{
- gint y = priv->mouse_y;
+ gint y = notebook->mouse_y;
if (y > height - SCROLL_THRESHOLD)
return POINTER_AFTER;
@@ -2861,22 +2813,21 @@ static gboolean
scroll_notebook_timer (gpointer data)
{
GtkNotebook *notebook = GTK_NOTEBOOK (data);
- GtkNotebookPrivate *priv = notebook->priv;
GtkNotebookPointerPosition pointer_position;
GList *element, *first_tab;
pointer_position = get_pointer_position (notebook);
element = get_drop_position (notebook);
- reorder_tab (notebook, element, priv->focus_tab);
- first_tab = gtk_notebook_search_page (notebook, priv->first_tab,
+ reorder_tab (notebook, element, notebook->focus_tab);
+ first_tab = gtk_notebook_search_page (notebook, notebook->first_tab,
(pointer_position == POINTER_BEFORE) ? STEP_PREV : STEP_NEXT,
TRUE);
- if (first_tab && priv->cur_page)
+ if (first_tab && notebook->cur_page)
{
- priv->first_tab = first_tab;
+ notebook->first_tab = first_tab;
- gtk_widget_queue_allocate (priv->tabs_widget);
+ gtk_widget_queue_allocate (notebook->tabs_widget);
}
return TRUE;
@@ -2912,11 +2863,10 @@ gtk_notebook_motion (GtkEventController *controller,
{
GtkWidget *widget = GTK_WIDGET (user_data);
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
- GtkNotebookPrivate *priv = notebook->priv;
GtkNotebookPage *page;
guint state;
- page = priv->cur_page;
+ page = notebook->cur_page;
if (!page)
return;
@@ -2924,20 +2874,20 @@ gtk_notebook_motion (GtkEventController *controller,
return;
if (!(state & GDK_BUTTON1_MASK) &&
- priv->pressed_button != 0)
+ notebook->pressed_button != 0)
{
gtk_notebook_stop_reorder (notebook);
stop_scrolling (notebook);
}
- priv->mouse_x = x;
- priv->mouse_y = y;
+ notebook->mouse_x = x;
+ notebook->mouse_y = y;
- if (priv->pressed_button == 0)
+ if (notebook->pressed_button == 0)
return;
if (page->detachable &&
- check_threshold (notebook, priv->mouse_x, priv->mouse_y))
+ check_threshold (notebook, notebook->mouse_x, notebook->mouse_y))
{
GdkSurface *surface;
GdkDevice *device;
@@ -2945,33 +2895,33 @@ gtk_notebook_motion (GtkEventController *controller,
GdkDrag *drag;
GdkPaintable *paintable;
- priv->detached_tab = priv->cur_page;
+ notebook->detached_tab = notebook->cur_page;
surface = gtk_native_get_surface (gtk_widget_get_native (GTK_WIDGET (notebook)));
device = gtk_get_current_event_device ();
content = gdk_content_provider_new_union ((GdkContentProvider *[2]) {
gtk_notebook_root_content_new (notebook),
- gdk_content_provider_new_typed (GTK_TYPE_NOTEBOOK_PAGE, priv->cur_page)
+ gdk_content_provider_new_typed (GTK_TYPE_NOTEBOOK_PAGE, notebook->cur_page)
}, 2);
- drag = gdk_drag_begin (surface, device, content, GDK_ACTION_MOVE, priv->drag_begin_x, priv->drag_begin_y);
+ drag = gdk_drag_begin (surface, device, content, GDK_ACTION_MOVE, notebook->drag_begin_x, notebook->drag_begin_y);
g_object_unref (content);
g_signal_connect (drag, "dnd-finished", G_CALLBACK (gtk_notebook_dnd_finished_cb), notebook);
g_signal_connect (drag, "cancel", G_CALLBACK (gtk_notebook_drag_cancel_cb), notebook);
- paintable = gtk_widget_paintable_new (priv->detached_tab->tab_widget);
+ paintable = gtk_widget_paintable_new (notebook->detached_tab->tab_widget);
gtk_drag_icon_set_from_paintable (drag, paintable, -2, -2);
g_object_unref (paintable);
- if (priv->dnd_timer)
+ if (notebook->dnd_timer)
{
- g_source_remove (priv->dnd_timer);
- priv->dnd_timer = 0;
+ g_source_remove (notebook->dnd_timer);
+ notebook->dnd_timer = 0;
}
- priv->operation = DRAG_OPERATION_DETACH;
- tab_drag_end (notebook, priv->cur_page);
+ notebook->operation = DRAG_OPERATION_DETACH;
+ tab_drag_end (notebook, notebook->cur_page);
g_object_set_data (G_OBJECT (drag), "gtk-notebook-drag-origin", notebook);
@@ -2981,9 +2931,9 @@ gtk_notebook_motion (GtkEventController *controller,
}
if (page->reorderable &&
- (priv->operation == DRAG_OPERATION_REORDER ||
- gtk_drag_check_threshold (widget, priv->drag_begin_x, priv->drag_begin_y,
- priv->mouse_x, priv->mouse_y)))
+ (notebook->operation == DRAG_OPERATION_REORDER ||
+ gtk_drag_check_threshold (widget, notebook->drag_begin_x, notebook->drag_begin_y,
+ notebook->mouse_x, notebook->mouse_y)))
{
GtkNotebookPointerPosition pointer_position = get_pointer_position (notebook);
@@ -2991,33 +2941,33 @@ gtk_notebook_motion (GtkEventController *controller,
gtk_notebook_show_arrows (notebook))
{
/* scroll tabs */
- if (!priv->dnd_timer)
+ if (!notebook->dnd_timer)
{
- priv->has_scrolled = TRUE;
- priv->dnd_timer = g_timeout_add (TIMEOUT_REPEAT * SCROLL_DELAY_FACTOR,
+ notebook->has_scrolled = TRUE;
+ notebook->dnd_timer = g_timeout_add (TIMEOUT_REPEAT * SCROLL_DELAY_FACTOR,
scroll_notebook_timer,
notebook);
- g_source_set_name_by_id (priv->dnd_timer, "[gtk] scroll_notebook_timer");
+ g_source_set_name_by_id (notebook->dnd_timer, "[gtk] scroll_notebook_timer");
}
}
else
{
- if (priv->dnd_timer)
+ if (notebook->dnd_timer)
{
- g_source_remove (priv->dnd_timer);
- priv->dnd_timer = 0;
+ g_source_remove (notebook->dnd_timer);
+ notebook->dnd_timer = 0;
}
}
- if (priv->operation != DRAG_OPERATION_REORDER)
+ if (notebook->operation != DRAG_OPERATION_REORDER)
{
- priv->operation = DRAG_OPERATION_REORDER;
+ notebook->operation = DRAG_OPERATION_REORDER;
tab_drag_begin (notebook, page);
}
}
- if (priv->operation == DRAG_OPERATION_REORDER)
- gtk_widget_queue_allocate (priv->tabs_widget);
+ if (notebook->operation == DRAG_OPERATION_REORDER)
+ gtk_widget_queue_allocate (notebook->tabs_widget);
}
static void
@@ -3038,7 +2988,6 @@ gtk_notebook_grab_notify (GtkWidget *widget,
static void
update_arrow_state (GtkNotebook *notebook)
{
- GtkNotebookPrivate *priv = notebook->priv;
gint i;
gboolean is_rtl, left;
@@ -3048,20 +2997,20 @@ update_arrow_state (GtkNotebook *notebook)
{
gboolean sensitive = TRUE;
- if (priv->arrow_widget[i] == NULL)
+ if (notebook->arrow_widget[i] == NULL)
continue;
left = (ARROW_IS_LEFT (i) && !is_rtl) ||
(!ARROW_IS_LEFT (i) && is_rtl);
- if (priv->focus_tab &&
- !gtk_notebook_search_page (notebook, priv->focus_tab,
+ if (notebook->focus_tab &&
+ !gtk_notebook_search_page (notebook, notebook->focus_tab,
left ? STEP_PREV : STEP_NEXT, TRUE))
{
sensitive = FALSE;
}
- gtk_widget_set_sensitive (priv->arrow_widget[i], sensitive);
+ gtk_widget_set_sensitive (notebook->arrow_widget[i], sensitive);
}
}
@@ -3079,19 +3028,18 @@ gtk_notebook_arrow_drag_enter (GtkDropControllerMotion *motion,
double y,
GtkNotebook *notebook)
{
- GtkNotebookPrivate *priv = notebook->priv;
GtkWidget *arrow_widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (motion));
guint arrow;
for (arrow = 0; arrow < 4; arrow++)
{
- if (priv->arrow_widget[arrow] == arrow_widget)
+ if (notebook->arrow_widget[arrow] == arrow_widget)
break;
}
g_assert (arrow != ARROW_NONE);
- priv->click_child = arrow;
+ notebook->click_child = arrow;
gtk_notebook_set_scroll_timer (notebook);
}
@@ -3106,14 +3054,13 @@ gtk_notebook_arrow_drag_leave (GtkDropTarget *target,
static void
update_arrow_nodes (GtkNotebook *notebook)
{
- GtkNotebookPrivate *priv = notebook->priv;
gboolean arrow[4];
const char *up_icon_name;
const char *down_icon_name;
gint i;
- if (priv->tab_pos == GTK_POS_LEFT ||
- priv->tab_pos == GTK_POS_RIGHT)
+ if (notebook->tab_pos == GTK_POS_LEFT ||
+ notebook->tab_pos == GTK_POS_RIGHT)
{
up_icon_name = "pan-down-symbolic";
down_icon_name = "pan-up-symbolic";
@@ -3136,9 +3083,9 @@ update_arrow_nodes (GtkNotebook *notebook)
for (i = 0; i < 4; i++)
{
- if (priv->scrollable && arrow[i])
+ if (notebook->scrollable && arrow[i])
{
- if (priv->arrow_widget[i] == NULL)
+ if (notebook->arrow_widget[i] == NULL)
{
GtkWidget *next_widget;
GtkEventController *controller;
@@ -3146,29 +3093,29 @@ update_arrow_nodes (GtkNotebook *notebook)
switch (i)
{
case 0:
- if (priv->arrow_widget[1])
+ if (notebook->arrow_widget[1])
{
- next_widget = priv->arrow_widget[1];
+ next_widget = notebook->arrow_widget[1];
break;
}
G_GNUC_FALLTHROUGH;
case 1:
- if (priv->children)
+ if (notebook->children)
{
- GtkNotebookPage *page = priv->children->data;
+ GtkNotebookPage *page = notebook->children->data;
next_widget = page->tab_widget;
break;
}
- if (priv->arrow_widget[2])
+ if (notebook->arrow_widget[2])
{
- next_widget = priv->arrow_widget[2];
+ next_widget = notebook->arrow_widget[2];
break;
}
G_GNUC_FALLTHROUGH;
case 2:
- if (priv->arrow_widget[3])
+ if (notebook->arrow_widget[3])
{
- next_widget = priv->arrow_widget[3];
+ next_widget = notebook->arrow_widget[3];
break;
}
G_GNUC_FALLTHROUGH;
@@ -3182,34 +3129,34 @@ update_arrow_nodes (GtkNotebook *notebook)
break;
}
- priv->arrow_widget[i] = g_object_new (GTK_TYPE_BUTTON,
+ notebook->arrow_widget[i] = g_object_new (GTK_TYPE_BUTTON,
"css-name", "arrow",
NULL);
controller = gtk_drop_controller_motion_new ();
g_signal_connect (controller, "enter", G_CALLBACK (gtk_notebook_arrow_drag_enter), notebook);
g_signal_connect (controller, "leave", G_CALLBACK (gtk_notebook_arrow_drag_leave), notebook);
- gtk_widget_add_controller (priv->arrow_widget[i], controller);
+ gtk_widget_add_controller (notebook->arrow_widget[i], controller);
if (i == ARROW_LEFT_BEFORE || i == ARROW_LEFT_AFTER)
{
- gtk_widget_add_css_class (priv->arrow_widget[i], "down");
- gtk_widget_insert_after (priv->arrow_widget[i], priv->tabs_widget, next_widget);
+ gtk_widget_add_css_class (notebook->arrow_widget[i], "down");
+ gtk_widget_insert_after (notebook->arrow_widget[i], notebook->tabs_widget, next_widget);
}
else
{
- gtk_widget_add_css_class (priv->arrow_widget[i], "up");
- gtk_widget_insert_before (priv->arrow_widget[i], priv->tabs_widget, next_widget);
+ gtk_widget_add_css_class (notebook->arrow_widget[i], "up");
+ gtk_widget_insert_before (notebook->arrow_widget[i], notebook->tabs_widget, next_widget);
}
}
if (i == ARROW_LEFT_BEFORE || i == ARROW_LEFT_AFTER)
- gtk_button_set_icon_name (GTK_BUTTON (priv->arrow_widget[i]), down_icon_name);
+ gtk_button_set_icon_name (GTK_BUTTON (notebook->arrow_widget[i]), down_icon_name);
else
- gtk_button_set_icon_name (GTK_BUTTON (priv->arrow_widget[i]), up_icon_name);
+ gtk_button_set_icon_name (GTK_BUTTON (notebook->arrow_widget[i]), up_icon_name);
}
else
{
- g_clear_pointer (&priv->arrow_widget[i], gtk_widget_unparent);
+ g_clear_pointer (&notebook->arrow_widget[i], gtk_widget_unparent);
}
}
}
@@ -3226,28 +3173,27 @@ gtk_notebook_dnd_finished_cb (GdkDrag *drag,
GtkWidget *widget)
{
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
- GtkNotebookPrivate *priv = notebook->priv;
gtk_notebook_stop_reorder (notebook);
- if (priv->rootwindow_drop)
+ if (notebook->rootwindow_drop)
{
GtkNotebook *dest_notebook = NULL;
g_signal_emit (notebook, notebook_signals[CREATE_WINDOW], 0,
- priv->detached_tab->child, &dest_notebook);
+ notebook->detached_tab->child, &dest_notebook);
if (dest_notebook)
- do_detach_tab (notebook, dest_notebook, priv->detached_tab->child);
+ do_detach_tab (notebook, dest_notebook, notebook->detached_tab->child);
- priv->rootwindow_drop = FALSE;
+ notebook->rootwindow_drop = FALSE;
}
- else if (priv->detached_tab)
+ else if (notebook->detached_tab)
{
- gtk_notebook_switch_page (notebook, priv->detached_tab);
+ gtk_notebook_switch_page (notebook, notebook->detached_tab);
}
- priv->operation = DRAG_OPERATION_NONE;
+ notebook->operation = DRAG_OPERATION_NONE;
}
static GtkNotebook *
@@ -3263,19 +3209,18 @@ gtk_notebook_drag_cancel_cb (GdkDrag *drag,
GtkWidget *widget)
{
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
- GtkNotebookPrivate *priv = notebook->priv;
- priv->rootwindow_drop = FALSE;
+ notebook->rootwindow_drop = FALSE;
if (reason == GDK_DRAG_CANCEL_NO_TARGET)
{
GtkNotebook *dest_notebook = NULL;
g_signal_emit (notebook, notebook_signals[CREATE_WINDOW], 0,
- priv->detached_tab->child, &dest_notebook);
+ notebook->detached_tab->child, &dest_notebook);
if (dest_notebook)
- do_detach_tab (notebook, dest_notebook, priv->detached_tab->child);
+ do_detach_tab (notebook, dest_notebook, notebook->detached_tab->child);
}
}
@@ -3283,22 +3228,21 @@ static gboolean
gtk_notebook_switch_page_timeout (gpointer data)
{
GtkNotebook *notebook = GTK_NOTEBOOK (data);
- GtkNotebookPrivate *priv = notebook->priv;
GtkNotebookPage *switch_page;
- priv->switch_page_timer = 0;
+ notebook->switch_page_timer = 0;
- switch_page = priv->switch_page;
- priv->switch_page = NULL;
+ switch_page = notebook->switch_page;
+ notebook->switch_page = NULL;
if (switch_page)
{
/* FIXME: hack, we don't want the
* focus to move fom the source widget
*/
- priv->child_has_focus = FALSE;
+ notebook->child_has_focus = FALSE;
gtk_notebook_switch_focus_tab (notebook,
- g_list_find (priv->children,
+ g_list_find (notebook->children,
switch_page));
}
@@ -3315,8 +3259,8 @@ gtk_notebook_can_drag_from (GtkNotebook *self,
return TRUE;
/* if the groups don't match, fail */
- if (self->priv->group == 0 ||
- self->priv->group != other->priv->group)
+ if (self->group == 0 ||
+ self->group != other->group)
return FALSE;
/* Check that the dragged page is not a parent of the notebook
@@ -3336,20 +3280,19 @@ gtk_notebook_drag_motion (GtkDropTarget *dest,
double y,
GtkNotebook *notebook)
{
- GtkNotebookPrivate *priv = notebook->priv;
GdkDrag *drag = gdk_drop_get_drag (gtk_drop_target_get_drop (dest));
GtkNotebook *source;
- priv->mouse_x = x;
- priv->mouse_y = y;
+ notebook->mouse_x = x;
+ notebook->mouse_y = y;
if (!drag)
return 0;
source = GTK_NOTEBOOK (g_object_get_data (G_OBJECT (drag), "gtk-notebook-drag-origin"));
- g_assert (source->priv->cur_page != NULL);
+ g_assert (source->cur_page != NULL);
- if (!gtk_notebook_can_drag_from (notebook, source, source->priv->cur_page))
+ if (!gtk_notebook_can_drag_from (notebook, source, source->cur_page))
return 0;
return GDK_ACTION_MOVE;
@@ -3368,11 +3311,11 @@ gtk_notebook_drag_drop (GtkDropTarget *dest,
source = drag ? g_object_get_data (G_OBJECT (drag), "gtk-notebook-drag-origin") : NULL;
- if (!source || !gtk_notebook_can_drag_from (self, source, source->priv->cur_page))
+ if (!source || !gtk_notebook_can_drag_from (self, source, source->cur_page))
return FALSE;
- self->priv->mouse_x = x;
- self->priv->mouse_y = y;
+ self->mouse_x = x;
+ self->mouse_y = y;
do_detach_tab (source, self, page->child);
@@ -3395,9 +3338,9 @@ void
gtk_notebook_detach_tab (GtkNotebook *notebook,
GtkWidget *child)
{
- notebook->priv->remove_in_detach = TRUE;
+ notebook->remove_in_detach = TRUE;
gtk_container_remove (GTK_CONTAINER (notebook), child);
- notebook->priv->remove_in_detach = FALSE;
+ notebook->remove_in_detach = FALSE;
}
static void
@@ -3405,7 +3348,6 @@ do_detach_tab (GtkNotebook *from,
GtkNotebook *to,
GtkWidget *child)
{
- GtkNotebookPrivate *to_priv = to->priv;
GtkWidget *tab_label, *menu_label;
gboolean tab_expand, tab_fill, reorderable, detachable;
GList *element;
@@ -3435,7 +3377,7 @@ do_detach_tab (GtkNotebook *from,
gtk_notebook_detach_tab (from, child);
element = get_drop_position (to);
- page_num = g_list_position (to_priv->children, element);
+ page_num = g_list_position (to->children, element);
gtk_notebook_insert_page_menu (to, child, tab_label, menu_label, page_num);
page = gtk_notebook_get_page (to, child);
@@ -3480,12 +3422,11 @@ gtk_notebook_remove (GtkContainer *container,
GtkWidget *widget)
{
GtkNotebook *notebook = GTK_NOTEBOOK (container);
- GtkNotebookPrivate *priv = notebook->priv;
GtkNotebookPage *page;
GList *children, *list;
gint page_num = 0;
- children = priv->children;
+ children = notebook->children;
while (children)
{
page = children->data;
@@ -3523,15 +3464,13 @@ gtk_notebook_remove (GtkContainer *container,
static gboolean
focus_tabs_in (GtkNotebook *notebook)
{
- GtkNotebookPrivate *priv = notebook->priv;
-
- if (priv->show_tabs && gtk_notebook_has_current_page (notebook))
+ if (notebook->show_tabs && gtk_notebook_has_current_page (notebook))
{
gtk_widget_grab_focus (GTK_WIDGET (notebook));
gtk_notebook_set_focus_child (GTK_CONTAINER (notebook), NULL);
gtk_notebook_switch_focus_tab (notebook,
- g_list_find (priv->children,
- priv->cur_page));
+ g_list_find (notebook->children,
+ notebook->cur_page));
return TRUE;
}
@@ -3544,10 +3483,9 @@ focus_tabs_move (GtkNotebook *notebook,
GtkDirectionType direction,
gint search_direction)
{
- GtkNotebookPrivate *priv = notebook->priv;
GList *new_page;
- new_page = gtk_notebook_search_page (notebook, priv->focus_tab,
+ new_page = gtk_notebook_search_page (notebook, notebook->focus_tab,
search_direction, TRUE);
if (!new_page)
{
@@ -3567,10 +3505,8 @@ static gboolean
focus_child_in (GtkNotebook *notebook,
GtkDirectionType direction)
{
- GtkNotebookPrivate *priv = notebook->priv;
-
- if (priv->cur_page)
- return gtk_widget_child_focus (priv->cur_page->child, direction);
+ if (notebook->cur_page)
+ return gtk_widget_child_focus (notebook->cur_page->child, direction);
else
return FALSE;
}
@@ -3580,11 +3516,9 @@ focus_action_in (GtkNotebook *notebook,
gint action,
GtkDirectionType direction)
{
- GtkNotebookPrivate *priv = notebook->priv;
-
- if (priv->action_widget[action] &&
- gtk_widget_get_visible (priv->action_widget[action]))
- return gtk_widget_child_focus (priv->action_widget[action], direction);
+ if (notebook->action_widget[action] &&
+ gtk_widget_get_visible (notebook->action_widget[action]))
+ return gtk_widget_child_focus (notebook->action_widget[action], direction);
else
return FALSE;
}
@@ -3597,7 +3531,6 @@ gtk_notebook_focus (GtkWidget *widget,
GtkDirectionType direction)
{
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
- GtkNotebookPrivate *priv = notebook->priv;
GtkWidget *old_focus_child;
GtkDirectionType effective_direction;
gint first_action;
@@ -3605,8 +3538,8 @@ gtk_notebook_focus (GtkWidget *widget,
gboolean widget_is_focus;
- if (priv->tab_pos == GTK_POS_TOP ||
- priv->tab_pos == GTK_POS_LEFT)
+ if (notebook->tab_pos == GTK_POS_TOP ||
+ notebook->tab_pos == GTK_POS_LEFT)
{
first_action = ACTION_WIDGET_START;
last_action = ACTION_WIDGET_END;
@@ -3617,9 +3550,9 @@ gtk_notebook_focus (GtkWidget *widget,
last_action = ACTION_WIDGET_START;
}
- if (priv->focus_out)
+ if (notebook->focus_out)
{
- priv->focus_out = FALSE; /* Clear this to catch the wrap-around case */
+ notebook->focus_out = FALSE; /* Clear this to catch the wrap-around case */
return FALSE;
}
@@ -3633,7 +3566,7 @@ gtk_notebook_focus (GtkWidget *widget,
if (gtk_widget_child_focus (old_focus_child, direction))
return TRUE;
- if (old_focus_child == priv->action_widget[ACTION_WIDGET_START])
+ if (old_focus_child == notebook->action_widget[ACTION_WIDGET_START])
{
switch ((guint) effective_direction)
{
@@ -3649,7 +3582,7 @@ gtk_notebook_focus (GtkWidget *widget,
switch ((guint) direction)
{
case GTK_DIR_TAB_FORWARD:
- if ((priv->tab_pos == GTK_POS_RIGHT || priv->tab_pos == GTK_POS_BOTTOM) &&
+ if ((notebook->tab_pos == GTK_POS_RIGHT || notebook->tab_pos == GTK_POS_BOTTOM) &&
focus_child_in (notebook, direction))
return TRUE;
return focus_tabs_in (notebook);
@@ -3661,7 +3594,7 @@ gtk_notebook_focus (GtkWidget *widget,
}
}
}
- else if (old_focus_child == priv->action_widget[ACTION_WIDGET_END])
+ else if (old_focus_child == notebook->action_widget[ACTION_WIDGET_END])
{
switch ((guint) effective_direction)
{
@@ -3679,7 +3612,7 @@ gtk_notebook_focus (GtkWidget *widget,
case GTK_DIR_TAB_FORWARD:
return FALSE;
case GTK_DIR_TAB_BACKWARD:
- if ((priv->tab_pos == GTK_POS_TOP || priv->tab_pos == GTK_POS_LEFT) &&
+ if ((notebook->tab_pos == GTK_POS_TOP || notebook->tab_pos == GTK_POS_LEFT) &&
focus_child_in (notebook, direction))
return TRUE;
return focus_tabs_in (notebook);
@@ -3777,7 +3710,6 @@ gtk_notebook_set_focus_child (GtkContainer *container,
GtkWidget *child)
{
GtkNotebook *notebook = GTK_NOTEBOOK (container);
- GtkNotebookPrivate *priv = notebook->priv;
GtkWidget *page_child;
GtkWidget *toplevel;
@@ -3817,13 +3749,13 @@ gtk_notebook_set_focus_child (GtkContainer *container,
{
g_return_if_fail (GTK_IS_WIDGET (child));
- priv->child_has_focus = TRUE;
- if (!priv->focus_tab)
+ notebook->child_has_focus = TRUE;
+ if (!notebook->focus_tab)
{
GList *children;
GtkNotebookPage *page;
- children = priv->children;
+ children = notebook->children;
while (children)
{
page = children->data;
@@ -3834,7 +3766,7 @@ gtk_notebook_set_focus_child (GtkContainer *container,
}
}
else
- priv->child_has_focus = FALSE;
+ notebook->child_has_focus = FALSE;
GTK_CONTAINER_CLASS (gtk_notebook_parent_class)->set_focus_child (container, child);
}
@@ -3845,10 +3777,9 @@ gtk_notebook_forall (GtkContainer *container,
gpointer callback_data)
{
GtkNotebook *notebook = GTK_NOTEBOOK (container);
- GtkNotebookPrivate *priv = notebook->priv;
GList *children;
- children = priv->children;
+ children = notebook->children;
while (children)
{
GtkNotebookPage *page;
@@ -3875,12 +3806,11 @@ page_visible_cb (GtkWidget *child,
gpointer data)
{
GtkNotebook *notebook = GTK_NOTEBOOK (data);
- GtkNotebookPrivate *priv = notebook->priv;
GList *list = gtk_notebook_find_child (notebook, GTK_WIDGET (child));
GtkNotebookPage *page = list->data;
GList *next = NULL;
- if (priv->menu && page->menu_label)
+ if (notebook->menu && page->menu_label)
{
GtkWidget *parent = gtk_widget_get_parent (page->menu_label);
if (parent)
@@ -3889,11 +3819,11 @@ page_visible_cb (GtkWidget *child,
gtk_widget_set_visible (page->tab_widget, gtk_widget_get_visible (child));
- if (priv->cur_page == page)
+ if (notebook->cur_page == page)
{
if (!gtk_widget_get_visible (child))
{
- list = g_list_find (priv->children, priv->cur_page);
+ list = g_list_find (notebook->children, notebook->cur_page);
if (list)
{
next = gtk_notebook_search_page (notebook, list, STEP_NEXT, TRUE);
@@ -3904,14 +3834,14 @@ page_visible_cb (GtkWidget *child,
if (next)
gtk_notebook_switch_page (notebook, GTK_NOTEBOOK_PAGE_FROM_LIST (next));
}
- gtk_widget_set_visible (priv->header_widget, priv->show_tabs && gtk_notebook_has_current_page (notebook));
+ gtk_widget_set_visible (notebook->header_widget, notebook->show_tabs && gtk_notebook_has_current_page (notebook));
}
if (!gtk_notebook_has_current_page (notebook) && gtk_widget_get_visible (child))
{
gtk_notebook_switch_page (notebook, page);
/* focus_tab is set in the switch_page method */
- gtk_notebook_switch_focus_tab (notebook, priv->focus_tab);
+ gtk_notebook_switch_focus_tab (notebook, notebook->focus_tab);
}
}
@@ -3925,11 +3855,10 @@ measure_tab (GtkGizmo *gizmo,
gint *natural_baseline)
{
GtkNotebook *notebook = g_object_get_data (G_OBJECT (gizmo), "notebook");
- GtkNotebookPrivate *priv = notebook->priv;
GList *l;
GtkNotebookPage *page = NULL;
- for (l = priv->children; l; l = l->next)
+ for (l = notebook->children; l; l = l->next)
{
GtkNotebookPage *p = GTK_NOTEBOOK_PAGE_FROM_LIST (l);
if (p->tab_widget == GTK_WIDGET (gizmo))
@@ -3955,12 +3884,11 @@ allocate_tab (GtkGizmo *gizmo,
int baseline)
{
GtkNotebook *notebook = g_object_get_data (G_OBJECT (gizmo), "notebook");
- GtkNotebookPrivate *priv = notebook->priv;
GList *l;
GtkNotebookPage *page = NULL;
GtkAllocation child_allocation;
- for (l = priv->children; l; l = l->next)
+ for (l = notebook->children; l; l = l->next)
{
GtkNotebookPage *p = GTK_NOTEBOOK_PAGE_FROM_LIST (l);
if (p->tab_widget == GTK_WIDGET (gizmo))
@@ -3976,7 +3904,7 @@ allocate_tab (GtkGizmo *gizmo,
if (!page->fill)
{
- if (priv->tab_pos == GTK_POS_TOP || priv->tab_pos == GTK_POS_BOTTOM)
+ if (notebook->tab_pos == GTK_POS_TOP || notebook->tab_pos == GTK_POS_BOTTOM)
{
gtk_widget_measure (page->tab_label, GTK_ORIENTATION_HORIZONTAL, height,
NULL, &child_allocation.width, NULL, NULL);
@@ -4009,14 +3937,13 @@ gtk_notebook_tab_drop_enter (GtkEventController *controller,
{
GtkWidget *widget = gtk_event_controller_get_widget (controller);
GtkNotebook *notebook = g_object_get_data (G_OBJECT (widget), "notebook");
- GtkNotebookPrivate *priv = notebook->priv;
- g_assert (!priv->switch_page_timer);
+ g_assert (!notebook->switch_page_timer);
- priv->switch_page = page;
+ notebook->switch_page = page;
- priv->switch_page_timer = g_timeout_add (TIMEOUT_EXPAND, gtk_notebook_switch_page_timeout, notebook);
- g_source_set_name_by_id (priv->switch_page_timer, "[gtk] gtk_notebook_switch_page_timeout");
+ notebook->switch_page_timer = g_timeout_add (TIMEOUT_EXPAND, gtk_notebook_switch_page_timeout, notebook);
+ g_source_set_name_by_id (notebook->switch_page_timer, "[gtk] gtk_notebook_switch_page_timeout");
}
static void
@@ -4025,9 +3952,8 @@ gtk_notebook_tab_drop_leave (GtkEventController *controller,
{
GtkWidget *widget = gtk_event_controller_get_widget (controller);
GtkNotebook *notebook = g_object_get_data (G_OBJECT (widget), "notebook");
- GtkNotebookPrivate *priv = notebook->priv;
- g_clear_handle_id (&priv->switch_page_timer, g_source_remove);
+ g_clear_handle_id (&notebook->switch_page_timer, g_source_remove);
}
static gint
@@ -4035,28 +3961,27 @@ gtk_notebook_insert_notebook_page (GtkNotebook *notebook,
GtkNotebookPage *page,
int position)
{
- GtkNotebookPrivate *priv = notebook->priv;
gint nchildren;
GList *list;
GtkWidget *sibling;
GtkEventController *controller;
- nchildren = g_list_length (priv->children);
+ nchildren = g_list_length (notebook->children);
if ((position < 0) || (position > nchildren))
position = nchildren;
- priv->children = g_list_insert (priv->children, g_object_ref (page), position);
+ notebook->children = g_list_insert (notebook->children, g_object_ref (page), position);
if (position < nchildren)
- sibling = GTK_NOTEBOOK_PAGE_FROM_LIST (g_list_nth (priv->children, position))->tab_widget;
- else if (priv->arrow_widget[ARROW_LEFT_AFTER])
- sibling = priv->arrow_widget[ARROW_LEFT_AFTER];
+ sibling = GTK_NOTEBOOK_PAGE_FROM_LIST (g_list_nth (notebook->children, position))->tab_widget;
+ else if (notebook->arrow_widget[ARROW_LEFT_AFTER])
+ sibling = notebook->arrow_widget[ARROW_LEFT_AFTER];
else
- sibling = priv->arrow_widget[ARROW_RIGHT_AFTER];
+ sibling = notebook->arrow_widget[ARROW_RIGHT_AFTER];
page->tab_widget = gtk_gizmo_new ("tab", measure_tab, allocate_tab, NULL, NULL);
g_object_set_data (G_OBJECT (page->tab_widget), "notebook", notebook);
- gtk_widget_insert_before (page->tab_widget, priv->tabs_widget, sibling);
+ gtk_widget_insert_before (page->tab_widget, notebook->tabs_widget, sibling);
controller = gtk_drop_controller_motion_new ();
g_signal_connect (controller, "enter", G_CALLBACK (gtk_notebook_tab_drop_enter), page);
g_signal_connect (controller, "leave", G_CALLBACK (gtk_notebook_tab_drop_leave), page);
@@ -4065,10 +3990,10 @@ gtk_notebook_insert_notebook_page (GtkNotebook *notebook,
page->expand = FALSE;
page->fill = TRUE;
- if (priv->menu)
+ if (notebook->menu)
gtk_notebook_menu_item_create (notebook, page);
- gtk_container_add (GTK_CONTAINER (priv->stack_widget), page->child);
+ gtk_container_add (GTK_CONTAINER (notebook->stack_widget), page->child);
if (page->tab_label)
{
@@ -4078,12 +4003,12 @@ gtk_notebook_insert_notebook_page (GtkNotebook *notebook,
gtk_notebook_update_labels (notebook);
- if (!priv->first_tab)
- priv->first_tab = priv->children;
+ if (!notebook->first_tab)
+ notebook->first_tab = notebook->children;
if (page->tab_label)
{
- if (priv->show_tabs && gtk_widget_get_visible (page->child))
+ if (notebook->show_tabs && gtk_widget_get_visible (page->child))
gtk_widget_show (page->tab_label);
else
gtk_widget_hide (page->tab_label);
@@ -4104,7 +4029,7 @@ gtk_notebook_insert_notebook_page (GtkNotebook *notebook,
{
gtk_notebook_switch_page (notebook, page);
/* focus_tab is set in the switch_page method */
- gtk_notebook_switch_focus_tab (notebook, priv->focus_tab);
+ gtk_notebook_switch_focus_tab (notebook, notebook->focus_tab);
}
g_object_notify (G_OBJECT (page), "tab-expand");
@@ -4112,7 +4037,7 @@ gtk_notebook_insert_notebook_page (GtkNotebook *notebook,
g_object_notify (G_OBJECT (page), "tab-label");
g_object_notify (G_OBJECT (page), "menu-label");
- list = g_list_nth (priv->children, position);
+ list = g_list_nth (notebook->children, position);
while (list)
{
g_object_notify (G_OBJECT (list->data), "position");
@@ -4121,8 +4046,8 @@ gtk_notebook_insert_notebook_page (GtkNotebook *notebook,
update_arrow_state (notebook);
- if (priv->pages)
- g_list_model_items_changed (priv->pages, position, 0, 1);
+ if (notebook->pages)
+ g_list_model_items_changed (notebook->pages, position, 0, 1);
/* The page-added handler might have reordered the pages, re-get the position */
return gtk_notebook_page_num (notebook, page->child);
@@ -4154,20 +4079,19 @@ gtk_notebook_real_insert_page (GtkNotebook *notebook,
static gboolean
gtk_notebook_timer (GtkNotebook *notebook)
{
- GtkNotebookPrivate *priv = notebook->priv;
gboolean retval = FALSE;
- if (priv->timer)
+ if (notebook->timer)
{
- gtk_notebook_do_arrow (notebook, priv->click_child);
+ gtk_notebook_do_arrow (notebook, notebook->click_child);
- if (priv->need_timer)
+ if (notebook->need_timer)
{
- priv->need_timer = FALSE;
- priv->timer = g_timeout_add (TIMEOUT_REPEAT * SCROLL_DELAY_FACTOR,
+ notebook->need_timer = FALSE;
+ notebook->timer = g_timeout_add (TIMEOUT_REPEAT * SCROLL_DELAY_FACTOR,
(GSourceFunc) gtk_notebook_timer,
notebook);
- g_source_set_name_by_id (priv->timer, "[gtk] gtk_notebook_timer");
+ g_source_set_name_by_id (notebook->timer, "[gtk] gtk_notebook_timer");
}
else
retval = TRUE;
@@ -4179,15 +4103,13 @@ gtk_notebook_timer (GtkNotebook *notebook)
static void
gtk_notebook_set_scroll_timer (GtkNotebook *notebook)
{
- GtkNotebookPrivate *priv = notebook->priv;
-
- if (!priv->timer)
+ if (!notebook->timer)
{
- priv->timer = g_timeout_add (TIMEOUT_INITIAL,
+ notebook->timer = g_timeout_add (TIMEOUT_INITIAL,
(GSourceFunc) gtk_notebook_timer,
notebook);
- g_source_set_name_by_id (priv->timer, "[gtk] gtk_notebook_timer");
- priv->need_timer = TRUE;
+ g_source_set_name_by_id (notebook->timer, "[gtk] gtk_notebook_timer");
+ notebook->need_timer = TRUE;
}
}
@@ -4202,7 +4124,7 @@ static GList*
gtk_notebook_find_child (GtkNotebook *notebook,
GtkWidget *child)
{
- return g_list_find_custom (notebook->priv->children,
+ return g_list_find_custom (notebook->children,
child,
gtk_notebook_page_compare);
}
@@ -4243,7 +4165,6 @@ static void
gtk_notebook_real_remove (GtkNotebook *notebook,
GList *list)
{
- GtkNotebookPrivate *priv = notebook->priv;
GtkNotebookPage *page;
GList * next_list;
gint need_resize = FALSE;
@@ -4259,29 +4180,29 @@ gtk_notebook_real_remove (GtkNotebook *notebook,
if (!next_list)
next_list = gtk_notebook_search_page (notebook, list, STEP_PREV, TRUE);
- priv->children = g_list_remove_link (priv->children, list);
+ notebook->children = g_list_remove_link (notebook->children, list);
- if (priv->cur_page == list->data)
+ if (notebook->cur_page == list->data)
{
- priv->cur_page = NULL;
+ notebook->cur_page = NULL;
if (next_list && !destroying)
gtk_notebook_switch_page (notebook, GTK_NOTEBOOK_PAGE_FROM_LIST (next_list));
- if (priv->operation == DRAG_OPERATION_REORDER && !priv->remove_in_detach)
+ if (notebook->operation == DRAG_OPERATION_REORDER && !notebook->remove_in_detach)
gtk_notebook_stop_reorder (notebook);
}
- if (priv->detached_tab == list->data)
- priv->detached_tab = NULL;
+ if (notebook->detached_tab == list->data)
+ notebook->detached_tab = NULL;
- if (priv->switch_page == page)
- priv->switch_page = NULL;
+ if (notebook->switch_page == page)
+ notebook->switch_page = NULL;
- if (list == priv->first_tab)
- priv->first_tab = next_list;
- if (list == priv->focus_tab && !destroying)
+ if (list == notebook->first_tab)
+ notebook->first_tab = next_list;
+ if (list == notebook->focus_tab && !destroying)
gtk_notebook_switch_focus_tab (notebook, next_list);
- position = g_list_index (priv->children, page);
+ position = g_list_index (notebook->children, page);
g_signal_handler_disconnect (page->child, page->notify_visible_handler);
@@ -4289,7 +4210,7 @@ gtk_notebook_real_remove (GtkNotebook *notebook,
gtk_widget_get_visible (GTK_WIDGET (notebook)))
need_resize = TRUE;
- gtk_container_remove (GTK_CONTAINER (priv->stack_widget), page->child);
+ gtk_container_remove (GTK_CONTAINER (notebook->stack_widget), page->child);
tab_label = page->tab_label;
if (tab_label)
@@ -4301,14 +4222,14 @@ gtk_notebook_real_remove (GtkNotebook *notebook,
g_object_unref (tab_label);
}
- if (priv->menu)
+ if (notebook->menu)
{
GtkWidget *parent = gtk_widget_get_parent (page->menu_label);
gtk_notebook_menu_label_unparent (parent, NULL);
- gtk_container_remove (GTK_CONTAINER (priv->menu), parent);
+ gtk_container_remove (GTK_CONTAINER (notebook->menu), parent);
- gtk_widget_queue_resize (priv->menu);
+ gtk_widget_queue_resize (notebook->menu);
}
g_list_free (list);
@@ -4327,20 +4248,19 @@ gtk_notebook_real_remove (GtkNotebook *notebook,
if (need_resize)
gtk_widget_queue_resize (GTK_WIDGET (notebook));
- if (priv->pages)
- g_list_model_items_changed (priv->pages, position, 1, 0);
+ if (notebook->pages)
+ g_list_model_items_changed (notebook->pages, position, 1, 0);
}
static void
gtk_notebook_update_labels (GtkNotebook *notebook)
{
- GtkNotebookPrivate *priv = notebook->priv;
GtkNotebookPage *page;
GList *list;
char string[32];
gint page_num = 1;
- if (!priv->show_tabs && !priv->menu)
+ if (!notebook->show_tabs && !notebook->menu)
return;
for (list = gtk_notebook_search_page (notebook, NULL, STEP_NEXT, FALSE);
@@ -4354,7 +4274,7 @@ gtk_notebook_update_labels (GtkNotebook *notebook)
text = page->tab_text;
else
text = string;
- if (priv->show_tabs)
+ if (notebook->show_tabs)
{
if (page->default_tab)
{
@@ -4372,7 +4292,7 @@ gtk_notebook_update_labels (GtkNotebook *notebook)
gtk_widget_set_visible (page->tab_label, gtk_widget_get_visible (page->child));
}
- if (priv->menu && page->default_menu)
+ if (notebook->menu && page->default_menu)
{
if (page->menu_text)
text = page->menu_text;
@@ -4391,7 +4311,6 @@ gtk_notebook_search_page (GtkNotebook *notebook,
gint direction,
gboolean find_visible)
{
- GtkNotebookPrivate *priv = notebook->priv;
GtkNotebookPage *page = NULL;
GList *old_list = NULL;
@@ -4406,7 +4325,7 @@ gtk_notebook_search_page (GtkNotebook *notebook,
list = list->next;
}
else
- list = priv->children;
+ list = notebook->children;
while (list)
{
@@ -4444,7 +4363,6 @@ gtk_notebook_snapshot_tabs (GtkGizmo *gizmo,
{
GtkWidget *widget = gtk_widget_get_parent (GTK_WIDGET (gizmo));
GtkNotebook *notebook = GTK_NOTEBOOK (gtk_widget_get_parent (widget));
- GtkNotebookPrivate *priv = notebook->priv;
GtkNotebookPage *page;
GList *children;
gboolean showarrow;
@@ -4460,11 +4378,11 @@ gtk_notebook_snapshot_tabs (GtkGizmo *gizmo,
if (!gtk_notebook_has_current_page (notebook))
return;
- if (!priv->first_tab)
- priv->first_tab = priv->children;
+ if (!notebook->first_tab)
+ notebook->first_tab = notebook->children;
- if (!NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, priv->cur_page) ||
- !gtk_widget_get_mapped (priv->cur_page->tab_label))
+ if (!NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, notebook->cur_page) ||
+ !gtk_widget_get_mapped (notebook->cur_page->tab_label))
{
step = STEP_PREV;
}
@@ -4486,12 +4404,12 @@ gtk_notebook_snapshot_tabs (GtkGizmo *gizmo,
}
}
- for (children = priv->children; children; children = children->next)
+ for (children = notebook->children; children; children = children->next)
{
page = children->data;
if (!gtk_widget_get_visible (page->child) ||
- page == priv->detached_tab)
+ page == notebook->detached_tab)
continue;
if (!gtk_widget_get_mapped (page->tab_label))
@@ -4508,7 +4426,7 @@ gtk_notebook_snapshot_tabs (GtkGizmo *gizmo,
{
page = children->data;
- if (page == priv->cur_page)
+ if (page == notebook->cur_page)
break;
if (!gtk_notebook_page_tab_label_is_visible (page))
@@ -4543,19 +4461,19 @@ gtk_notebook_snapshot_tabs (GtkGizmo *gizmo,
g_list_free (other_order);
}
- if (showarrow && priv->scrollable)
+ if (showarrow && notebook->scrollable)
{
for (i = 0; i < 4; i++)
{
- if (priv->arrow_widget[i] == NULL)
+ if (notebook->arrow_widget[i] == NULL)
continue;
- gtk_widget_snapshot_child (GTK_WIDGET (gizmo), priv->arrow_widget[i], snapshot);
+ gtk_widget_snapshot_child (GTK_WIDGET (gizmo), notebook->arrow_widget[i], snapshot);
}
}
- if (priv->operation != DRAG_OPERATION_DETACH)
- gtk_widget_snapshot_child (GTK_WIDGET (gizmo), priv->cur_page->tab_widget, snapshot);
+ if (notebook->operation != DRAG_OPERATION_DETACH)
+ gtk_widget_snapshot_child (GTK_WIDGET (gizmo), notebook->cur_page->tab_widget, snapshot);
}
/* Private GtkNotebook Size Allocate Functions:
@@ -4568,12 +4486,11 @@ static void
gtk_notebook_allocate_arrows (GtkNotebook *notebook,
GtkAllocation *allocation)
{
- GtkNotebookPrivate *priv = notebook->priv;
GtkAllocation arrow_allocation;
gint size1, size2, min, nat;
guint i, ii;
- switch (priv->tab_pos)
+ switch (notebook->tab_pos)
{
case GTK_POS_TOP:
case GTK_POS_BOTTOM:
@@ -4583,10 +4500,10 @@ gtk_notebook_allocate_arrows (GtkNotebook *notebook,
{
ii = i < 2 ? i : i ^ 1;
- if (priv->arrow_widget[ii] == NULL)
+ if (notebook->arrow_widget[ii] == NULL)
continue;
- gtk_widget_measure (priv->arrow_widget[ii],
+ gtk_widget_measure (notebook->arrow_widget[ii],
GTK_ORIENTATION_HORIZONTAL,
allocation->height,
&min, &nat,
@@ -4595,7 +4512,7 @@ gtk_notebook_allocate_arrows (GtkNotebook *notebook,
{
arrow_allocation.x = allocation->x;
arrow_allocation.width = min;
- gtk_widget_size_allocate (priv->arrow_widget[ii],
+ gtk_widget_size_allocate (notebook->arrow_widget[ii],
&arrow_allocation,
-1);
allocation->x += min;
@@ -4605,7 +4522,7 @@ gtk_notebook_allocate_arrows (GtkNotebook *notebook,
{
arrow_allocation.x = allocation->x + allocation->width - min;
arrow_allocation.width = min;
- gtk_widget_size_allocate (priv->arrow_widget[ii],
+ gtk_widget_size_allocate (notebook->arrow_widget[ii],
&arrow_allocation,
-1);
allocation->width -= min;
@@ -4615,7 +4532,7 @@ gtk_notebook_allocate_arrows (GtkNotebook *notebook,
case GTK_POS_LEFT:
case GTK_POS_RIGHT:
- if (priv->arrow_widget[0] || priv->arrow_widget[1])
+ if (notebook->arrow_widget[0] || notebook->arrow_widget[1])
{
gtk_notebook_measure_arrows (notebook,
GTK_PACK_START,
@@ -4628,16 +4545,16 @@ gtk_notebook_allocate_arrows (GtkNotebook *notebook,
arrow_allocation.y = allocation->y;
arrow_allocation.width = size1;
arrow_allocation.height = min;
- if (priv->arrow_widget[0])
- gtk_widget_size_allocate (priv->arrow_widget[0], &arrow_allocation, -1);
+ if (notebook->arrow_widget[0])
+ gtk_widget_size_allocate (notebook->arrow_widget[0], &arrow_allocation, -1);
arrow_allocation.x += size1;
arrow_allocation.width = size2;
- if (priv->arrow_widget[1])
- gtk_widget_size_allocate (priv->arrow_widget[1], &arrow_allocation, -1);
+ if (notebook->arrow_widget[1])
+ gtk_widget_size_allocate (notebook->arrow_widget[1], &arrow_allocation, -1);
allocation->y += min;
allocation->height -= min;
}
- if (priv->arrow_widget[2] || priv->arrow_widget[3])
+ if (notebook->arrow_widget[2] || notebook->arrow_widget[3])
{
gtk_notebook_measure_arrows (notebook,
GTK_PACK_END,
@@ -4650,12 +4567,12 @@ gtk_notebook_allocate_arrows (GtkNotebook *notebook,
arrow_allocation.y = allocation->y + allocation->height - min;
arrow_allocation.width = size1;
arrow_allocation.height = min;
- if (priv->arrow_widget[2])
- gtk_widget_size_allocate (priv->arrow_widget[2], &arrow_allocation, -1);
+ if (notebook->arrow_widget[2])
+ gtk_widget_size_allocate (notebook->arrow_widget[2], &arrow_allocation, -1);
arrow_allocation.x += size1;
arrow_allocation.width = size2;
- if (priv->arrow_widget[3])
- gtk_widget_size_allocate (priv->arrow_widget[3], &arrow_allocation, -1);
+ if (notebook->arrow_widget[3])
+ gtk_widget_size_allocate (notebook->arrow_widget[3], &arrow_allocation, -1);
allocation->height -= min;
}
break;
@@ -4675,11 +4592,10 @@ gtk_notebook_tab_space (GtkNotebook *notebook,
GtkAllocation *tabs_allocation,
gint *tab_space)
{
- GtkNotebookPrivate *priv = notebook->priv;
GList *children;
GtkPositionType tab_pos = get_effective_tab_pos (notebook);
- children = priv->children;
+ children = notebook->children;
*tabs_allocation = (GtkAllocation) {0, 0, notebook_width, notebook_height};
@@ -4719,7 +4635,7 @@ gtk_notebook_tab_space (GtkNotebook *notebook,
break;
}
- if (!priv->scrollable)
+ if (!notebook->scrollable)
*show_arrows = FALSE;
else
{
@@ -4764,7 +4680,6 @@ gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook,
gint *n,
gint *remaining_space)
{
- GtkNotebookPrivate *priv = notebook->priv;
GList *children;
GtkNotebookPage *page;
@@ -4772,20 +4687,20 @@ gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook,
{
*remaining_space = tab_space;
- if (NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, priv->cur_page) &&
- gtk_widget_get_visible (priv->cur_page->child))
+ if (NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, notebook->cur_page) &&
+ gtk_widget_get_visible (notebook->cur_page->child))
{
gtk_notebook_calc_tabs (notebook,
- priv->focus_tab,
- &(priv->focus_tab),
+ notebook->focus_tab,
+ &(notebook->focus_tab),
remaining_space, STEP_NEXT);
}
if (tab_space <= 0 || *remaining_space <= 0)
{
/* show 1 tab */
- priv->first_tab = priv->focus_tab;
- *last_child = gtk_notebook_search_page (notebook, priv->focus_tab,
+ notebook->first_tab = notebook->focus_tab;
+ *last_child = gtk_notebook_search_page (notebook, notebook->focus_tab,
STEP_NEXT, TRUE);
*n = 1;
}
@@ -4793,14 +4708,14 @@ gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook,
{
children = NULL;
- if (priv->first_tab && priv->first_tab != priv->focus_tab)
+ if (notebook->first_tab && notebook->first_tab != notebook->focus_tab)
{
/* Is first_tab really predecessor of focus_tab? */
- page = priv->first_tab->data;
+ page = notebook->first_tab->data;
if (NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, page) &&
gtk_widget_get_visible (page->child))
- for (children = priv->focus_tab;
- children && children != priv->first_tab;
+ for (children = notebook->focus_tab;
+ children && children != notebook->first_tab;
children = gtk_notebook_search_page (notebook,
children,
STEP_PREV,
@@ -4809,45 +4724,45 @@ gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook,
if (!children)
{
- if (NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, priv->cur_page))
- priv->first_tab = priv->focus_tab;
+ if (NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, notebook->cur_page))
+ notebook->first_tab = notebook->focus_tab;
else
- priv->first_tab = gtk_notebook_search_page (notebook, priv->focus_tab,
+ notebook->first_tab = gtk_notebook_search_page (notebook, notebook->focus_tab,
STEP_NEXT, TRUE);
}
else
/* calculate shown tabs counting backwards from the focus tab */
gtk_notebook_calc_tabs (notebook,
gtk_notebook_search_page (notebook,
- priv->focus_tab,
+ notebook->focus_tab,
STEP_PREV,
TRUE),
- &(priv->first_tab),
+ &(notebook->first_tab),
remaining_space,
STEP_PREV);
if (*remaining_space < 0)
{
- priv->first_tab =
- gtk_notebook_search_page (notebook, priv->first_tab,
+ notebook->first_tab =
+ gtk_notebook_search_page (notebook, notebook->first_tab,
STEP_NEXT, TRUE);
- if (!priv->first_tab)
- priv->first_tab = priv->focus_tab;
+ if (!notebook->first_tab)
+ notebook->first_tab = notebook->focus_tab;
- *last_child = gtk_notebook_search_page (notebook, priv->focus_tab,
+ *last_child = gtk_notebook_search_page (notebook, notebook->focus_tab,
STEP_NEXT, TRUE);
}
else /* focus_tab -> end */
{
- if (!priv->first_tab)
- priv->first_tab = gtk_notebook_search_page (notebook,
+ if (!notebook->first_tab)
+ notebook->first_tab = gtk_notebook_search_page (notebook,
NULL,
STEP_NEXT,
TRUE);
children = NULL;
gtk_notebook_calc_tabs (notebook,
gtk_notebook_search_page (notebook,
- priv->focus_tab,
+ notebook->focus_tab,
STEP_NEXT,
TRUE),
&children,
@@ -4863,7 +4778,7 @@ gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook,
gtk_notebook_calc_tabs (notebook,
gtk_notebook_search_page (notebook,
- priv->first_tab,
+ notebook->first_tab,
STEP_PREV,
TRUE),
&children,
@@ -4871,9 +4786,9 @@ gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook,
STEP_PREV);
if (*remaining_space == 0)
- priv->first_tab = children;
+ notebook->first_tab = children;
else
- priv->first_tab = gtk_notebook_search_page(notebook,
+ notebook->first_tab = gtk_notebook_search_page(notebook,
children,
STEP_NEXT,
TRUE);
@@ -4886,7 +4801,7 @@ gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook,
*remaining_space = - (*remaining_space);
*n = 0;
- for (children = priv->first_tab;
+ for (children = notebook->first_tab;
children && children != *last_child;
children = gtk_notebook_search_page (notebook, children,
STEP_NEXT, TRUE))
@@ -4899,7 +4814,7 @@ gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook,
/* unmap all non-visible tabs */
for (children = gtk_notebook_search_page (notebook, NULL,
STEP_NEXT, TRUE);
- children && children != priv->first_tab;
+ children && children != notebook->first_tab;
children = gtk_notebook_search_page (notebook, children,
STEP_NEXT, TRUE))
{
@@ -4927,7 +4842,7 @@ gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook,
gint c = 0;
*n = 0;
- if (priv->tab_pos == GTK_POS_TOP || priv->tab_pos == GTK_POS_BOTTOM)
+ if (notebook->tab_pos == GTK_POS_TOP || notebook->tab_pos == GTK_POS_BOTTOM)
{
tab_expand_orientation = GTK_ORIENTATION_HORIZONTAL;
*remaining_space = tabs_allocation->width - tab_space;
@@ -4937,8 +4852,8 @@ gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook,
tab_expand_orientation = GTK_ORIENTATION_VERTICAL;
*remaining_space = tabs_allocation->height - tab_space;
}
- children = priv->children;
- priv->first_tab = gtk_notebook_search_page (notebook, NULL,
+ children = notebook->children;
+ notebook->first_tab = gtk_notebook_search_page (notebook, NULL,
STEP_NEXT, TRUE);
while (children)
{
@@ -4994,7 +4909,6 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook *notebook,
gint *expanded_tabs,
const GtkAllocation *allocation)
{
- GtkNotebookPrivate *priv = notebook->priv;
GtkWidget *widget;
GtkNotebookPage *page;
gboolean allocate_at_bottom;
@@ -5006,7 +4920,7 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook *notebook,
GtkOrientation tab_expand_orientation;
graphene_rect_t drag_bounds;
- g_assert (priv->cur_page != NULL);
+ g_assert (notebook->cur_page != NULL);
widget = GTK_WIDGET (notebook);
tab_pos = get_effective_tab_pos (notebook);
@@ -5036,18 +4950,18 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook *notebook,
break;
}
- if (!gtk_widget_compute_bounds (priv->cur_page->tab_widget, priv->cur_page->tab_widget, &drag_bounds))
+ if (!gtk_widget_compute_bounds (notebook->cur_page->tab_widget, notebook->cur_page->tab_widget, &drag_bounds))
graphene_rect_init_from_rect (&drag_bounds, graphene_rect_zero ());
- left_x = CLAMP (priv->mouse_x - priv->drag_offset_x,
+ left_x = CLAMP (notebook->mouse_x - notebook->drag_offset_x,
allocation->x, allocation->x + allocation->width - drag_bounds.size.width);
- top_y = CLAMP (priv->mouse_y - priv->drag_offset_y,
+ top_y = CLAMP (notebook->mouse_y - notebook->drag_offset_y,
allocation->y, allocation->y + allocation->height - drag_bounds.size.height);
right_x = left_x + drag_bounds.size.width;
bottom_y = top_y + drag_bounds.size.height;
gap_left = packing_changed = FALSE;
- if (priv->tab_pos == GTK_POS_TOP || priv->tab_pos == GTK_POS_BOTTOM)
+ if (notebook->tab_pos == GTK_POS_TOP || notebook->tab_pos == GTK_POS_BOTTOM)
tab_expand_orientation = GTK_ORIENTATION_HORIZONTAL;
else
tab_expand_orientation = GTK_ORIENTATION_VERTICAL;
@@ -5082,14 +4996,14 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook *notebook,
child_allocation.width = MAX (1, page->requisition.width + tab_extra_space);
/* make sure that the reordered tab doesn't go past the last position */
- if (priv->operation == DRAG_OPERATION_REORDER &&
+ if (notebook->operation == DRAG_OPERATION_REORDER &&
!gap_left && packing_changed)
{
if (!allocate_at_bottom)
{
if (left_x >= anchor)
{
- left_x = priv->drag_surface_x = anchor;
+ left_x = notebook->drag_surface_x = anchor;
anchor += drag_bounds.size.width;
}
}
@@ -5098,24 +5012,24 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook *notebook,
if (right_x <= anchor)
{
anchor -= drag_bounds.size.width;
- left_x = priv->drag_surface_x = anchor;
+ left_x = notebook->drag_surface_x = anchor;
}
}
gap_left = TRUE;
}
- if (priv->operation == DRAG_OPERATION_REORDER && page == priv->cur_page)
+ if (notebook->operation == DRAG_OPERATION_REORDER && page == notebook->cur_page)
{
- priv->drag_surface_x = left_x;
- priv->drag_surface_y = child_allocation.y;
+ notebook->drag_surface_x = left_x;
+ notebook->drag_surface_y = child_allocation.y;
}
else
{
if (allocate_at_bottom)
anchor -= child_allocation.width;
- if (priv->operation == DRAG_OPERATION_REORDER)
+ if (notebook->operation == DRAG_OPERATION_REORDER)
{
if (!allocate_at_bottom &&
left_x >= anchor &&
@@ -5136,29 +5050,29 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook *notebook,
child_allocation.height = MAX (1, page->requisition.height + tab_extra_space);
/* make sure that the reordered tab doesn't go past the last position */
- if (priv->operation == DRAG_OPERATION_REORDER &&
+ if (notebook->operation == DRAG_OPERATION_REORDER &&
!gap_left && packing_changed)
{
if (!allocate_at_bottom && top_y >= anchor)
{
- top_y = priv->drag_surface_y = anchor;
+ top_y = notebook->drag_surface_y = anchor;
anchor += drag_bounds.size.height;
}
gap_left = TRUE;
}
- if (priv->operation == DRAG_OPERATION_REORDER && page == priv->cur_page)
+ if (notebook->operation == DRAG_OPERATION_REORDER && page == notebook->cur_page)
{
- priv->drag_surface_x = child_allocation.x;
- priv->drag_surface_y = top_y;
+ notebook->drag_surface_x = child_allocation.x;
+ notebook->drag_surface_y = top_y;
}
else
{
if (allocate_at_bottom)
anchor -= child_allocation.height;
- if (priv->operation == DRAG_OPERATION_REORDER)
+ if (notebook->operation == DRAG_OPERATION_REORDER)
{
if (!allocate_at_bottom &&
top_y >= anchor &&
@@ -5183,13 +5097,13 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook *notebook,
if (page->tab_label)
gtk_widget_set_child_visible (page->tab_widget, TRUE);
- if (page == priv->cur_page && priv->operation == DRAG_OPERATION_REORDER)
+ if (page == notebook->cur_page && notebook->operation == DRAG_OPERATION_REORDER)
{
- GtkAllocation fixed_allocation = { priv->drag_surface_x, priv->drag_surface_y,
+ GtkAllocation fixed_allocation = { notebook->drag_surface_x, notebook->drag_surface_y,
child_allocation.width, child_allocation.height };
gtk_widget_size_allocate (page->tab_widget, &fixed_allocation, -1);
}
- else if (page == priv->detached_tab && priv->operation == DRAG_OPERATION_DETACH)
+ else if (page == notebook->detached_tab && notebook->operation == DRAG_OPERATION_DETACH)
{
/* needs to be allocated at 0,0
* to be shown in the drag window */
@@ -5206,9 +5120,9 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook *notebook,
{
case GTK_POS_TOP:
case GTK_POS_BOTTOM:
- if (priv->operation != DRAG_OPERATION_REORDER || page != priv->cur_page)
+ if (notebook->operation != DRAG_OPERATION_REORDER || page != notebook->cur_page)
{
- if (priv->operation == DRAG_OPERATION_REORDER)
+ if (notebook->operation == DRAG_OPERATION_REORDER)
{
if (!allocate_at_bottom &&
left_x > anchor + child_allocation.width / 2 &&
@@ -5227,9 +5141,9 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook *notebook,
break;
case GTK_POS_LEFT:
case GTK_POS_RIGHT:
- if (priv->operation != DRAG_OPERATION_REORDER || page != priv->cur_page)
+ if (notebook->operation != DRAG_OPERATION_REORDER || page != notebook->cur_page)
{
- if (priv->operation == DRAG_OPERATION_REORDER)
+ if (notebook->operation == DRAG_OPERATION_REORDER)
{
if (!allocate_at_bottom &&
top_y >= anchor + child_allocation.height / 2 &&
@@ -5253,7 +5167,7 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook *notebook,
}
/* Don't move the current tab past the last position during tabs reordering */
- if (priv->operation == DRAG_OPERATION_REORDER &&
+ if (notebook->operation == DRAG_OPERATION_REORDER &&
direction == STEP_NEXT)
{
switch (tab_pos)
@@ -5263,18 +5177,18 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook *notebook,
if (allocate_at_bottom)
anchor -= drag_bounds.size.width;
- if ((!allocate_at_bottom && priv->drag_surface_x > anchor) ||
- (allocate_at_bottom && priv->drag_surface_x < anchor))
- priv->drag_surface_x = anchor;
+ if ((!allocate_at_bottom && notebook->drag_surface_x > anchor) ||
+ (allocate_at_bottom && notebook->drag_surface_x < anchor))
+ notebook->drag_surface_x = anchor;
break;
case GTK_POS_LEFT:
case GTK_POS_RIGHT:
if (allocate_at_bottom)
anchor -= drag_bounds.size.height;
- if ((!allocate_at_bottom && priv->drag_surface_y > anchor) ||
- (allocate_at_bottom && priv->drag_surface_y < anchor))
- priv->drag_surface_y = anchor;
+ if ((!allocate_at_bottom && notebook->drag_surface_y > anchor) ||
+ (allocate_at_bottom && notebook->drag_surface_y < anchor))
+ notebook->drag_surface_y = anchor;
break;
default:
g_assert_not_reached ();
@@ -5288,7 +5202,6 @@ gtk_notebook_pages_allocate (GtkNotebook *notebook,
int width,
int height)
{
- GtkNotebookPrivate *priv = notebook->priv;
GList *children = NULL;
GList *last_child = NULL;
gboolean showarrow = FALSE;
@@ -5296,7 +5209,7 @@ gtk_notebook_pages_allocate (GtkNotebook *notebook,
gint tab_space, remaining_space;
gint expanded_tabs;
- if (!priv->show_tabs || !gtk_notebook_has_current_page (notebook))
+ if (!notebook->show_tabs || !gtk_notebook_has_current_page (notebook))
return;
tab_space = remaining_space = 0;
@@ -5309,20 +5222,20 @@ gtk_notebook_pages_allocate (GtkNotebook *notebook,
&tabs_allocation, tab_space, &last_child,
&expanded_tabs, &remaining_space);
- children = priv->first_tab;
+ children = notebook->first_tab;
gtk_notebook_calculate_tabs_allocation (notebook, &children, last_child,
showarrow, STEP_NEXT,
&remaining_space, &expanded_tabs, &tabs_allocation);
if (children && children != last_child)
{
- children = priv->children;
+ children = notebook->children;
gtk_notebook_calculate_tabs_allocation (notebook, &children, last_child,
showarrow, STEP_PREV,
&remaining_space, &expanded_tabs, &tabs_allocation);
}
- if (!priv->first_tab)
- priv->first_tab = priv->children;
+ if (!notebook->first_tab)
+ notebook->first_tab = notebook->children;
}
static void
@@ -5422,37 +5335,36 @@ gtk_notebook_real_switch_page (GtkNotebook *notebook,
GtkWidget* child,
guint page_num)
{
- GtkNotebookPrivate *priv = notebook->priv;
GList *list = gtk_notebook_find_child (notebook, GTK_WIDGET (child));
GtkNotebookPage *page = GTK_NOTEBOOK_PAGE_FROM_LIST (list);
gboolean child_has_focus;
- if (priv->cur_page == page || !gtk_widget_get_visible (GTK_WIDGET (child)))
+ if (notebook->cur_page == page || !gtk_widget_get_visible (GTK_WIDGET (child)))
return;
/* save the value here, changing visibility changes focus */
- child_has_focus = priv->child_has_focus;
+ child_has_focus = notebook->child_has_focus;
- if (priv->cur_page)
+ if (notebook->cur_page)
{
GtkRoot *root = gtk_widget_get_root (GTK_WIDGET (notebook));
GtkWidget *focus = gtk_root_get_focus (root);
if (focus)
- child_has_focus = gtk_widget_is_ancestor (focus, priv->cur_page->child);
- gtk_widget_unset_state_flags (priv->cur_page->tab_widget, GTK_STATE_FLAG_CHECKED);
+ child_has_focus = gtk_widget_is_ancestor (focus, notebook->cur_page->child);
+ gtk_widget_unset_state_flags (notebook->cur_page->tab_widget, GTK_STATE_FLAG_CHECKED);
}
- priv->cur_page = page;
+ notebook->cur_page = page;
gtk_widget_set_state_flags (page->tab_widget, GTK_STATE_FLAG_CHECKED, FALSE);
- gtk_widget_set_visible (priv->header_widget, priv->show_tabs);
+ gtk_widget_set_visible (notebook->header_widget, notebook->show_tabs);
- if (!priv->focus_tab ||
- priv->focus_tab->data != (gpointer) priv->cur_page)
- priv->focus_tab =
- g_list_find (priv->children, priv->cur_page);
+ if (!notebook->focus_tab ||
+ notebook->focus_tab->data != (gpointer) notebook->cur_page)
+ notebook->focus_tab =
+ g_list_find (notebook->children, notebook->cur_page);
- gtk_stack_set_visible_child (GTK_STACK (priv->stack_widget), priv->cur_page->child);
- gtk_widget_set_child_visible (priv->cur_page->tab_widget, TRUE);
+ gtk_stack_set_visible_child (GTK_STACK (notebook->stack_widget), notebook->cur_page->child);
+ gtk_widget_set_child_visible (notebook->cur_page->tab_widget, TRUE);
/* If the focus was on the previous page, move it to the first
* element on the new page, if possible, or if not, to the
@@ -5460,18 +5372,18 @@ gtk_notebook_real_switch_page (GtkNotebook *notebook,
*/
if (child_has_focus)
{
- if (priv->cur_page->last_focus_child &&
- gtk_widget_is_ancestor (priv->cur_page->last_focus_child, priv->cur_page->child))
- gtk_widget_grab_focus (priv->cur_page->last_focus_child);
+ if (notebook->cur_page->last_focus_child &&
+ gtk_widget_is_ancestor (notebook->cur_page->last_focus_child, notebook->cur_page->child))
+ gtk_widget_grab_focus (notebook->cur_page->last_focus_child);
else
- if (!gtk_widget_child_focus (priv->cur_page->child, GTK_DIR_TAB_FORWARD))
+ if (!gtk_widget_child_focus (notebook->cur_page->child, GTK_DIR_TAB_FORWARD))
gtk_widget_grab_focus (GTK_WIDGET (notebook));
}
update_arrow_state (notebook);
gtk_widget_queue_resize (GTK_WIDGET (notebook));
- gtk_widget_queue_resize (priv->tabs_widget);
+ gtk_widget_queue_resize (notebook->tabs_widget);
g_object_notify_by_pspec (G_OBJECT (notebook), properties[PROP_PAGE]);
}
@@ -5486,13 +5398,12 @@ static void
gtk_notebook_switch_page (GtkNotebook *notebook,
GtkNotebookPage *page)
{
- GtkNotebookPrivate *priv = notebook->priv;
guint page_num;
- if (priv->cur_page == page)
+ if (notebook->cur_page == page)
return;
- page_num = g_list_index (priv->children, page);
+ page_num = g_list_index (notebook->children, page);
g_signal_emit (notebook,
notebook_signals[SWITCH_PAGE],
@@ -5505,15 +5416,14 @@ static gint
gtk_notebook_page_select (GtkNotebook *notebook,
gboolean move_focus)
{
- GtkNotebookPrivate *priv = notebook->priv;
GtkNotebookPage *page;
GtkDirectionType dir;
GtkPositionType tab_pos = get_effective_tab_pos (notebook);
- if (!priv->focus_tab)
+ if (!notebook->focus_tab)
return FALSE;
- page = priv->focus_tab->data;
+ page = notebook->focus_tab->data;
gtk_notebook_switch_page (notebook, page);
if (move_focus)
@@ -5548,18 +5458,17 @@ static void
gtk_notebook_switch_focus_tab (GtkNotebook *notebook,
GList *new_child)
{
- GtkNotebookPrivate *priv = notebook->priv;
GtkNotebookPage *page;
- if (priv->focus_tab == new_child)
+ if (notebook->focus_tab == new_child)
return;
- priv->focus_tab = new_child;
+ notebook->focus_tab = new_child;
- if (!priv->show_tabs || !priv->focus_tab)
+ if (!notebook->show_tabs || !notebook->focus_tab)
return;
- page = priv->focus_tab->data;
+ page = notebook->focus_tab->data;
gtk_notebook_switch_page (notebook, page);
}
@@ -5567,21 +5476,19 @@ static void
gtk_notebook_menu_switch_page (GtkWidget *widget,
GtkNotebookPage *page)
{
- GtkNotebookPrivate *priv;
GtkNotebook *notebook;
GList *children;
guint page_num;
notebook = GTK_NOTEBOOK (gtk_widget_get_ancestor (widget, GTK_TYPE_NOTEBOOK));
- priv = notebook->priv;
- gtk_popover_popdown (GTK_POPOVER (priv->menu));
+ gtk_popover_popdown (GTK_POPOVER (notebook->menu));
- if (priv->cur_page == page)
+ if (notebook->cur_page == page)
return;
page_num = 0;
- children = priv->children;
+ children = notebook->children;
while (children && children->data != page)
{
children = children->next;
@@ -5605,7 +5512,6 @@ static void
gtk_notebook_menu_item_create (GtkNotebook *notebook,
GtkNotebookPage *page)
{
- GtkNotebookPrivate *priv = notebook->priv;
GtkWidget *menu_item;
if (page->default_menu)
@@ -5622,7 +5528,7 @@ gtk_notebook_menu_item_create (GtkNotebook *notebook,
menu_item = gtk_button_new ();
gtk_button_set_relief (GTK_BUTTON (menu_item), GTK_RELIEF_NONE);
gtk_container_add (GTK_CONTAINER (menu_item), page->menu_label);
- gtk_container_add (GTK_CONTAINER (priv->menu_box), menu_item);
+ gtk_container_add (GTK_CONTAINER (notebook->menu_box), menu_item);
g_signal_connect (menu_item, "clicked",
G_CALLBACK (gtk_notebook_menu_switch_page), page);
if (!gtk_widget_get_visible (page->child))
@@ -5633,12 +5539,11 @@ static void
gtk_notebook_menu_item_recreate (GtkNotebook *notebook,
GList *list)
{
- GtkNotebookPrivate *priv = notebook->priv;
GtkNotebookPage *page = list->data;
GtkWidget *menu_item = gtk_widget_get_parent (page->menu_label);
gtk_container_remove (GTK_CONTAINER (menu_item), page->menu_label);
- gtk_container_remove (GTK_CONTAINER (priv->menu), menu_item);
+ gtk_container_remove (GTK_CONTAINER (notebook->menu), menu_item);
gtk_notebook_menu_item_create (notebook, page);
}
@@ -5815,10 +5720,9 @@ gtk_notebook_mnemonic_activate_switch_page (GtkWidget *child,
gpointer data)
{
GtkNotebook *notebook = GTK_NOTEBOOK (data);
- GtkNotebookPrivate *priv = notebook->priv;
GList *list;
- list = g_list_find_custom (priv->children, child,
+ list = g_list_find_custom (notebook->children, child,
gtk_notebook_page_compare_tab);
if (list)
{
@@ -5885,17 +5789,14 @@ void
gtk_notebook_remove_page (GtkNotebook *notebook,
gint page_num)
{
- GtkNotebookPrivate *priv;
GList *list = NULL;
g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
- priv = notebook->priv;
-
if (page_num >= 0)
- list = g_list_nth (priv->children, page_num);
+ list = g_list_nth (notebook->children, page_num);
else
- list = g_list_last (priv->children);
+ list = g_list_last (notebook->children);
if (list)
gtk_container_remove (GTK_CONTAINER (notebook),
@@ -5922,16 +5823,12 @@ gtk_notebook_remove_page (GtkNotebook *notebook,
gint
gtk_notebook_get_current_page (GtkNotebook *notebook)
{
- GtkNotebookPrivate *priv;
-
g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), -1);
- priv = notebook->priv;
-
- if (!priv->cur_page)
+ if (!notebook->cur_page)
return -1;
- return g_list_index (priv->children, priv->cur_page);
+ return g_list_index (notebook->children, notebook->cur_page);
}
/**
@@ -5949,18 +5846,15 @@ GtkWidget*
gtk_notebook_get_nth_page (GtkNotebook *notebook,
gint page_num)
{
- GtkNotebookPrivate *priv;
GtkNotebookPage *page;
GList *list;
g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), NULL);
- priv = notebook->priv;
-
if (page_num >= 0)
- list = g_list_nth (priv->children, page_num);
+ list = g_list_nth (notebook->children, page_num);
else
- list = g_list_last (priv->children);
+ list = g_list_last (notebook->children);
if (list)
{
@@ -5982,13 +5876,9 @@ gtk_notebook_get_nth_page (GtkNotebook *notebook,
gint
gtk_notebook_get_n_pages (GtkNotebook *notebook)
{
- GtkNotebookPrivate *priv;
-
g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), 0);
- priv = notebook->priv;
-
- return g_list_length (priv->children);
+ return g_list_length (notebook->children);
}
/**
@@ -6006,16 +5896,13 @@ gint
gtk_notebook_page_num (GtkNotebook *notebook,
GtkWidget *child)
{
- GtkNotebookPrivate *priv;
GList *children;
gint num;
g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), -1);
- priv = notebook->priv;
-
num = 0;
- children = priv->children;
+ children = notebook->children;
while (children)
{
GtkNotebookPage *page = children->data;
@@ -6049,17 +5936,14 @@ void
gtk_notebook_set_current_page (GtkNotebook *notebook,
gint page_num)
{
- GtkNotebookPrivate *priv;
GList *list;
g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
- priv = notebook->priv;
-
if (page_num < 0)
- page_num = g_list_length (priv->children) - 1;
+ page_num = g_list_length (notebook->children) - 1;
- list = g_list_nth (priv->children, page_num);
+ list = g_list_nth (notebook->children, page_num);
if (list)
gtk_notebook_switch_page (notebook, GTK_NOTEBOOK_PAGE_FROM_LIST (list));
@@ -6076,14 +5960,11 @@ gtk_notebook_set_current_page (GtkNotebook *notebook,
void
gtk_notebook_next_page (GtkNotebook *notebook)
{
- GtkNotebookPrivate *priv;
GList *list;
g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
- priv = notebook->priv;
-
- list = g_list_find (priv->children, priv->cur_page);
+ list = g_list_find (notebook->children, notebook->cur_page);
if (!list)
return;
@@ -6104,14 +5985,11 @@ gtk_notebook_next_page (GtkNotebook *notebook)
void
gtk_notebook_prev_page (GtkNotebook *notebook)
{
- GtkNotebookPrivate *priv;
GList *list;
g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
- priv = notebook->priv;
-
- list = g_list_find (priv->children, priv->cur_page);
+ list = g_list_find (notebook->children, notebook->cur_page);
if (!list)
return;
@@ -6146,15 +6024,11 @@ void
gtk_notebook_set_show_border (GtkNotebook *notebook,
gboolean show_border)
{
- GtkNotebookPrivate *priv;
-
g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
- priv = notebook->priv;
-
- if (priv->show_border != show_border)
+ if (notebook->show_border != show_border)
{
- priv->show_border = show_border;
+ notebook->show_border = show_border;
if (show_border)
gtk_widget_add_css_class (GTK_WIDGET (notebook), GTK_STYLE_CLASS_FRAME);
@@ -6179,7 +6053,7 @@ gtk_notebook_get_show_border (GtkNotebook *notebook)
{
g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), FALSE);
- return notebook->priv->show_border;
+ return notebook->show_border;
}
/**
@@ -6193,22 +6067,19 @@ void
gtk_notebook_set_show_tabs (GtkNotebook *notebook,
gboolean show_tabs)
{
- GtkNotebookPrivate *priv;
GtkNotebookPage *page;
GList *children;
gint i;
g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
- priv = notebook->priv;
-
show_tabs = show_tabs != FALSE;
- if (priv->show_tabs == show_tabs)
+ if (notebook->show_tabs == show_tabs)
return;
- priv->show_tabs = show_tabs;
- children = priv->children;
+ notebook->show_tabs = show_tabs;
+ children = notebook->children;
if (!show_tabs)
{
@@ -6227,19 +6098,19 @@ gtk_notebook_set_show_tabs (GtkNotebook *notebook,
gtk_widget_hide (page->tab_label);
}
- gtk_widget_hide (priv->header_widget);
+ gtk_widget_hide (notebook->header_widget);
}
else
{
gtk_widget_set_can_focus (GTK_WIDGET (notebook), TRUE);
gtk_notebook_update_labels (notebook);
- gtk_widget_show (priv->header_widget);
+ gtk_widget_show (notebook->header_widget);
}
for (i = 0; i < N_ACTION_WIDGETS; i++)
{
- if (priv->action_widget[i])
- gtk_widget_set_child_visible (priv->action_widget[i], show_tabs);
+ if (notebook->action_widget[i])
+ gtk_widget_set_child_visible (notebook->action_widget[i], show_tabs);
}
gtk_notebook_update_tab_pos (notebook);
@@ -6262,13 +6133,12 @@ gtk_notebook_get_show_tabs (GtkNotebook *notebook)
{
g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), FALSE);
- return notebook->priv->show_tabs;
+ return notebook->show_tabs;
}
static void
gtk_notebook_update_tab_pos (GtkNotebook *notebook)
{
- GtkNotebookPrivate *priv = notebook->priv;
GtkLayoutManager *layout;
GtkPositionType tab_pos;
const char *tab_pos_names[] = {
@@ -6284,9 +6154,9 @@ gtk_notebook_update_tab_pos (GtkNotebook *notebook)
for (i = 0; i < G_N_ELEMENTS (tab_pos_names); i++)
{
if (tab_pos == i)
- gtk_widget_add_css_class (priv->header_widget, tab_pos_names[i]);
+ gtk_widget_add_css_class (notebook->header_widget, tab_pos_names[i]);
else
- gtk_widget_remove_css_class (priv->header_widget, tab_pos_names[i]);
+ gtk_widget_remove_css_class (notebook->header_widget, tab_pos_names[i]);
}
layout = gtk_widget_get_layout_manager (GTK_WIDGET (notebook));
@@ -6294,71 +6164,71 @@ gtk_notebook_update_tab_pos (GtkNotebook *notebook)
switch (tab_pos)
{
case GTK_POS_TOP:
- gtk_widget_set_hexpand (priv->tabs_widget, TRUE);
- gtk_widget_set_vexpand (priv->tabs_widget, FALSE);
- gtk_widget_set_hexpand (priv->header_widget, TRUE);
- gtk_widget_set_vexpand (priv->header_widget, FALSE);
- if (priv->show_tabs)
+ gtk_widget_set_hexpand (notebook->tabs_widget, TRUE);
+ gtk_widget_set_vexpand (notebook->tabs_widget, FALSE);
+ gtk_widget_set_hexpand (notebook->header_widget, TRUE);
+ gtk_widget_set_vexpand (notebook->header_widget, FALSE);
+ if (notebook->show_tabs)
{
- gtk_widget_insert_before (priv->header_widget, GTK_WIDGET (notebook), priv->stack_widget);
+ gtk_widget_insert_before (notebook->header_widget, GTK_WIDGET (notebook), notebook->stack_widget);
gtk_css_node_insert_before (gtk_widget_get_css_node (GTK_WIDGET (notebook)),
- gtk_widget_get_css_node (priv->header_widget),
- gtk_widget_get_css_node (priv->stack_widget));
+ gtk_widget_get_css_node (notebook->header_widget),
+ gtk_widget_get_css_node (notebook->stack_widget));
}
gtk_orientable_set_orientation (GTK_ORIENTABLE (layout), GTK_ORIENTATION_VERTICAL);
- gtk_orientable_set_orientation (GTK_ORIENTABLE (priv->header_widget), GTK_ORIENTATION_HORIZONTAL);
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (notebook->header_widget), GTK_ORIENTATION_HORIZONTAL);
break;
case GTK_POS_BOTTOM:
- gtk_widget_set_hexpand (priv->tabs_widget, TRUE);
- gtk_widget_set_vexpand (priv->tabs_widget, FALSE);
- gtk_widget_set_hexpand (priv->header_widget, TRUE);
- gtk_widget_set_vexpand (priv->header_widget, FALSE);
- if (priv->show_tabs)
+ gtk_widget_set_hexpand (notebook->tabs_widget, TRUE);
+ gtk_widget_set_vexpand (notebook->tabs_widget, FALSE);
+ gtk_widget_set_hexpand (notebook->header_widget, TRUE);
+ gtk_widget_set_vexpand (notebook->header_widget, FALSE);
+ if (notebook->show_tabs)
{
- gtk_widget_insert_after (priv->header_widget, GTK_WIDGET (notebook), priv->stack_widget);
+ gtk_widget_insert_after (notebook->header_widget, GTK_WIDGET (notebook), notebook->stack_widget);
gtk_css_node_insert_after (gtk_widget_get_css_node (GTK_WIDGET (notebook)),
- gtk_widget_get_css_node (priv->header_widget),
- gtk_widget_get_css_node (priv->stack_widget));
+ gtk_widget_get_css_node (notebook->header_widget),
+ gtk_widget_get_css_node (notebook->stack_widget));
}
gtk_orientable_set_orientation (GTK_ORIENTABLE (layout), GTK_ORIENTATION_VERTICAL);
- gtk_orientable_set_orientation (GTK_ORIENTABLE (priv->header_widget), GTK_ORIENTATION_HORIZONTAL);
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (notebook->header_widget), GTK_ORIENTATION_HORIZONTAL);
break;
case GTK_POS_LEFT:
- gtk_widget_set_hexpand (priv->tabs_widget, FALSE);
- gtk_widget_set_vexpand (priv->tabs_widget, TRUE);
- gtk_widget_set_hexpand (priv->header_widget, FALSE);
- gtk_widget_set_vexpand (priv->header_widget, TRUE);
- if (priv->show_tabs)
+ gtk_widget_set_hexpand (notebook->tabs_widget, FALSE);
+ gtk_widget_set_vexpand (notebook->tabs_widget, TRUE);
+ gtk_widget_set_hexpand (notebook->header_widget, FALSE);
+ gtk_widget_set_vexpand (notebook->header_widget, TRUE);
+ if (notebook->show_tabs)
{
- gtk_widget_insert_before (priv->header_widget, GTK_WIDGET (notebook), priv->stack_widget);
+ gtk_widget_insert_before (notebook->header_widget, GTK_WIDGET (notebook), notebook->stack_widget);
gtk_css_node_insert_before (gtk_widget_get_css_node (GTK_WIDGET (notebook)),
- gtk_widget_get_css_node (priv->header_widget),
- gtk_widget_get_css_node (priv->stack_widget));
+ gtk_widget_get_css_node (notebook->header_widget),
+ gtk_widget_get_css_node (notebook->stack_widget));
}
gtk_orientable_set_orientation (GTK_ORIENTABLE (layout), GTK_ORIENTATION_HORIZONTAL);
- gtk_orientable_set_orientation (GTK_ORIENTABLE (priv->header_widget), GTK_ORIENTATION_VERTICAL);
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (notebook->header_widget), GTK_ORIENTATION_VERTICAL);
break;
case GTK_POS_RIGHT:
- gtk_widget_set_hexpand (priv->tabs_widget, FALSE);
- gtk_widget_set_vexpand (priv->tabs_widget, TRUE);
- gtk_widget_set_hexpand (priv->header_widget, FALSE);
- gtk_widget_set_vexpand (priv->header_widget, TRUE);
- if (priv->show_tabs)
+ gtk_widget_set_hexpand (notebook->tabs_widget, FALSE);
+ gtk_widget_set_vexpand (notebook->tabs_widget, TRUE);
+ gtk_widget_set_hexpand (notebook->header_widget, FALSE);
+ gtk_widget_set_vexpand (notebook->header_widget, TRUE);
+ if (notebook->show_tabs)
{
- gtk_widget_insert_after (priv->header_widget, GTK_WIDGET (notebook), priv->stack_widget);
+ gtk_widget_insert_after (notebook->header_widget, GTK_WIDGET (notebook), notebook->stack_widget);
gtk_css_node_insert_after (gtk_widget_get_css_node (GTK_WIDGET (notebook)),
- gtk_widget_get_css_node (priv->header_widget),
- gtk_widget_get_css_node (priv->stack_widget));
+ gtk_widget_get_css_node (notebook->header_widget),
+ gtk_widget_get_css_node (notebook->stack_widget));
}
gtk_orientable_set_orientation (GTK_ORIENTABLE (layout), GTK_ORIENTATION_HORIZONTAL);
- gtk_orientable_set_orientation (GTK_ORIENTABLE (priv->header_widget), GTK_ORIENTATION_VERTICAL);
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (notebook->header_widget), GTK_ORIENTATION_VERTICAL);
break;
default:
g_assert_not_reached ();
@@ -6378,15 +6248,11 @@ void
gtk_notebook_set_tab_pos (GtkNotebook *notebook,
GtkPositionType pos)
{
- GtkNotebookPrivate *priv;
-
g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
- priv = notebook->priv;
-
- if (priv->tab_pos != pos)
+ if (notebook->tab_pos != pos)
{
- priv->tab_pos = pos;
+ notebook->tab_pos = pos;
gtk_widget_queue_resize (GTK_WIDGET (notebook));
gtk_notebook_update_tab_pos (notebook);
@@ -6409,7 +6275,7 @@ gtk_notebook_get_tab_pos (GtkNotebook *notebook)
{
g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), GTK_POS_TOP);
- return notebook->priv->tab_pos;
+ return notebook->tab_pos;
}
/**
@@ -6424,18 +6290,14 @@ void
gtk_notebook_set_scrollable (GtkNotebook *notebook,
gboolean scrollable)
{
- GtkNotebookPrivate *priv;
-
g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
- priv = notebook->priv;
-
scrollable = (scrollable != FALSE);
- if (priv->scrollable == scrollable)
+ if (notebook->scrollable == scrollable)
return;
- priv->scrollable = scrollable;
+ notebook->scrollable = scrollable;
update_arrow_nodes (notebook);
update_arrow_state (notebook);
@@ -6459,7 +6321,7 @@ gtk_notebook_get_scrollable (GtkNotebook *notebook)
{
g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), FALSE);
- return notebook->priv->scrollable;
+ return notebook->scrollable;
}
@@ -6481,21 +6343,18 @@ gtk_notebook_get_scrollable (GtkNotebook *notebook)
void
gtk_notebook_popup_enable (GtkNotebook *notebook)
{
- GtkNotebookPrivate *priv;
GList *list;
g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
- priv = notebook->priv;
-
- if (priv->menu)
+ if (notebook->menu)
return;
- priv->menu = gtk_popover_menu_new ();
- gtk_widget_set_parent (priv->menu, priv->tabs_widget);
+ notebook->menu = gtk_popover_menu_new ();
+ gtk_widget_set_parent (notebook->menu, notebook->tabs_widget);
- priv->menu_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_popover_menu_add_submenu (GTK_POPOVER_MENU (priv->menu), priv->menu_box, "main");
+ notebook->menu_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+ gtk_popover_menu_add_submenu (GTK_POPOVER_MENU (notebook->menu), notebook->menu_box, "main");
for (list = gtk_notebook_search_page (notebook, NULL, STEP_NEXT, FALSE);
list;
@@ -6516,20 +6375,16 @@ gtk_notebook_popup_enable (GtkNotebook *notebook)
void
gtk_notebook_popup_disable (GtkNotebook *notebook)
{
- GtkNotebookPrivate *priv;
-
g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
- priv = notebook->priv;
-
- if (!priv->menu)
+ if (!notebook->menu)
return;
- gtk_container_foreach (GTK_CONTAINER (priv->menu_box),
+ gtk_container_foreach (GTK_CONTAINER (notebook->menu_box),
(GtkCallback) gtk_notebook_menu_label_unparent, NULL);
- gtk_widget_destroy (priv->menu);
- priv->menu = NULL;
- priv->menu_box = NULL;
+ gtk_widget_destroy (notebook->menu);
+ notebook->menu = NULL;
+ notebook->menu_box = NULL;
g_object_notify_by_pspec (G_OBJECT (notebook), properties[PROP_ENABLE_POPUP]);
}
@@ -6594,15 +6449,12 @@ gtk_notebook_set_tab_label (GtkNotebook *notebook,
GtkWidget *child,
GtkWidget *tab_label)
{
- GtkNotebookPrivate *priv;
GtkNotebookPage *page;
GList *list;
g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
g_return_if_fail (GTK_IS_WIDGET (child));
- priv = notebook->priv;
-
list = gtk_notebook_find_child (notebook, child);
g_return_if_fail (list != NULL);
@@ -6628,12 +6480,12 @@ gtk_notebook_set_tab_label (GtkNotebook *notebook,
page->default_tab = TRUE;
page->tab_label = NULL;
- if (priv->show_tabs)
+ if (notebook->show_tabs)
{
gchar string[32];
g_snprintf (string, sizeof(string), _("Page %u"),
- g_list_position (priv->children, list));
+ g_list_position (notebook->children, list));
page->tab_label = gtk_label_new (string);
gtk_widget_set_parent (page->tab_label, page->tab_widget);
g_object_set_data (G_OBJECT (page->tab_label), "notebook", notebook);
@@ -6647,13 +6499,13 @@ gtk_notebook_set_tab_label (GtkNotebook *notebook,
G_CALLBACK (gtk_notebook_mnemonic_activate_switch_page),
notebook);
- if (priv->show_tabs && gtk_widget_get_visible (child))
+ if (notebook->show_tabs && gtk_widget_get_visible (child))
{
gtk_widget_show (page->tab_label);
gtk_widget_queue_resize (GTK_WIDGET (notebook));
}
- if (priv->menu)
+ if (notebook->menu)
gtk_notebook_menu_item_recreate (notebook, list);
g_object_notify (G_OBJECT (page), "tab-label");
@@ -6753,23 +6605,20 @@ gtk_notebook_set_menu_label (GtkNotebook *notebook,
GtkWidget *child,
GtkWidget *menu_label)
{
- GtkNotebookPrivate *priv;
GtkNotebookPage *page;
GList *list;
g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
g_return_if_fail (GTK_IS_WIDGET (child));
- priv = notebook->priv;
-
list = gtk_notebook_find_child (notebook, child);
g_return_if_fail (list != NULL);
page = list->data;
if (page->menu_label)
{
- if (priv->menu)
- gtk_container_remove (GTK_CONTAINER (priv->menu),
+ if (notebook->menu)
+ gtk_container_remove (GTK_CONTAINER (notebook->menu),
gtk_widget_get_parent (page->menu_label));
g_clear_object (&page->menu_label);
@@ -6784,7 +6633,7 @@ gtk_notebook_set_menu_label (GtkNotebook *notebook,
else
page->default_menu = TRUE;
- if (priv->menu)
+ if (notebook->menu)
gtk_notebook_menu_item_create (notebook, page);
g_object_notify (G_OBJECT (page), "menu-label");
}
@@ -6851,29 +6700,28 @@ static void
gtk_notebook_child_reordered (GtkNotebook *notebook,
GtkNotebookPage *page)
{
- GtkNotebookPrivate *priv = notebook->priv;
GList *list;
GtkCssNode *sibling;
- list = g_list_find (priv->children, page);
+ list = g_list_find (notebook->children, page);
- if (priv->menu)
+ if (notebook->menu)
gtk_notebook_menu_item_recreate (notebook, list);
if (list->prev)
sibling = gtk_widget_get_css_node (GTK_NOTEBOOK_PAGE_FROM_LIST (list->prev)->tab_widget);
- else if (priv->arrow_widget[ARROW_RIGHT_BEFORE])
- sibling = gtk_widget_get_css_node (priv->arrow_widget[ARROW_RIGHT_BEFORE]);
- else if (priv->arrow_widget[ARROW_LEFT_BEFORE])
- sibling = gtk_widget_get_css_node (priv->arrow_widget[ARROW_LEFT_BEFORE]);
+ else if (notebook->arrow_widget[ARROW_RIGHT_BEFORE])
+ sibling = gtk_widget_get_css_node (notebook->arrow_widget[ARROW_RIGHT_BEFORE]);
+ else if (notebook->arrow_widget[ARROW_LEFT_BEFORE])
+ sibling = gtk_widget_get_css_node (notebook->arrow_widget[ARROW_LEFT_BEFORE]);
else
sibling = NULL;
- gtk_css_node_insert_after (gtk_widget_get_css_node (priv->tabs_widget),
+ gtk_css_node_insert_after (gtk_widget_get_css_node (notebook->tabs_widget),
gtk_widget_get_css_node (page->tab_widget),
sibling);
gtk_notebook_update_labels (notebook);
- gtk_widget_queue_allocate (priv->tabs_widget);
+ gtk_widget_queue_allocate (notebook->tabs_widget);
}
/**
@@ -6892,7 +6740,6 @@ gtk_notebook_reorder_child (GtkNotebook *notebook,
GtkWidget *child,
gint position)
{
- GtkNotebookPrivate *priv;
GList *list, *new_list;
GtkNotebookPage *page;
gint old_pos;
@@ -6902,36 +6749,34 @@ gtk_notebook_reorder_child (GtkNotebook *notebook,
g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
g_return_if_fail (GTK_IS_WIDGET (child));
- priv = notebook->priv;
-
list = gtk_notebook_find_child (notebook, child);
g_return_if_fail (list != NULL);
- max_pos = g_list_length (priv->children) - 1;
+ max_pos = g_list_length (notebook->children) - 1;
if (position < 0 || position > max_pos)
position = max_pos;
- old_pos = g_list_position (priv->children, list);
+ old_pos = g_list_position (notebook->children, list);
if (old_pos == position)
return;
page = list->data;
- priv->children = g_list_delete_link (priv->children, list);
+ notebook->children = g_list_delete_link (notebook->children, list);
- priv->children = g_list_insert (priv->children, page, position);
- new_list = g_list_nth (priv->children, position);
+ notebook->children = g_list_insert (notebook->children, page, position);
+ new_list = g_list_nth (notebook->children, position);
/* Fix up GList references in GtkNotebook structure */
- if (priv->first_tab == list)
- priv->first_tab = new_list;
- if (priv->focus_tab == list)
- priv->focus_tab = new_list;
+ if (notebook->first_tab == list)
+ notebook->first_tab = new_list;
+ if (notebook->focus_tab == list)
+ notebook->focus_tab = new_list;
/* Move around the menu items if necessary */
gtk_notebook_child_reordered (notebook, page);
- for (list = priv->children, i = 0; list; list = list->next, i++)
+ for (list = notebook->children, i = 0; list; list = list->next, i++)
{
if (MIN (old_pos, position) <= i && i <= MAX (old_pos, position))
g_object_notify (G_OBJECT (list->data), "position");
@@ -6960,18 +6805,15 @@ void
gtk_notebook_set_group_name (GtkNotebook *notebook,
const gchar *group_name)
{
- GtkNotebookPrivate *priv;
GQuark group;
g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
- priv = notebook->priv;
-
group = g_quark_from_string (group_name);
- if (priv->group != group)
+ if (notebook->group != group)
{
- priv->group = group;
+ notebook->group = group;
g_object_notify_by_pspec (G_OBJECT (notebook), properties[PROP_GROUP_NAME]);
}
@@ -6990,7 +6832,7 @@ gtk_notebook_get_group_name (GtkNotebook *notebook)
{
g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), NULL);
- return g_quark_to_string (notebook->priv->group);
+ return g_quark_to_string (notebook->group);
}
/**
@@ -7170,7 +7012,7 @@ gtk_notebook_get_action_widget (GtkNotebook *notebook,
{
g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), NULL);
- return notebook->priv->action_widget[pack_type];
+ return notebook->action_widget[pack_type];
}
/**
@@ -7191,27 +7033,23 @@ gtk_notebook_set_action_widget (GtkNotebook *notebook,
GtkWidget *widget,
GtkPackType pack_type)
{
- GtkNotebookPrivate *priv;
-
g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
g_return_if_fail (!widget || GTK_IS_WIDGET (widget));
g_return_if_fail (!widget || gtk_widget_get_parent (widget) == NULL);
- priv = notebook->priv;
+ if (notebook->action_widget[pack_type])
+ gtk_container_remove (GTK_CONTAINER (notebook->header_widget), notebook->action_widget[pack_type]);
- if (priv->action_widget[pack_type])
- gtk_container_remove (GTK_CONTAINER (priv->header_widget), priv->action_widget[pack_type]);
-
- priv->action_widget[pack_type] = widget;
+ notebook->action_widget[pack_type] = widget;
if (widget)
{
- gtk_container_add (GTK_CONTAINER (priv->header_widget), widget);
+ gtk_container_add (GTK_CONTAINER (notebook->header_widget), widget);
if (pack_type == GTK_PACK_START)
- gtk_box_reorder_child_after (GTK_BOX (priv->header_widget), widget, NULL);
+ gtk_box_reorder_child_after (GTK_BOX (notebook->header_widget), widget, NULL);
else
- gtk_box_reorder_child_after (GTK_BOX (priv->header_widget), widget, gtk_widget_get_last_child (priv->header_widget));
- gtk_widget_set_child_visible (widget, priv->show_tabs);
+ gtk_box_reorder_child_after (GTK_BOX (notebook->header_widget), widget, gtk_widget_get_last_child (notebook->header_widget));
+ gtk_widget_set_child_visible (widget, notebook->show_tabs);
}
gtk_widget_queue_resize (GTK_WIDGET (notebook));
@@ -7282,7 +7120,7 @@ gtk_notebook_pages_get_n_items (GListModel *model)
{
GtkNotebookPages *pages = GTK_NOTEBOOK_PAGES (model);
- return g_list_length (pages->notebook->priv->children);
+ return g_list_length (pages->notebook->children);
}
@@ -7293,7 +7131,7 @@ gtk_notebook_pages_get_item (GListModel *model,
GtkNotebookPages *pages = GTK_NOTEBOOK_PAGES (model);
GtkNotebookPage *page;
- page = g_list_nth_data (pages->notebook->priv->children, position);
+ page = g_list_nth_data (pages->notebook->children, position);
return g_object_ref (page);
}
@@ -7341,17 +7179,15 @@ gtk_notebook_pages_new (GtkNotebook *notebook)
GListModel *
gtk_notebook_get_pages (GtkNotebook *notebook)
{
- GtkNotebookPrivate *priv = notebook->priv;
-
g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), NULL);
- if (priv->pages)
- return g_object_ref (priv->pages);
+ if (notebook->pages)
+ return g_object_ref (notebook->pages);
- priv->pages = G_LIST_MODEL (gtk_notebook_pages_new (notebook));
+ notebook->pages = G_LIST_MODEL (gtk_notebook_pages_new (notebook));
- g_object_add_weak_pointer (G_OBJECT (priv->pages), (gpointer *)&priv->pages);
+ g_object_add_weak_pointer (G_OBJECT (notebook->pages), (gpointer *)&notebook->pages);
- return priv->pages;
+ return notebook->pages;
}
diff --git a/gtk/gtkprintjob.c b/gtk/gtkprintjob.c
index f6288364ca..8a98f5510d 100644
--- a/gtk/gtkprintjob.c
+++ b/gtk/gtkprintjob.c
@@ -57,24 +57,11 @@
#endif
typedef struct _GtkPrintJobClass GtkPrintJobClass;
-typedef struct _GtkPrintJobPrivate GtkPrintJobPrivate;
struct _GtkPrintJob
{
GObject parent_instance;
- GtkPrintJobPrivate *priv;
-};
-
-struct _GtkPrintJobClass
-{
- GObjectClass parent_class;
-
- void (*status_changed) (GtkPrintJob *job);
-};
-
-struct _GtkPrintJobPrivate
-{
gchar *title;
GIOChannel *spool_io;
@@ -104,6 +91,13 @@ struct _GtkPrintJobPrivate
guint reverse : 1;
};
+struct _GtkPrintJobClass
+{
+ GObjectClass parent_class;
+
+ void (*status_changed) (GtkPrintJob *job);
+};
+
static void gtk_print_job_finalize (GObject *object);
static void gtk_print_job_set_property (GObject *object,
guint prop_id,
@@ -131,7 +125,7 @@ enum {
static guint signals[LAST_SIGNAL] = { 0 };
-G_DEFINE_TYPE_WITH_PRIVATE (GtkPrintJob, gtk_print_job, G_TYPE_OBJECT)
+G_DEFINE_TYPE (GtkPrintJob, gtk_print_job, G_TYPE_OBJECT)
static void
gtk_print_job_class_init (GtkPrintJobClass *class)
@@ -211,34 +205,30 @@ gtk_print_job_class_init (GtkPrintJobClass *class)
static void
gtk_print_job_init (GtkPrintJob *job)
{
- GtkPrintJobPrivate *priv;
-
- priv = job->priv = gtk_print_job_get_instance_private (job);
-
- priv->spool_io = NULL;
+ job->spool_io = NULL;
- priv->title = g_strdup ("");
- priv->surface = NULL;
- priv->backend = NULL;
- priv->printer = NULL;
+ job->title = g_strdup ("");
+ job->surface = NULL;
+ job->backend = NULL;
+ job->printer = NULL;
- priv->printer_set = FALSE;
- priv->settings_set = FALSE;
- priv->page_setup_set = FALSE;
- priv->status = GTK_PRINT_STATUS_INITIAL;
- priv->track_print_status = FALSE;
+ job->printer_set = FALSE;
+ job->settings_set = FALSE;
+ job->page_setup_set = FALSE;
+ job->status = GTK_PRINT_STATUS_INITIAL;
+ job->track_print_status = FALSE;
- priv->print_pages = GTK_PRINT_PAGES_ALL;
- priv->page_ranges = NULL;
- priv->num_page_ranges = 0;
- priv->collate = FALSE;
- priv->reverse = FALSE;
- priv->num_copies = 1;
- priv->scale = 1.0;
- priv->page_set = GTK_PAGE_SET_ALL;
- priv->rotate_to_orientation = FALSE;
- priv->number_up = 1;
- priv->number_up_layout = GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_TOP_TO_BOTTOM;
+ job->print_pages = GTK_PRINT_PAGES_ALL;
+ job->page_ranges = NULL;
+ job->num_page_ranges = 0;
+ job->collate = FALSE;
+ job->reverse = FALSE;
+ job->num_copies = 1;
+ job->scale = 1.0;
+ job->page_set = GTK_PAGE_SET_ALL;
+ job->rotate_to_orientation = FALSE;
+ job->number_up = 1;
+ job->number_up_layout = GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_TOP_TO_BOTTOM;
}
@@ -246,18 +236,17 @@ static void
gtk_print_job_constructed (GObject *object)
{
GtkPrintJob *job = GTK_PRINT_JOB (object);
- GtkPrintJobPrivate *priv = job->priv;
G_OBJECT_CLASS (gtk_print_job_parent_class)->constructed (object);
- g_assert (priv->printer_set &&
- priv->settings_set &&
- priv->page_setup_set);
+ g_assert (job->printer_set &&
+ job->settings_set &&
+ job->page_setup_set);
- _gtk_printer_prepare_for_print (priv->printer,
+ _gtk_printer_prepare_for_print (job->printer,
job,
- priv->settings,
- priv->page_setup);
+ job->settings,
+ job->page_setup);
}
@@ -265,34 +254,33 @@ static void
gtk_print_job_finalize (GObject *object)
{
GtkPrintJob *job = GTK_PRINT_JOB (object);
- GtkPrintJobPrivate *priv = job->priv;
- if (priv->surface)
- cairo_surface_destroy (priv->surface);
+ if (job->surface)
+ cairo_surface_destroy (job->surface);
- if (priv->backend)
- g_object_unref (priv->backend);
+ if (job->backend)
+ g_object_unref (job->backend);
- if (priv->spool_io != NULL)
+ if (job->spool_io != NULL)
{
- g_io_channel_unref (priv->spool_io);
- priv->spool_io = NULL;
+ g_io_channel_unref (job->spool_io);
+ job->spool_io = NULL;
}
- if (priv->printer)
- g_object_unref (priv->printer);
+ if (job->printer)
+ g_object_unref (job->printer);
- if (priv->settings)
- g_object_unref (priv->settings);
+ if (job->settings)
+ g_object_unref (job->settings);
- if (priv->page_setup)
- g_object_unref (priv->page_setup);
+ if (job->page_setup)
+ g_object_unref (job->page_setup);
- g_free (priv->page_ranges);
- priv->page_ranges = NULL;
+ g_free (job->page_ranges);
+ job->page_ranges = NULL;
- g_free (priv->title);
- priv->title = NULL;
+ g_free (job->title);
+ job->title = NULL;
G_OBJECT_CLASS (gtk_print_job_parent_class)->finalize (object);
}
@@ -337,7 +325,7 @@ gtk_print_job_get_settings (GtkPrintJob *job)
{
g_return_val_if_fail (GTK_IS_PRINT_JOB (job), NULL);
- return job->priv->settings;
+ return job->settings;
}
/**
@@ -353,7 +341,7 @@ gtk_print_job_get_printer (GtkPrintJob *job)
{
g_return_val_if_fail (GTK_IS_PRINT_JOB (job), NULL);
- return job->priv->printer;
+ return job->printer;
}
/**
@@ -369,7 +357,7 @@ gtk_print_job_get_title (GtkPrintJob *job)
{
g_return_val_if_fail (GTK_IS_PRINT_JOB (job), NULL);
- return job->priv->title;
+ return job->title;
}
/**
@@ -385,23 +373,19 @@ gtk_print_job_get_status (GtkPrintJob *job)
{
g_return_val_if_fail (GTK_IS_PRINT_JOB (job), GTK_PRINT_STATUS_FINISHED);
- return job->priv->status;
+ return job->status;
}
void
gtk_print_job_set_status (GtkPrintJob *job,
GtkPrintStatus status)
{
- GtkPrintJobPrivate *priv;
-
g_return_if_fail (GTK_IS_PRINT_JOB (job));
- priv = job->priv;
-
- if (priv->status == status)
+ if (job->status == status)
return;
- priv->status = status;
+ job->status = status;
g_signal_emit (job, signals[STATUS_CHANGED], 0);
}
@@ -424,19 +408,16 @@ gtk_print_job_set_source_file (GtkPrintJob *job,
const gchar *filename,
GError **error)
{
- GtkPrintJobPrivate *priv;
GError *tmp_error;
tmp_error = NULL;
g_return_val_if_fail (GTK_IS_PRINT_JOB (job), FALSE);
- priv = job->priv;
-
- priv->spool_io = g_io_channel_new_file (filename, "r", &tmp_error);
+ job->spool_io = g_io_channel_new_file (filename, "r", &tmp_error);
if (tmp_error == NULL)
- g_io_channel_set_encoding (priv->spool_io, NULL, &tmp_error);
+ g_io_channel_set_encoding (job->spool_io, NULL, &tmp_error);
if (tmp_error != NULL)
{
@@ -473,8 +454,8 @@ gtk_print_job_set_source_fd (GtkPrintJob *job,
g_return_val_if_fail (GTK_IS_PRINT_JOB (job), FALSE);
g_return_val_if_fail (fd >= 0, FALSE);
- job->priv->spool_io = g_io_channel_unix_new (fd);
- if (g_io_channel_set_encoding (job->priv->spool_io, NULL, error) != G_IO_STATUS_NORMAL)
+ job->spool_io = g_io_channel_unix_new (fd);
+ if (g_io_channel_set_encoding (job->spool_io, NULL, error) != G_IO_STATUS_NORMAL)
return FALSE;
return TRUE;
@@ -494,7 +475,6 @@ cairo_surface_t *
gtk_print_job_get_surface (GtkPrintJob *job,
GError **error)
{
- GtkPrintJobPrivate *priv;
gchar *filename = NULL;
gdouble width, height;
GtkPaperSize *paper_size;
@@ -505,12 +485,10 @@ gtk_print_job_get_surface (GtkPrintJob *job,
g_return_val_if_fail (GTK_IS_PRINT_JOB (job), NULL);
- priv = job->priv;
-
- if (priv->surface)
- return priv->surface;
+ if (job->surface)
+ return job->surface;
- g_return_val_if_fail (priv->spool_io == NULL, NULL);
+ g_return_val_if_fail (job->spool_io == NULL, NULL);
fd = g_file_open_tmp ("gtkprint_XXXXXX",
&filename,
@@ -532,28 +510,28 @@ gtk_print_job_get_surface (GtkPrintJob *job,
g_unlink (filename);
g_free (filename);
- paper_size = gtk_page_setup_get_paper_size (priv->page_setup);
+ paper_size = gtk_page_setup_get_paper_size (job->page_setup);
width = gtk_paper_size_get_width (paper_size, GTK_UNIT_POINTS);
height = gtk_paper_size_get_height (paper_size, GTK_UNIT_POINTS);
- priv->spool_io = g_io_channel_unix_new (fd);
- g_io_channel_set_close_on_unref (priv->spool_io, TRUE);
- g_io_channel_set_encoding (priv->spool_io, NULL, &tmp_error);
+ job->spool_io = g_io_channel_unix_new (fd);
+ g_io_channel_set_close_on_unref (job->spool_io, TRUE);
+ g_io_channel_set_encoding (job->spool_io, NULL, &tmp_error);
if (tmp_error != NULL)
{
- g_io_channel_unref (priv->spool_io);
- priv->spool_io = NULL;
+ g_io_channel_unref (job->spool_io);
+ job->spool_io = NULL;
g_propagate_error (error, tmp_error);
return NULL;
}
- priv->surface = _gtk_printer_create_cairo_surface (priv->printer,
- priv->settings,
+ job->surface = _gtk_printer_create_cairo_surface (job->printer,
+ job->settings,
width, height,
- priv->spool_io);
+ job->spool_io);
- return priv->surface;
+ return job->surface;
}
/**
@@ -573,17 +551,13 @@ void
gtk_print_job_set_track_print_status (GtkPrintJob *job,
gboolean track_status)
{
- GtkPrintJobPrivate *priv;
-
g_return_if_fail (GTK_IS_PRINT_JOB (job));
- priv = job->priv;
-
track_status = track_status != FALSE;
- if (priv->track_print_status != track_status)
+ if (job->track_print_status != track_status)
{
- priv->track_print_status = track_status;
+ job->track_print_status = track_status;
g_object_notify (G_OBJECT (job), "track-print-status");
}
@@ -601,13 +575,9 @@ gtk_print_job_set_track_print_status (GtkPrintJob *job,
gboolean
gtk_print_job_get_track_print_status (GtkPrintJob *job)
{
- GtkPrintJobPrivate *priv;
-
g_return_val_if_fail (GTK_IS_PRINT_JOB (job), FALSE);
-
- priv = job->priv;
- return priv->track_print_status;
+ return job->track_print_status;
}
static void
@@ -618,33 +588,32 @@ gtk_print_job_set_property (GObject *object,
{
GtkPrintJob *job = GTK_PRINT_JOB (object);
- GtkPrintJobPrivate *priv = job->priv;
GtkPrintSettings *settings;
switch (prop_id)
{
case PROP_TITLE:
- g_free (priv->title);
- priv->title = g_value_dup_string (value);
+ g_free (job->title);
+ job->title = g_value_dup_string (value);
break;
case PROP_PRINTER:
- priv->printer = GTK_PRINTER (g_value_dup_object (value));
- priv->printer_set = TRUE;
- priv->backend = g_object_ref (gtk_printer_get_backend (priv->printer));
+ job->printer = GTK_PRINTER (g_value_dup_object (value));
+ job->printer_set = TRUE;
+ job->backend = g_object_ref (gtk_printer_get_backend (job->printer));
break;
case PROP_PAGE_SETUP:
- priv->page_setup = GTK_PAGE_SETUP (g_value_dup_object (value));
- priv->page_setup_set = TRUE;
+ job->page_setup = GTK_PAGE_SETUP (g_value_dup_object (value));
+ job->page_setup_set = TRUE;
break;
case PROP_SETTINGS:
/* We save a copy of the settings since we modify
* if when preparing the printer job. */
settings = GTK_PRINT_SETTINGS (g_value_get_object (value));
- priv->settings = gtk_print_settings_copy (settings);
- priv->settings_set = TRUE;
+ job->settings = gtk_print_settings_copy (settings);
+ job->settings_set = TRUE;
break;
case PROP_TRACK_PRINT_STATUS:
@@ -664,24 +633,23 @@ gtk_print_job_get_property (GObject *object,
GParamSpec *pspec)
{
GtkPrintJob *job = GTK_PRINT_JOB (object);
- GtkPrintJobPrivate *priv = job->priv;
switch (prop_id)
{
case PROP_TITLE:
- g_value_set_string (value, priv->title);
+ g_value_set_string (value, job->title);
break;
case PROP_PRINTER:
- g_value_set_object (value, priv->printer);
+ g_value_set_object (value, job->printer);
break;
case PROP_SETTINGS:
- g_value_set_object (value, priv->settings);
+ g_value_set_object (value, job->settings);
break;
case PROP_PAGE_SETUP:
- g_value_set_object (value, priv->page_setup);
+ g_value_set_object (value, job->page_setup);
break;
case PROP_TRACK_PRINT_STATUS:
- g_value_set_boolean (value, priv->track_print_status);
+ g_value_set_boolean (value, job->track_print_status);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -704,19 +672,15 @@ gtk_print_job_send (GtkPrintJob *job,
gpointer user_data,
GDestroyNotify dnotify)
{
- GtkPrintJobPrivate *priv;
-
g_return_if_fail (GTK_IS_PRINT_JOB (job));
-
- priv = job->priv;
- g_return_if_fail (priv->spool_io != NULL);
+ g_return_if_fail (job->spool_io != NULL);
gtk_print_job_set_status (job, GTK_PRINT_STATUS_SENDING_DATA);
- g_io_channel_seek_position (priv->spool_io, 0, G_SEEK_SET, NULL);
+ g_io_channel_seek_position (job->spool_io, 0, G_SEEK_SET, NULL);
- gtk_print_backend_print_stream (priv->backend, job,
- priv->spool_io,
+ gtk_print_backend_print_stream (job->backend, job,
+ job->spool_io,
callback, user_data, dnotify);
}
@@ -731,7 +695,7 @@ gtk_print_job_send (GtkPrintJob *job,
GtkPrintPages
gtk_print_job_get_pages (GtkPrintJob *job)
{
- return job->priv->print_pages;
+ return job->print_pages;
}
/**
@@ -745,7 +709,7 @@ void
gtk_print_job_set_pages (GtkPrintJob *job,
GtkPrintPages pages)
{
- job->priv->print_pages = pages;
+ job->print_pages = pages;
}
/**
@@ -762,8 +726,8 @@ GtkPageRange *
gtk_print_job_get_page_ranges (GtkPrintJob *job,
gint *n_ranges)
{
- *n_ranges = job->priv->num_page_ranges;
- return job->priv->page_ranges;
+ *n_ranges = job->num_page_ranges;
+ return job->page_ranges;
}
/**
@@ -780,9 +744,9 @@ gtk_print_job_set_page_ranges (GtkPrintJob *job,
GtkPageRange *ranges,
gint n_ranges)
{
- g_free (job->priv->page_ranges);
- job->priv->page_ranges = ranges;
- job->priv->num_page_ranges = n_ranges;
+ g_free (job->page_ranges);
+ job->page_ranges = ranges;
+ job->num_page_ranges = n_ranges;
}
/**
@@ -796,7 +760,7 @@ gtk_print_job_set_page_ranges (GtkPrintJob *job,
GtkPageSet
gtk_print_job_get_page_set (GtkPrintJob *job)
{
- return job->priv->page_set;
+ return job->page_set;
}
/**
@@ -810,7 +774,7 @@ void
gtk_print_job_set_page_set (GtkPrintJob *job,
GtkPageSet page_set)
{
- job->priv->page_set = page_set;
+ job->page_set = page_set;
}
/**
@@ -824,7 +788,7 @@ gtk_print_job_set_page_set (GtkPrintJob *job,
gint
gtk_print_job_get_num_copies (GtkPrintJob *job)
{
- return job->priv->num_copies;
+ return job->num_copies;
}
/**
@@ -838,7 +802,7 @@ void
gtk_print_job_set_num_copies (GtkPrintJob *job,
gint num_copies)
{
- job->priv->num_copies = num_copies;
+ job->num_copies = num_copies;
}
/**
@@ -853,7 +817,7 @@ gdouble
gtk_print_job_get_scale (GtkPrintJob *job)
{
- return job->priv->scale;
+ return job->scale;
}
/**
@@ -867,7 +831,7 @@ void
gtk_print_job_set_scale (GtkPrintJob *job,
gdouble scale)
{
- job->priv->scale = scale;
+ job->scale = scale;
}
/**
@@ -881,7 +845,7 @@ gtk_print_job_set_scale (GtkPrintJob *job,
guint
gtk_print_job_get_n_up (GtkPrintJob *job)
{
- return job->priv->number_up;
+ return job->number_up;
}
/**
@@ -895,7 +859,7 @@ void
gtk_print_job_set_n_up (GtkPrintJob *job,
guint n_up)
{
- job->priv->number_up = n_up;
+ job->number_up = n_up;
}
/**
@@ -909,7 +873,7 @@ gtk_print_job_set_n_up (GtkPrintJob *job,
GtkNumberUpLayout
gtk_print_job_get_n_up_layout (GtkPrintJob *job)
{
- return job->priv->number_up_layout;
+ return job->number_up_layout;
}
/**
@@ -923,7 +887,7 @@ void
gtk_print_job_set_n_up_layout (GtkPrintJob *job,
GtkNumberUpLayout layout)
{
- job->priv->number_up_layout = layout;
+ job->number_up_layout = layout;
}
/**
@@ -937,7 +901,7 @@ gtk_print_job_set_n_up_layout (GtkPrintJob *job,
gboolean
gtk_print_job_get_rotate (GtkPrintJob *job)
{
- return job->priv->rotate_to_orientation;
+ return job->rotate_to_orientation;
}
/**
@@ -951,7 +915,7 @@ void
gtk_print_job_set_rotate (GtkPrintJob *job,
gboolean rotate)
{
- job->priv->rotate_to_orientation = rotate;
+ job->rotate_to_orientation = rotate;
}
/**
@@ -965,7 +929,7 @@ gtk_print_job_set_rotate (GtkPrintJob *job,
gboolean
gtk_print_job_get_collate (GtkPrintJob *job)
{
- return job->priv->collate;
+ return job->collate;
}
/**
@@ -979,7 +943,7 @@ void
gtk_print_job_set_collate (GtkPrintJob *job,
gboolean collate)
{
- job->priv->collate = collate;
+ job->collate = collate;
}
/**
@@ -993,7 +957,7 @@ gtk_print_job_set_collate (GtkPrintJob *job,
gboolean
gtk_print_job_get_reverse (GtkPrintJob *job)
{
- return job->priv->reverse;
+ return job->reverse;
}
/**
@@ -1007,5 +971,5 @@ void
gtk_print_job_set_reverse (GtkPrintJob *job,
gboolean reverse)
{
- job->priv->reverse = reverse;
+ job->reverse = reverse;
}
diff --git a/gtk/gtkprintunixdialog.c b/gtk/gtkprintunixdialog.c
index 2d3d4703e6..aae3b0d4b4 100644
--- a/gtk/gtkprintunixdialog.c
+++ b/gtk/gtkprintunixdialog.c
@@ -265,20 +265,11 @@ enum {
};
typedef struct _GtkPrintUnixDialogClass GtkPrintUnixDialogClass;
-typedef struct GtkPrintUnixDialogPrivate GtkPrintUnixDialogPrivate;
struct _GtkPrintUnixDialog
{
GtkDialog parent_instance;
-};
-struct _GtkPrintUnixDialogClass
-{
- GtkDialogClass parent_class;
-};
-
-struct GtkPrintUnixDialogPrivate
-{
GtkWidget *notebook;
GtkWidget *printer_treeview;
@@ -388,8 +379,12 @@ struct GtkPrintUnixDialogPrivate
gint current_page;
};
+struct _GtkPrintUnixDialogClass
+{
+ GtkDialogClass parent_class;
+};
+
G_DEFINE_TYPE_WITH_CODE (GtkPrintUnixDialog, gtk_print_unix_dialog, GTK_TYPE_DIALOG,
- G_ADD_PRIVATE (GtkPrintUnixDialog)
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
gtk_print_unix_dialog_buildable_init))
@@ -399,10 +394,8 @@ static gboolean
is_default_printer (GtkPrintUnixDialog *dialog,
GtkPrinter *printer)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
- if (priv->format_for_printer)
- return strcmp (priv->format_for_printer,
+ if (dialog->format_for_printer)
+ return strcmp (dialog->format_for_printer,
gtk_printer_get_name (printer)) == 0;
else
return gtk_printer_is_default (printer);
@@ -497,68 +490,68 @@ gtk_print_unix_dialog_class_init (GtkPrintUnixDialogClass *class)
"/org/gtk/libgtk/ui/gtkprintunixdialog.ui");
/* GtkTreeView / GtkTreeModel */
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, printer_treeview);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, printer_list);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, printer_list_filter);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, page_setup_list);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, custom_paper_list);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, printer_icon_column);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, printer_name_column);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, printer_location_column);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, printer_status_column);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, printer_icon_renderer);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, printer_name_renderer);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, printer_location_renderer);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, printer_status_renderer);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, printer_treeview);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, printer_list);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, printer_list_filter);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, page_setup_list);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, custom_paper_list);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, printer_icon_column);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, printer_name_column);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, printer_location_column);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, printer_status_column);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, printer_icon_renderer);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, printer_name_renderer);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, printer_location_renderer);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, printer_status_renderer);
/* General Widgetry */
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, notebook);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, all_pages_radio);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, all_pages_radio);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, current_page_radio);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, selection_radio);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, range_table);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, page_range_radio);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, page_range_entry);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, copies_spin);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, collate_check);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, reverse_check);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, collate_image);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, page_layout_preview);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, scale_spin);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, page_set_combo);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, print_now_radio);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, print_at_radio);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, print_at_entry);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, print_hold_radio);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, paper_size_combo);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, paper_size_combo_label);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, paper_size_renderer);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, orientation_combo);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, orientation_combo_label);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, conflicts_widget);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, job_page);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, finishing_table);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, finishing_page);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, image_quality_table);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, image_quality_page);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, color_table);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, color_page);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, advanced_vbox);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, advanced_page);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, extension_point);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, notebook);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, all_pages_radio);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, all_pages_radio);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, current_page_radio);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, selection_radio);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, range_table);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, page_range_radio);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, page_range_entry);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, copies_spin);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, collate_check);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, reverse_check);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, collate_image);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, page_layout_preview);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, scale_spin);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, page_set_combo);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, print_now_radio);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, print_at_radio);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, print_at_entry);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, print_hold_radio);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, paper_size_combo);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, paper_size_combo_label);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, paper_size_renderer);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, orientation_combo);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, orientation_combo_label);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, conflicts_widget);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, job_page);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, finishing_table);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, finishing_page);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, image_quality_table);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, image_quality_page);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, color_table);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, color_page);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, advanced_vbox);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, advanced_page);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, extension_point);
/* GtkPrinterOptionWidgets... */
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, pages_per_sheet);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, duplex);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, paper_type);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, paper_source);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, output_tray);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, job_prio);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, billing_info);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, cover_before);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, cover_after);
- gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, number_up_layout);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, pages_per_sheet);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, duplex);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, paper_type);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, paper_source);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, output_tray);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, job_prio);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, billing_info);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, cover_before);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, cover_after);
+ gtk_widget_class_bind_template_child (widget_class, GtkPrintUnixDialog, number_up_layout);
/* Callbacks handled in the UI */
gtk_widget_class_bind_template_callback (widget_class, redraw_page_layout_preview);
@@ -613,29 +606,27 @@ set_busy_cursor (GtkPrintUnixDialog *dialog,
/* This function handles error messages before printing.
*/
static gboolean
-error_dialogs (GtkPrintUnixDialog *print_dialog,
- gint print_dialog_response_id,
+error_dialogs (GtkPrintUnixDialog *dialog,
+ gint dialog_response_id,
gpointer data)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (print_dialog);
GtkPrinterOption *option = NULL;
GtkPrinter *printer = NULL;
GtkWindow *toplevel = NULL;
- GtkWidget *dialog = NULL;
GFile *file = NULL;
gchar *basename = NULL;
gchar *dirname = NULL;
int response;
- if (print_dialog != NULL && print_dialog_response_id == GTK_RESPONSE_OK)
+ if (dialog != NULL && dialog_response_id == GTK_RESPONSE_OK)
{
- printer = gtk_print_unix_dialog_get_selected_printer (print_dialog);
+ printer = gtk_print_unix_dialog_get_selected_printer (dialog);
if (printer != NULL)
{
- if (priv->request_details_tag || !gtk_printer_is_accepting_jobs (printer))
+ if (dialog->request_details_tag || !gtk_printer_is_accepting_jobs (printer))
{
- g_signal_stop_emission_by_name (print_dialog, "response");
+ g_signal_stop_emission_by_name (dialog, "response");
return TRUE;
}
@@ -644,7 +635,7 @@ error_dialogs (GtkPrintUnixDialog *print_dialog,
*/
if (gtk_printer_is_virtual (printer))
{
- option = gtk_printer_option_set_lookup (priv->options,
+ option = gtk_printer_option_set_lookup (dialog->options,
"gtk-main-page-custom-input");
if (option != NULL &&
@@ -655,50 +646,51 @@ error_dialogs (GtkPrintUnixDialog *print_dialog,
if (g_file_query_exists (file, NULL))
{
GFile *parent;
+ GtkWidget *message_dialog;
- toplevel = get_toplevel (GTK_WIDGET (print_dialog));
+ toplevel = get_toplevel (GTK_WIDGET (dialog));
basename = g_file_get_basename (file);
parent = g_file_get_parent (file);
dirname = g_file_get_parse_name (parent);
g_object_unref (parent);
- dialog = gtk_message_dialog_new (toplevel,
- GTK_DIALOG_MODAL |
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_QUESTION,
- GTK_BUTTONS_NONE,
- _("A file named “%s” already exists. Do you want to replace it?"),
- basename);
+ message_dialog = gtk_message_dialog_new (toplevel,
+ GTK_DIALOG_MODAL |
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_NONE,
+ _("A file named “%s” already exists. Do you want to replace it?"),
+ basename);
- gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message_dialog),
_("The file already exists in “%s”. Replacing it will "
"overwrite its contents."),
dirname);
- gtk_dialog_add_button (GTK_DIALOG (dialog),
+ gtk_dialog_add_button (GTK_DIALOG (message_dialog),
_("_Cancel"),
GTK_RESPONSE_CANCEL);
- gtk_dialog_add_button (GTK_DIALOG (dialog),
+ gtk_dialog_add_button (GTK_DIALOG (message_dialog),
_("_Replace"),
GTK_RESPONSE_ACCEPT);
- gtk_dialog_set_default_response (GTK_DIALOG (dialog),
+ gtk_dialog_set_default_response (GTK_DIALOG (message_dialog),
GTK_RESPONSE_ACCEPT);
if (gtk_window_has_group (toplevel))
gtk_window_group_add_window (gtk_window_get_group (toplevel),
- GTK_WINDOW (dialog));
+ GTK_WINDOW (message_dialog));
- response = gtk_dialog_run (GTK_DIALOG (dialog));
+ response = gtk_dialog_run (GTK_DIALOG (message_dialog));
- gtk_widget_destroy (dialog);
+ gtk_widget_destroy (message_dialog);
g_free (dirname);
g_free (basename);
if (response != GTK_RESPONSE_ACCEPT)
{
- g_signal_stop_emission_by_name (print_dialog, "response");
+ g_signal_stop_emission_by_name (dialog, "response");
g_object_unref (file);
return TRUE;
}
@@ -715,24 +707,21 @@ error_dialogs (GtkPrintUnixDialog *print_dialog,
static void
gtk_print_unix_dialog_init (GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv;
GtkTreeSortable *sort;
GtkWidget *widget;
- priv = gtk_print_unix_dialog_get_instance_private (dialog);
+ dialog->print_backends = NULL;
+ dialog->current_page = -1;
+ dialog->number_up_layout_n_option = NULL;
+ dialog->number_up_layout_2_option = NULL;
- priv->print_backends = NULL;
- priv->current_page = -1;
- priv->number_up_layout_n_option = NULL;
- priv->number_up_layout_2_option = NULL;
+ dialog->page_setup = gtk_page_setup_new ();
+ dialog->page_setup_set = FALSE;
+ dialog->embed_page_setup = FALSE;
+ dialog->internal_page_setup_change = FALSE;
- priv->page_setup = gtk_page_setup_new ();
- priv->page_setup_set = FALSE;
- priv->embed_page_setup = FALSE;
- priv->internal_page_setup_change = FALSE;
-
- priv->support_selection = FALSE;
- priv->has_selection = FALSE;
+ dialog->support_selection = FALSE;
+ dialog->has_selection = FALSE;
g_type_ensure (GTK_TYPE_PRINTER);
g_type_ensure (GTK_TYPE_PRINTER_OPTION);
@@ -750,16 +739,16 @@ gtk_print_unix_dialog_init (GtkPrintUnixDialog *dialog)
widget = gtk_dialog_get_widget_for_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
gtk_widget_set_sensitive (widget, FALSE);
- gtk_widget_set_visible (priv->selection_radio, FALSE);
- gtk_widget_set_visible (priv->conflicts_widget, FALSE);
+ gtk_widget_set_visible (dialog->selection_radio, FALSE);
+ gtk_widget_set_visible (dialog->conflicts_widget, FALSE);
/* Treeview auxiliary functions need to be setup here */
- gtk_tree_model_filter_set_visible_func (priv->printer_list_filter,
+ gtk_tree_model_filter_set_visible_func (dialog->printer_list_filter,
(GtkTreeModelFilterVisibleFunc) is_printer_active,
dialog,
NULL);
- sort = GTK_TREE_SORTABLE (priv->printer_list);
+ sort = GTK_TREE_SORTABLE (dialog->printer_list);
gtk_tree_sortable_set_default_sort_func (sort,
default_printer_list_sort_func,
NULL,
@@ -769,48 +758,48 @@ gtk_print_unix_dialog_init (GtkPrintUnixDialog *dialog)
GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
GTK_SORT_ASCENDING);
- gtk_tree_view_set_search_equal_func (GTK_TREE_VIEW (priv->printer_treeview),
+ gtk_tree_view_set_search_equal_func (GTK_TREE_VIEW (dialog->printer_treeview),
printer_compare, NULL, NULL);
- gtk_tree_view_column_set_cell_data_func (priv->printer_icon_column,
- priv->printer_icon_renderer,
+ gtk_tree_view_column_set_cell_data_func (dialog->printer_icon_column,
+ dialog->printer_icon_renderer,
set_cell_sensitivity_func, NULL, NULL);
- gtk_tree_view_column_set_cell_data_func (priv->printer_name_column,
- priv->printer_name_renderer,
+ gtk_tree_view_column_set_cell_data_func (dialog->printer_name_column,
+ dialog->printer_name_renderer,
set_cell_sensitivity_func, NULL, NULL);
- gtk_tree_view_column_set_cell_data_func (priv->printer_location_column,
- priv->printer_location_renderer,
+ gtk_tree_view_column_set_cell_data_func (dialog->printer_location_column,
+ dialog->printer_location_renderer,
set_cell_sensitivity_func, NULL, NULL);
- gtk_tree_view_column_set_cell_data_func (priv->printer_status_column,
- priv->printer_status_renderer,
+ gtk_tree_view_column_set_cell_data_func (dialog->printer_status_column,
+ dialog->printer_status_renderer,
set_cell_sensitivity_func, NULL, NULL);
/* Paper size combo auxilary funcs */
- gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (priv->paper_size_combo),
+ gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (dialog->paper_size_combo),
paper_size_row_is_separator, NULL, NULL);
- gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (priv->paper_size_combo),
- priv->paper_size_renderer,
+ gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (dialog->paper_size_combo),
+ dialog->paper_size_renderer,
page_name_func, NULL, NULL);
/* Load backends */
load_print_backends (dialog);
/* Load custom papers */
- _gtk_print_load_custom_papers (priv->custom_paper_list);
+ _gtk_print_load_custom_papers (dialog->custom_paper_list);
- gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (priv->collate_image),
+ gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (dialog->collate_image),
draw_collate,
dialog, NULL);
- gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (priv->page_layout_preview),
+ gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (dialog->page_layout_preview),
draw_page,
dialog, NULL);
- gtk_css_node_set_name (gtk_widget_get_css_node (priv->collate_image), g_quark_from_static_string ("drawing"));
- gtk_css_node_set_name (gtk_widget_get_css_node (priv->page_layout_preview), g_quark_from_static_string ("drawing"));
+ gtk_css_node_set_name (gtk_widget_get_css_node (dialog->collate_image), g_quark_from_static_string ("drawing"));
+ gtk_css_node_set_name (gtk_widget_get_css_node (dialog->page_layout_preview), g_quark_from_static_string ("drawing"));
}
static void
@@ -851,30 +840,28 @@ static void
disconnect_printer_details_request (GtkPrintUnixDialog *dialog,
gboolean details_failed)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
- if (priv->request_details_tag)
+ if (dialog->request_details_tag)
{
- g_signal_handler_disconnect (priv->request_details_printer,
- priv->request_details_tag);
- priv->request_details_tag = 0;
+ g_signal_handler_disconnect (dialog->request_details_printer,
+ dialog->request_details_tag);
+ dialog->request_details_tag = 0;
set_busy_cursor (dialog, FALSE);
if (details_failed)
- gtk_list_store_set (GTK_LIST_STORE (priv->printer_list),
- g_object_get_data (G_OBJECT (priv->request_details_printer),
+ gtk_list_store_set (GTK_LIST_STORE (dialog->printer_list),
+ g_object_get_data (G_OBJECT (dialog->request_details_printer),
"gtk-print-tree-iter"),
PRINTER_LIST_COL_STATE,
_("Getting printer information failed"),
-1);
else
- gtk_list_store_set (GTK_LIST_STORE (priv->printer_list),
- g_object_get_data (G_OBJECT (priv->request_details_printer),
+ gtk_list_store_set (GTK_LIST_STORE (dialog->printer_list),
+ g_object_get_data (G_OBJECT (dialog->request_details_printer),
"gtk-print-tree-iter"),
PRINTER_LIST_COL_STATE,
- gtk_printer_get_state_message (priv->request_details_printer),
+ gtk_printer_get_state_message (dialog->request_details_printer),
-1);
- g_object_unref (priv->request_details_printer);
- priv->request_details_printer = NULL;
+ g_object_unref (dialog->request_details_printer);
+ dialog->request_details_printer = NULL;
}
}
@@ -882,35 +869,34 @@ static void
gtk_print_unix_dialog_finalize (GObject *object)
{
GtkPrintUnixDialog *dialog = GTK_PRINT_UNIX_DIALOG (object);
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
GtkPrintBackend *backend;
GList *node;
unschedule_idle_mark_conflicts (dialog);
disconnect_printer_details_request (dialog, FALSE);
- g_clear_object (&priv->current_printer);
- g_clear_object (&priv->options);
+ g_clear_object (&dialog->current_printer);
+ g_clear_object (&dialog->options);
- if (priv->number_up_layout_2_option)
+ if (dialog->number_up_layout_2_option)
{
- priv->number_up_layout_2_option->choices[0] = NULL;
- priv->number_up_layout_2_option->choices[1] = NULL;
- g_free (priv->number_up_layout_2_option->choices_display[0]);
- g_free (priv->number_up_layout_2_option->choices_display[1]);
- priv->number_up_layout_2_option->choices_display[0] = NULL;
- priv->number_up_layout_2_option->choices_display[1] = NULL;
- g_object_unref (priv->number_up_layout_2_option);
- priv->number_up_layout_2_option = NULL;
+ dialog->number_up_layout_2_option->choices[0] = NULL;
+ dialog->number_up_layout_2_option->choices[1] = NULL;
+ g_free (dialog->number_up_layout_2_option->choices_display[0]);
+ g_free (dialog->number_up_layout_2_option->choices_display[1]);
+ dialog->number_up_layout_2_option->choices_display[0] = NULL;
+ dialog->number_up_layout_2_option->choices_display[1] = NULL;
+ g_object_unref (dialog->number_up_layout_2_option);
+ dialog->number_up_layout_2_option = NULL;
}
- g_clear_object (&priv->number_up_layout_n_option);
- g_clear_object (&priv->page_setup);
- g_clear_object (&priv->initial_settings);
- g_clear_pointer (&priv->waiting_for_printer, (GDestroyNotify)g_free);
- g_clear_pointer (&priv->format_for_printer, (GDestroyNotify)g_free);
+ g_clear_object (&dialog->number_up_layout_n_option);
+ g_clear_object (&dialog->page_setup);
+ g_clear_object (&dialog->initial_settings);
+ g_clear_pointer (&dialog->waiting_for_printer, (GDestroyNotify)g_free);
+ g_clear_pointer (&dialog->format_for_printer, (GDestroyNotify)g_free);
- for (node = priv->print_backends; node != NULL; node = node->next)
+ for (node = dialog->print_backends; node != NULL; node = node->next)
{
backend = GTK_PRINT_BACKEND (node->data);
@@ -922,10 +908,10 @@ gtk_print_unix_dialog_finalize (GObject *object)
g_object_unref (backend);
}
- g_list_free (priv->print_backends);
- priv->print_backends = NULL;
+ g_list_free (dialog->print_backends);
+ dialog->print_backends = NULL;
- g_clear_object (&priv->page_setup_list);
+ g_clear_object (&dialog->page_setup_list);
G_OBJECT_CLASS (gtk_print_unix_dialog_parent_class)->finalize (object);
}
@@ -935,11 +921,10 @@ printer_removed_cb (GtkPrintBackend *backend,
GtkPrinter *printer,
GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
GtkTreeIter *iter;
iter = g_object_get_data (G_OBJECT (printer), "gtk-print-tree-iter");
- gtk_list_store_remove (GTK_LIST_STORE (priv->printer_list), iter);
+ gtk_list_store_remove (GTK_LIST_STORE (dialog->printer_list), iter);
}
static void
@@ -955,10 +940,10 @@ gtk_print_unix_dialog_buildable_get_internal_child (GtkBuildable *buildable,
GtkBuilder *builder,
const gchar *childname)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (GTK_PRINT_UNIX_DIALOG (buildable));
+ GtkPrintUnixDialog *dialog = GTK_PRINT_UNIX_DIALOG (buildable);
if (strcmp (childname, "notebook") == 0)
- return G_OBJECT (priv->notebook);
+ return G_OBJECT (dialog->notebook);
return parent_buildable_iface->get_internal_child (buildable, builder, childname);
}
@@ -991,7 +976,6 @@ printer_status_cb (GtkPrintBackend *backend,
GtkPrinter *printer,
GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
GtkTreeIter *iter;
GtkTreeSelection *selection;
GIcon *icon;
@@ -1000,7 +984,7 @@ printer_status_cb (GtkPrintBackend *backend,
icon = g_themed_icon_new ("printer");
g_themed_icon_prepend_name (G_THEMED_ICON (icon), gtk_printer_get_icon_name (printer));
- gtk_list_store_set (GTK_LIST_STORE (priv->printer_list), iter,
+ gtk_list_store_set (GTK_LIST_STORE (dialog->printer_list), iter,
PRINTER_LIST_COL_ICON, icon,
PRINTER_LIST_COL_STATE, gtk_printer_get_state_message (printer),
PRINTER_LIST_COL_JOBS, gtk_printer_get_job_count (printer),
@@ -1011,10 +995,10 @@ printer_status_cb (GtkPrintBackend *backend,
/* When the pause state change then we need to update sensitive property
* of GTK_RESPONSE_OK button inside of selected_printer_changed function.
*/
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->printer_treeview));
- priv->internal_printer_change = TRUE;
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->printer_treeview));
+ dialog->internal_printer_change = TRUE;
selected_printer_changed (selection, dialog);
- priv->internal_printer_change = FALSE;
+ dialog->internal_printer_change = FALSE;
if (gtk_print_backend_printer_list_is_done (backend) &&
gtk_printer_is_default (printer) &&
@@ -1027,13 +1011,12 @@ printer_added_cb (GtkPrintBackend *backend,
GtkPrinter *printer,
GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
GtkTreeIter iter, filter_iter;
GtkTreeSelection *selection;
GtkTreePath *path;
GIcon *icon;
- gtk_list_store_append (GTK_LIST_STORE (priv->printer_list), &iter);
+ gtk_list_store_append (GTK_LIST_STORE (dialog->printer_list), &iter);
g_object_set_data_full (G_OBJECT (printer),
"gtk-print-tree-iter",
@@ -1042,7 +1025,7 @@ printer_added_cb (GtkPrintBackend *backend,
icon = g_themed_icon_new ("printer");
g_themed_icon_prepend_name (G_THEMED_ICON (icon), gtk_printer_get_icon_name (printer));
- gtk_list_store_set (GTK_LIST_STORE (priv->printer_list), &iter,
+ gtk_list_store_set (GTK_LIST_STORE (dialog->printer_list), &iter,
PRINTER_LIST_COL_ICON, icon,
PRINTER_LIST_COL_NAME, gtk_printer_get_name (printer),
PRINTER_LIST_COL_STATE, gtk_printer_get_state_message (printer),
@@ -1052,31 +1035,31 @@ printer_added_cb (GtkPrintBackend *backend,
-1);
g_object_unref (icon);
- gtk_tree_model_filter_convert_child_iter_to_iter (priv->printer_list_filter,
+ gtk_tree_model_filter_convert_child_iter_to_iter (dialog->printer_list_filter,
&filter_iter, &iter);
- path = gtk_tree_model_get_path (GTK_TREE_MODEL (priv->printer_list_filter), &filter_iter);
+ path = gtk_tree_model_get_path (GTK_TREE_MODEL (dialog->printer_list_filter), &filter_iter);
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->printer_treeview));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->printer_treeview));
- if (priv->waiting_for_printer != NULL &&
- strcmp (gtk_printer_get_name (printer), priv->waiting_for_printer) == 0)
+ if (dialog->waiting_for_printer != NULL &&
+ strcmp (gtk_printer_get_name (printer), dialog->waiting_for_printer) == 0)
{
- priv->internal_printer_change = TRUE;
+ dialog->internal_printer_change = TRUE;
gtk_tree_selection_select_iter (selection, &filter_iter);
- gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (priv->printer_treeview),
+ gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (dialog->printer_treeview),
path, NULL, TRUE, 0.5, 0.0);
- priv->internal_printer_change = FALSE;
- g_free (priv->waiting_for_printer);
- priv->waiting_for_printer = NULL;
+ dialog->internal_printer_change = FALSE;
+ g_free (dialog->waiting_for_printer);
+ dialog->waiting_for_printer = NULL;
}
else if (is_default_printer (dialog, printer) &&
gtk_tree_selection_count_selected_rows (selection) == 0)
{
- priv->internal_printer_change = TRUE;
+ dialog->internal_printer_change = TRUE;
gtk_tree_selection_select_iter (selection, &filter_iter);
- gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (priv->printer_treeview),
+ gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (dialog->printer_treeview),
path, NULL, TRUE, 0.5, 0.0);
- priv->internal_printer_change = FALSE;
+ dialog->internal_printer_change = FALSE;
}
gtk_tree_path_free (path);
@@ -1115,13 +1098,12 @@ printer_list_initialize (GtkPrintUnixDialog *dialog,
static void
load_print_backends (GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
GList *node;
if (g_module_supported ())
- priv->print_backends = gtk_print_backend_load_modules ();
+ dialog->print_backends = gtk_print_backend_load_modules ();
- for (node = priv->print_backends; node != NULL; node = node->next)
+ for (node = dialog->print_backends; node != NULL; node = node->next)
{
GtkPrintBackend *backend = node->data;
printer_list_initialize (dialog, backend);
@@ -1173,33 +1155,32 @@ gtk_print_unix_dialog_get_property (GObject *object,
GParamSpec *pspec)
{
GtkPrintUnixDialog *dialog = GTK_PRINT_UNIX_DIALOG (object);
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
switch (prop_id)
{
case PROP_PAGE_SETUP:
- g_value_set_object (value, priv->page_setup);
+ g_value_set_object (value, dialog->page_setup);
break;
case PROP_CURRENT_PAGE:
- g_value_set_int (value, priv->current_page);
+ g_value_set_int (value, dialog->current_page);
break;
case PROP_PRINT_SETTINGS:
g_value_take_object (value, gtk_print_unix_dialog_get_settings (dialog));
break;
case PROP_SELECTED_PRINTER:
- g_value_set_object (value, priv->current_printer);
+ g_value_set_object (value, dialog->current_printer);
break;
case PROP_MANUAL_CAPABILITIES:
- g_value_set_flags (value, priv->manual_capabilities);
+ g_value_set_flags (value, dialog->manual_capabilities);
break;
case PROP_SUPPORT_SELECTION:
- g_value_set_boolean (value, priv->support_selection);
+ g_value_set_boolean (value, dialog->support_selection);
break;
case PROP_HAS_SELECTION:
- g_value_set_boolean (value, priv->has_selection);
+ g_value_set_boolean (value, dialog->has_selection);
break;
case PROP_EMBED_PAGE_SETUP:
- g_value_set_boolean (value, priv->embed_page_setup);
+ g_value_set_boolean (value, dialog->embed_page_setup);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -1214,7 +1195,6 @@ is_printer_active (GtkTreeModel *model,
{
gboolean result;
GtkPrinter *printer;
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
gtk_tree_model_get (model, iter,
PRINTER_LIST_COL_PRINTER_OBJ, &printer,
@@ -1226,15 +1206,15 @@ is_printer_active (GtkTreeModel *model,
result = gtk_printer_is_active (printer);
if (result &&
- priv->manual_capabilities & (GTK_PRINT_CAPABILITY_GENERATE_PDF |
+ dialog->manual_capabilities & (GTK_PRINT_CAPABILITY_GENERATE_PDF |
GTK_PRINT_CAPABILITY_GENERATE_PS))
{
/* Check that the printer can handle at least one of the data
* formats that the application supports.
*/
- result = ((priv->manual_capabilities & GTK_PRINT_CAPABILITY_GENERATE_PDF) &&
+ result = ((dialog->manual_capabilities & GTK_PRINT_CAPABILITY_GENERATE_PDF) &&
gtk_printer_accepts_pdf (printer)) ||
- ((priv->manual_capabilities & GTK_PRINT_CAPABILITY_GENERATE_PS) &&
+ ((dialog->manual_capabilities & GTK_PRINT_CAPABILITY_GENERATE_PS) &&
gtk_printer_accepts_ps (printer));
}
@@ -1330,10 +1310,9 @@ setup_option (GtkPrintUnixDialog *dialog,
const gchar *option_name,
GtkPrinterOptionWidget *widget)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
GtkPrinterOption *option;
- option = gtk_printer_option_set_lookup (priv->options, option_name);
+ option = gtk_printer_option_set_lookup (dialog->options, option_name);
gtk_printer_option_widget_set_source (widget, option);
return option != NULL;
@@ -1458,30 +1437,29 @@ setup_page_table (GtkPrinterOptionSet *options,
static void
update_print_at_option (GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
GtkPrinterOption *option;
- option = gtk_printer_option_set_lookup (priv->options, "gtk-print-time");
+ option = gtk_printer_option_set_lookup (dialog->options, "gtk-print-time");
if (option == NULL)
return;
- if (priv->updating_print_at)
+ if (dialog->updating_print_at)
return;
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->print_at_radio)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->print_at_radio)))
gtk_printer_option_set (option, "at");
- else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->print_hold_radio)))
+ else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->print_hold_radio)))
gtk_printer_option_set (option, "on-hold");
else
gtk_printer_option_set (option, "now");
- option = gtk_printer_option_set_lookup (priv->options, "gtk-print-time-text");
+ option = gtk_printer_option_set_lookup (dialog->options, "gtk-print-time-text");
if (option != NULL)
{
const gchar *text;
- text = gtk_editable_get_text (GTK_EDITABLE (priv->print_at_entry));
+ text = gtk_editable_get_text (GTK_EDITABLE (dialog->print_at_entry));
gtk_printer_option_set (option, text);
}
}
@@ -1490,48 +1468,47 @@ update_print_at_option (GtkPrintUnixDialog *dialog)
static gboolean
setup_print_at (GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
GtkPrinterOption *option;
- option = gtk_printer_option_set_lookup (priv->options, "gtk-print-time");
+ option = gtk_printer_option_set_lookup (dialog->options, "gtk-print-time");
if (option == NULL)
{
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->print_now_radio),
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->print_now_radio),
TRUE);
- gtk_widget_set_sensitive (priv->print_at_radio, FALSE);
- gtk_widget_set_sensitive (priv->print_at_entry, FALSE);
- gtk_widget_set_sensitive (priv->print_hold_radio, FALSE);
- gtk_editable_set_text (GTK_EDITABLE (priv->print_at_entry), "");
+ gtk_widget_set_sensitive (dialog->print_at_radio, FALSE);
+ gtk_widget_set_sensitive (dialog->print_at_entry, FALSE);
+ gtk_widget_set_sensitive (dialog->print_hold_radio, FALSE);
+ gtk_editable_set_text (GTK_EDITABLE (dialog->print_at_entry), "");
return FALSE;
}
- priv->updating_print_at = TRUE;
+ dialog->updating_print_at = TRUE;
- gtk_widget_set_sensitive (priv->print_at_entry, FALSE);
- gtk_widget_set_sensitive (priv->print_at_radio,
+ gtk_widget_set_sensitive (dialog->print_at_entry, FALSE);
+ gtk_widget_set_sensitive (dialog->print_at_radio,
gtk_printer_option_has_choice (option, "at"));
- gtk_widget_set_sensitive (priv->print_hold_radio,
+ gtk_widget_set_sensitive (dialog->print_hold_radio,
gtk_printer_option_has_choice (option, "on-hold"));
update_print_at_option (dialog);
if (strcmp (option->value, "at") == 0)
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->print_at_radio),
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->print_at_radio),
TRUE);
else if (strcmp (option->value, "on-hold") == 0)
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->print_hold_radio),
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->print_hold_radio),
TRUE);
else
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->print_now_radio),
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->print_now_radio),
TRUE);
- option = gtk_printer_option_set_lookup (priv->options, "gtk-print-time-text");
+ option = gtk_printer_option_set_lookup (dialog->options, "gtk-print-time-text");
if (option != NULL)
- gtk_editable_set_text (GTK_EDITABLE (priv->print_at_entry), option->value);
+ gtk_editable_set_text (GTK_EDITABLE (dialog->print_at_entry), option->value);
- priv->updating_print_at = FALSE;
+ dialog->updating_print_at = FALSE;
return TRUE;
}
@@ -1539,7 +1516,6 @@ setup_print_at (GtkPrintUnixDialog *dialog)
static void
update_dialog_from_settings (GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
GList *groups, *l;
gchar *group;
GtkWidget *table, *frame;
@@ -1547,70 +1523,70 @@ update_dialog_from_settings (GtkPrintUnixDialog *dialog)
guint nrows;
GList *children;
- if (priv->current_printer == NULL)
+ if (dialog->current_printer == NULL)
{
clear_per_printer_ui (dialog);
- gtk_widget_hide (priv->job_page);
- gtk_widget_hide (priv->advanced_page);
- gtk_widget_hide (priv->image_quality_page);
- gtk_widget_hide (priv->finishing_page);
- gtk_widget_hide (priv->color_page);
+ gtk_widget_hide (dialog->job_page);
+ gtk_widget_hide (dialog->advanced_page);
+ gtk_widget_hide (dialog->image_quality_page);
+ gtk_widget_hide (dialog->finishing_page);
+ gtk_widget_hide (dialog->color_page);
gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, FALSE);
return;
}
- setup_option (dialog, "gtk-n-up", priv->pages_per_sheet);
- setup_option (dialog, "gtk-n-up-layout", priv->number_up_layout);
- setup_option (dialog, "gtk-duplex", priv->duplex);
- setup_option (dialog, "gtk-paper-type", priv->paper_type);
- setup_option (dialog, "gtk-paper-source", priv->paper_source);
- setup_option (dialog, "gtk-output-tray", priv->output_tray);
+ setup_option (dialog, "gtk-n-up", dialog->pages_per_sheet);
+ setup_option (dialog, "gtk-n-up-layout", dialog->number_up_layout);
+ setup_option (dialog, "gtk-duplex", dialog->duplex);
+ setup_option (dialog, "gtk-paper-type", dialog->paper_type);
+ setup_option (dialog, "gtk-paper-source", dialog->paper_source);
+ setup_option (dialog, "gtk-output-tray", dialog->output_tray);
has_job = FALSE;
- has_job |= setup_option (dialog, "gtk-job-prio", priv->job_prio);
- has_job |= setup_option (dialog, "gtk-billing-info", priv->billing_info);
- has_job |= setup_option (dialog, "gtk-cover-before", priv->cover_before);
- has_job |= setup_option (dialog, "gtk-cover-after", priv->cover_after);
+ has_job |= setup_option (dialog, "gtk-job-prio", dialog->job_prio);
+ has_job |= setup_option (dialog, "gtk-billing-info", dialog->billing_info);
+ has_job |= setup_option (dialog, "gtk-cover-before", dialog->cover_before);
+ has_job |= setup_option (dialog, "gtk-cover-after", dialog->cover_after);
has_job |= setup_print_at (dialog);
if (has_job)
- gtk_widget_show (priv->job_page);
+ gtk_widget_show (dialog->job_page);
else
- gtk_widget_hide (priv->job_page);
+ gtk_widget_hide (dialog->job_page);
- setup_page_table (priv->options,
+ setup_page_table (dialog->options,
"ImageQualityPage",
- priv->image_quality_table,
- priv->image_quality_page);
+ dialog->image_quality_table,
+ dialog->image_quality_page);
- setup_page_table (priv->options,
+ setup_page_table (dialog->options,
"FinishingPage",
- priv->finishing_table,
- priv->finishing_page);
+ dialog->finishing_table,
+ dialog->finishing_page);
- setup_page_table (priv->options,
+ setup_page_table (dialog->options,
"ColorPage",
- priv->color_table,
- priv->color_page);
+ dialog->color_table,
+ dialog->color_page);
- gtk_printer_option_set_foreach_in_group (priv->options,
+ gtk_printer_option_set_foreach_in_group (dialog->options,
"GtkPrintDialogExtension",
add_option_to_extension_point,
- priv->extension_point);
+ dialog->extension_point);
/* A bit of a hack, keep the last option flush right.
* This keeps the file format radios from moving as the
* filename changes.
*/
- children = gtk_container_get_children (GTK_CONTAINER (priv->extension_point));
+ children = gtk_container_get_children (GTK_CONTAINER (dialog->extension_point));
l = g_list_last (children);
if (l && l != children)
gtk_widget_set_halign (GTK_WIDGET (l->data), GTK_ALIGN_END);
g_list_free (children);
/* Put the rest of the groups in the advanced page */
- groups = gtk_printer_option_set_get_groups (priv->options);
+ groups = gtk_printer_option_set_get_groups (dialog->options);
has_advanced = FALSE;
for (l = groups; l != NULL; l = l->next)
@@ -1630,7 +1606,7 @@ update_dialog_from_settings (GtkPrintUnixDialog *dialog)
gtk_grid_set_row_spacing (GTK_GRID (table), 6);
gtk_grid_set_column_spacing (GTK_GRID (table), 12);
- gtk_printer_option_set_foreach_in_group (priv->options,
+ gtk_printer_option_set_foreach_in_group (dialog->options,
group,
add_option_to_table,
table);
@@ -1645,15 +1621,15 @@ update_dialog_from_settings (GtkPrintUnixDialog *dialog)
gtk_widget_show (table);
gtk_widget_show (frame);
- gtk_container_add (GTK_CONTAINER (priv->advanced_vbox),
+ gtk_container_add (GTK_CONTAINER (dialog->advanced_vbox),
frame);
}
}
if (has_advanced)
- gtk_widget_show (priv->advanced_page);
+ gtk_widget_show (dialog->advanced_page);
else
- gtk_widget_hide (priv->advanced_page);
+ gtk_widget_hide (dialog->advanced_page);
g_list_free_full (groups, g_free);
}
@@ -1661,29 +1637,28 @@ update_dialog_from_settings (GtkPrintUnixDialog *dialog)
static void
update_dialog_from_capabilities (GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
GtkPrintCapabilities caps;
gboolean can_collate;
const gchar *copies;
GtkWidget *button;
- copies = gtk_editable_get_text (GTK_EDITABLE (priv->copies_spin));
+ copies = gtk_editable_get_text (GTK_EDITABLE (dialog->copies_spin));
can_collate = (*copies != '\0' && atoi (copies) > 1);
- caps = priv->manual_capabilities | priv->printer_capabilities;
+ caps = dialog->manual_capabilities | dialog->printer_capabilities;
- gtk_widget_set_sensitive (priv->page_set_combo,
+ gtk_widget_set_sensitive (dialog->page_set_combo,
caps & GTK_PRINT_CAPABILITY_PAGE_SET);
- gtk_widget_set_sensitive (priv->copies_spin,
+ gtk_widget_set_sensitive (dialog->copies_spin,
caps & GTK_PRINT_CAPABILITY_COPIES);
- gtk_widget_set_sensitive (priv->collate_check,
+ gtk_widget_set_sensitive (dialog->collate_check,
can_collate &&
(caps & GTK_PRINT_CAPABILITY_COLLATE));
- gtk_widget_set_sensitive (priv->reverse_check,
+ gtk_widget_set_sensitive (dialog->reverse_check,
caps & GTK_PRINT_CAPABILITY_REVERSE);
- gtk_widget_set_sensitive (priv->scale_spin,
+ gtk_widget_set_sensitive (dialog->scale_spin,
caps & GTK_PRINT_CAPABILITY_SCALE);
- gtk_widget_set_sensitive (GTK_WIDGET (priv->pages_per_sheet),
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->pages_per_sheet),
caps & GTK_PRINT_CAPABILITY_NUMBER_UP);
button = gtk_dialog_get_widget_for_response (GTK_DIALOG (dialog), GTK_RESPONSE_APPLY);
@@ -1691,7 +1666,7 @@ update_dialog_from_capabilities (GtkPrintUnixDialog *dialog)
update_collate_icon (NULL, dialog);
- gtk_tree_model_filter_refilter (priv->printer_list_filter);
+ gtk_tree_model_filter_refilter (dialog->printer_list_filter);
}
static gboolean
@@ -1721,24 +1696,23 @@ set_paper_size (GtkPrintUnixDialog *dialog,
gboolean size_only,
gboolean add_item)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
GtkTreeModel *model;
GtkTreeIter iter;
GtkPageSetup *list_page_setup;
- if (!priv->internal_page_setup_change)
+ if (!dialog->internal_page_setup_change)
return TRUE;
if (page_setup == NULL)
return FALSE;
- model = GTK_TREE_MODEL (priv->page_setup_list);
+ model = GTK_TREE_MODEL (dialog->page_setup_list);
if (gtk_tree_model_get_iter_first (model, &iter))
{
do
{
- gtk_tree_model_get (GTK_TREE_MODEL (priv->page_setup_list), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (dialog->page_setup_list), &iter,
PAGE_SETUP_LIST_COL_PAGE_SETUP, &list_page_setup,
-1);
if (list_page_setup == NULL)
@@ -1747,9 +1721,9 @@ set_paper_size (GtkPrintUnixDialog *dialog,
if ((size_only && page_setup_is_same_size (page_setup, list_page_setup)) ||
(!size_only && page_setup_is_equal (page_setup, list_page_setup)))
{
- gtk_combo_box_set_active_iter (GTK_COMBO_BOX (priv->paper_size_combo),
+ gtk_combo_box_set_active_iter (GTK_COMBO_BOX (dialog->paper_size_combo),
&iter);
- gtk_combo_box_set_active (GTK_COMBO_BOX (priv->orientation_combo),
+ gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->orientation_combo),
gtk_page_setup_get_orientation (page_setup));
g_object_unref (list_page_setup);
return TRUE;
@@ -1762,17 +1736,17 @@ set_paper_size (GtkPrintUnixDialog *dialog,
if (add_item)
{
- gtk_list_store_append (priv->page_setup_list, &iter);
- gtk_list_store_set (priv->page_setup_list, &iter,
+ gtk_list_store_append (dialog->page_setup_list, &iter);
+ gtk_list_store_set (dialog->page_setup_list, &iter,
PAGE_SETUP_LIST_COL_IS_SEPARATOR, TRUE,
-1);
- gtk_list_store_append (priv->page_setup_list, &iter);
- gtk_list_store_set (priv->page_setup_list, &iter,
+ gtk_list_store_append (dialog->page_setup_list, &iter);
+ gtk_list_store_set (dialog->page_setup_list, &iter,
PAGE_SETUP_LIST_COL_PAGE_SETUP, page_setup,
-1);
- gtk_combo_box_set_active_iter (GTK_COMBO_BOX (priv->paper_size_combo),
+ gtk_combo_box_set_active_iter (GTK_COMBO_BOX (dialog->paper_size_combo),
&iter);
- gtk_combo_box_set_active (GTK_COMBO_BOX (priv->orientation_combo),
+ gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->orientation_combo),
gtk_page_setup_get_orientation (page_setup));
return TRUE;
}
@@ -1783,15 +1757,14 @@ set_paper_size (GtkPrintUnixDialog *dialog,
static void
fill_custom_paper_sizes (GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
GtkTreeIter iter, paper_iter;
GtkTreeModel *model;
- model = GTK_TREE_MODEL (priv->custom_paper_list);
+ model = GTK_TREE_MODEL (dialog->custom_paper_list);
if (gtk_tree_model_get_iter_first (model, &iter))
{
- gtk_list_store_append (priv->page_setup_list, &paper_iter);
- gtk_list_store_set (priv->page_setup_list, &paper_iter,
+ gtk_list_store_append (dialog->page_setup_list, &paper_iter);
+ gtk_list_store_set (dialog->page_setup_list, &paper_iter,
PAGE_SETUP_LIST_COL_IS_SEPARATOR, TRUE,
-1);
do
@@ -1799,8 +1772,8 @@ fill_custom_paper_sizes (GtkPrintUnixDialog *dialog)
GtkPageSetup *page_setup;
gtk_tree_model_get (model, &iter, 0, &page_setup, -1);
- gtk_list_store_append (priv->page_setup_list, &paper_iter);
- gtk_list_store_set (priv->page_setup_list, &paper_iter,
+ gtk_list_store_append (dialog->page_setup_list, &paper_iter);
+ gtk_list_store_set (dialog->page_setup_list, &paper_iter,
PAGE_SETUP_LIST_COL_PAGE_SETUP, page_setup,
-1);
@@ -1808,12 +1781,12 @@ fill_custom_paper_sizes (GtkPrintUnixDialog *dialog)
} while (gtk_tree_model_iter_next (model, &iter));
}
- gtk_list_store_append (priv->page_setup_list, &paper_iter);
- gtk_list_store_set (priv->page_setup_list, &paper_iter,
+ gtk_list_store_append (dialog->page_setup_list, &paper_iter);
+ gtk_list_store_set (dialog->page_setup_list, &paper_iter,
PAGE_SETUP_LIST_COL_IS_SEPARATOR, TRUE,
-1);
- gtk_list_store_append (priv->page_setup_list, &paper_iter);
- gtk_list_store_set (priv->page_setup_list, &paper_iter,
+ gtk_list_store_append (dialog->page_setup_list, &paper_iter);
+ gtk_list_store_set (dialog->page_setup_list, &paper_iter,
PAGE_SETUP_LIST_COL_PAGE_SETUP, NULL,
-1);
}
@@ -1822,14 +1795,13 @@ static void
fill_paper_sizes (GtkPrintUnixDialog *dialog,
GtkPrinter *printer)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
GList *list, *l;
GtkPageSetup *page_setup;
GtkPaperSize *paper_size;
GtkTreeIter iter;
gint i;
- gtk_list_store_clear (priv->page_setup_list);
+ gtk_list_store_clear (dialog->page_setup_list);
if (printer == NULL || (list = gtk_printer_list_papers (printer)) == NULL)
{
@@ -1840,8 +1812,8 @@ fill_paper_sizes (GtkPrintUnixDialog *dialog,
gtk_page_setup_set_paper_size_and_default_margins (page_setup, paper_size);
gtk_paper_size_free (paper_size);
- gtk_list_store_append (priv->page_setup_list, &iter);
- gtk_list_store_set (priv->page_setup_list, &iter,
+ gtk_list_store_append (dialog->page_setup_list, &iter);
+ gtk_list_store_set (dialog->page_setup_list, &iter,
PAGE_SETUP_LIST_COL_PAGE_SETUP, page_setup,
-1);
g_object_unref (page_setup);
@@ -1852,8 +1824,8 @@ fill_paper_sizes (GtkPrintUnixDialog *dialog,
for (l = list; l != NULL; l = l->next)
{
page_setup = l->data;
- gtk_list_store_append (priv->page_setup_list, &iter);
- gtk_list_store_set (priv->page_setup_list, &iter,
+ gtk_list_store_append (dialog->page_setup_list, &iter);
+ gtk_list_store_set (dialog->page_setup_list, &iter,
PAGE_SETUP_LIST_COL_PAGE_SETUP, page_setup,
-1);
g_object_unref (page_setup);
@@ -1888,42 +1860,40 @@ update_paper_sizes (GtkPrintUnixDialog *dialog)
static void
mark_conflicts (GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
GtkPrinter *printer;
gboolean have_conflict;
have_conflict = FALSE;
- printer = priv->current_printer;
+ printer = dialog->current_printer;
if (printer)
{
- g_signal_handler_block (priv->options,
- priv->options_changed_handler);
+ g_signal_handler_block (dialog->options,
+ dialog->options_changed_handler);
- gtk_printer_option_set_clear_conflicts (priv->options);
+ gtk_printer_option_set_clear_conflicts (dialog->options);
have_conflict = _gtk_printer_mark_conflicts (printer,
- priv->options);
+ dialog->options);
- g_signal_handler_unblock (priv->options,
- priv->options_changed_handler);
+ g_signal_handler_unblock (dialog->options,
+ dialog->options_changed_handler);
}
if (have_conflict)
- gtk_widget_show (priv->conflicts_widget);
+ gtk_widget_show (dialog->conflicts_widget);
else
- gtk_widget_hide (priv->conflicts_widget);
+ gtk_widget_hide (dialog->conflicts_widget);
}
static gboolean
mark_conflicts_callback (gpointer data)
{
GtkPrintUnixDialog *dialog = data;
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
- priv->mark_conflicts_id = 0;
+ dialog->mark_conflicts_id = 0;
mark_conflicts (dialog);
@@ -1933,36 +1903,30 @@ mark_conflicts_callback (gpointer data)
static void
unschedule_idle_mark_conflicts (GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
- if (priv->mark_conflicts_id != 0)
+ if (dialog->mark_conflicts_id != 0)
{
- g_source_remove (priv->mark_conflicts_id);
- priv->mark_conflicts_id = 0;
+ g_source_remove (dialog->mark_conflicts_id);
+ dialog->mark_conflicts_id = 0;
}
}
static void
schedule_idle_mark_conflicts (GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
- if (priv->mark_conflicts_id != 0)
+ if (dialog->mark_conflicts_id != 0)
return;
- priv->mark_conflicts_id = g_idle_add (mark_conflicts_callback, dialog);
- g_source_set_name_by_id (priv->mark_conflicts_id, "[gtk] mark_conflicts_callback");
+ dialog->mark_conflicts_id = g_idle_add (mark_conflicts_callback, dialog);
+ g_source_set_name_by_id (dialog->mark_conflicts_id, "[gtk] mark_conflicts_callback");
}
static void
options_changed_cb (GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
schedule_idle_mark_conflicts (dialog);
- g_free (priv->waiting_for_printer);
- priv->waiting_for_printer = NULL;
+ g_free (dialog->waiting_for_printer);
+ dialog->waiting_for_printer = NULL;
}
static void
@@ -1983,20 +1947,18 @@ extension_point_clear_children (GtkContainer *container)
static void
clear_per_printer_ui (GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
- if (priv->finishing_table == NULL)
+ if (dialog->finishing_table == NULL)
return;
- gtk_container_foreach (GTK_CONTAINER (priv->finishing_table),
+ gtk_container_foreach (GTK_CONTAINER (dialog->finishing_table),
(GtkCallback)gtk_widget_destroy, NULL);
- gtk_container_foreach (GTK_CONTAINER (priv->image_quality_table),
+ gtk_container_foreach (GTK_CONTAINER (dialog->image_quality_table),
(GtkCallback)gtk_widget_destroy, NULL);
- gtk_container_foreach (GTK_CONTAINER (priv->color_table),
+ gtk_container_foreach (GTK_CONTAINER (dialog->color_table),
(GtkCallback)gtk_widget_destroy, NULL);
- gtk_container_foreach (GTK_CONTAINER (priv->advanced_vbox),
+ gtk_container_foreach (GTK_CONTAINER (dialog->advanced_vbox),
(GtkCallback)gtk_widget_destroy, NULL);
- extension_point_clear_children (GTK_CONTAINER (priv->extension_point));
+ extension_point_clear_children (GTK_CONTAINER (dialog->extension_point));
}
static void
@@ -2004,14 +1966,12 @@ printer_details_acquired (GtkPrinter *printer,
gboolean success,
GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
disconnect_printer_details_request (dialog, !success);
if (success)
{
GtkTreeSelection *selection;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->printer_treeview));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->printer_treeview));
selected_printer_changed (selection, dialog);
}
@@ -2021,18 +1981,17 @@ static void
selected_printer_changed (GtkTreeSelection *selection,
GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
GtkPrinter *printer;
GtkTreeIter iter, filter_iter;
/* Whenever the user selects a printer we stop looking for
* the printer specified in the initial settings
*/
- if (priv->waiting_for_printer &&
- !priv->internal_printer_change)
+ if (dialog->waiting_for_printer &&
+ !dialog->internal_printer_change)
{
- g_free (priv->waiting_for_printer);
- priv->waiting_for_printer = NULL;
+ g_free (dialog->waiting_for_printer);
+ dialog->waiting_for_printer = NULL;
}
disconnect_printer_details_request (dialog, FALSE);
@@ -2040,11 +1999,11 @@ selected_printer_changed (GtkTreeSelection *selection,
printer = NULL;
if (gtk_tree_selection_get_selected (selection, NULL, &filter_iter))
{
- gtk_tree_model_filter_convert_iter_to_child_iter (priv->printer_list_filter,
+ gtk_tree_model_filter_convert_iter_to_child_iter (dialog->printer_list_filter,
&iter,
&filter_iter);
- gtk_tree_model_get (priv->printer_list, &iter,
+ gtk_tree_model_get (dialog->printer_list, &iter,
PRINTER_LIST_COL_PRINTER_OBJ, &printer,
-1);
}
@@ -2056,7 +2015,7 @@ selected_printer_changed (GtkTreeSelection *selection,
{
if (!gtk_printer_is_accepting_jobs (printer))
gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, FALSE);
- else if (priv->current_printer == printer && gtk_printer_has_details (printer))
+ else if (dialog->current_printer == printer && gtk_printer_has_details (printer))
gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, TRUE);
}
@@ -2064,13 +2023,13 @@ selected_printer_changed (GtkTreeSelection *selection,
if (printer != NULL && !gtk_printer_has_details (printer))
{
gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, FALSE);
- priv->request_details_tag =
+ dialog->request_details_tag =
g_signal_connect (printer, "details-acquired",
G_CALLBACK (printer_details_acquired), dialog);
/* take the reference */
- priv->request_details_printer = printer;
+ dialog->request_details_printer = printer;
set_busy_cursor (dialog, TRUE);
- gtk_list_store_set (GTK_LIST_STORE (priv->printer_list),
+ gtk_list_store_set (GTK_LIST_STORE (dialog->printer_list),
g_object_get_data (G_OBJECT (printer), "gtk-print-tree-iter"),
PRINTER_LIST_COL_STATE, _("Getting printer information…"),
-1);
@@ -2078,29 +2037,29 @@ selected_printer_changed (GtkTreeSelection *selection,
return;
}
- if (printer == priv->current_printer)
+ if (printer == dialog->current_printer)
{
if (printer)
g_object_unref (printer);
return;
}
- if (priv->options)
+ if (dialog->options)
{
- g_clear_object (&priv->options);
+ g_clear_object (&dialog->options);
clear_per_printer_ui (dialog);
}
- g_clear_object (&priv->current_printer);
- priv->printer_capabilities = 0;
+ g_clear_object (&dialog->current_printer);
+ dialog->printer_capabilities = 0;
if (printer != NULL && gtk_printer_is_accepting_jobs (printer))
gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, TRUE);
- priv->current_printer = printer;
+ dialog->current_printer = printer;
if (printer != NULL)
{
- if (!priv->page_setup_set)
+ if (!dialog->page_setup_set)
{
/* if no explicit page setup has been set, use the printer default */
GtkPageSetup *page_setup;
@@ -2110,30 +2069,30 @@ selected_printer_changed (GtkTreeSelection *selection,
if (!page_setup)
page_setup = gtk_page_setup_new ();
- if (page_setup && priv->page_setup)
- gtk_page_setup_set_orientation (page_setup, gtk_page_setup_get_orientation (priv->page_setup));
+ if (page_setup && dialog->page_setup)
+ gtk_page_setup_set_orientation (page_setup, gtk_page_setup_get_orientation (dialog->page_setup));
- g_clear_object (&priv->page_setup);
- priv->page_setup = page_setup; /* transfer ownership */
+ g_clear_object (&dialog->page_setup);
+ dialog->page_setup = page_setup; /* transfer ownership */
}
- priv->printer_capabilities = gtk_printer_get_capabilities (printer);
- priv->options = _gtk_printer_get_options (printer,
- priv->initial_settings,
- priv->page_setup,
- priv->manual_capabilities);
+ dialog->printer_capabilities = gtk_printer_get_capabilities (printer);
+ dialog->options = _gtk_printer_get_options (printer,
+ dialog->initial_settings,
+ dialog->page_setup,
+ dialog->manual_capabilities);
- priv->options_changed_handler =
- g_signal_connect_swapped (priv->options, "changed", G_CALLBACK (options_changed_cb), dialog);
+ dialog->options_changed_handler =
+ g_signal_connect_swapped (dialog->options, "changed", G_CALLBACK (options_changed_cb), dialog);
schedule_idle_mark_conflicts (dialog);
}
update_dialog_from_settings (dialog);
update_dialog_from_capabilities (dialog);
- priv->internal_page_setup_change = TRUE;
+ dialog->internal_page_setup_change = TRUE;
update_paper_sizes (dialog);
- priv->internal_page_setup_change = FALSE;
+ dialog->internal_page_setup_change = FALSE;
g_object_notify ( G_OBJECT(dialog), "selected-printer");
}
@@ -2221,9 +2180,7 @@ static void
update_collate_icon (GtkToggleButton *toggle_button,
GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
- gtk_widget_queue_draw (priv->collate_image);
+ gtk_widget_queue_draw (dialog->collate_image);
}
static void
@@ -2321,10 +2278,8 @@ page_range_entry_focus_changed (GtkWidget *entry,
GParamSpec *pspec,
GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
if (gtk_widget_has_focus (entry))
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->page_range_radio), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->page_range_radio), TRUE);
return FALSE;
}
@@ -2333,28 +2288,26 @@ static void
update_page_range_entry_sensitivity (GtkWidget *button,
GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
gboolean active;
active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
if (active)
- gtk_widget_grab_focus (priv->page_range_entry);
+ gtk_widget_grab_focus (dialog->page_range_entry);
}
static void
update_print_at_entry_sensitivity (GtkWidget *button,
GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
gboolean active;
active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
- gtk_widget_set_sensitive (priv->print_at_entry, active);
+ gtk_widget_set_sensitive (dialog->print_at_entry, active);
if (active)
- gtk_widget_grab_focus (priv->print_at_entry);
+ gtk_widget_grab_focus (dialog->print_at_entry);
}
static void
@@ -2380,14 +2333,13 @@ static GtkPageRange *
dialog_get_page_ranges (GtkPrintUnixDialog *dialog,
gint *n_ranges_out)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
gint i, n_ranges;
const gchar *text, *p;
gchar *next;
GtkPageRange *ranges;
gint start, end;
- text = gtk_editable_get_text (GTK_EDITABLE (priv->page_range_entry));
+ text = gtk_editable_get_text (GTK_EDITABLE (dialog->page_range_entry));
if (*text == 0)
{
@@ -2462,7 +2414,6 @@ dialog_set_page_ranges (GtkPrintUnixDialog *dialog,
GtkPageRange *ranges,
gint n_ranges)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
gint i;
GString *s = g_string_new (NULL);
@@ -2478,7 +2429,7 @@ dialog_set_page_ranges (GtkPrintUnixDialog *dialog,
g_string_append (s, ",");
}
- gtk_editable_set_text (GTK_EDITABLE (priv->page_range_entry), s->str);
+ gtk_editable_set_text (GTK_EDITABLE (dialog->page_range_entry), s->str);
g_string_free (s, TRUE);
}
@@ -2486,13 +2437,11 @@ dialog_set_page_ranges (GtkPrintUnixDialog *dialog,
static GtkPrintPages
dialog_get_print_pages (GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->all_pages_radio)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->all_pages_radio)))
return GTK_PRINT_PAGES_ALL;
- else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->current_page_radio)))
+ else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->current_page_radio)))
return GTK_PRINT_PAGES_CURRENT;
- else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->selection_radio)))
+ else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->selection_radio)))
return GTK_PRINT_PAGES_SELECTION;
else
return GTK_PRINT_PAGES_RANGES;
@@ -2502,25 +2451,21 @@ static void
dialog_set_print_pages (GtkPrintUnixDialog *dialog,
GtkPrintPages pages)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
if (pages == GTK_PRINT_PAGES_RANGES)
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->page_range_radio), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->page_range_radio), TRUE);
else if (pages == GTK_PRINT_PAGES_CURRENT)
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->current_page_radio), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->current_page_radio), TRUE);
else if (pages == GTK_PRINT_PAGES_SELECTION)
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->selection_radio), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->selection_radio), TRUE);
else
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->all_pages_radio), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->all_pages_radio), TRUE);
}
static gdouble
dialog_get_scale (GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
- if (gtk_widget_is_sensitive (priv->scale_spin))
- return gtk_spin_button_get_value (GTK_SPIN_BUTTON (priv->scale_spin));
+ if (gtk_widget_is_sensitive (dialog->scale_spin))
+ return gtk_spin_button_get_value (GTK_SPIN_BUTTON (dialog->scale_spin));
else
return 100.0;
}
@@ -2529,18 +2474,14 @@ static void
dialog_set_scale (GtkPrintUnixDialog *dialog,
gdouble val)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->scale_spin), val);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (dialog->scale_spin), val);
}
static GtkPageSet
dialog_get_page_set (GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
- if (gtk_widget_is_sensitive (priv->page_set_combo))
- return (GtkPageSet)gtk_combo_box_get_active (GTK_COMBO_BOX (priv->page_set_combo));
+ if (gtk_widget_is_sensitive (dialog->page_set_combo))
+ return (GtkPageSet)gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->page_set_combo));
else
return GTK_PAGE_SET_ALL;
}
@@ -2549,26 +2490,23 @@ static void
dialog_set_page_set (GtkPrintUnixDialog *dialog,
GtkPageSet val)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
- gtk_combo_box_set_active (GTK_COMBO_BOX (priv->page_set_combo), (int)val);
+ gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->page_set_combo), (int)val);
}
static gint
dialog_get_n_copies (GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
GtkAdjustment *adjustment;
const gchar *text;
gchar *endptr = NULL;
gint n_copies;
- adjustment = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (priv->copies_spin));
+ adjustment = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (dialog->copies_spin));
- text = gtk_editable_get_text (GTK_EDITABLE (priv->copies_spin));
+ text = gtk_editable_get_text (GTK_EDITABLE (dialog->copies_spin));
n_copies = g_ascii_strtoull (text, &endptr, 0);
- if (gtk_widget_is_sensitive (priv->copies_spin))
+ if (gtk_widget_is_sensitive (dialog->copies_spin))
{
if (n_copies != 0 && endptr != text && (endptr != NULL && endptr[0] == '\0') &&
n_copies >= gtk_adjustment_get_lower (adjustment) &&
@@ -2577,7 +2515,7 @@ dialog_get_n_copies (GtkPrintUnixDialog *dialog)
return n_copies;
}
- return gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (priv->copies_spin));
+ return gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (dialog->copies_spin));
}
return 1;
@@ -2587,19 +2525,14 @@ static void
dialog_set_n_copies (GtkPrintUnixDialog *dialog,
gint n_copies)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->copies_spin),
- n_copies);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (dialog->copies_spin), n_copies);
}
static gboolean
dialog_get_collate (GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
- if (gtk_widget_is_sensitive (priv->collate_check))
- return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->collate_check));
+ if (gtk_widget_is_sensitive (dialog->collate_check))
+ return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->collate_check));
return FALSE;
}
@@ -2607,19 +2540,14 @@ static void
dialog_set_collate (GtkPrintUnixDialog *dialog,
gboolean collate)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->collate_check),
- collate);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->collate_check), collate);
}
static gboolean
dialog_get_reverse (GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
- if (gtk_widget_is_sensitive (priv->reverse_check))
- return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->reverse_check));
+ if (gtk_widget_is_sensitive (dialog->reverse_check))
+ return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->reverse_check));
return FALSE;
}
@@ -2627,20 +2555,16 @@ static void
dialog_set_reverse (GtkPrintUnixDialog *dialog,
gboolean reverse)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->reverse_check),
- reverse);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->reverse_check), reverse);
}
static gint
dialog_get_pages_per_sheet (GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
const gchar *val;
gint num;
- val = gtk_printer_option_widget_get_value (priv->pages_per_sheet);
+ val = gtk_printer_option_widget_get_value (dialog->pages_per_sheet);
num = 1;
@@ -2657,16 +2581,15 @@ dialog_get_pages_per_sheet (GtkPrintUnixDialog *dialog)
static GtkNumberUpLayout
dialog_get_number_up_layout (GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
GtkPrintCapabilities caps;
GtkNumberUpLayout layout;
const gchar *val;
GEnumClass *enum_class;
GEnumValue *enum_value;
- val = gtk_printer_option_widget_get_value (priv->number_up_layout);
+ val = gtk_printer_option_widget_get_value (dialog->number_up_layout);
- caps = priv->manual_capabilities | priv->printer_capabilities;
+ caps = dialog->manual_capabilities | dialog->printer_capabilities;
if ((caps & GTK_PRINT_CAPABILITY_NUMBER_UP_LAYOUT) == 0)
return GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_TOP_TO_BOTTOM;
@@ -2679,9 +2602,9 @@ dialog_get_number_up_layout (GtkPrintUnixDialog *dialog)
if (val == NULL)
return layout;
- if (val[0] == '\0' && priv->options)
+ if (val[0] == '\0' && dialog->options)
{
- GtkPrinterOption *option = gtk_printer_option_set_lookup (priv->options, "gtk-n-up-layout");
+ GtkPrinterOption *option = gtk_printer_option_set_lookup (dialog->options, "gtk-n-up-layout");
if (option)
val = option->value;
}
@@ -2704,7 +2627,6 @@ draw_page (GtkDrawingArea *da,
{
GtkWidget *widget = GTK_WIDGET (da);
GtkPrintUnixDialog *dialog = GTK_PRINT_UNIX_DIALOG (data);
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
GtkStyleContext *context;
gdouble ratio;
gint w, h, tmp;
@@ -2726,7 +2648,7 @@ draw_page (GtkDrawingArea *da,
gint pages_per_sheet;
gboolean ltr = TRUE;
- orientation = gtk_page_setup_get_orientation (priv->page_setup);
+ orientation = gtk_page_setup_get_orientation (dialog->page_setup);
landscape =
(orientation == GTK_PAGE_ORIENTATION_LANDSCAPE) ||
(orientation == GTK_PAGE_ORIENTATION_REVERSE_LANDSCAPE);
@@ -3101,16 +3023,13 @@ draw_page (GtkDrawingArea *da,
static void
redraw_page_layout_preview (GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
- if (priv->page_layout_preview)
- gtk_widget_queue_draw (priv->page_layout_preview);
+ if (dialog->page_layout_preview)
+ gtk_widget_queue_draw (dialog->page_layout_preview);
}
static void
update_number_up_layout (GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
GtkPrintCapabilities caps;
GtkPrinterOptionSet *set;
GtkNumberUpLayout layout;
@@ -3118,16 +3037,16 @@ update_number_up_layout (GtkPrintUnixDialog *dialog)
GtkPrinterOption *old_option;
GtkPageOrientation page_orientation;
- set = priv->options;
+ set = dialog->options;
- caps = priv->manual_capabilities | priv->printer_capabilities;
+ caps = dialog->manual_capabilities | dialog->printer_capabilities;
if (caps & GTK_PRINT_CAPABILITY_NUMBER_UP_LAYOUT)
{
- if (priv->number_up_layout_n_option == NULL)
+ if (dialog->number_up_layout_n_option == NULL)
{
- priv->number_up_layout_n_option = gtk_printer_option_set_lookup (set, "gtk-n-up-layout");
- if (priv->number_up_layout_n_option == NULL)
+ dialog->number_up_layout_n_option = gtk_printer_option_set_lookup (set, "gtk-n-up-layout");
+ if (dialog->number_up_layout_n_option == NULL)
{
const char *n_up_layout[] = { "lrtb", "lrbt", "rltb", "rlbt", "tblr", "tbrl", "btlr", "btrl" };
/* Translators: These strings name the possible arrangements of
@@ -3139,51 +3058,51 @@ update_number_up_layout (GtkPrintUnixDialog *dialog)
N_("Bottom to top, left to right"), N_("Bottom to top, right to left") };
int i;
- priv->number_up_layout_n_option = gtk_printer_option_new ("gtk-n-up-layout",
+ dialog->number_up_layout_n_option = gtk_printer_option_new ("gtk-n-up-layout",
_("Page Ordering"),
GTK_PRINTER_OPTION_TYPE_PICKONE);
- gtk_printer_option_allocate_choices (priv->number_up_layout_n_option, 8);
+ gtk_printer_option_allocate_choices (dialog->number_up_layout_n_option, 8);
for (i = 0; i < G_N_ELEMENTS (n_up_layout_display); i++)
{
- priv->number_up_layout_n_option->choices[i] = g_strdup (n_up_layout[i]);
- priv->number_up_layout_n_option->choices_display[i] = g_strdup (_(n_up_layout_display[i]));
+ dialog->number_up_layout_n_option->choices[i] = g_strdup (n_up_layout[i]);
+ dialog->number_up_layout_n_option->choices_display[i] = g_strdup (_(n_up_layout_display[i]));
}
}
- g_object_ref (priv->number_up_layout_n_option);
+ g_object_ref (dialog->number_up_layout_n_option);
- priv->number_up_layout_2_option = gtk_printer_option_new ("gtk-n-up-layout",
+ dialog->number_up_layout_2_option = gtk_printer_option_new ("gtk-n-up-layout",
_("Page Ordering"),
GTK_PRINTER_OPTION_TYPE_PICKONE);
- gtk_printer_option_allocate_choices (priv->number_up_layout_2_option, 2);
+ gtk_printer_option_allocate_choices (dialog->number_up_layout_2_option, 2);
}
- page_orientation = gtk_page_setup_get_orientation (priv->page_setup);
+ page_orientation = gtk_page_setup_get_orientation (dialog->page_setup);
if (page_orientation == GTK_PAGE_ORIENTATION_PORTRAIT ||
page_orientation == GTK_PAGE_ORIENTATION_REVERSE_PORTRAIT)
{
- if (! (priv->number_up_layout_2_option->choices[0] == priv->number_up_layout_n_option->choices[0] &&
- priv->number_up_layout_2_option->choices[1] == priv->number_up_layout_n_option->choices[2]))
+ if (! (dialog->number_up_layout_2_option->choices[0] == dialog->number_up_layout_n_option->choices[0] &&
+ dialog->number_up_layout_2_option->choices[1] == dialog->number_up_layout_n_option->choices[2]))
{
- g_free (priv->number_up_layout_2_option->choices_display[0]);
- g_free (priv->number_up_layout_2_option->choices_display[1]);
- priv->number_up_layout_2_option->choices[0] = priv->number_up_layout_n_option->choices[0];
- priv->number_up_layout_2_option->choices[1] = priv->number_up_layout_n_option->choices[2];
- priv->number_up_layout_2_option->choices_display[0] = g_strdup ( _("Left to right"));
- priv->number_up_layout_2_option->choices_display[1] = g_strdup ( _("Right to left"));
+ g_free (dialog->number_up_layout_2_option->choices_display[0]);
+ g_free (dialog->number_up_layout_2_option->choices_display[1]);
+ dialog->number_up_layout_2_option->choices[0] = dialog->number_up_layout_n_option->choices[0];
+ dialog->number_up_layout_2_option->choices[1] = dialog->number_up_layout_n_option->choices[2];
+ dialog->number_up_layout_2_option->choices_display[0] = g_strdup ( _("Left to right"));
+ dialog->number_up_layout_2_option->choices_display[1] = g_strdup ( _("Right to left"));
}
}
else
{
- if (! (priv->number_up_layout_2_option->choices[0] == priv->number_up_layout_n_option->choices[0] &&
- priv->number_up_layout_2_option->choices[1] == priv->number_up_layout_n_option->choices[1]))
+ if (! (dialog->number_up_layout_2_option->choices[0] == dialog->number_up_layout_n_option->choices[0] &&
+ dialog->number_up_layout_2_option->choices[1] == dialog->number_up_layout_n_option->choices[1]))
{
- g_free (priv->number_up_layout_2_option->choices_display[0]);
- g_free (priv->number_up_layout_2_option->choices_display[1]);
- priv->number_up_layout_2_option->choices[0] = priv->number_up_layout_n_option->choices[0];
- priv->number_up_layout_2_option->choices[1] = priv->number_up_layout_n_option->choices[1];
- priv->number_up_layout_2_option->choices_display[0] = g_strdup ( _("Top to bottom"));
- priv->number_up_layout_2_option->choices_display[1] = g_strdup ( _("Bottom to top"));
+ g_free (dialog->number_up_layout_2_option->choices_display[0]);
+ g_free (dialog->number_up_layout_2_option->choices_display[1]);
+ dialog->number_up_layout_2_option->choices[0] = dialog->number_up_layout_n_option->choices[0];
+ dialog->number_up_layout_2_option->choices[1] = dialog->number_up_layout_n_option->choices[1];
+ dialog->number_up_layout_2_option->choices_display[0] = g_strdup ( _("Top to bottom"));
+ dialog->number_up_layout_2_option->choices_display[1] = g_strdup ( _("Bottom to top"));
}
}
@@ -3201,7 +3120,7 @@ update_number_up_layout (GtkPrintUnixDialog *dialog)
if (dialog_get_pages_per_sheet (dialog) == 2)
{
- option = priv->number_up_layout_2_option;
+ option = dialog->number_up_layout_2_option;
switch (layout)
{
@@ -3232,7 +3151,7 @@ update_number_up_layout (GtkPrintUnixDialog *dialog)
}
else
{
- option = priv->number_up_layout_n_option;
+ option = dialog->number_up_layout_n_option;
enum_value = g_enum_get_value (enum_class, layout);
}
@@ -3245,10 +3164,10 @@ update_number_up_layout (GtkPrintUnixDialog *dialog)
}
}
- setup_option (dialog, "gtk-n-up-layout", priv->number_up_layout);
+ setup_option (dialog, "gtk-n-up-layout", dialog->number_up_layout);
- if (priv->number_up_layout != NULL)
- gtk_widget_set_sensitive (GTK_WIDGET (priv->number_up_layout),
+ if (dialog->number_up_layout != NULL)
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->number_up_layout),
(caps & GTK_PRINT_CAPABILITY_NUMBER_UP_LAYOUT) &&
(dialog_get_pages_per_sheet (dialog) > 1));
}
@@ -3258,20 +3177,19 @@ custom_paper_dialog_response_cb (GtkDialog *custom_paper_dialog,
gint response_id,
gpointer user_data)
{
- GtkPrintUnixDialog *print_dialog = GTK_PRINT_UNIX_DIALOG (user_data);
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (print_dialog);
+ GtkPrintUnixDialog *dialog = GTK_PRINT_UNIX_DIALOG (user_data);
GtkTreeModel *model;
GtkTreeIter iter;
- _gtk_print_load_custom_papers (priv->custom_paper_list);
+ _gtk_print_load_custom_papers (dialog->custom_paper_list);
- priv->internal_page_setup_change = TRUE;
- update_paper_sizes (print_dialog);
- priv->internal_page_setup_change = FALSE;
+ dialog->internal_page_setup_change = TRUE;
+ update_paper_sizes (dialog);
+ dialog->internal_page_setup_change = FALSE;
- if (priv->page_setup_set)
+ if (dialog->page_setup_set)
{
- model = GTK_TREE_MODEL (priv->custom_paper_list);
+ model = GTK_TREE_MODEL (dialog->custom_paper_list);
if (gtk_tree_model_get_iter_first (model, &iter))
{
do
@@ -3281,8 +3199,8 @@ custom_paper_dialog_response_cb (GtkDialog *custom_paper_dialog,
if (page_setup &&
g_strcmp0 (gtk_paper_size_get_display_name (gtk_page_setup_get_paper_size (page_setup)),
- gtk_paper_size_get_display_name (gtk_page_setup_get_paper_size (priv->page_setup))) == 0)
- gtk_print_unix_dialog_set_page_setup (print_dialog, page_setup);
+ gtk_paper_size_get_display_name (gtk_page_setup_get_paper_size (dialog->page_setup))) == 0)
+ gtk_print_unix_dialog_set_page_setup (dialog, page_setup);
g_clear_object (&page_setup);
} while (gtk_tree_model_iter_next (model, &iter));
@@ -3296,18 +3214,17 @@ static void
orientation_changed (GtkComboBox *combo_box,
GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
GtkPageOrientation orientation;
GtkPageSetup *page_setup;
- if (priv->internal_page_setup_change)
+ if (dialog->internal_page_setup_change)
return;
- orientation = (GtkPageOrientation) gtk_combo_box_get_active (GTK_COMBO_BOX (priv->orientation_combo));
+ orientation = (GtkPageOrientation) gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->orientation_combo));
- if (priv->page_setup)
+ if (dialog->page_setup)
{
- page_setup = gtk_page_setup_copy (priv->page_setup);
+ page_setup = gtk_page_setup_copy (dialog->page_setup);
if (page_setup)
gtk_page_setup_set_orientation (page_setup, orientation);
@@ -3321,12 +3238,11 @@ static void
paper_size_changed (GtkComboBox *combo_box,
GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
GtkTreeIter iter;
GtkPageSetup *page_setup, *last_page_setup;
GtkPageOrientation orientation;
- if (priv->internal_page_setup_change)
+ if (dialog->internal_page_setup_change)
return;
if (gtk_combo_box_get_active_iter (combo_box, &iter))
@@ -3340,8 +3256,8 @@ paper_size_changed (GtkComboBox *combo_box,
GtkWidget *custom_paper_dialog;
/* Change from "manage" menu item to last value */
- if (priv->page_setup)
- last_page_setup = g_object_ref (priv->page_setup);
+ if (dialog->page_setup)
+ last_page_setup = g_object_ref (dialog->page_setup);
else
last_page_setup = gtk_page_setup_new (); /* "good" default */
@@ -3359,8 +3275,8 @@ paper_size_changed (GtkComboBox *combo_box,
return;
}
- if (priv->page_setup)
- orientation = gtk_page_setup_get_orientation (priv->page_setup);
+ if (dialog->page_setup)
+ orientation = gtk_page_setup_get_orientation (dialog->page_setup);
else
orientation = GTK_PAGE_ORIENTATION_PORTRAIT;
@@ -3443,11 +3359,9 @@ gtk_print_unix_dialog_new (const gchar *title,
GtkPrinter *
gtk_print_unix_dialog_get_selected_printer (GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
g_return_val_if_fail (GTK_IS_PRINT_UNIX_DIALOG (dialog), NULL);
- return priv->current_printer;
+ return dialog->current_printer;
}
/**
@@ -3461,17 +3375,15 @@ void
gtk_print_unix_dialog_set_page_setup (GtkPrintUnixDialog *dialog,
GtkPageSetup *page_setup)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
g_return_if_fail (GTK_IS_PRINT_UNIX_DIALOG (dialog));
g_return_if_fail (GTK_IS_PAGE_SETUP (page_setup));
- if (priv->page_setup != page_setup)
+ if (dialog->page_setup != page_setup)
{
- g_clear_object (&priv->page_setup);
- priv->page_setup = g_object_ref (page_setup);
+ g_clear_object (&dialog->page_setup);
+ dialog->page_setup = g_object_ref (page_setup);
- priv->page_setup_set = TRUE;
+ dialog->page_setup_set = TRUE;
g_object_notify (G_OBJECT (dialog), "page-setup");
}
@@ -3488,11 +3400,9 @@ gtk_print_unix_dialog_set_page_setup (GtkPrintUnixDialog *dialog,
GtkPageSetup *
gtk_print_unix_dialog_get_page_setup (GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
g_return_val_if_fail (GTK_IS_PRINT_UNIX_DIALOG (dialog), NULL);
- return priv->page_setup;
+ return dialog->page_setup;
}
/**
@@ -3506,11 +3416,9 @@ gtk_print_unix_dialog_get_page_setup (GtkPrintUnixDialog *dialog)
gboolean
gtk_print_unix_dialog_get_page_setup_set (GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
g_return_val_if_fail (GTK_IS_PRINT_UNIX_DIALOG (dialog), FALSE);
- return priv->page_setup_set;
+ return dialog->page_setup_set;
}
/**
@@ -3525,16 +3433,14 @@ void
gtk_print_unix_dialog_set_current_page (GtkPrintUnixDialog *dialog,
gint current_page)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
g_return_if_fail (GTK_IS_PRINT_UNIX_DIALOG (dialog));
- if (priv->current_page != current_page)
+ if (dialog->current_page != current_page)
{
- priv->current_page = current_page;
+ dialog->current_page = current_page;
- if (priv->current_page_radio)
- gtk_widget_set_sensitive (priv->current_page_radio, current_page != -1);
+ if (dialog->current_page_radio)
+ gtk_widget_set_sensitive (dialog->current_page_radio, current_page != -1);
g_object_notify (G_OBJECT (dialog), "current-page");
}
@@ -3551,30 +3457,27 @@ gtk_print_unix_dialog_set_current_page (GtkPrintUnixDialog *dialog,
gint
gtk_print_unix_dialog_get_current_page (GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
g_return_val_if_fail (GTK_IS_PRINT_UNIX_DIALOG (dialog), -1);
- return priv->current_page;
+ return dialog->current_page;
}
static gboolean
set_active_printer (GtkPrintUnixDialog *dialog,
const gchar *printer_name)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
GtkTreeModel *model;
GtkTreeIter iter, filter_iter;
GtkTreeSelection *selection;
GtkPrinter *printer;
- model = GTK_TREE_MODEL (priv->printer_list);
+ model = GTK_TREE_MODEL (dialog->printer_list);
if (gtk_tree_model_get_iter_first (model, &iter))
{
do
{
- gtk_tree_model_get (GTK_TREE_MODEL (priv->printer_list), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (dialog->printer_list), &iter,
PRINTER_LIST_COL_PRINTER_OBJ, &printer,
-1);
if (printer == NULL)
@@ -3582,15 +3485,15 @@ set_active_printer (GtkPrintUnixDialog *dialog,
if (strcmp (gtk_printer_get_name (printer), printer_name) == 0)
{
- gtk_tree_model_filter_convert_child_iter_to_iter (priv->printer_list_filter,
+ gtk_tree_model_filter_convert_child_iter_to_iter (dialog->printer_list_filter,
&filter_iter, &iter);
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->printer_treeview));
- priv->internal_printer_change = TRUE;
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->printer_treeview));
+ dialog->internal_printer_change = TRUE;
gtk_tree_selection_select_iter (selection, &filter_iter);
- priv->internal_printer_change = FALSE;
- g_free (priv->waiting_for_printer);
- priv->waiting_for_printer = NULL;
+ dialog->internal_printer_change = FALSE;
+ g_free (dialog->waiting_for_printer);
+ dialog->waiting_for_printer = NULL;
g_object_unref (printer);
return TRUE;
@@ -3617,7 +3520,6 @@ void
gtk_print_unix_dialog_set_settings (GtkPrintUnixDialog *dialog,
GtkPrintSettings *settings)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
const gchar *printer;
GtkPageRange *ranges;
gint num_ranges;
@@ -3640,17 +3542,17 @@ gtk_print_unix_dialog_set_settings (GtkPrintUnixDialog *dialog,
g_free (ranges);
}
- priv->format_for_printer =
+ dialog->format_for_printer =
g_strdup (gtk_print_settings_get (settings, "format-for-printer"));
}
- if (priv->initial_settings)
- g_object_unref (priv->initial_settings);
+ if (dialog->initial_settings)
+ g_object_unref (dialog->initial_settings);
- priv->initial_settings = settings;
+ dialog->initial_settings = settings;
- g_free (priv->waiting_for_printer);
- priv->waiting_for_printer = NULL;
+ g_free (dialog->waiting_for_printer);
+ dialog->waiting_for_printer = NULL;
if (settings)
{
@@ -3659,7 +3561,7 @@ gtk_print_unix_dialog_set_settings (GtkPrintUnixDialog *dialog,
printer = gtk_print_settings_get_printer (settings);
if (printer && !set_active_printer (dialog, printer))
- priv->waiting_for_printer = g_strdup (printer);
+ dialog->waiting_for_printer = g_strdup (printer);
}
g_object_notify (G_OBJECT (dialog), "print-settings");
@@ -3679,7 +3581,6 @@ gtk_print_unix_dialog_set_settings (GtkPrintUnixDialog *dialog,
GtkPrintSettings *
gtk_print_unix_dialog_get_settings (GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
GtkPrintSettings *settings;
GtkPrintPages print_pages;
GtkPageRange *ranges;
@@ -3689,14 +3590,14 @@ gtk_print_unix_dialog_get_settings (GtkPrintUnixDialog *dialog)
settings = gtk_print_settings_new ();
- if (priv->current_printer)
+ if (dialog->current_printer)
gtk_print_settings_set_printer (settings,
- gtk_printer_get_name (priv->current_printer));
+ gtk_printer_get_name (dialog->current_printer));
else
gtk_print_settings_set_printer (settings, "default");
gtk_print_settings_set (settings, "format-for-printer",
- priv->format_for_printer);
+ dialog->format_for_printer);
gtk_print_settings_set_collate (settings,
dialog_get_collate (dialog));
@@ -3725,9 +3626,9 @@ gtk_print_unix_dialog_get_settings (GtkPrintUnixDialog *dialog)
/* TODO: print when. How to handle? */
- if (priv->current_printer)
- _gtk_printer_get_settings_from_options (priv->current_printer,
- priv->options,
+ if (dialog->current_printer)
+ _gtk_printer_get_settings_from_options (dialog->current_printer,
+ dialog->options,
settings);
return settings;
@@ -3746,9 +3647,7 @@ gtk_print_unix_dialog_add_custom_tab (GtkPrintUnixDialog *dialog,
GtkWidget *child,
GtkWidget *tab_label)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
- gtk_notebook_insert_page (GTK_NOTEBOOK (priv->notebook),
+ gtk_notebook_insert_page (GTK_NOTEBOOK (dialog->notebook),
child, tab_label, 2);
gtk_widget_show (child);
gtk_widget_show (tab_label);
@@ -3769,22 +3668,20 @@ void
gtk_print_unix_dialog_set_manual_capabilities (GtkPrintUnixDialog *dialog,
GtkPrintCapabilities capabilities)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
- if (priv->manual_capabilities != capabilities)
+ if (dialog->manual_capabilities != capabilities)
{
- priv->manual_capabilities = capabilities;
+ dialog->manual_capabilities = capabilities;
update_dialog_from_capabilities (dialog);
- if (priv->current_printer)
+ if (dialog->current_printer)
{
GtkTreeSelection *selection;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->printer_treeview));
- g_clear_object (&priv->current_printer);
- priv->internal_printer_change = TRUE;
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->printer_treeview));
+ g_clear_object (&dialog->current_printer);
+ dialog->internal_printer_change = TRUE;
selected_printer_changed (selection, dialog);
- priv->internal_printer_change = FALSE;
+ dialog->internal_printer_change = FALSE;
}
g_object_notify (G_OBJECT (dialog), "manual-capabilities");
@@ -3802,11 +3699,9 @@ gtk_print_unix_dialog_set_manual_capabilities (GtkPrintUnixDialog *dialog,
GtkPrintCapabilities
gtk_print_unix_dialog_get_manual_capabilities (GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
g_return_val_if_fail (GTK_IS_PRINT_UNIX_DIALOG (dialog), FALSE);
- return priv->manual_capabilities;
+ return dialog->manual_capabilities;
}
/**
@@ -3820,26 +3715,24 @@ void
gtk_print_unix_dialog_set_support_selection (GtkPrintUnixDialog *dialog,
gboolean support_selection)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
g_return_if_fail (GTK_IS_PRINT_UNIX_DIALOG (dialog));
support_selection = support_selection != FALSE;
- if (priv->support_selection != support_selection)
+ if (dialog->support_selection != support_selection)
{
- priv->support_selection = support_selection;
+ dialog->support_selection = support_selection;
- if (priv->selection_radio)
+ if (dialog->selection_radio)
{
if (support_selection)
{
- gtk_widget_set_sensitive (priv->selection_radio, priv->has_selection);
- gtk_widget_show (priv->selection_radio);
+ gtk_widget_set_sensitive (dialog->selection_radio, dialog->has_selection);
+ gtk_widget_show (dialog->selection_radio);
}
else
{
- gtk_widget_set_sensitive (priv->selection_radio, FALSE);
- gtk_widget_hide (priv->selection_radio);
+ gtk_widget_set_sensitive (dialog->selection_radio, FALSE);
+ gtk_widget_hide (dialog->selection_radio);
}
}
@@ -3858,11 +3751,9 @@ gtk_print_unix_dialog_set_support_selection (GtkPrintUnixDialog *dialog,
gboolean
gtk_print_unix_dialog_get_support_selection (GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
g_return_val_if_fail (GTK_IS_PRINT_UNIX_DIALOG (dialog), FALSE);
- return priv->support_selection;
+ return dialog->support_selection;
}
/**
@@ -3876,21 +3767,19 @@ void
gtk_print_unix_dialog_set_has_selection (GtkPrintUnixDialog *dialog,
gboolean has_selection)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
g_return_if_fail (GTK_IS_PRINT_UNIX_DIALOG (dialog));
has_selection = has_selection != FALSE;
- if (priv->has_selection != has_selection)
+ if (dialog->has_selection != has_selection)
{
- priv->has_selection = has_selection;
+ dialog->has_selection = has_selection;
- if (priv->selection_radio)
+ if (dialog->selection_radio)
{
- if (priv->support_selection)
- gtk_widget_set_sensitive (priv->selection_radio, has_selection);
+ if (dialog->support_selection)
+ gtk_widget_set_sensitive (dialog->selection_radio, has_selection);
else
- gtk_widget_set_sensitive (priv->selection_radio, FALSE);
+ gtk_widget_set_sensitive (dialog->selection_radio, FALSE);
}
g_object_notify (G_OBJECT (dialog), "has-selection");
@@ -3908,11 +3797,9 @@ gtk_print_unix_dialog_set_has_selection (GtkPrintUnixDialog *dialog,
gboolean
gtk_print_unix_dialog_get_has_selection (GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
g_return_val_if_fail (GTK_IS_PRINT_UNIX_DIALOG (dialog), FALSE);
- return priv->has_selection;
+ return dialog->has_selection;
}
/**
@@ -3926,38 +3813,36 @@ void
gtk_print_unix_dialog_set_embed_page_setup (GtkPrintUnixDialog *dialog,
gboolean embed)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
g_return_if_fail (GTK_IS_PRINT_UNIX_DIALOG (dialog));
embed = embed != FALSE;
- if (priv->embed_page_setup != embed)
+ if (dialog->embed_page_setup != embed)
{
- priv->embed_page_setup = embed;
+ dialog->embed_page_setup = embed;
- gtk_widget_set_sensitive (priv->paper_size_combo, priv->embed_page_setup);
- gtk_widget_set_sensitive (priv->orientation_combo, priv->embed_page_setup);
+ gtk_widget_set_sensitive (dialog->paper_size_combo, dialog->embed_page_setup);
+ gtk_widget_set_sensitive (dialog->orientation_combo, dialog->embed_page_setup);
- if (priv->embed_page_setup)
+ if (dialog->embed_page_setup)
{
- if (priv->paper_size_combo != NULL)
- g_signal_connect (priv->paper_size_combo, "changed", G_CALLBACK (paper_size_changed), dialog);
+ if (dialog->paper_size_combo != NULL)
+ g_signal_connect (dialog->paper_size_combo, "changed", G_CALLBACK (paper_size_changed), dialog);
- if (priv->orientation_combo)
- g_signal_connect (priv->orientation_combo, "changed", G_CALLBACK (orientation_changed), dialog);
+ if (dialog->orientation_combo)
+ g_signal_connect (dialog->orientation_combo, "changed", G_CALLBACK (orientation_changed), dialog);
}
else
{
- if (priv->paper_size_combo != NULL)
- g_signal_handlers_disconnect_by_func (priv->paper_size_combo, G_CALLBACK (paper_size_changed), dialog);
+ if (dialog->paper_size_combo != NULL)
+ g_signal_handlers_disconnect_by_func (dialog->paper_size_combo, G_CALLBACK (paper_size_changed), dialog);
- if (priv->orientation_combo)
- g_signal_handlers_disconnect_by_func (priv->orientation_combo, G_CALLBACK (orientation_changed), dialog);
+ if (dialog->orientation_combo)
+ g_signal_handlers_disconnect_by_func (dialog->orientation_combo, G_CALLBACK (orientation_changed), dialog);
}
- priv->internal_page_setup_change = TRUE;
+ dialog->internal_page_setup_change = TRUE;
update_paper_sizes (dialog);
- priv->internal_page_setup_change = FALSE;
+ dialog->internal_page_setup_change = FALSE;
}
}
@@ -3972,9 +3857,7 @@ gtk_print_unix_dialog_set_embed_page_setup (GtkPrintUnixDialog *dialog,
gboolean
gtk_print_unix_dialog_get_embed_page_setup (GtkPrintUnixDialog *dialog)
{
- GtkPrintUnixDialogPrivate *priv = gtk_print_unix_dialog_get_instance_private (dialog);
-
g_return_val_if_fail (GTK_IS_PRINT_UNIX_DIALOG (dialog), FALSE);
- return priv->embed_page_setup;
+ return dialog->embed_page_setup;
}
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index 0176797f1e..6d610e7ef3 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -188,26 +188,7 @@ typedef struct _GtkSpinButtonClass GtkSpinButtonClass;
struct _GtkSpinButton
{
GtkWidget parent_instance;
-};
-
-struct _GtkSpinButtonClass
-{
- GtkWidgetClass parent_class;
-
- gint (*input) (GtkSpinButton *spin_button,
- gdouble *new_value);
- gint (*output) (GtkSpinButton *spin_button);
- void (*value_changed) (GtkSpinButton *spin_button);
-
- /* Action signals for keybindings, do not connect to these */
- void (*change_value) (GtkSpinButton *spin_button,
- GtkScrollType scroll);
- void (*wrapped) (GtkSpinButton *spin_button);
-};
-
-struct _GtkSpinButtonPrivate
-{
GtkAdjustment *adjustment;
GtkWidget *entry;
@@ -234,7 +215,22 @@ struct _GtkSpinButtonPrivate
guint wrap : 1;
guint editing_canceled : 1;
};
-typedef struct _GtkSpinButtonPrivate GtkSpinButtonPrivate;
+
+struct _GtkSpinButtonClass
+{
+ GtkWidgetClass parent_class;
+
+ gint (*input) (GtkSpinButton *spin_button,
+ gdouble *new_value);
+ gint (*output) (GtkSpinButton *spin_button);
+ void (*value_changed) (GtkSpinButton *spin_button);
+
+ /* Action signals for keybindings, do not connect to these */
+ void (*change_value) (GtkSpinButton *spin_button,
+ GtkScrollType scroll);
+
+ void (*wrapped) (GtkSpinButton *spin_button);
+};
enum {
PROP_0,
@@ -309,7 +305,6 @@ static guint spinbutton_signals[LAST_SIGNAL] = {0};
static GParamSpec *spinbutton_props[NUM_SPINBUTTON_PROPS] = {NULL, };
G_DEFINE_TYPE_WITH_CODE (GtkSpinButton, gtk_spin_button, GTK_TYPE_WIDGET,
- G_ADD_PRIVATE (GtkSpinButton)
G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, NULL)
G_IMPLEMENT_INTERFACE (GTK_TYPE_EDITABLE,
gtk_spin_button_editable_init)
@@ -326,9 +321,8 @@ static gboolean
gtk_spin_button_grab_focus (GtkWidget *widget)
{
GtkSpinButton *spin_button = GTK_SPIN_BUTTON (widget);
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
- return gtk_widget_grab_focus (priv->entry);
+ return gtk_widget_grab_focus (spin_button->entry);
}
static gboolean
@@ -336,9 +330,8 @@ gtk_spin_button_mnemonic_activate (GtkWidget *widget,
gboolean group_cycling)
{
GtkSpinButton *spin_button = GTK_SPIN_BUTTON (widget);
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
- return gtk_widget_grab_focus (priv->entry);
+ return gtk_widget_grab_focus (spin_button->entry);
}
static void
@@ -563,9 +556,8 @@ static GtkEditable *
gtk_spin_button_get_delegate (GtkEditable *editable)
{
GtkSpinButton *spin_button = GTK_SPIN_BUTTON (editable);
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
- return GTK_EDITABLE (priv->entry);
+ return GTK_EDITABLE (spin_button->entry);
}
static void
@@ -591,11 +583,9 @@ gtk_cell_editable_spin_button_key_pressed (GtkEventControllerKey *key,
GdkModifierType modifiers,
GtkSpinButton *spin)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin);
-
if (keyval == GDK_KEY_Escape)
{
- priv->editing_canceled = TRUE;
+ spin->editing_canceled = TRUE;
g_object_ref (spin);
gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (spin));
@@ -624,11 +614,10 @@ gtk_spin_button_start_editing (GtkCellEditable *cell_editable,
GdkEvent *event)
{
GtkSpinButton *spin = GTK_SPIN_BUTTON (cell_editable);
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin);
- g_signal_connect (priv->entry, "activate",
+ g_signal_connect (spin->entry, "activate",
G_CALLBACK (gtk_cell_editable_spin_button_activated), cell_editable);
- g_signal_connect (gtk_text_get_key_controller (GTK_TEXT (priv->entry)), "key-pressed",
+ g_signal_connect (gtk_text_get_key_controller (GTK_TEXT (spin->entry)), "key-pressed",
G_CALLBACK (gtk_cell_editable_spin_button_key_pressed), cell_editable);
}
@@ -645,7 +634,6 @@ gtk_spin_button_set_property (GObject *object,
GParamSpec *pspec)
{
GtkSpinButton *spin_button = GTK_SPIN_BUTTON (object);
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
if (gtk_editable_delegate_set_property (object, prop_id, value, pspec))
return;
@@ -660,14 +648,14 @@ gtk_spin_button_set_property (GObject *object,
break;
case PROP_CLIMB_RATE:
gtk_spin_button_configure (spin_button,
- priv->adjustment,
+ spin_button->adjustment,
g_value_get_double (value),
- priv->digits);
+ spin_button->digits);
break;
case PROP_DIGITS:
gtk_spin_button_configure (spin_button,
- priv->adjustment,
- priv->climb_rate,
+ spin_button->adjustment,
+ spin_button->climb_rate,
g_value_get_uint (value));
break;
case PROP_SNAP_TO_TICKS:
@@ -689,9 +677,9 @@ gtk_spin_button_set_property (GObject *object,
gtk_spin_button_set_orientation (spin_button, g_value_get_enum (value));
break;
case PROP_EDITING_CANCELED:
- if (priv->editing_canceled != g_value_get_boolean (value))
+ if (spin_button->editing_canceled != g_value_get_boolean (value))
{
- priv->editing_canceled = g_value_get_boolean (value);
+ spin_button->editing_canceled = g_value_get_boolean (value);
g_object_notify (object, "editing-canceled");
}
break;
@@ -708,7 +696,6 @@ gtk_spin_button_get_property (GObject *object,
GParamSpec *pspec)
{
GtkSpinButton *spin_button = GTK_SPIN_BUTTON (object);
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
if (gtk_editable_delegate_get_property (object, prop_id, value, pspec))
return;
@@ -716,34 +703,34 @@ gtk_spin_button_get_property (GObject *object,
switch (prop_id)
{
case PROP_ADJUSTMENT:
- g_value_set_object (value, priv->adjustment);
+ g_value_set_object (value, spin_button->adjustment);
break;
case PROP_CLIMB_RATE:
- g_value_set_double (value, priv->climb_rate);
+ g_value_set_double (value, spin_button->climb_rate);
break;
case PROP_DIGITS:
- g_value_set_uint (value, priv->digits);
+ g_value_set_uint (value, spin_button->digits);
break;
case PROP_SNAP_TO_TICKS:
- g_value_set_boolean (value, priv->snap_to_ticks);
+ g_value_set_boolean (value, spin_button->snap_to_ticks);
break;
case PROP_NUMERIC:
- g_value_set_boolean (value, priv->numeric);
+ g_value_set_boolean (value, spin_button->numeric);
break;
case PROP_WRAP:
- g_value_set_boolean (value, priv->wrap);
+ g_value_set_boolean (value, spin_button->wrap);
break;
case PROP_UPDATE_POLICY:
- g_value_set_enum (value, priv->update_policy);
+ g_value_set_enum (value, spin_button->update_policy);
break;
case PROP_VALUE:
- g_value_set_double (value, gtk_adjustment_get_value (priv->adjustment));
+ g_value_set_double (value, gtk_adjustment_get_value (spin_button->adjustment));
break;
case PROP_ORIENTATION:
- g_value_set_enum (value, priv->orientation);
+ g_value_set_enum (value, spin_button->orientation);
break;
case PROP_EDITING_CANCELED:
- g_value_set_boolean (value, priv->editing_canceled);
+ g_value_set_boolean (value, spin_button->editing_canceled);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -778,11 +765,10 @@ scroll_controller_scroll (GtkEventControllerScroll *Scroll,
GtkWidget *widget)
{
GtkSpinButton *spin = GTK_SPIN_BUTTON (widget);
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin);
if (!gtk_widget_has_focus (widget))
gtk_widget_grab_focus (widget);
- gtk_spin_button_real_spin (spin, -dy * gtk_adjustment_get_step_increment (priv->adjustment));
+ gtk_spin_button_real_spin (spin, -dy * gtk_adjustment_get_step_increment (spin->adjustment));
return GDK_EVENT_STOP;
}
@@ -790,22 +776,21 @@ scroll_controller_scroll (GtkEventControllerScroll *Scroll,
static gboolean
gtk_spin_button_stop_spinning (GtkSpinButton *spin)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin);
gboolean did_spin = FALSE;
- if (priv->timer)
+ if (spin->timer)
{
- g_source_remove (priv->timer);
- priv->timer = 0;
- priv->need_timer = FALSE;
+ g_source_remove (spin->timer);
+ spin->timer = 0;
+ spin->need_timer = FALSE;
did_spin = TRUE;
}
- priv->timer_step = gtk_adjustment_get_step_increment (priv->adjustment);
- priv->timer_calls = 0;
+ spin->timer_step = gtk_adjustment_get_step_increment (spin->adjustment);
+ spin->timer_calls = 0;
- priv->click_child = NULL;
+ spin->click_child = NULL;
return did_spin;
}
@@ -815,20 +800,18 @@ start_spinning (GtkSpinButton *spin,
GtkWidget *click_child,
gdouble step)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin);
+ spin->click_child = click_child;
- priv->click_child = click_child;
-
- if (!priv->timer)
+ if (!spin->timer)
{
- priv->timer_step = step;
- priv->need_timer = TRUE;
- priv->timer = g_timeout_add (TIMEOUT_INITIAL,
+ spin->timer_step = step;
+ spin->need_timer = TRUE;
+ spin->timer = g_timeout_add (TIMEOUT_INITIAL,
(GSourceFunc) gtk_spin_button_timer,
(gpointer) spin);
- g_source_set_name_by_id (priv->timer, "[gtk] gtk_spin_button_timer");
+ g_source_set_name_by_id (spin->timer, "[gtk] gtk_spin_button_timer");
}
- gtk_spin_button_real_spin (spin, click_child == priv->up_button ? step : -step);
+ gtk_spin_button_real_spin (spin, click_child == spin->up_button ? step : -step);
}
static void
@@ -839,20 +822,19 @@ button_pressed_cb (GtkGestureClick *gesture,
gpointer user_data)
{
GtkSpinButton *spin_button = user_data;
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
GtkWidget *pressed_button = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
gtk_widget_grab_focus (GTK_WIDGET (spin_button));
- if (gtk_editable_get_editable (GTK_EDITABLE (priv->entry)))
+ if (gtk_editable_get_editable (GTK_EDITABLE (spin_button->entry)))
{
int button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture));
gtk_spin_button_update (spin_button);
if (button == GDK_BUTTON_PRIMARY)
- start_spinning (spin_button, pressed_button, gtk_adjustment_get_step_increment (priv->adjustment));
+ start_spinning (spin_button, pressed_button, gtk_adjustment_get_step_increment (spin_button->adjustment));
else if (button == GDK_BUTTON_MIDDLE)
- start_spinning (spin_button, pressed_button, gtk_adjustment_get_page_increment (priv->adjustment));
+ start_spinning (spin_button, pressed_button, gtk_adjustment_get_page_increment (spin_button->adjustment));
}
else
{
@@ -868,7 +850,6 @@ button_released_cb (GtkGestureClick *gesture,
gpointer user_data)
{
GtkSpinButton *spin_button = user_data;
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
int button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture));
gtk_spin_button_stop_spinning (spin_button);
@@ -877,15 +858,15 @@ button_released_cb (GtkGestureClick *gesture,
{
GtkWidget *button_widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
double diff;
- if (button_widget == priv->down_button)
+ if (button_widget == spin_button->down_button)
{
- diff = gtk_adjustment_get_value (priv->adjustment) - gtk_adjustment_get_lower (priv->adjustment);
+ diff = gtk_adjustment_get_value (spin_button->adjustment) - gtk_adjustment_get_lower (spin_button->adjustment);
if (diff > EPSILON)
gtk_spin_button_real_spin (spin_button, -diff);
}
- else if (button_widget == priv->up_button)
+ else if (button_widget == spin_button->up_button)
{
- diff = gtk_adjustment_get_upper (priv->adjustment) - gtk_adjustment_get_value (priv->adjustment);
+ diff = gtk_adjustment_get_upper (spin_button->adjustment) - gtk_adjustment_get_value (spin_button->adjustment);
if (diff > EPSILON)
gtk_spin_button_real_spin (spin_button, diff);
}
@@ -907,59 +888,54 @@ key_controller_key_released (GtkEventControllerKey *key,
GdkModifierType modifiers,
GtkSpinButton *spin_button)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
-
- priv->timer_step = gtk_adjustment_get_step_increment (priv->adjustment);
- priv->timer_calls = 0;
+ spin_button->timer_step = gtk_adjustment_get_step_increment (spin_button->adjustment);
+ spin_button->timer_calls = 0;
}
static void
key_controller_focus_out (GtkEventController *controller,
GtkSpinButton *spin_button)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
-
- if (gtk_editable_get_editable (GTK_EDITABLE (priv->entry)))
+ if (gtk_editable_get_editable (GTK_EDITABLE (spin_button->entry)))
gtk_spin_button_update (spin_button);
}
static void
gtk_spin_button_init (GtkSpinButton *spin_button)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
GtkEventController *controller;
GtkGesture *gesture;
- priv->adjustment = NULL;
- priv->timer = 0;
- priv->climb_rate = 0.0;
- priv->timer_step = 0.0;
- priv->update_policy = GTK_UPDATE_ALWAYS;
- priv->click_child = NULL;
- priv->need_timer = FALSE;
- priv->timer_calls = 0;
- priv->digits = 0;
- priv->numeric = FALSE;
- priv->wrap = FALSE;
- priv->snap_to_ticks = FALSE;
-
- priv->orientation = GTK_ORIENTATION_HORIZONTAL;
+ spin_button->adjustment = NULL;
+ spin_button->timer = 0;
+ spin_button->climb_rate = 0.0;
+ spin_button->timer_step = 0.0;
+ spin_button->update_policy = GTK_UPDATE_ALWAYS;
+ spin_button->click_child = NULL;
+ spin_button->need_timer = FALSE;
+ spin_button->timer_calls = 0;
+ spin_button->digits = 0;
+ spin_button->numeric = FALSE;
+ spin_button->wrap = FALSE;
+ spin_button->snap_to_ticks = FALSE;
+
+ spin_button->orientation = GTK_ORIENTATION_HORIZONTAL;
_gtk_orientable_set_style_classes (GTK_ORIENTABLE (spin_button));
- priv->entry = gtk_text_new ();
+ spin_button->entry = gtk_text_new ();
gtk_editable_init_delegate (GTK_EDITABLE (spin_button));
- gtk_editable_set_width_chars (GTK_EDITABLE (priv->entry), 0);
- gtk_editable_set_max_width_chars (GTK_EDITABLE (priv->entry), 0);
- gtk_widget_set_hexpand (priv->entry, TRUE);
- gtk_widget_set_vexpand (priv->entry, TRUE);
- g_signal_connect (priv->entry, "activate", G_CALLBACK (gtk_spin_button_activate), spin_button);
- gtk_widget_set_parent (priv->entry, GTK_WIDGET (spin_button));
-
- priv->down_button = gtk_button_new_from_icon_name ("value-decrease-symbolic");
- gtk_widget_add_css_class (priv->down_button, "down");
- gtk_widget_set_can_focus (priv->down_button, FALSE);
- gtk_widget_set_parent (priv->down_button, GTK_WIDGET (spin_button));
+ gtk_editable_set_width_chars (GTK_EDITABLE (spin_button->entry), 0);
+ gtk_editable_set_max_width_chars (GTK_EDITABLE (spin_button->entry), 0);
+ gtk_widget_set_hexpand (spin_button->entry, TRUE);
+ gtk_widget_set_vexpand (spin_button->entry, TRUE);
+ g_signal_connect (spin_button->entry, "activate", G_CALLBACK (gtk_spin_button_activate), spin_button);
+ gtk_widget_set_parent (spin_button->entry, GTK_WIDGET (spin_button));
+
+ spin_button->down_button = gtk_button_new_from_icon_name ("value-decrease-symbolic");
+ gtk_widget_add_css_class (spin_button->down_button, "down");
+ gtk_widget_set_can_focus (spin_button->down_button, FALSE);
+ gtk_widget_set_parent (spin_button->down_button, GTK_WIDGET (spin_button));
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
@@ -969,12 +945,12 @@ gtk_spin_button_init (GtkSpinButton *spin_button)
g_signal_connect (gesture, "pressed", G_CALLBACK (button_pressed_cb), spin_button);
g_signal_connect (gesture, "released", G_CALLBACK (button_released_cb), spin_button);
g_signal_connect (gesture, "cancel", G_CALLBACK (button_cancel_cb), spin_button);
- gtk_widget_add_controller (GTK_WIDGET (priv->down_button), GTK_EVENT_CONTROLLER (gesture));
+ gtk_widget_add_controller (GTK_WIDGET (spin_button->down_button), GTK_EVENT_CONTROLLER (gesture));
- priv->up_button = gtk_button_new_from_icon_name ("value-increase-symbolic");
- gtk_widget_add_css_class (priv->up_button, "up");
- gtk_widget_set_can_focus (priv->up_button, FALSE);
- gtk_widget_set_parent (priv->up_button, GTK_WIDGET (spin_button));
+ spin_button->up_button = gtk_button_new_from_icon_name ("value-increase-symbolic");
+ gtk_widget_add_css_class (spin_button->up_button, "up");
+ gtk_widget_set_can_focus (spin_button->up_button, FALSE);
+ gtk_widget_set_parent (spin_button->up_button, GTK_WIDGET (spin_button));
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
@@ -984,7 +960,7 @@ gtk_spin_button_init (GtkSpinButton *spin_button)
g_signal_connect (gesture, "pressed", G_CALLBACK (button_pressed_cb), spin_button);
g_signal_connect (gesture, "released", G_CALLBACK (button_released_cb), spin_button);
g_signal_connect (gesture, "cancel", G_CALLBACK (button_cancel_cb), spin_button);
- gtk_widget_add_controller (GTK_WIDGET (priv->up_button), GTK_EVENT_CONTROLLER (gesture));
+ gtk_widget_add_controller (GTK_WIDGET (spin_button->up_button), GTK_EVENT_CONTROLLER (gesture));
gtk_spin_button_set_adjustment (spin_button, NULL);
@@ -1018,15 +994,14 @@ static void
gtk_spin_button_finalize (GObject *object)
{
GtkSpinButton *spin_button = GTK_SPIN_BUTTON (object);
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
gtk_spin_button_unset_adjustment (spin_button);
gtk_editable_finish_delegate (GTK_EDITABLE (spin_button));
- gtk_widget_unparent (priv->entry);
- gtk_widget_unparent (priv->up_button);
- gtk_widget_unparent (priv->down_button);
+ gtk_widget_unparent (spin_button->entry);
+ gtk_widget_unparent (spin_button->up_button);
+ gtk_widget_unparent (spin_button->down_button);
G_OBJECT_CLASS (gtk_spin_button_parent_class)->finalize (object);
}
@@ -1043,7 +1018,6 @@ static void
gtk_spin_button_realize (GtkWidget *widget)
{
GtkSpinButton *spin_button = GTK_SPIN_BUTTON (widget);
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
gboolean return_val;
const char *text;
@@ -1055,8 +1029,8 @@ gtk_spin_button_realize (GtkWidget *widget)
/* If output wasn't processed explicitly by the method connected to the
* 'output' signal; and if we don't have any explicit 'text' set initially,
* fallback to the default output. */
- text = gtk_editable_get_text (GTK_EDITABLE (priv->entry));
- if (!return_val && (priv->numeric || text == NULL || *text == '\0'))
+ text = gtk_editable_get_text (GTK_EDITABLE (spin_button->entry));
+ if (!return_val && (spin_button->numeric || text == NULL || *text == '\0'))
gtk_spin_button_default_output (spin_button);
}
@@ -1065,15 +1039,14 @@ gtk_spin_button_realize (GtkWidget *widget)
static void
update_buttons_sensitivity (GtkSpinButton *spin_button)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
- const double lower = gtk_adjustment_get_lower (priv->adjustment);
- const double upper = gtk_adjustment_get_upper (priv->adjustment);
- const double value = gtk_adjustment_get_value (priv->adjustment);
+ const double lower = gtk_adjustment_get_lower (spin_button->adjustment);
+ const double upper = gtk_adjustment_get_upper (spin_button->adjustment);
+ const double value = gtk_adjustment_get_value (spin_button->adjustment);
- gtk_widget_set_sensitive (priv->up_button,
- priv->wrap || upper - value > EPSILON);
- gtk_widget_set_sensitive (priv->down_button,
- priv->wrap || value - lower > EPSILON);
+ gtk_widget_set_sensitive (spin_button->up_button,
+ spin_button->wrap || upper - value > EPSILON);
+ gtk_widget_set_sensitive (spin_button->down_button,
+ spin_button->wrap || value - lower > EPSILON);
}
/* Callback used when the spin button's adjustment changes.
@@ -1082,9 +1055,8 @@ static void
adjustment_changed_cb (GtkAdjustment *adjustment, gpointer data)
{
GtkSpinButton *spin_button = GTK_SPIN_BUTTON (data);
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
- priv->timer_step = gtk_adjustment_get_step_increment (priv->adjustment);
+ spin_button->timer_step = gtk_adjustment_get_step_increment (spin_button->adjustment);
update_buttons_sensitivity (spin_button);
gtk_widget_queue_resize (GTK_WIDGET (spin_button));
@@ -1093,17 +1065,15 @@ adjustment_changed_cb (GtkAdjustment *adjustment, gpointer data)
static void
gtk_spin_button_unset_adjustment (GtkSpinButton *spin_button)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
-
- if (priv->adjustment)
+ if (spin_button->adjustment)
{
- g_signal_handlers_disconnect_by_func (priv->adjustment,
+ g_signal_handlers_disconnect_by_func (spin_button->adjustment,
gtk_spin_button_value_changed,
spin_button);
- g_signal_handlers_disconnect_by_func (priv->adjustment,
+ g_signal_handlers_disconnect_by_func (spin_button->adjustment,
adjustment_changed_cb,
spin_button);
- g_clear_object (&priv->adjustment);
+ g_clear_object (&spin_button->adjustment);
}
}
@@ -1111,37 +1081,36 @@ static void
gtk_spin_button_set_orientation (GtkSpinButton *spin,
GtkOrientation orientation)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin);
GtkBoxLayout *layout_manager;
- GtkEditable *editable = GTK_EDITABLE (priv->entry);
+ GtkEditable *editable = GTK_EDITABLE (spin->entry);
- if (priv->orientation == orientation)
+ if (spin->orientation == orientation)
return;
- priv->orientation = orientation;
+ spin->orientation = orientation;
_gtk_orientable_set_style_classes (GTK_ORIENTABLE (spin));
/* change alignment if it's the default */
- if (priv->orientation == GTK_ORIENTATION_VERTICAL &&
+ if (spin->orientation == GTK_ORIENTATION_VERTICAL &&
gtk_editable_get_alignment (editable) == 0.0)
gtk_editable_set_alignment (editable, 0.5);
- else if (priv->orientation == GTK_ORIENTATION_HORIZONTAL &&
+ else if (spin->orientation == GTK_ORIENTATION_HORIZONTAL &&
gtk_editable_get_alignment (editable) == 0.5)
gtk_editable_set_alignment (editable, 0.0);
- if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
+ if (spin->orientation == GTK_ORIENTATION_HORIZONTAL)
{
/* Current orientation of the box is vertical! */
- gtk_widget_insert_after (priv->up_button, GTK_WIDGET (spin), priv->down_button);
+ gtk_widget_insert_after (spin->up_button, GTK_WIDGET (spin), spin->down_button);
}
else
{
/* Current orientation of the box is horizontal! */
- gtk_widget_insert_before (priv->up_button, GTK_WIDGET (spin), priv->entry);
+ gtk_widget_insert_before (spin->up_button, GTK_WIDGET (spin), spin->entry);
}
layout_manager = GTK_BOX_LAYOUT (gtk_widget_get_layout_manager (GTK_WIDGET (spin)));
- gtk_orientable_set_orientation (GTK_ORIENTABLE (layout_manager), priv->orientation);
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (layout_manager), spin->orientation);
g_object_notify (G_OBJECT (spin), "orientation");
}
@@ -1164,10 +1133,9 @@ static gchar *
gtk_spin_button_format_for_value (GtkSpinButton *spin_button,
gdouble value)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
- gchar *buf = g_strdup_printf ("%0.*f", priv->digits, value);
+ gchar *buf = g_strdup_printf ("%0.*f", spin_button->digits, value);
- return weed_out_neg_zero (buf, priv->digits);
+ return weed_out_neg_zero (buf, spin_button->digits);
}
static void
@@ -1197,35 +1165,34 @@ gtk_spin_button_state_flags_changed (GtkWidget *widget,
static gint
gtk_spin_button_timer (GtkSpinButton *spin_button)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
gboolean retval = FALSE;
- if (priv->timer)
+ if (spin_button->timer)
{
- if (priv->click_child == priv->up_button)
- gtk_spin_button_real_spin (spin_button, priv->timer_step);
+ if (spin_button->click_child == spin_button->up_button)
+ gtk_spin_button_real_spin (spin_button, spin_button->timer_step);
else
- gtk_spin_button_real_spin (spin_button, -priv->timer_step);
+ gtk_spin_button_real_spin (spin_button, -spin_button->timer_step);
- if (priv->need_timer)
+ if (spin_button->need_timer)
{
- priv->need_timer = FALSE;
- priv->timer = g_timeout_add (TIMEOUT_REPEAT,
+ spin_button->need_timer = FALSE;
+ spin_button->timer = g_timeout_add (TIMEOUT_REPEAT,
(GSourceFunc) gtk_spin_button_timer,
spin_button);
- g_source_set_name_by_id (priv->timer, "[gtk] gtk_spin_button_timer");
+ g_source_set_name_by_id (spin_button->timer, "[gtk] gtk_spin_button_timer");
}
else
{
- if (priv->climb_rate > 0.0 && priv->timer_step
- < gtk_adjustment_get_page_increment (priv->adjustment))
+ if (spin_button->climb_rate > 0.0 && spin_button->timer_step
+ < gtk_adjustment_get_page_increment (spin_button->adjustment))
{
- if (priv->timer_calls < MAX_TIMER_CALLS)
- priv->timer_calls++;
+ if (spin_button->timer_calls < MAX_TIMER_CALLS)
+ spin_button->timer_calls++;
else
{
- priv->timer_calls = 0;
- priv->timer_step += priv->climb_rate;
+ spin_button->timer_calls = 0;
+ spin_button->timer_step += spin_button->climb_rate;
}
}
retval = TRUE;
@@ -1259,10 +1226,9 @@ static void
gtk_spin_button_real_change_value (GtkSpinButton *spin,
GtkScrollType scroll)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin);
gdouble old_value;
- if (!gtk_editable_get_editable (GTK_EDITABLE (priv->entry)))
+ if (!gtk_editable_get_editable (GTK_EDITABLE (spin->entry)))
{
gtk_widget_error_bell (GTK_WIDGET (spin));
return;
@@ -1274,24 +1240,24 @@ gtk_spin_button_real_change_value (GtkSpinButton *spin,
*/
gtk_spin_button_update (spin);
- old_value = gtk_adjustment_get_value (priv->adjustment);
+ old_value = gtk_adjustment_get_value (spin->adjustment);
switch (scroll)
{
case GTK_SCROLL_STEP_BACKWARD:
case GTK_SCROLL_STEP_DOWN:
case GTK_SCROLL_STEP_LEFT:
- gtk_spin_button_real_spin (spin, -priv->timer_step);
+ gtk_spin_button_real_spin (spin, -spin->timer_step);
- if (priv->climb_rate > 0.0 && priv->timer_step
- < gtk_adjustment_get_page_increment (priv->adjustment))
+ if (spin->climb_rate > 0.0 &&
+ spin->timer_step < gtk_adjustment_get_page_increment (spin->adjustment))
{
- if (priv->timer_calls < MAX_TIMER_CALLS)
- priv->timer_calls++;
+ if (spin->timer_calls < MAX_TIMER_CALLS)
+ spin->timer_calls++;
else
{
- priv->timer_calls = 0;
- priv->timer_step += priv->climb_rate;
+ spin->timer_calls = 0;
+ spin->timer_step += spin->climb_rate;
}
}
break;
@@ -1299,17 +1265,17 @@ gtk_spin_button_real_change_value (GtkSpinButton *spin,
case GTK_SCROLL_STEP_FORWARD:
case GTK_SCROLL_STEP_UP:
case GTK_SCROLL_STEP_RIGHT:
- gtk_spin_button_real_spin (spin, priv->timer_step);
+ gtk_spin_button_real_spin (spin, spin->timer_step);
- if (priv->climb_rate > 0.0 && priv->timer_step
- < gtk_adjustment_get_page_increment (priv->adjustment))
+ if (spin->climb_rate > 0.0 &&
+ spin->timer_step < gtk_adjustment_get_page_increment (spin->adjustment))
{
- if (priv->timer_calls < MAX_TIMER_CALLS)
- priv->timer_calls++;
+ if (spin->timer_calls < MAX_TIMER_CALLS)
+ spin->timer_calls++;
else
{
- priv->timer_calls = 0;
- priv->timer_step += priv->climb_rate;
+ spin->timer_calls = 0;
+ spin->timer_step += spin->climb_rate;
}
}
break;
@@ -1317,18 +1283,18 @@ gtk_spin_button_real_change_value (GtkSpinButton *spin,
case GTK_SCROLL_PAGE_BACKWARD:
case GTK_SCROLL_PAGE_DOWN:
case GTK_SCROLL_PAGE_LEFT:
- gtk_spin_button_real_spin (spin, -gtk_adjustment_get_page_increment (priv->adjustment));
+ gtk_spin_button_real_spin (spin, -gtk_adjustment_get_page_increment (spin->adjustment));
break;
case GTK_SCROLL_PAGE_FORWARD:
case GTK_SCROLL_PAGE_UP:
case GTK_SCROLL_PAGE_RIGHT:
- gtk_spin_button_real_spin (spin, gtk_adjustment_get_page_increment (priv->adjustment));
+ gtk_spin_button_real_spin (spin, gtk_adjustment_get_page_increment (spin->adjustment));
break;
case GTK_SCROLL_START:
{
- gdouble diff = gtk_adjustment_get_value (priv->adjustment) - gtk_adjustment_get_lower (priv->adjustment);
+ double diff = gtk_adjustment_get_value (spin->adjustment) - gtk_adjustment_get_lower (spin->adjustment);
if (diff > EPSILON)
gtk_spin_button_real_spin (spin, -diff);
break;
@@ -1336,7 +1302,7 @@ gtk_spin_button_real_change_value (GtkSpinButton *spin,
case GTK_SCROLL_END:
{
- gdouble diff = gtk_adjustment_get_upper (priv->adjustment) - gtk_adjustment_get_value (priv->adjustment);
+ double diff = gtk_adjustment_get_upper (spin->adjustment) - gtk_adjustment_get_value (spin->adjustment);
if (diff > EPSILON)
gtk_spin_button_real_spin (spin, diff);
break;
@@ -1351,7 +1317,7 @@ gtk_spin_button_real_change_value (GtkSpinButton *spin,
gtk_spin_button_update (spin);
- if (gtk_adjustment_get_value (priv->adjustment) == old_value)
+ if (gtk_adjustment_get_value (spin->adjustment) == old_value)
gtk_widget_error_bell (GTK_WIDGET (spin));
}
@@ -1359,19 +1325,18 @@ static void
gtk_spin_button_snap (GtkSpinButton *spin_button,
gdouble val)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
gdouble inc;
gdouble tmp;
- inc = gtk_adjustment_get_step_increment (priv->adjustment);
+ inc = gtk_adjustment_get_step_increment (spin_button->adjustment);
if (inc == 0)
return;
- tmp = (val - gtk_adjustment_get_lower (priv->adjustment)) / inc;
+ tmp = (val - gtk_adjustment_get_lower (spin_button->adjustment)) / inc;
if (tmp - floor (tmp) < ceil (tmp) - tmp)
- val = gtk_adjustment_get_lower (priv->adjustment) + floor (tmp) * inc;
+ val = gtk_adjustment_get_lower (spin_button->adjustment) + floor (tmp) * inc;
else
- val = gtk_adjustment_get_lower (priv->adjustment) + ceil (tmp) * inc;
+ val = gtk_adjustment_get_lower (spin_button->adjustment) + ceil (tmp) * inc;
gtk_spin_button_set_value (spin_button, val);
}
@@ -1381,9 +1346,8 @@ gtk_spin_button_activate (GtkText *entry,
gpointer user_data)
{
GtkSpinButton *spin_button = user_data;
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
- if (gtk_editable_get_editable (GTK_EDITABLE (priv->entry)))
+ if (gtk_editable_get_editable (GTK_EDITABLE (spin_button->entry)))
gtk_spin_button_update (spin_button);
}
@@ -1394,9 +1358,8 @@ gtk_spin_button_insert_text (GtkEditable *editable,
gint *position)
{
GtkSpinButton *spin = GTK_SPIN_BUTTON (editable);
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin);
- if (priv->numeric)
+ if (spin->numeric)
{
struct lconv *lc;
gboolean sign;
@@ -1407,7 +1370,7 @@ gtk_spin_button_insert_text (GtkEditable *editable,
gint entry_length;
const gchar *entry_text;
- entry_text = gtk_editable_get_text (GTK_EDITABLE (priv->entry));
+ entry_text = gtk_editable_get_text (GTK_EDITABLE (spin->entry));
entry_length = g_utf8_strlen (entry_text, -1);
lc = localeconv ();
@@ -1442,7 +1405,7 @@ gtk_spin_button_insert_text (GtkEditable *editable,
pos_sign = '+';
#endif
- for (sign=0, i=0; i<entry_length; i++)
+ for (sign = 0, i = 0; i<entry_length; i++)
if ((entry_text[i] == neg_sign) ||
(entry_text[i] == pos_sign))
{
@@ -1453,7 +1416,7 @@ gtk_spin_button_insert_text (GtkEditable *editable,
if (sign && !(*position))
return;
- for (dotpos=-1, i=0; i<entry_length; i++)
+ for (dotpos = -1, i = 0; i<entry_length; i++)
if (entry_text[i] == *(lc->decimal_point))
{
dotpos = i;
@@ -1461,7 +1424,7 @@ gtk_spin_button_insert_text (GtkEditable *editable,
}
if (dotpos > -1 && *position > dotpos &&
- (gint)priv->digits - entry_length
+ (gint)spin->digits - entry_length
+ dotpos - new_text_length + 1 < 0)
return;
@@ -1475,9 +1438,8 @@ gtk_spin_button_insert_text (GtkEditable *editable,
}
else if (new_text[i] == *(lc->decimal_point))
{
- if (!priv->digits || dotpos > -1 ||
- (new_text_length - 1 - i + entry_length
- - *position > (gint)priv->digits))
+ if (!spin->digits || dotpos > -1 ||
+ (new_text_length - 1 - i + entry_length - *position > (gint)spin->digits))
return;
dotpos = *position + i;
}
@@ -1486,7 +1448,7 @@ gtk_spin_button_insert_text (GtkEditable *editable,
}
}
- gtk_editable_insert_text (GTK_EDITABLE (priv->entry),
+ gtk_editable_insert_text (GTK_EDITABLE (spin->entry),
new_text, new_text_length, position);
}
@@ -1494,18 +1456,17 @@ static void
gtk_spin_button_real_spin (GtkSpinButton *spin_button,
gdouble increment)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
GtkAdjustment *adjustment;
gdouble new_value = 0.0;
gboolean wrapped = FALSE;
- adjustment = priv->adjustment;
+ adjustment = spin_button->adjustment;
new_value = gtk_adjustment_get_value (adjustment) + increment;
if (increment > 0)
{
- if (priv->wrap)
+ if (spin_button->wrap)
{
if (fabs (gtk_adjustment_get_value (adjustment) - gtk_adjustment_get_upper (adjustment)) < EPSILON)
{
@@ -1520,7 +1481,7 @@ gtk_spin_button_real_spin (GtkSpinButton *spin_button,
}
else if (increment < 0)
{
- if (priv->wrap)
+ if (spin_button->wrap)
{
if (fabs (gtk_adjustment_get_value (adjustment) - gtk_adjustment_get_lower (adjustment)) < EPSILON)
{
@@ -1545,9 +1506,8 @@ static gint
gtk_spin_button_default_input (GtkSpinButton *spin_button,
gdouble *new_val)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
gchar *err = NULL;
- const char *text = gtk_editable_get_text (GTK_EDITABLE (priv->entry));
+ const char *text = gtk_editable_get_text (GTK_EDITABLE (spin_button->entry));
*new_val = g_strtod (text, &err);
if (*err)
@@ -1559,12 +1519,11 @@ gtk_spin_button_default_input (GtkSpinButton *spin_button,
static void
gtk_spin_button_default_output (GtkSpinButton *spin_button)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
gchar *buf = gtk_spin_button_format_for_value (spin_button,
- gtk_adjustment_get_value (priv->adjustment));
+ gtk_adjustment_get_value (spin_button->adjustment));
- if (strcmp (buf, gtk_editable_get_text (GTK_EDITABLE (priv->entry))))
- gtk_editable_set_text (GTK_EDITABLE (priv->entry), buf);
+ if (strcmp (buf, gtk_editable_get_text (GTK_EDITABLE (spin_button->entry))))
+ gtk_editable_set_text (GTK_EDITABLE (spin_button->entry), buf);
g_free (buf);
}
@@ -1594,20 +1553,18 @@ gtk_spin_button_configure (GtkSpinButton *spin_button,
gdouble climb_rate,
guint digits)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
-
g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button));
if (!adjustment)
- adjustment = priv->adjustment;
+ adjustment = spin_button->adjustment;
g_object_freeze_notify (G_OBJECT (spin_button));
- if (priv->adjustment != adjustment)
+ if (spin_button->adjustment != adjustment)
{
gtk_spin_button_unset_adjustment (spin_button);
- priv->adjustment = adjustment;
+ spin_button->adjustment = adjustment;
g_object_ref_sink (adjustment);
g_signal_connect (adjustment, "value-changed",
G_CALLBACK (gtk_spin_button_value_changed),
@@ -1615,21 +1572,21 @@ gtk_spin_button_configure (GtkSpinButton *spin_button,
g_signal_connect (adjustment, "changed",
G_CALLBACK (adjustment_changed_cb),
spin_button);
- priv->timer_step = gtk_adjustment_get_step_increment (priv->adjustment);
+ spin_button->timer_step = gtk_adjustment_get_step_increment (spin_button->adjustment);
g_object_notify_by_pspec (G_OBJECT (spin_button), spinbutton_props[PROP_ADJUSTMENT]);
gtk_widget_queue_resize (GTK_WIDGET (spin_button));
}
- if (priv->digits != digits)
+ if (spin_button->digits != digits)
{
- priv->digits = digits;
+ spin_button->digits = digits;
g_object_notify_by_pspec (G_OBJECT (spin_button), spinbutton_props[PROP_DIGITS]);
}
- if (priv->climb_rate != climb_rate)
+ if (spin_button->climb_rate != climb_rate)
{
- priv->climb_rate = climb_rate;
+ spin_button->climb_rate = climb_rate;
g_object_notify_by_pspec (G_OBJECT (spin_button), spinbutton_props[PROP_CLIMB_RATE]);
}
@@ -1727,8 +1684,6 @@ void
gtk_spin_button_set_adjustment (GtkSpinButton *spin_button,
GtkAdjustment *adjustment)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
-
g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button));
if (!adjustment)
@@ -1736,8 +1691,8 @@ gtk_spin_button_set_adjustment (GtkSpinButton *spin_button,
gtk_spin_button_configure (spin_button,
adjustment,
- priv->climb_rate,
- priv->digits);
+ spin_button->climb_rate,
+ spin_button->digits);
}
/**
@@ -1751,11 +1706,9 @@ gtk_spin_button_set_adjustment (GtkSpinButton *spin_button,
GtkAdjustment *
gtk_spin_button_get_adjustment (GtkSpinButton *spin_button)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
-
g_return_val_if_fail (GTK_IS_SPIN_BUTTON (spin_button), NULL);
- return priv->adjustment;
+ return spin_button->adjustment;
}
/**
@@ -1770,14 +1723,12 @@ void
gtk_spin_button_set_digits (GtkSpinButton *spin_button,
guint digits)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
-
g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button));
- if (priv->digits != digits)
+ if (spin_button->digits != digits)
{
- priv->digits = digits;
- gtk_spin_button_value_changed (priv->adjustment, spin_button);
+ spin_button->digits = digits;
+ gtk_spin_button_value_changed (spin_button->adjustment, spin_button);
g_object_notify_by_pspec (G_OBJECT (spin_button), spinbutton_props[PROP_DIGITS]);
/* since lower/upper may have changed */
@@ -1796,11 +1747,9 @@ gtk_spin_button_set_digits (GtkSpinButton *spin_button,
guint
gtk_spin_button_get_digits (GtkSpinButton *spin_button)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
-
g_return_val_if_fail (GTK_IS_SPIN_BUTTON (spin_button), 0);
- return priv->digits;
+ return spin_button->digits;
}
/**
@@ -1817,17 +1766,15 @@ gtk_spin_button_set_increments (GtkSpinButton *spin_button,
gdouble step,
gdouble page)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
-
g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button));
- gtk_adjustment_configure (priv->adjustment,
- gtk_adjustment_get_value (priv->adjustment),
- gtk_adjustment_get_lower (priv->adjustment),
- gtk_adjustment_get_upper (priv->adjustment),
+ gtk_adjustment_configure (spin_button->adjustment,
+ gtk_adjustment_get_value (spin_button->adjustment),
+ gtk_adjustment_get_lower (spin_button->adjustment),
+ gtk_adjustment_get_upper (spin_button->adjustment),
step,
page,
- gtk_adjustment_get_page_size (priv->adjustment));
+ gtk_adjustment_get_page_size (spin_button->adjustment));
}
/**
@@ -1844,14 +1791,12 @@ gtk_spin_button_get_increments (GtkSpinButton *spin_button,
gdouble *step,
gdouble *page)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
-
g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button));
if (step)
- *step = gtk_adjustment_get_step_increment (priv->adjustment);
+ *step = gtk_adjustment_get_step_increment (spin_button->adjustment);
if (page)
- *page = gtk_adjustment_get_page_increment (priv->adjustment);
+ *page = gtk_adjustment_get_page_increment (spin_button->adjustment);
}
/**
@@ -1870,12 +1815,11 @@ gtk_spin_button_set_range (GtkSpinButton *spin_button,
gdouble min,
gdouble max)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
GtkAdjustment *adjustment;
g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button));
- adjustment = priv->adjustment;
+ adjustment = spin_button->adjustment;
gtk_adjustment_configure (adjustment,
CLAMP (gtk_adjustment_get_value (adjustment), min, max),
@@ -1900,14 +1844,12 @@ gtk_spin_button_get_range (GtkSpinButton *spin_button,
gdouble *min,
gdouble *max)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
-
g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button));
if (min)
- *min = gtk_adjustment_get_lower (priv->adjustment);
+ *min = gtk_adjustment_get_lower (spin_button->adjustment);
if (max)
- *max = gtk_adjustment_get_upper (priv->adjustment);
+ *max = gtk_adjustment_get_upper (spin_button->adjustment);
}
/**
@@ -1921,11 +1863,9 @@ gtk_spin_button_get_range (GtkSpinButton *spin_button,
gdouble
gtk_spin_button_get_value (GtkSpinButton *spin_button)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
-
g_return_val_if_fail (GTK_IS_SPIN_BUTTON (spin_button), 0.0);
- return gtk_adjustment_get_value (priv->adjustment);
+ return gtk_adjustment_get_value (spin_button->adjustment);
}
/**
@@ -1939,12 +1879,11 @@ gtk_spin_button_get_value (GtkSpinButton *spin_button)
gint
gtk_spin_button_get_value_as_int (GtkSpinButton *spin_button)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
gdouble val;
g_return_val_if_fail (GTK_IS_SPIN_BUTTON (spin_button), 0);
- val = gtk_adjustment_get_value (priv->adjustment);
+ val = gtk_adjustment_get_value (spin_button->adjustment);
if (val - floor (val) < ceil (val) - val)
return floor (val);
else
@@ -1962,12 +1901,10 @@ void
gtk_spin_button_set_value (GtkSpinButton *spin_button,
gdouble value)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
-
g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button));
- if (fabs (value - gtk_adjustment_get_value (priv->adjustment)) > EPSILON)
- gtk_adjustment_set_value (priv->adjustment, value);
+ if (fabs (value - gtk_adjustment_get_value (spin_button->adjustment)) > EPSILON)
+ gtk_adjustment_set_value (spin_button->adjustment, value);
else
{
gint return_val = FALSE;
@@ -1990,13 +1927,11 @@ void
gtk_spin_button_set_update_policy (GtkSpinButton *spin_button,
GtkSpinButtonUpdatePolicy policy)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
-
g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button));
- if (priv->update_policy != policy)
+ if (spin_button->update_policy != policy)
{
- priv->update_policy = policy;
+ spin_button->update_policy = policy;
g_object_notify_by_pspec (G_OBJECT (spin_button), spinbutton_props[PROP_UPDATE_POLICY]);
}
}
@@ -2013,11 +1948,9 @@ gtk_spin_button_set_update_policy (GtkSpinButton *spin_button,
GtkSpinButtonUpdatePolicy
gtk_spin_button_get_update_policy (GtkSpinButton *spin_button)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
-
g_return_val_if_fail (GTK_IS_SPIN_BUTTON (spin_button), GTK_UPDATE_ALWAYS);
- return priv->update_policy;
+ return spin_button->update_policy;
}
/**
@@ -2032,15 +1965,13 @@ void
gtk_spin_button_set_numeric (GtkSpinButton *spin_button,
gboolean numeric)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
-
g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button));
numeric = numeric != FALSE;
- if (priv->numeric != numeric)
+ if (spin_button->numeric != numeric)
{
- priv->numeric = numeric;
+ spin_button->numeric = numeric;
g_object_notify_by_pspec (G_OBJECT (spin_button), spinbutton_props[PROP_NUMERIC]);
}
}
@@ -2057,11 +1988,9 @@ gtk_spin_button_set_numeric (GtkSpinButton *spin_button,
gboolean
gtk_spin_button_get_numeric (GtkSpinButton *spin_button)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
-
g_return_val_if_fail (GTK_IS_SPIN_BUTTON (spin_button), FALSE);
- return priv->numeric;
+ return spin_button->numeric;
}
/**
@@ -2077,15 +2006,13 @@ void
gtk_spin_button_set_wrap (GtkSpinButton *spin_button,
gboolean wrap)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
-
g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button));
wrap = wrap != FALSE;
- if (priv->wrap != wrap)
+ if (spin_button->wrap != wrap)
{
- priv->wrap = wrap;
+ spin_button->wrap = wrap;
g_object_notify_by_pspec (G_OBJECT (spin_button), spinbutton_props[PROP_WRAP]);
update_buttons_sensitivity (spin_button);
@@ -2105,11 +2032,9 @@ gtk_spin_button_set_wrap (GtkSpinButton *spin_button,
gboolean
gtk_spin_button_get_wrap (GtkSpinButton *spin_button)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
-
g_return_val_if_fail (GTK_IS_SPIN_BUTTON (spin_button), FALSE);
- return priv->wrap;
+ return spin_button->wrap;
}
/**
@@ -2125,17 +2050,16 @@ void
gtk_spin_button_set_snap_to_ticks (GtkSpinButton *spin_button,
gboolean snap_to_ticks)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
guint new_val;
g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button));
new_val = (snap_to_ticks != 0);
- if (new_val != priv->snap_to_ticks)
+ if (new_val != spin_button->snap_to_ticks)
{
- priv->snap_to_ticks = new_val;
- if (new_val && gtk_editable_get_editable (GTK_EDITABLE (priv->entry)))
+ spin_button->snap_to_ticks = new_val;
+ if (new_val && gtk_editable_get_editable (GTK_EDITABLE (spin_button->entry)))
gtk_spin_button_update (spin_button);
g_object_notify_by_pspec (G_OBJECT (spin_button), spinbutton_props[PROP_SNAP_TO_TICKS]);
@@ -2154,11 +2078,9 @@ gtk_spin_button_set_snap_to_ticks (GtkSpinButton *spin_button,
gboolean
gtk_spin_button_get_snap_to_ticks (GtkSpinButton *spin_button)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
-
g_return_val_if_fail (GTK_IS_SPIN_BUTTON (spin_button), FALSE);
- return priv->snap_to_ticks;
+ return spin_button->snap_to_ticks;
}
/**
@@ -2175,13 +2097,12 @@ gtk_spin_button_spin (GtkSpinButton *spin_button,
GtkSpinType direction,
gdouble increment)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
GtkAdjustment *adjustment;
gdouble diff;
g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button));
- adjustment = priv->adjustment;
+ adjustment = spin_button->adjustment;
/* for compatibility with the 1.0.x version of this function */
if (increment != 0 && increment != gtk_adjustment_get_step_increment (adjustment) &&
@@ -2249,7 +2170,6 @@ gtk_spin_button_spin (GtkSpinButton *spin_button,
void
gtk_spin_button_update (GtkSpinButton *spin_button)
{
- GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
gdouble val;
gint error = 0;
gint return_val;
@@ -2266,23 +2186,23 @@ gtk_spin_button_update (GtkSpinButton *spin_button)
else if (return_val == GTK_INPUT_ERROR)
error = 1;
- if (priv->update_policy == GTK_UPDATE_ALWAYS)
+ if (spin_button->update_policy == GTK_UPDATE_ALWAYS)
{
- if (val < gtk_adjustment_get_lower (priv->adjustment))
- val = gtk_adjustment_get_lower (priv->adjustment);
- else if (val > gtk_adjustment_get_upper (priv->adjustment))
- val = gtk_adjustment_get_upper (priv->adjustment);
+ if (val < gtk_adjustment_get_lower (spin_button->adjustment))
+ val = gtk_adjustment_get_lower (spin_button->adjustment);
+ else if (val > gtk_adjustment_get_upper (spin_button->adjustment))
+ val = gtk_adjustment_get_upper (spin_button->adjustment);
}
- else if ((priv->update_policy == GTK_UPDATE_IF_VALID) &&
+ else if ((spin_button->update_policy == GTK_UPDATE_IF_VALID) &&
(error ||
- val < gtk_adjustment_get_lower (priv->adjustment) ||
- val > gtk_adjustment_get_upper (priv->adjustment)))
+ val < gtk_adjustment_get_lower (spin_button->adjustment) ||
+ val > gtk_adjustment_get_upper (spin_button->adjustment)))
{
- gtk_spin_button_value_changed (priv->adjustment, spin_button);
+ gtk_spin_button_value_changed (spin_button->adjustment, spin_button);
return;
}
- if (priv->snap_to_ticks)
+ if (spin_button->snap_to_ticks)
gtk_spin_button_snap (spin_button, val);
else
gtk_spin_button_set_value (spin_button, val);
diff --git a/testsuite/gtk/notify.c b/testsuite/gtk/notify.c
index 4592b8db32..1c37c8cc66 100644
--- a/testsuite/gtk/notify.c
+++ b/testsuite/gtk/notify.c
@@ -465,6 +465,15 @@ test_type (gconstpointer data)
NULL);
g_object_unref (list_store);
}
+ else if (g_type_is_a (type, GTK_TYPE_CALENDAR))
+ {
+ /* avoid day 30 and 31, since they don't exist in February */
+ instance = g_object_new (type,
+ "year", 1984,
+ "month", 10,
+ "day", 05,
+ NULL);
+ }
/* special casing for singletons */
else if (g_type_is_a (type, GTK_TYPE_NEVER_TRIGGER))
instance = (GObject *) g_object_ref (gtk_never_trigger_get ());