[ekiga/gnome-2-26] Replace deprecated functions in gtk >= 2.18
- From: Eugen Dedu <ededu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga/gnome-2-26] Replace deprecated functions in gtk >= 2.18
- Date: Fri, 7 May 2010 20:13:03 +0000 (UTC)
commit 0f6434b25228100f44ed8916736ad6cc9244ea84
Author: Eugen Dedu <Eugen Dedu pu-pm univ-fcomte fr>
Date: Fri May 7 22:11:44 2010 +0200
Replace deprecated functions in gtk >= 2.18
lib/engine/gui/gtk-frontend/addressbook-window.cpp | 12 +++++--
lib/gui/gm-smiley-chooser-button.c | 8 +++-
lib/gui/gmconnectbutton.c | 4 ++
lib/gui/gmlevelmeter.c | 34 +++++++++++++++++++-
lib/gui/gmmenuaddon.c | 12 +++++--
src/dbus-helper/dbus.cpp | 4 ++
src/gui/main.cpp | 12 +++++++
src/gui/misc.cpp | 7 +++-
src/gui/statusicon.cpp | 6 +++-
9 files changed, 86 insertions(+), 13 deletions(-)
---
diff --git a/lib/engine/gui/gtk-frontend/addressbook-window.cpp b/lib/engine/gui/gtk-frontend/addressbook-window.cpp
index 41124bb..994b30a 100644
--- a/lib/engine/gui/gtk-frontend/addressbook-window.cpp
+++ b/lib/engine/gui/gtk-frontend/addressbook-window.cpp
@@ -435,26 +435,30 @@ addressbook_window_add_book (AddressBookWindow *self,
page = gtk_notebook_append_page (GTK_NOTEBOOK (self->priv->notebook),
view, NULL);
+#if GTK_CHECK_VERSION(2,18,0)
+ if (gtk_widget_get_visible (GTK_WIDGET (self)))
+#else
if (GTK_WIDGET_VISIBLE (self))
+#endif
gtk_widget_show_all (view);
g_signal_connect (view, "updated", G_CALLBACK (on_view_updated), self);
icon = gtk_widget_render_icon (GTK_WIDGET (self->priv->tree_view),
book->get_icon ().c_str (),
- GTK_ICON_SIZE_MENU, NULL);
+ GTK_ICON_SIZE_MENU, NULL);
store = gtk_tree_view_get_model (GTK_TREE_VIEW (self->priv->tree_view));
gtk_tree_store_append (GTK_TREE_STORE (store), &iter, NULL);
gtk_tree_store_set (GTK_TREE_STORE (store), &iter,
- COLUMN_PIXBUF, icon,
+ COLUMN_PIXBUF, icon,
COLUMN_NAME, book->get_name ().c_str (),
- COLUMN_BOOK_POINTER, book.get (),
+ COLUMN_BOOK_POINTER, book.get (),
COLUMN_VIEW, view,
-1);
if (!gtk_tree_selection_get_selected (self->priv->selection, &store, &iter)) {
-
+
gtk_tree_model_get_iter_first (store, &iter);
gtk_tree_selection_select_iter (self->priv->selection, &iter);
}
diff --git a/lib/gui/gm-smiley-chooser-button.c b/lib/gui/gm-smiley-chooser-button.c
index f215d34..b43e4ad 100644
--- a/lib/gui/gm-smiley-chooser-button.c
+++ b/lib/gui/gm-smiley-chooser-button.c
@@ -782,8 +782,12 @@ gm_smiley_chooser_button_new (void)
/* if already possible (unlikely), initially set the toplevel reference */
widget = gtk_widget_get_toplevel (GTK_WIDGET (self));
if (widget &&
- GTK_WIDGET_TOPLEVEL (widget) &&
- GTK_IS_WINDOW (widget))
+#if GTK_CHECK_VERSION(2,18,0)
+ gtk_widget_is_toplevel (widget)
+#else
+ GTK_WIDGET_TOPLEVEL (widget)
+#endif
+ && GTK_IS_WINDOW (widget))
{
g_object_ref_sink (G_OBJECT (widget));
self->priv->toplevel_window_handler[HANDLER_CONFIGURE] =
diff --git a/lib/gui/gmconnectbutton.c b/lib/gui/gmconnectbutton.c
index fd7af59..0c35837 100644
--- a/lib/gui/gmconnectbutton.c
+++ b/lib/gui/gmconnectbutton.c
@@ -212,7 +212,11 @@ gm_connect_button_get_connected (GmConnectButton *cb)
g_return_val_if_fail (cb != NULL, FALSE);
g_return_val_if_fail (GM_IS_CONNECT_BUTTON (cb), FALSE);
+#if GTK_CHECK_VERSION(2,20,0)
+ return (gtk_widget_get_sensitive (GTK_WIDGET (cb->hangup_button)));
+#else
return (GTK_WIDGET_SENSITIVE (cb->hangup_button));
+#endif
}
diff --git a/lib/gui/gmlevelmeter.c b/lib/gui/gmlevelmeter.c
index 65477f1..e7a599b 100644
--- a/lib/gui/gmlevelmeter.c
+++ b/lib/gui/gmlevelmeter.c
@@ -153,7 +153,11 @@ gm_level_meter_set_level (GmLevelMeter *lm,
if (level > lm->peak)
lm->peak = level;
+#if GTK_CHECK_VERSION(2,20,0)
+ if (gtk_widget_get_realized (GTK_WIDGET (lm)))
+#else
if (GTK_WIDGET_REALIZED (lm))
+#endif
gm_level_meter_paint (lm);
}
@@ -164,7 +168,11 @@ gm_level_meter_clear (GmLevelMeter *lm)
lm->level = 0;
lm->peak = 0;
+#if GTK_CHECK_VERSION(2,20,0)
+ if (gtk_widget_get_realized (GTK_WIDGET (lm)))
+#else
if (GTK_WIDGET_REALIZED (lm))
+#endif
gm_level_meter_paint (lm);
}
@@ -178,7 +186,11 @@ gm_level_meter_set_colors (GmLevelMeter* lm,
if (lm->colorEntries) {
/* free old colors, if they have been allocated; delete old array */
- if (GTK_WIDGET_REALIZED (lm))
+#if GTK_CHECK_VERSION(2,20,0)
+ if (gtk_widget_get_realized (GTK_WIDGET (lm)))
+#else
+ if (GTK_WIDGET_REALIZED (lm))
+#endif
gm_level_meter_free_colors (lm->colorEntries);
g_array_free (lm->colorEntries, TRUE);
}
@@ -193,7 +205,11 @@ gm_level_meter_set_colors (GmLevelMeter* lm,
g_array_append_val (lm->colorEntries, *entry);
}
+#if GTK_CHECK_VERSION(2,20,0)
+ if (gtk_widget_get_realized (GTK_WIDGET (lm))) {
+#else
if (GTK_WIDGET_REALIZED (lm)) {
+#endif
gm_level_meter_allocate_colors (lm->colorEntries);
@@ -379,7 +395,11 @@ gm_level_meter_create_pixmap (GmLevelMeter *lm)
g_return_if_fail (GM_IS_LEVEL_METER (lm));
+#if GTK_CHECK_VERSION(2,20,0)
+ if (gtk_widget_get_realized (GTK_WIDGET (lm))) {
+#else
if (GTK_WIDGET_REALIZED (lm)) {
+#endif
widget = GTK_WIDGET (lm);
if (lm->offscreen_image)
@@ -518,7 +538,11 @@ gm_level_meter_paint (GmLevelMeter *lm)
peak_width, peak_height);
/* repaint */
+#if GTK_CHECK_VERSION(2,20,0)
+ if (gtk_widget_is_drawable (widget))
+#else
if (GTK_WIDGET_DRAWABLE (widget))
+#endif
gdk_draw_drawable (widget->window,
widget->style->black_gc,
lm->offscreen_image,
@@ -570,7 +594,11 @@ gm_level_meter_size_allocate (GtkWidget *widget,
g_return_if_fail (allocation != NULL);
widget->allocation = *allocation;
+#if GTK_CHECK_VERSION(2,20,0)
+ if (gtk_widget_get_realized (widget)) {
+#else
if (GTK_WIDGET_REALIZED (widget)) {
+#endif
gdk_window_move_resize (widget->window,
allocation->x, allocation->y,
@@ -596,7 +624,11 @@ gm_level_meter_expose (GtkWidget *widget,
return FALSE;
/* repaint */
+#if GTK_CHECK_VERSION(2,20,0)
+ if (gtk_widget_is_drawable (widget))
+#else
if (GTK_WIDGET_DRAWABLE (widget))
+#endif
gdk_draw_drawable (widget->window,
widget->style->black_gc,
GM_LEVEL_METER (widget)->offscreen_image,
diff --git a/lib/gui/gmmenuaddon.c b/lib/gui/gmmenuaddon.c
index 19945fc..0a60e1d 100644
--- a/lib/gui/gmmenuaddon.c
+++ b/lib/gui/gmmenuaddon.c
@@ -565,14 +565,18 @@ gtk_radio_menu_select_with_id (GtkWidget *menu,
last pos is 0 */
while (group) {
+#if GTK_CHECK_VERSION(2,20,0)
+ if (gtk_widget_get_sensitive (GTK_WIDGET (GTK_CHECK_MENU_ITEM (group->data))))
+#else
if (GTK_WIDGET_SENSITIVE (GTK_CHECK_MENU_ITEM (group->data)))
- GTK_CHECK_MENU_ITEM (group->data)->active =
+#endif
+ GTK_CHECK_MENU_ITEM (group->data)->active =
(i == group_last_pos - active);
else
- GTK_CHECK_MENU_ITEM (group->data)->active = FALSE;
-
+ GTK_CHECK_MENU_ITEM (group->data)->active = FALSE;
+
gtk_widget_queue_draw (GTK_WIDGET (group->data));
-
+
group = g_slist_next (group);
i++;
}
diff --git a/src/dbus-helper/dbus.cpp b/src/dbus-helper/dbus.cpp
index eb6cacc..0215873 100644
--- a/src/dbus-helper/dbus.cpp
+++ b/src/dbus-helper/dbus.cpp
@@ -114,7 +114,11 @@ ekiga_dbus_component_show (G_GNUC_UNUSED EkigaDBusComponent *self,
PTRACE (1, "DBus\tShow");
GtkWidget *window = GnomeMeeting::Process ()->GetMainWindow ();
+#if GTK_CHECK_VERSION(2,18,0)
+ if (gtk_widget_get_visible (GTK_WIDGET (window)))
+#else
if (GTK_WIDGET_VISIBLE (window))
+#endif
gtk_window_set_urgency_hint (GTK_WINDOW (window), TRUE);
else
gtk_window_present (GTK_WINDOW (window));
diff --git a/src/gui/main.cpp b/src/gui/main.cpp
index 521932e..944a17c 100644
--- a/src/gui/main.cpp
+++ b/src/gui/main.cpp
@@ -1042,7 +1042,11 @@ ekiga_main_window_set_video_size (EkigaMainWindow *mw, int width, int height)
return;
panel = gtk_paned_get_child2 (GTK_PANED (mw->priv->hpaned));
+#if GTK_CHECK_VERSION(2,18,0)
+ if (gtk_widget_get_visible (GTK_WIDGET (panel))) {
+#else
if (GTK_WIDGET_VISIBLE (panel)) {
+#endif
int x, y;
int rw, pos;
GtkRequisition req;
@@ -2551,7 +2555,11 @@ ekiga_main_window_show_call_panel (EkigaMainWindow *mw)
int x, y = 0;
GtkWidget *call_panel = gtk_paned_get_child2 (GTK_PANED (mw->priv->hpaned));
+#if GTK_CHECK_VERSION(2,18,0)
+ if (!gtk_widget_get_visible (GTK_WIDGET (call_panel))) {
+#else
if (!GTK_WIDGET_VISIBLE (call_panel)) {
+#endif
gtk_window_get_size (GTK_WINDOW (mw), &x, &y);
gtk_widget_show_all (call_panel);
gtk_window_resize (GTK_WINDOW (mw), x + call_panel->allocation.width, y);
@@ -2565,7 +2573,11 @@ ekiga_main_window_hide_call_panel (EkigaMainWindow *mw)
int x, y = 0;
GtkWidget *call_panel = gtk_paned_get_child2 (GTK_PANED (mw->priv->hpaned));
+#if GTK_CHECK_VERSION(2,18,0)
+ if (gtk_widget_get_visible (GTK_WIDGET (call_panel))) {
+#else
if (GTK_WIDGET_VISIBLE (call_panel)) {
+#endif
gtk_window_get_size (GTK_WINDOW (mw), &x, &y);
gtk_widget_hide (call_panel);
x = x - call_panel->allocation.width;
diff --git a/src/gui/misc.cpp b/src/gui/misc.cpp
index ac7db2a..0cea935 100644
--- a/src/gui/misc.cpp
+++ b/src/gui/misc.cpp
@@ -125,7 +125,12 @@ gdk_window_set_always_on_top (GdkWindow *window,
gboolean
gnomemeeting_window_is_visible (GtkWidget *w)
{
- return (GTK_WIDGET_VISIBLE (w) && !(gdk_window_get_state (GDK_WINDOW (w->window)) & GDK_WINDOW_STATE_ICONIFIED));
+#if GTK_CHECK_VERSION(2,18,0)
+ return (gtk_widget_get_visible (GTK_WIDGET (w))
+#else
+ return (GTK_WIDGET_VISIBLE (w)
+#endif
+ && !(gdk_window_get_state (GDK_WINDOW (w->window)) & GDK_WINDOW_STATE_ICONIFIED));
}
diff --git a/src/gui/statusicon.cpp b/src/gui/statusicon.cpp
index 4c8d1e9..c111306 100644
--- a/src/gui/statusicon.cpp
+++ b/src/gui/statusicon.cpp
@@ -264,7 +264,11 @@ statusicon_activated_cb (G_GNUC_UNUSED GtkStatusIcon *icon,
window = GnomeMeeting::Process ()->GetMainWindow (); //FIXME
// FIXME when the main window becomes a gobject
- if (!(GTK_WIDGET_VISIBLE (window)
+#if GTK_CHECK_VERSION(2,18,0)
+ if (!(gtk_widget_get_visible (GTK_WIDGET (window))
+#else
+ if (!(GTK_WIDGET_VISIBLE (window)
+#endif
&& !(gdk_window_get_state (GDK_WINDOW (window->window)) & GDK_WINDOW_STATE_ICONIFIED))) {
gtk_widget_show (window);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]