[libgd] main-box: Enclose the view in a GtkFrame



commit 7ead068e487ee2aee2cb1967be6bf9b0497f610a
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Jan 27 15:56:29 2017 +0100

    main-box: Enclose the view in a GtkFrame
    
    https://bugzilla.gnome.org/show_bug.cgi?id=774914

 libgd/gd-main-box.c |   23 +++++------------------
 1 files changed, 5 insertions(+), 18 deletions(-)
---
diff --git a/libgd/gd-main-box.c b/libgd/gd-main-box.c
index 669736e..fcbd62a 100644
--- a/libgd/gd-main-box.c
+++ b/libgd/gd-main-box.c
@@ -33,6 +33,7 @@ struct _GdMainBoxPrivate
   GListModel *model;
   GdMainBoxType current_type;
   GtkWidget *current_box;
+  GtkWidget *frame;
   gboolean selection_mode;
   gboolean show_primary_text;
   gboolean show_secondary_text;
@@ -157,7 +158,7 @@ gd_main_box_rebuild (GdMainBox *self)
   g_object_bind_property (self, "show-secondary-text",
                           priv->current_box, "show-secondary-text",
                           G_BINDING_SYNC_CREATE);
-  gtk_container_add (GTK_CONTAINER (self), priv->current_box);
+  gtk_container_add (GTK_CONTAINER (priv->frame), priv->current_box);
 
   g_signal_connect_swapped (priv->current_box,
                             "item-activated",
@@ -178,21 +179,6 @@ gd_main_box_rebuild (GdMainBox *self)
   gtk_widget_show_all (GTK_WIDGET (self));
 }
 
-static gboolean
-gd_main_box_draw (GtkWidget *widget, cairo_t *cr)
-{
-  GtkStyleContext *context;
-  gint height;
-  gint width;
-
-  context = gtk_widget_get_style_context (widget);
-  height = gtk_widget_get_allocated_height (widget);
-  width = gtk_widget_get_allocated_width (widget);
-  gtk_render_background (context, cr, 0, 0, width, height);
-
-  return GTK_WIDGET_CLASS (gd_main_box_parent_class)->draw (widget, cr);
-}
-
 static void
 gd_main_box_dispose (GObject *obj)
 {
@@ -214,8 +200,10 @@ gd_main_box_init (GdMainBox *self)
 
   priv = gd_main_box_get_instance_private (self);
 
-  context = gtk_widget_get_style_context (GTK_WIDGET (self));
+  priv->frame = gtk_frame_new (NULL);
+  context = gtk_widget_get_style_context (priv->frame);
   gtk_style_context_add_class (context, "content-view");
+  gtk_container_add (GTK_CONTAINER (self), priv->frame);
 
   /* so that we get constructed with the right view even at startup */
   priv->current_type = MAIN_BOX_TYPE_INITIAL;
@@ -286,7 +274,6 @@ gd_main_box_class_init (GdMainBoxClass *klass)
   oclass->get_property = gd_main_box_get_property;
   oclass->set_property = gd_main_box_set_property;
   oclass->dispose = gd_main_box_dispose;
-  wclass->draw = gd_main_box_draw;
 
   properties[PROP_BOX_TYPE] = g_param_spec_int ("box-type",
                                                 "Box type",


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]