[empathy] EmpathyIndividualLinker: inherit from a GtkBox instead of a GtkBin



commit aafefb7b6c4a17715e181bb2263423d950dca369
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Tue Jun 21 11:50:34 2011 +0200

    EmpathyIndividualLinker: inherit from a GtkBox instead of a GtkBin

 libempathy-gtk/empathy-individual-linker.c |   34 +--------------------------
 libempathy-gtk/empathy-individual-linker.h |    4 +-
 2 files changed, 4 insertions(+), 34 deletions(-)
---
diff --git a/libempathy-gtk/empathy-individual-linker.c b/libempathy-gtk/empathy-individual-linker.c
index 3a1551a..54663ef 100644
--- a/libempathy-gtk/empathy-individual-linker.c
+++ b/libempathy-gtk/empathy-individual-linker.c
@@ -85,7 +85,7 @@ enum {
 };
 
 G_DEFINE_TYPE (EmpathyIndividualLinker, empathy_individual_linker,
-    GTK_TYPE_BIN);
+    GTK_TYPE_BOX);
 
 static void
 contact_toggle_cell_data_func (GtkTreeViewColumn *tree_column,
@@ -494,7 +494,7 @@ set_up (EmpathyIndividualLinker *self)
   gtk_box_pack_start (GTK_BOX (top_vbox), label, FALSE, TRUE, 0);
 
   /* Add the main vbox to the bin */
-  gtk_container_add (GTK_CONTAINER (self), GTK_WIDGET (top_vbox));
+  gtk_box_pack_start (GTK_BOX (self), GTK_WIDGET (top_vbox), TRUE, TRUE, 0);
   gtk_widget_show (GTK_WIDGET (top_vbox));
 }
 
@@ -578,45 +578,15 @@ finalize (GObject *object)
 }
 
 static void
-size_allocate (GtkWidget *widget,
-    GtkAllocation *allocation)
-{
-  GtkBin *bin = GTK_BIN (widget);
-  GtkAllocation child_allocation;
-  GtkWidget *child;
-
-  gtk_widget_set_allocation (widget, allocation);
-
-  child = gtk_bin_get_child (bin);
-
-  if (child && gtk_widget_get_visible (child))
-    {
-      child_allocation.x = allocation->x +
-          gtk_container_get_border_width (GTK_CONTAINER (widget));
-      child_allocation.y = allocation->y +
-          gtk_container_get_border_width (GTK_CONTAINER (widget));
-      child_allocation.width = MAX (allocation->width -
-          gtk_container_get_border_width (GTK_CONTAINER (widget)) * 2, 0);
-      child_allocation.height = MAX (allocation->height -
-          gtk_container_get_border_width (GTK_CONTAINER (widget)) * 2, 0);
-
-      gtk_widget_size_allocate (child, &child_allocation);
-    }
-}
-
-static void
 empathy_individual_linker_class_init (EmpathyIndividualLinkerClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
-  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
   object_class->get_property = get_property;
   object_class->set_property = set_property;
   object_class->dispose = dispose;
   object_class->finalize = finalize;
 
-  widget_class->size_allocate = size_allocate;
-
   /**
    * EmpathyIndividualLinker:start-individual:
    *
diff --git a/libempathy-gtk/empathy-individual-linker.h b/libempathy-gtk/empathy-individual-linker.h
index dcf7518..3079fa0 100644
--- a/libempathy-gtk/empathy-individual-linker.h
+++ b/libempathy-gtk/empathy-individual-linker.h
@@ -43,14 +43,14 @@ G_BEGIN_DECLS
         EmpathyIndividualLinkerClass))
 
 typedef struct {
-	GtkBin parent;
+	GtkBox parent;
 
 	/*<private>*/
 	gpointer priv;
 } EmpathyIndividualLinker;
 
 typedef struct {
-	GtkBinClass parent_class;
+	GtkBoxClass parent_class;
 } EmpathyIndividualLinkerClass;
 
 GType empathy_individual_linker_get_type (void) G_GNUC_CONST;



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