From 642bb4af7e4c007332e34b31228c599a2bcd5fd9 Mon Sep 17 00:00:00 2001
From: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
Date: Mon, 3 Oct 2011 17:43:39 -0400
Subject: [PATCH] * #7087: fix imwidget inheritance bug

It inherits directly from GtkVBox, not directly from GtkContainer

Resolved Conflicts:

	gnome/src/imwindow.c
---
 gnome/src/imwindow.c        | 38 +++++++++++++++++--------------------
 gnome/src/imwindow.h        | 10 +++-------
 gnome/src/widget/imwidget.c |  2 +-
 gnome/src/widget/imwidget.h |  2 +-
 4 files changed, 22 insertions(+), 30 deletions(-)

diff --git a/gnome/src/imwindow.c b/gnome/src/imwindow.c
index 301ae698ed..21b5eb2d37 100644
--- a/gnome/src/imwindow.c
+++ b/gnome/src/imwindow.c
@@ -30,14 +30,13 @@
  *  as that of the covered work.
  */
 
-#include <config.h>
-#include <gtk/gtk.h>
-#include <eel-gconf-extensions.h>
-#include <sflphone_const.h>
-
-#include <imwindow.h>
-#include <contacts/calltab.h>
-#include <contacts/calltab.h>
+#include "config.h"
+#include "eel-gconf-extensions.h"
+#include "sflphone_const.h"
+
+#include "imwindow.h"
+#include "contacts/calltab.h"
+#include "contacts/calltab.h"
 #include <sys/stat.h>
 
 /** Local variables */
@@ -47,12 +46,12 @@ static GtkWidget *im_notebook = NULL;
 
 static void im_window_init();
 
-static GtkWindow *im_window_get()
+static GtkWidget *im_window_get()
 {
     if (im_window == NULL)
         im_window_init();
 
-    return GTK_WINDOW(im_window);
+    return im_window;
 }
 
 static gboolean window_configure_cb (GtkWidget *wini UNUSED, GdkEventConfigure *event)
@@ -62,7 +61,7 @@ static gboolean window_configure_cb (GtkWidget *wini UNUSED, GdkEventConfigure *
     eel_gconf_set_integer (CONF_IM_WINDOW_WIDTH, event->width);
     eel_gconf_set_integer (CONF_IM_WINDOW_HEIGHT, event->height);
 
-    gtk_window_get_position (im_window_get(), &pos_x, &pos_y);
+    gtk_window_get_position (GTK_WINDOW(im_window_get()), &pos_x, &pos_y);
     eel_gconf_set_integer (CONF_IM_WINDOW_POSITION_X, pos_x);
     eel_gconf_set_integer (CONF_IM_WINDOW_POSITION_Y, pos_y);
 
@@ -76,7 +75,7 @@ static gboolean
 on_delete (GtkWidget * widget UNUSED, gpointer data UNUSED)
 {
     /* Only hide the main window that contains all the instant messaging instances */
-    gtk_widget_hide (GTK_WIDGET (im_window_get()));
+    gtk_widget_hide(im_window_get());
     return TRUE;
 }
 
@@ -152,15 +151,15 @@ im_window_is_active ()
 gboolean
 im_window_is_visible ()
 {
-    return gtk_widget_get_visible(GTK_WIDGET(im_window_get()));
+    return gtk_widget_get_visible(im_window_get());
 }
 
 void
-im_window_add (GtkWidget *widget)
+im_window_add (IMWidget *widget)
 {
     if (im_window_get()) {
         im_window_add_tab (widget);
-        gtk_widget_show_all (GTK_WIDGET(im_window_get()));
+        gtk_widget_show_all (im_window_get());
     }
 }
 
@@ -192,11 +191,8 @@ im_window_hide_show_tabs ()
 }
 
 void
-im_window_add_tab (GtkWidget *widget)
+im_window_add_tab (IMWidget *im)
 {
-    /* Cast the paramater */
-    IMWidget *im = IM_WIDGET (widget);
-
     /* Fetch the call */
     callable_obj_t *im_widget_call = calllist_get_call (current_calls, im->call_id);
     conference_obj_t *im_widget_conf = conferencelist_get (current_calls, im->call_id);
@@ -222,14 +218,14 @@ im_window_add_tab (GtkWidget *widget)
     gtk_container_add (GTK_CONTAINER (tab_CloseButton), gtk_image_new_from_stock (GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU));
 
     /* Connect a signal to the close button on each tab, to be able to close the tabs individually */
-    g_signal_connect (tab_CloseButton, "clicked", G_CALLBACK (close_tab_cb), widget);
+    g_signal_connect (tab_CloseButton, "clicked", G_CALLBACK (close_tab_cb), im);
 
     /* Show it */
     gtk_widget_show_all (im_notebook);
     gtk_widget_show_all (tab_Container);
 
     /* Add the page to the notebook */
-    guint tabIndex = gtk_notebook_append_page (GTK_NOTEBOOK (im_notebook), widget, tab_Container);
+    guint tabIndex = gtk_notebook_append_page(GTK_NOTEBOOK(im_notebook), GTK_WIDGET(im), tab_Container);
 
     /* TODO Switch to the newly opened tab. Still not working */
     DEBUG ("InstantMessaging: Switch to tab: %i", tabIndex);
diff --git a/gnome/src/imwindow.h b/gnome/src/imwindow.h
index 0db8c628c4..d7ef33b7aa 100644
--- a/gnome/src/imwindow.h
+++ b/gnome/src/imwindow.h
@@ -31,12 +31,8 @@
 #define __IMWINDOW_H__
 
 #include <gtk/gtk.h>
-#include <gtk/gtk.h>
-
-#include <widget/imwidget.h>
 
-#define IM_WINDOW_WIDTH 280
-#define IM_WINDOW_HEIGHT 320
+#include "widget/imwidget.h"
 
 /** @file imwindow.h
   * @brief The IM window of the client.
@@ -45,7 +41,7 @@
 /*!	@function
 @abstract	Add IM widget to the IM window
  */
-void im_window_add (GtkWidget *widget);
+void im_window_add (IMWidget *widget);
 
 /*! @function
  @abstract	Remove IM widget from the IM window
@@ -71,7 +67,7 @@ gint im_window_get_nb_tabs (void);
 @abstract	Add a new tab in the notebook. Each tab is an IM Widget
 @param		The IM widget
 */
-void im_window_add_tab (GtkWidget *widget);
+void im_window_add_tab (IMWidget *widget);
 
 /*! @function
 @abstract Select the specified tab as current in instant messaging window
diff --git a/gnome/src/widget/imwidget.c b/gnome/src/widget/imwidget.c
index fd1087a5a7..4fbed5de82 100644
--- a/gnome/src/widget/imwidget.c
+++ b/gnome/src/widget/imwidget.c
@@ -370,7 +370,7 @@ GtkWidget *im_widget_display (const gchar *id)
     IMWidget *imwidget = IM_WIDGET(g_object_new (IM_WIDGET_TYPE, NULL));
     imwidget->call_id = id;
     im_widget_infobar (imwidget);
-    im_window_add (GTK_WIDGET (imwidget));
+    im_window_add (imwidget);
 
     return GTK_WIDGET(imwidget);
 }
diff --git a/gnome/src/widget/imwidget.h b/gnome/src/widget/imwidget.h
index fd77229270..b84af425a2 100644
--- a/gnome/src/widget/imwidget.h
+++ b/gnome/src/widget/imwidget.h
@@ -71,7 +71,7 @@ struct _IMWidget {
 };
 
 struct _IMWidgetClass {
-    GtkContainerClass parent_class;
+    GtkVBoxClass parent_class;
 };
 
 
-- 
GitLab