Skip to content
Snippets Groups Projects
Commit 642bb4af authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* #7087: fix imwidget inheritance bug

It inherits directly from GtkVBox, not directly from GtkContainer

Resolved Conflicts:

	gnome/src/imwindow.c
parent 9b1301b9
Branches
Tags
No related merge requests found
...@@ -30,14 +30,13 @@ ...@@ -30,14 +30,13 @@
* as that of the covered work. * as that of the covered work.
*/ */
#include <config.h> #include "config.h"
#include <gtk/gtk.h> #include "eel-gconf-extensions.h"
#include <eel-gconf-extensions.h> #include "sflphone_const.h"
#include <sflphone_const.h>
#include "imwindow.h"
#include <imwindow.h> #include "contacts/calltab.h"
#include <contacts/calltab.h> #include "contacts/calltab.h"
#include <contacts/calltab.h>
#include <sys/stat.h> #include <sys/stat.h>
/** Local variables */ /** Local variables */
...@@ -47,12 +46,12 @@ static GtkWidget *im_notebook = NULL; ...@@ -47,12 +46,12 @@ static GtkWidget *im_notebook = NULL;
static void im_window_init(); static void im_window_init();
static GtkWindow *im_window_get() static GtkWidget *im_window_get()
{ {
if (im_window == NULL) if (im_window == NULL)
im_window_init(); im_window_init();
return GTK_WINDOW(im_window); return im_window;
} }
static gboolean window_configure_cb (GtkWidget *wini UNUSED, GdkEventConfigure *event) static gboolean window_configure_cb (GtkWidget *wini UNUSED, GdkEventConfigure *event)
...@@ -62,7 +61,7 @@ static gboolean window_configure_cb (GtkWidget *wini UNUSED, GdkEventConfigure * ...@@ -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_WIDTH, event->width);
eel_gconf_set_integer (CONF_IM_WINDOW_HEIGHT, event->height); 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_X, pos_x);
eel_gconf_set_integer (CONF_IM_WINDOW_POSITION_Y, pos_y); eel_gconf_set_integer (CONF_IM_WINDOW_POSITION_Y, pos_y);
...@@ -76,7 +75,7 @@ static gboolean ...@@ -76,7 +75,7 @@ static gboolean
on_delete (GtkWidget * widget UNUSED, gpointer data UNUSED) on_delete (GtkWidget * widget UNUSED, gpointer data UNUSED)
{ {
/* Only hide the main window that contains all the instant messaging instances */ /* 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; return TRUE;
} }
...@@ -152,15 +151,15 @@ im_window_is_active () ...@@ -152,15 +151,15 @@ im_window_is_active ()
gboolean gboolean
im_window_is_visible () im_window_is_visible ()
{ {
return gtk_widget_get_visible(GTK_WIDGET(im_window_get())); return gtk_widget_get_visible(im_window_get());
} }
void void
im_window_add (GtkWidget *widget) im_window_add (IMWidget *widget)
{ {
if (im_window_get()) { if (im_window_get()) {
im_window_add_tab (widget); 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 () ...@@ -192,11 +191,8 @@ im_window_hide_show_tabs ()
} }
void void
im_window_add_tab (GtkWidget *widget) im_window_add_tab (IMWidget *im)
{ {
/* Cast the paramater */
IMWidget *im = IM_WIDGET (widget);
/* Fetch the call */ /* Fetch the call */
callable_obj_t *im_widget_call = calllist_get_call (current_calls, im->call_id); 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); conference_obj_t *im_widget_conf = conferencelist_get (current_calls, im->call_id);
...@@ -222,14 +218,14 @@ im_window_add_tab (GtkWidget *widget) ...@@ -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)); 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 */ /* 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 */ /* Show it */
gtk_widget_show_all (im_notebook); gtk_widget_show_all (im_notebook);
gtk_widget_show_all (tab_Container); gtk_widget_show_all (tab_Container);
/* Add the page to the notebook */ /* 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 */ /* TODO Switch to the newly opened tab. Still not working */
DEBUG ("InstantMessaging: Switch to tab: %i", tabIndex); DEBUG ("InstantMessaging: Switch to tab: %i", tabIndex);
......
...@@ -31,12 +31,8 @@ ...@@ -31,12 +31,8 @@
#define __IMWINDOW_H__ #define __IMWINDOW_H__
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <gtk/gtk.h>
#include <widget/imwidget.h>
#define IM_WINDOW_WIDTH 280 #include "widget/imwidget.h"
#define IM_WINDOW_HEIGHT 320
/** @file imwindow.h /** @file imwindow.h
* @brief The IM window of the client. * @brief The IM window of the client.
...@@ -45,7 +41,7 @@ ...@@ -45,7 +41,7 @@
/*! @function /*! @function
@abstract Add IM widget to the IM window @abstract Add IM widget to the IM window
*/ */
void im_window_add (GtkWidget *widget); void im_window_add (IMWidget *widget);
/*! @function /*! @function
@abstract Remove IM widget from the IM window @abstract Remove IM widget from the IM window
...@@ -71,7 +67,7 @@ gint im_window_get_nb_tabs (void); ...@@ -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 @abstract Add a new tab in the notebook. Each tab is an IM Widget
@param The IM widget @param The IM widget
*/ */
void im_window_add_tab (GtkWidget *widget); void im_window_add_tab (IMWidget *widget);
/*! @function /*! @function
@abstract Select the specified tab as current in instant messaging window @abstract Select the specified tab as current in instant messaging window
......
...@@ -370,7 +370,7 @@ GtkWidget *im_widget_display (const gchar *id) ...@@ -370,7 +370,7 @@ GtkWidget *im_widget_display (const gchar *id)
IMWidget *imwidget = IM_WIDGET(g_object_new (IM_WIDGET_TYPE, NULL)); IMWidget *imwidget = IM_WIDGET(g_object_new (IM_WIDGET_TYPE, NULL));
imwidget->call_id = id; imwidget->call_id = id;
im_widget_infobar (imwidget); im_widget_infobar (imwidget);
im_window_add (GTK_WIDGET (imwidget)); im_window_add (imwidget);
return GTK_WIDGET(imwidget); return GTK_WIDGET(imwidget);
} }
......
...@@ -71,7 +71,7 @@ struct _IMWidget { ...@@ -71,7 +71,7 @@ struct _IMWidget {
}; };
struct _IMWidgetClass { struct _IMWidgetClass {
GtkContainerClass parent_class; GtkVBoxClass parent_class;
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment