aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-06-21 18:01:47 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-06-21 18:01:47 +0800
commitb95223f0d32b6c8424341bf0c406e4422c831de6 (patch)
treead92e4416a9b52078b59c02f390e0f9e185998f1
parentaafefb7b6c4a17715e181bb2263423d950dca369 (diff)
downloadgsoc2013-empathy-b95223f0d32b6c8424341bf0c406e4422c831de6.tar
gsoc2013-empathy-b95223f0d32b6c8424341bf0c406e4422c831de6.tar.gz
gsoc2013-empathy-b95223f0d32b6c8424341bf0c406e4422c831de6.tar.bz2
gsoc2013-empathy-b95223f0d32b6c8424341bf0c406e4422c831de6.tar.lz
gsoc2013-empathy-b95223f0d32b6c8424341bf0c406e4422c831de6.tar.xz
gsoc2013-empathy-b95223f0d32b6c8424341bf0c406e4422c831de6.tar.zst
gsoc2013-empathy-b95223f0d32b6c8424341bf0c406e4422c831de6.zip
EmpathySearchBar: inherit from a GtkBox instead of a GtkBin
-rw-r--r--libempathy-gtk/empathy-search-bar.c48
-rw-r--r--libempathy-gtk/empathy-search-bar.h4
2 files changed, 4 insertions, 48 deletions
diff --git a/libempathy-gtk/empathy-search-bar.c b/libempathy-gtk/empathy-search-bar.c
index fe5f167a0..d23380d4d 100644
--- a/libempathy-gtk/empathy-search-bar.c
+++ b/libempathy-gtk/empathy-search-bar.c
@@ -33,7 +33,7 @@
#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathySearchBar)
-G_DEFINE_TYPE (EmpathySearchBar, empathy_search_bar, GTK_TYPE_BIN);
+G_DEFINE_TYPE (EmpathySearchBar, empathy_search_bar, GTK_TYPE_BOX);
typedef struct _EmpathySearchBarPriv EmpathySearchBarPriv;
struct _EmpathySearchBarPriv
@@ -63,45 +63,6 @@ empathy_search_bar_new (EmpathyChatView *view)
}
static void
-empathy_search_bar_get_preferred_height (GtkWidget *widget,
- gint *minimun_height,
- gint *natural_height)
-{
- GtkBin *bin;
- GtkWidget *child;
-
- bin = GTK_BIN (widget);
- child = gtk_bin_get_child (bin);
-
- if (child && gtk_widget_get_visible (child))
- gtk_widget_get_preferred_height (child, minimun_height, natural_height);
-}
-
-static void
-empathy_search_bar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkBin *bin;
- GtkWidget *child;
- GtkAllocation child_allocation;
-
- bin = GTK_BIN (widget);
- child = gtk_bin_get_child (bin);
-
- gtk_widget_set_allocation (widget, allocation);
-
- if (child && gtk_widget_get_visible (child))
- {
- child_allocation.x = allocation->x;
- child_allocation.y = allocation->y;
- child_allocation.width = MAX (allocation->width, 0);
- child_allocation.height = MAX (allocation->height, 0);
-
- gtk_widget_size_allocate (child, &child_allocation);
- }
-}
-
-static void
empathy_search_bar_update_buttons (EmpathySearchBar *self,
gchar *search,
gboolean match_case)
@@ -332,7 +293,7 @@ empathy_search_bar_init (EmpathySearchBar * self)
g_signal_connect (G_OBJECT (self), "key-press-event",
G_CALLBACK (empathy_search_bar_key_pressed), NULL);
- gtk_container_add (GTK_CONTAINER (self), internal);
+ gtk_box_pack_start (GTK_BOX (self), internal, TRUE, TRUE, 0);
gtk_widget_show_all (internal);
gtk_widget_hide (priv->search_not_found);
g_object_unref (gui);
@@ -342,13 +303,8 @@ static void
empathy_search_bar_class_init (EmpathySearchBarClass *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
g_type_class_add_private (gobject_class, sizeof (EmpathySearchBarPriv));
-
- /* Neither GtkBin nor GtkContainer seems to do this for us :( */
- widget_class->get_preferred_height = empathy_search_bar_get_preferred_height;
- widget_class->size_allocate = empathy_search_bar_size_allocate;
}
void
diff --git a/libempathy-gtk/empathy-search-bar.h b/libempathy-gtk/empathy-search-bar.h
index 2e4e0d76e..4b07f92c2 100644
--- a/libempathy-gtk/empathy-search-bar.h
+++ b/libempathy-gtk/empathy-search-bar.h
@@ -44,7 +44,7 @@ typedef struct _EmpathySearchBarClass EmpathySearchBarClass;
struct _EmpathySearchBar
{
- GtkBin parent;
+ GtkBox parent;
/*<private>*/
gpointer priv;
@@ -52,7 +52,7 @@ struct _EmpathySearchBar
struct _EmpathySearchBarClass
{
- GtkBinClass parent_class;
+ GtkBoxClass parent_class;
};
GType empathy_search_bar_get_type (void) G_GNUC_CONST;