[PATCH 3/5] Add a class BaseStandalone.

Vratislav Podzimek vpodzime at redhat.com
Wed Jun 18 09:16:12 UTC 2014


On Mon, 2014-06-16 at 15:09 -0400, David Shea wrote:
> +static int get_sidebar_width(GtkWidget *window) {
> +    GtkAllocation allocation;
> +
> +    /* change value below to make sidebar bigger / smaller */
> +    float sidebar_width_percentage = 0.15;
I think this value should be defined as a macro.

> +
> +    gtk_widget_get_allocation(window, &allocation);
> +    return allocation.width * sidebar_width_percentage;
> +}
> +
> +static int get_sidebar_height(GtkWidget *window) {
> +    GtkAllocation allocation;
> +    gtk_widget_get_allocation(window, &allocation);
> +    return allocation.height;
> +}
> +
> +/* Move base window content appropriate amount of space to make room for sidebar */
> +static void anaconda_base_standalone_size_allocate(GtkWidget *window, GtkAllocation *allocation) {
> +    GtkAllocation child_allocation;
> +    GtkWidget *child;
> +    int sidebar_width;
> +
> +    GTK_WIDGET_CLASS(anaconda_base_standalone_parent_class)->size_allocate(window, allocation);
> +
> +    /*
> +     * For RTL languages, the width is reduced by the same amount, but the
> +     * start of the window does not need to move.
> +     */
> +    gtk_widget_set_allocation(window, allocation);
> +    sidebar_width = get_sidebar_width(window);
> +    child_allocation.y = allocation->y;
> +    child_allocation.width = allocation->width-sidebar_width;
> +    child_allocation.height = allocation->height;
> +
> +    if (gtk_get_locale_direction() == GTK_TEXT_DIR_LTR)
> +        child_allocation.x = allocation->x+sidebar_width;
> +    else
> +        child_allocation.x = allocation->x;
> +
> +    child = gtk_bin_get_child (GTK_BIN (window));
> +    if (child && gtk_widget_get_visible (child))
> +        gtk_widget_size_allocate (child, &child_allocation);
> +}
> +
> +/* function to override default drawing to insert sidebar image */
> +static gboolean anaconda_base_standalone_on_draw(GtkWidget *win, cairo_t *cr) {
> +    GtkStyleContext *context;
> +    gdouble sidebar_x;
> +    gdouble sidebar_width;
> +
> +    /* calls parent class' draw handler */
> +    GTK_WIDGET_CLASS(anaconda_base_standalone_parent_class)->draw(win,cr);
> +
> +    sidebar_width = get_sidebar_width(win);
> +
> +    /* For RTL languages, move the sidebar to the right edge */
> +    if (gtk_get_locale_direction() == GTK_TEXT_DIR_LTR) {
> +        sidebar_x = 0;
> +    } else {
> +        GtkAllocation allocation;
> +        gtk_widget_get_allocation(win, &allocation);
> +        sidebar_x = allocation.width - sidebar_width;
> +    }
> +
> +    context = gtk_widget_get_style_context(win);
> +    gtk_style_context_save (context);
> +
> +    gtk_style_context_add_class(context, "logo-sidebar");
> +    gtk_render_background(context, cr, sidebar_x, 0, sidebar_width, get_sidebar_height(win));
> +    gtk_style_context_remove_class(context, "logo-sidebar");
> +
> +    gtk_style_context_add_class(context, "logo");
> +    gtk_render_background(context, cr, sidebar_x, 0, sidebar_width, get_sidebar_height(win));
> +    gtk_style_context_remove_class(context, "logo");
> +
> +    gtk_style_context_restore (context);
> +
> +    return TRUE; /* TRUE to avoid default draw handler */
> +}
> +
> +static void anaconda_base_standalone_finalize(GObject *object) {
> +    AnacondaBaseStandalone *win = ANACONDA_BASE_STANDALONE(object);
> +
> +    anaconda_base_standalone_set_quit_button(win, NULL);
> +    anaconda_base_standalone_set_continue_button(win, NULL);
> +
> +    G_OBJECT_CLASS(anaconda_base_standalone_parent_class)->finalize(object);
> +}
I may be wrong, but what I remember from implementing the
LayoutIndicator is that the _finalize function was never called when I
tested it. If I understand it correctly, _finalize is the function for
class finalization not object finalization (destruction). Object
desctruction is handled by the _dispose function.

> +
> +static void anaconda_base_standalone_set_quit_button(AnacondaBaseStandalone *win, GtkButton *button) {
> +    AnacondaBaseStandalonePrivate *priv = win->priv;
> +
> +    if (priv->quit_button) {
> +        g_signal_handler_disconnect(priv->quit_button, priv->quit_clicked_handler_id);
> +        g_object_unref(priv->quit_button);
> +    }
> +
> +    priv->quit_button = GTK_WIDGET(button);
> +
> +    if (priv->quit_button) {
> +        g_object_ref(priv->quit_button);
> +        priv->quit_clicked_handler_id = g_signal_connect(priv->quit_button, "clicked", G_CALLBACK(anaconda_base_standalone_quit_clicked), win);
> +    }
> +}
> +
> +static void anaconda_base_standalone_set_continue_button(AnacondaBaseStandalone *win, GtkButton *button) {
> +    AnacondaBaseStandalonePrivate *priv = win->priv;
> +
> +    if (priv->continue_button) {
> +        g_signal_handler_disconnect(priv->continue_button, priv->continue_clicked_handler_id);
> +        g_object_unref(priv->continue_button);
> +    }
> +
> +    priv->continue_button = GTK_WIDGET(button);
> +
> +    if (priv->continue_button) {
> +        g_object_ref(priv->continue_button);
> +        priv->continue_clicked_handler_id = g_signal_connect(priv->continue_button, "clicked", G_CALLBACK(anaconda_base_standalone_continue_clicked), win);
> +    }
> +}
> +
> +static void anaconda_base_standalone_quit_clicked(GtkButton *button, gpointer user_data) {
> +    g_signal_emit(user_data, standalone_signals[SIGNAL_QUIT_CLICKED], 0);
> +}
> +
> +static void anaconda_base_standalone_continue_clicked(GtkButton *button, gpointer user_data) {
> +    g_signal_emit(user_data, standalone_signals[SIGNAL_CONTINUE_CLICKED], 0);
> +}
> +
> +/**
> + * anaconda_base_standalone_get_may_continue:
> + * @win: a #AnacondaBaseStandalone
> + *
> + * Returns whether or not the continue button is sensitive (thus, whether the
> + * user may continue forward from this window).
> + *
> + * Returns: Whether the continue button on @win is sensitive.
Any reason for not having the content of the first "Returns..."
paragraph as the "Returns:" doctext? It may be multi-line AFAICT.

> + *
> + * Since: 3.0
> + */
> +gboolean anaconda_base_standalone_get_may_continue(AnacondaBaseStandalone *win) {
> +    if (win->priv->continue_button) {
> +        return gtk_widget_get_sensitive(win->priv->continue_button);
> +    }
> +    return FALSE;
> +}
> +
> +/**
> + * anaconda_base_standalone_set_may_continue:
> + * @win: a #AnacondaBaseStandalone
> + * @may_continue: %TRUE if this window's continue buttons should be sensitive
> + *
> + * Specified whether the user may continue forward from this window.  If so,
Specifies?^^^

> + * the continue button will be made sensitive.  Windows default to continuable
> + * so you must set it as false if you want.  The reason the user may not be
                       %FALSE^^^ 
> + * able to continue is if there is required information the user must enter
> + * when no reasonable default may be given.
> + *
> + * Since: 3.0
> + */
> +void anaconda_base_standalone_set_may_continue(AnacondaBaseStandalone *win, gboolean may_continue) {
> +    if (win->priv->continue_button) {
> +        gtk_widget_set_sensitive(win->priv->continue_button, may_continue);
> +    }
> +}
> +
> +/**
> + * anaconda_base_standalone_get_quit_button:
> + * @win: a #AnacondaBaseStandalone
> + *
> + * Returns: (transfer none): the quit button
> + *
> + * Since: 3.0
> + */
> +GtkButton * anaconda_base_standalone_get_quit_button(AnacondaBaseStandalone *win) {
> +    return GTK_BUTTON(win->priv->quit_button);
> +}
> +
> +/**
> + * anaconda_base_standalone_get_continue_button:
> + * @win: a #AnacondaBaseStandalone
> + *
> + * Returns: (transfer none): the continue button
> + *
> + * Since: 3.0
> + */
> +GtkButton * anaconda_base_standalone_get_continue_button(AnacondaBaseStandalone *win) {
> +    return GTK_BUTTON(win->priv->continue_button);
> +}
> diff --git a/widgets/src/BaseStandalone.h b/widgets/src/BaseStandalone.h
> new file mode 100644
> index 0000000..5f2e663
> --- /dev/null
> +++ b/widgets/src/BaseStandalone.h
> @@ -0,0 +1,81 @@
> +/*
> + * Copyright (C) 2014  Red Hat, Inc.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program.  If not, see <http://www.gnu.org/licenses/>.
> + *
> + * Author: David Shea <dshea at redhat.com>
> + */
> +
> +#ifndef _BASE_STANDALONE_H
> +#define _BASE_STANDALONE_H
> +
> +#include <gtk/gtk.h>
> +
> +#include "BaseWindow.h"
> +
> +G_BEGIN_DECLS
> +
> +#define ANACONDA_TYPE_BASE_STANDALONE            (anaconda_base_standalone_get_type())
> +#define ANACONDA_BASE_STANDALONE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), ANACONDA_TYPE_BASE_STANDALONE, AnacondaBaseStandalone))
> +#define ANACONDA_IS_BASE_STANDALONE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ANACONDA_TYPE_BASE_STANDALONE))
> +#define ANACONDA_BASE_STANDALONE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), ANACONDA_TYPE_BASE_STANDALONE, AnacondaBaseStandaloneClass))
> +#define ANACONDA_IS_BASE_STANDALONE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ANACONDA_TYPE_BASE_STANDALONE))
> +#define ANACONDA_BASE_STANDALONE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), ANACONDA_TYPE_BASE_STANDALONE, AnacondaBaseStandaloneClass))
> +
> +typedef struct _AnacondaBaseStandalone        AnacondaBaseStandalone;
> +typedef struct _AnacondaBaseStandaloneClass   AnacondaBaseStandaloneClass;
> +typedef struct _AnacondaBaseStandalonePrivate AnacondaBaseStandalonePrivate;
> +
> +/**
> + * AnacondaBaseStandalone:
> + *
> + * The AnacondaBaseStandalone class contains only private fields and should not
> + * be directly accessed.
> + */
> +struct _AnacondaBaseStandalone {
> +    AnacondaBaseWindow             parent;
> +
> +    /*< private >*/
> +    AnacondaBaseStandalonePrivate *priv;
> +};
> +
> +/**
> + * AnacondaBaseStandaloneClass:
> + * @parent_class: The object class structure needs to be the first element in
> + *                the widget class structure in order for the class mechanism
> + *                to work correctly. This allows a AnacondaBaseStandaloneClass
> + *                pointer to be cast to a #AnacondaBaseWindowClass pointer.
> + * @quit_clicked: Function pointer called when the #AnacondaBaseStandalone::quit-clicked
> + *                signal is emitted.
> + * @continue_clicked: Function pointer called when the #AnacondaBaseStandalone::continue-clicked
> + *                    signal is emitted.
> + */
> +struct _AnacondaBaseStandaloneClass {
> +    AnacondaBaseWindowClass parent_class;
> +
> +    void (* quit_clicked)     (AnacondaBaseStandalone *window);
> +    void (* continue_clicked) (AnacondaBaseStandalone *window);
> +};
> +
> +GType       anaconda_base_standalone_get_type(void);
> +
> +gboolean    anaconda_base_standalone_get_may_continue(AnacondaBaseStandalone *win);
> +void        anaconda_base_standalone_set_may_continue(AnacondaBaseStandalone *win, gboolean may_continue);
> +
> +GtkButton * anaconda_base_standalone_get_quit_button(AnacondaBaseStandalone *win);
> +GtkButton * anaconda_base_standalone_get_continue_button(AnacondaBaseStandalone *win);
> +
> +G_END_DECLS
> +
> +#endif
> diff --git a/widgets/src/HubWindow.c b/widgets/src/HubWindow.c
> index b7a0ed6..281e3be 100644
> --- a/widgets/src/HubWindow.c
> +++ b/widgets/src/HubWindow.c
> @@ -17,7 +17,7 @@
>   * Author: Chris Lumens <clumens at redhat.com>
>   */
>  
> -#include "BaseWindow.h"
> +#include "BaseStandalone.h"
>  #include "HubWindow.h"
>  #include "intl.h"
>  
> @@ -97,91 +97,12 @@ struct _AnacondaHubWindowPrivate {
>  
>  static void anaconda_hub_window_buildable_init(GtkBuildableIface *iface);
>  
> -G_DEFINE_TYPE_WITH_CODE(AnacondaHubWindow, anaconda_hub_window, ANACONDA_TYPE_BASE_WINDOW,
> +G_DEFINE_TYPE_WITH_CODE(AnacondaHubWindow, anaconda_hub_window, ANACONDA_TYPE_BASE_STANDALONE,
>                          G_IMPLEMENT_INTERFACE(GTK_TYPE_BUILDABLE, anaconda_hub_window_buildable_init))
>  
> -static int get_sidebar_width(GtkWidget *window) {
> -    GtkAllocation allocation;
> -
> -    /* change value below to make sidebar bigger / smaller */
> -    float sidebar_width_percentage = 0.15;
> -
> -    gtk_widget_get_allocation(window, &allocation);
> -    return allocation.width * sidebar_width_percentage;
> -}
> -
> -static int get_sidebar_height(GtkWidget *window) {
> -    GtkAllocation allocation;
> -    gtk_widget_get_allocation(window, &allocation);
> -    return allocation.height;
> -}
> -
> -/* function to override default drawing to insert sidebar image */
> -static gboolean anaconda_hub_window_on_draw(GtkWidget *win, cairo_t *cr) {
> -    GtkStyleContext *context;
> -    gdouble sidebar_x;
> -    gdouble sidebar_width;
> -
> -    /* calls parent class' draw handler */
> -    GTK_WIDGET_CLASS(anaconda_hub_window_parent_class)->draw(win,cr);
> -
> -    sidebar_width = get_sidebar_width(win);
> -
> -    /* For RTL languages, move the sidebar to the right edge */
> -    if (gtk_get_locale_direction() == GTK_TEXT_DIR_LTR) {
> -        sidebar_x = 0;
> -    } else {
> -        GtkAllocation allocation;
> -        gtk_widget_get_allocation(win, &allocation);
> -        sidebar_x = allocation.width - sidebar_width;
> -    }
> -
> -    context = gtk_widget_get_style_context(win);
> -    gtk_style_context_save (context);
> -
> -    gtk_style_context_add_class(context, "logo-sidebar");
> -    gtk_render_background(context, cr, sidebar_x, 0, sidebar_width, get_sidebar_height(win));
> -    gtk_style_context_remove_class(context, "logo-sidebar");
> -
> -    gtk_style_context_add_class(context, "logo");
> -    gtk_render_background(context, cr, sidebar_x, 0, sidebar_width, get_sidebar_height(win));
> -    gtk_style_context_remove_class(context, "logo");
> -
> -    gtk_style_context_restore (context);
> -
> -    return TRUE; /* TRUE to avoid default draw handler */
> -}
> -
> -/* Move base window content appropriate amount of space to make room for sidebar */
> -static void anaconda_hub_window_size_allocate (GtkWidget *window, GtkAllocation *allocation) {
> -    GtkAllocation child_allocation;
> -    GtkWidget *child;
> -    int sidebar_width;
> -
> -    GTK_WIDGET_CLASS(anaconda_hub_window_parent_class)->size_allocate(window, allocation);
> -
> -    gtk_widget_set_allocation(window, allocation);
> -    sidebar_width = get_sidebar_width(window);
> -    child_allocation.y = allocation->y;
> -    child_allocation.width = allocation->width-sidebar_width;
> -    child_allocation.height = allocation->height;
> -
> -    if (gtk_get_locale_direction() == GTK_TEXT_DIR_LTR)
> -        child_allocation.x = allocation->x+sidebar_width;
> -    else
> -        child_allocation.x = allocation->x;
> -
> -    child = gtk_bin_get_child (GTK_BIN (window));
> -    if (child && gtk_widget_get_visible (child))
> -        gtk_widget_size_allocate (child, &child_allocation);
> -}
> -
>  static void anaconda_hub_window_class_init(AnacondaHubWindowClass *klass) {
>      GObjectClass *object_class = G_OBJECT_CLASS(klass);
> -    GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
>  
> -    widget_class->draw = anaconda_hub_window_on_draw;
> -    widget_class->size_allocate = anaconda_hub_window_size_allocate;
>      g_type_class_add_private(object_class, sizeof(AnacondaHubWindowPrivate));
>  }
>  
> diff --git a/widgets/src/HubWindow.h b/widgets/src/HubWindow.h
> index 8040eb8..9ff91e0 100644
> --- a/widgets/src/HubWindow.h
> +++ b/widgets/src/HubWindow.h
> @@ -22,7 +22,7 @@
>  
>  #include <gtk/gtk.h>
>  
> -#include "BaseWindow.h"
> +#include "BaseStandalone.h"
>  
>  G_BEGIN_DECLS
>  
> @@ -44,7 +44,7 @@ typedef struct _AnacondaHubWindowPrivate   AnacondaHubWindowPrivate;
>   * be directly accessed.
>   */
>  struct _AnacondaHubWindow {
> -    AnacondaBaseWindow           parent;
> +    AnacondaBaseStandalone     parent;
>  
>      /*< private >*/
>      AnacondaHubWindowPrivate  *priv;
> @@ -58,7 +58,7 @@ struct _AnacondaHubWindow {
>   *                pointer to be cast to an #AnacondaBaseWindow pointer.
>   */
>  struct _AnacondaHubWindowClass {
> -    AnacondaBaseWindowClass parent_class;
> +    AnacondaBaseStandaloneClass parent_class;
>  };
>  
>  GType       anaconda_hub_window_get_type (void);
> diff --git a/widgets/src/Makefile.am b/widgets/src/Makefile.am
> index f9639cd..525cec9 100644
> --- a/widgets/src/Makefile.am
> +++ b/widgets/src/Makefile.am
> @@ -34,6 +34,7 @@ GISOURCES = BaseWindow.c \
>  	 StandaloneWindow.c \
>  	 LayoutIndicator.c \
>  	 Lightbox.c \
> +	 BaseStandalone.c \
>  	 widgets-common.c
>  
>  GIHDRS = BaseWindow.h \
> @@ -45,6 +46,7 @@ GIHDRS = BaseWindow.h \
>  	 StandaloneWindow.h \
>  	 LayoutIndicator.h \
>  	 Lightbox.h \
> +	 BaseStandalone.h \
>  	 widgets-common.h
>  
>  NONGISOURCES =
> diff --git a/widgets/src/StandaloneWindow.c b/widgets/src/StandaloneWindow.c
> index 7e20270..4c489c2 100644
> --- a/widgets/src/StandaloneWindow.c
> +++ b/widgets/src/StandaloneWindow.c
> @@ -17,7 +17,7 @@
>   * Author: Chris Lumens <clumens at redhat.com>
>   */
>  
> -#include "BaseWindow.h"
> +#include "BaseStandalone.h"
>  #include "StandaloneWindow.h"
>  #include "intl.h"
>  
> @@ -46,155 +46,79 @@
>   *   space.  This is where widgets will be added and the user will do things.
>   */
>  
> -enum {
> -    SIGNAL_QUIT_CLICKED,
> -    SIGNAL_CONTINUE_CLICKED,
> -    LAST_SIGNAL
> -};
> -
>  #define QUIT_TEXT       N_("_Quit")
>  #define CONTINUE_TEXT   N_("_Continue")
>  
> -static guint window_signals[LAST_SIGNAL] = { 0 };
> -
>  struct _AnacondaStandaloneWindowPrivate {
>      GtkWidget  *button_box;
>      GtkWidget  *continue_button, *quit_button;
>  };
>  
> -static void anaconda_standalone_window_quit_clicked(GtkButton *button,
> -                                                    AnacondaStandaloneWindow *win);
> -static void anaconda_standalone_window_continue_clicked(GtkButton *button,
> -                                                        AnacondaStandaloneWindow *win);
> +enum {
> +    PROP_QUIT_BUTTON = 1,
> +    PROP_CONTINUE_BUTTON
> +};
> +
> +static void anaconda_standalone_window_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
>  static void anaconda_standalone_window_realize(GtkWidget *widget,
>                                                 AnacondaStandaloneWindow *win);
>  
> -G_DEFINE_TYPE(AnacondaStandaloneWindow, anaconda_standalone_window, ANACONDA_TYPE_BASE_WINDOW)
> -
> -static int get_sidebar_width(GtkWidget *window) {
> -    GtkAllocation allocation;
> -
> -    /* change value below to make sidebar bigger / smaller */
> -    float sidebar_width_percentage = 0.15;
> -
> -    gtk_widget_get_allocation(window, &allocation);
> -    return allocation.width * sidebar_width_percentage;
> -}
> -
> -static int get_sidebar_height(GtkWidget *window) {
> -    GtkAllocation allocation;
> -    gtk_widget_get_allocation(window, &allocation);
> -    return allocation.height;
> -}
> -
> -/* function to override default drawing to insert sidebar image */
> -static gboolean anaconda_standalone_window_on_draw(GtkWidget *win, cairo_t *cr) {
> -    GtkStyleContext *context;
> -    gdouble sidebar_x;
> -    gdouble sidebar_width;
> -
> -    /* calls parent class' draw handler */
> -    GTK_WIDGET_CLASS(anaconda_standalone_window_parent_class)->draw(win,cr);
> -
> -    sidebar_width = get_sidebar_width(win);
> -
> -    /* For RTL languages, move the sidebar to the right edge */
> -    if (gtk_get_locale_direction() == GTK_TEXT_DIR_LTR) {
> -        sidebar_x = 0;
> -    } else {
> -        GtkAllocation allocation;
> -        gtk_widget_get_allocation(win, &allocation);
> -        sidebar_x = allocation.width - sidebar_width;
> -    }
> -
> -    context = gtk_widget_get_style_context(win);
> -    gtk_style_context_save (context);
> -
> -    gtk_style_context_add_class(context, "logo-sidebar");
> -    gtk_render_background(context, cr, sidebar_x, 0, sidebar_width, get_sidebar_height(win));
> -    gtk_style_context_remove_class(context, "logo-sidebar");
> -
> -    gtk_style_context_add_class(context, "logo");
> -    gtk_render_background(context, cr, sidebar_x, 0, sidebar_width, get_sidebar_height(win));
> -    gtk_style_context_remove_class(context, "logo");
> -
> -    gtk_style_context_restore (context);
> -
> -    return TRUE; /* TRUE to avoid default draw handler */
> -}
> -
> -/* Move base window content appropriate amount of space to make room for sidebar */
> -static void anaconda_standalone_window_size_allocate (GtkWidget *window, GtkAllocation *allocation) {
> -    GtkAllocation child_allocation;
> -    GtkWidget *child;
> -    int sidebar_width;
> -
> -    GTK_WIDGET_CLASS(anaconda_standalone_window_parent_class)->size_allocate(window, allocation);
> -
> -    /*
> -     * For RTL languages, the width is reduced by the same amount, but the
> -     * start of the window does not need to move.
> -     */
> -    gtk_widget_set_allocation(window, allocation);
> -    sidebar_width = get_sidebar_width(window);
> -    child_allocation.y = allocation->y;
> -    child_allocation.width = allocation->width-sidebar_width;
> -    child_allocation.height = allocation->height;
> -
> -    if (gtk_get_locale_direction() == GTK_TEXT_DIR_LTR)
> -        child_allocation.x = allocation->x+sidebar_width;
> -    else
> -        child_allocation.x = allocation->x;
> -
> -    child = gtk_bin_get_child (GTK_BIN (window));
> -    if (child && gtk_widget_get_visible (child))
> -        gtk_widget_size_allocate (child, &child_allocation);
> -}
> +G_DEFINE_TYPE(AnacondaStandaloneWindow, anaconda_standalone_window, ANACONDA_TYPE_BASE_STANDALONE)
>  
>  static void anaconda_standalone_window_class_init(AnacondaStandaloneWindowClass *klass) {
>      GObjectClass *object_class = G_OBJECT_CLASS(klass);
> -    GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
> -    widget_class->draw = anaconda_standalone_window_on_draw;
> -    widget_class->size_allocate = anaconda_standalone_window_size_allocate;
>  
> -    klass->quit_clicked = NULL;
> -    klass->continue_clicked = NULL;
> +    object_class->get_property = anaconda_standalone_window_get_property;
> +
> +    /*
> +     * Override the quit-button and continue-button properties to make them
> +     * read only. The buttons will be create during the object's init method.
                                     created^^^

I don't understand why we want/need to have this override. And also I
cannot see how this is reflected in the rest of the changes (e.g. the
Welcome spoke).

-- 
Vratislav Podzimek

Anaconda Rider | RHCE | Red Hat, Inc. | Brno - Czech Republic




More information about the anaconda-patches mailing list