cht電腦資訊gcin已解決問題
adm Find login register

[PATCH] Drop usage of deprecated gtk2 symbols

jserv
joined: 2008-03-26
posted: 1
promoted: 0
bookmarked: 0
1subject: [PATCH] Drop usage of deprecated gtk2 symbolsPromote 0 Bookmark 02010-03-21quote  

Hello list,

Since CFLAGS defines  GTK_DISABLE_DEPRECATED, it would be better to drop the usage of deprecated GTK2 symbols, otherwise linkage would fail:

  win0.o: In function `disp_tsin_pho':
/tmp/gcin-1.4.7.pre17/win0.cpp:218: undefined reference to `GTK_WIDGET_VISIBLE'
win0.o: In function `show_win0':
/tmp/gcin-1.4.7.pre17/win0.cpp:606: undefined reference to `GTK_WIDGET_VISIBLE'
win1.o: In function `disp_selections':
/tmp/gcin-1.4.7.pre17/win1.cpp:190: undefined reference to `GTK_WIDGET_VISIBLE'
win1.o: In function `raise_tsin_selection_win':
/tmp/gcin-1.4.7.pre17/win1.cpp:210: undefined reference to `GTK_WIDGET_VISIBLE'
collect2: ld returned 1 exit status

 Here is the proposed patch to fix:

Index: gcin-1.4.7.pre17/anthy.cpp
===================================================================
--- gcin-1.4.7.pre17.orig/anthy.cpp 2010-02-08 12:14:20.000000000 +0800
+++ gcin-1.4.7.pre17/anthy.cpp 2010-03-21 12:51:53.000000000 +0800
@@ -1000,7 +1000,7 @@

int anthy_visible()
{
- return GTK_WIDGET_VISIBLE(win_anthy);
+ return gtk_widget_get_visible(win_anthy);
}

extern gboolean force_show;
Index: gcin-1.4.7.pre17/eggtrayicon.cpp
===================================================================
--- gcin-1.4.7.pre17.orig/eggtrayicon.cpp 2010-02-01 20:25:21.000000000 +0800
+++ gcin-1.4.7.pre17/eggtrayicon.cpp 2010-03-21 12:51:53.000000000 +0800
@@ -352,7 +352,7 @@

gdk_window_add_filter (gdkwin, egg_tray_icon_manager_filter, icon);

- if (dock_if_realized && GTK_WIDGET_REALIZED (icon))
+ if (dock_if_realized && gtk_widget_get_realized (icon))
egg_tray_icon_send_dock_request (icon);

egg_tray_icon_get_orientation_property (icon);
@@ -399,7 +399,7 @@
make_transparent (GtkWidget *widget, gpointer user_data)
{
#if GTK_CHECK_VERSION(2,19,3)
- if (GTK_WIDGET_NO_WINDOW (widget) || gtk_widget_get_app_paintable (widget))
+ if (!gtk_widget_get_has_window (widget) || gtk_widget_get_app_paintable (widget))
#else
if (GTK_WIDGET_NO_WINDOW (widget) || GTK_WIDGET_APP_PAINTABLE (widget))
#endif
Index: gcin-1.4.7.pre17/eve.cpp
===================================================================
--- gcin-1.4.7.pre17.orig/eve.cpp 2010-02-27 11:24:19.000000000 +0800
+++ gcin-1.4.7.pre17/eve.cpp 2010-03-21 12:51:53.000000000 +0800
@@ -686,10 +686,10 @@
return FALSE;
switch (current_CS->in_method) {
case 3:
- return gwin_pho && GTK_WIDGET_VISIBLE(gwin_pho);
+ return gwin_pho && gtk_widget_get_visible(gwin_pho);
#if USE_TSIN
case 6:
- return gwin0 && GTK_WIDGET_VISIBLE(gwin0);
+ return gwin0 && gtk_widget_get_visible(gwin0);
#endif
case 10:
break;
@@ -700,7 +700,7 @@
default:
if (!gwin_gtab)
return FALSE;
- return gwin_gtab && GTK_WIDGET_VISIBLE(gwin_gtab);
+ return gwin_gtab && gtk_widget_get_visible(gwin_gtab);
}

return FALSE;
Index: gcin-1.4.7.pre17/gtab.cpp
===================================================================
--- gcin-1.4.7.pre17.orig/gtab.cpp 2010-03-07 21:52:28.000000000 +0800
+++ gcin-1.4.7.pre17/gtab.cpp 2010-03-21 12:51:53.000000000 +0800
@@ -1243,7 +1243,7 @@
return feedkey_pho(key, 0);

if (same_pho_query_state == SAME_PHO_QUERY_none && gwin_pho &&
- GTK_WIDGET_VISIBLE(gwin_pho))
+ gtk_widget_get_visible(gwin_pho))
hide_win_pho();


Index: gcin-1.4.7.pre17/tray.cpp
===================================================================
--- gcin-1.4.7.pre17.orig/tray.cpp 2010-01-17 20:25:34.000000000 +0800
+++ gcin-1.4.7.pre17/tray.cpp 2010-03-21 12:51:53.000000000 +0800
@@ -288,7 +288,7 @@
gtk_widget_show_all (GTK_WIDGET (egg_tray_icon));
tray_da_win = da->window;
// tray window is not ready ??
- if (!tray_da_win || !GTK_WIDGET_DRAWABLE(da)) {
+ if (!tray_da_win || !gtk_widget_is_drawable(da)) {
gtk_widget_destroy(GTK_WIDGET(egg_tray_icon));
da = NULL;
return FALSE;
Index: gcin-1.4.7.pre17/win0.cpp
===================================================================
--- gcin-1.4.7.pre17.orig/win0.cpp 2009-12-07 09:57:36.000000000 +0800
+++ gcin-1.4.7.pre17/win0.cpp 2010-03-21 12:51:53.000000000 +0800
@@ -215,7 +215,7 @@
void disp_pho_sub(GtkWidget *label, int index, char *pho);
void disp_tsin_pho(int index, char *pho)
{
- if (button_pho && !GTK_WIDGET_VISIBLE(button_pho))
+ if (button_pho && !gtk_widget_get_visible(button_pho))
gtk_widget_show(button_pho);

disp_pho_sub(label_pho, index, pho);
@@ -270,7 +270,7 @@
#if 0
GtkWidget *widget =chars[index].line;

- if (!GTK_WIDGET_VISIBLE(widget)) {
+ if (!gtk_widget_get_visible(widget)) {
widget = chars[index].vbox;
}
#endif
@@ -603,7 +603,7 @@
if (gcin_pop_up_win && !tsin_has_input() && !force_show)
return;
#if UNIX
- if (!GTK_WIDGET_VISIBLE(gwin0))
+ if (!gtk_widget_get_visible(gwin0))
#endif
{
gtk_widget_show(gwin0);
Index: gcin-1.4.7.pre17/win1.cpp
===================================================================
--- gcin-1.4.7.pre17.orig/win1.cpp 2009-12-26 16:22:26.000000000 +0800
+++ gcin-1.4.7.pre17/win1.cpp 2010-03-21 12:51:53.000000000 +0800
@@ -187,7 +187,7 @@

void disp_selections(int x, int y)
{
- if (!GTK_WIDGET_VISIBLE(gwin1)) {
+ if (!gtk_widget_get_visible(gwin1)) {
gtk_widget_show(gwin1);
}

@@ -207,7 +207,7 @@

void raise_tsin_selection_win()
{
- if (gwin1 && GTK_WIDGET_VISIBLE(gwin1))
+ if (gwin1 && gtk_widget_get_visible(gwin1))
gtk_window_present(GTK_WINDOW(gwin1));
}

Index: gcin-1.4.7.pre17/win-gtab.cpp
===================================================================
--- gcin-1.4.7.pre17.orig/win-gtab.cpp 2009-12-19 15:19:58.000000000 +0800
+++ gcin-1.4.7.pre17/win-gtab.cpp 2010-03-21 12:51:53.000000000 +0800
@@ -526,7 +526,7 @@

// dbg("show_win_gtab()\n");
#if UNIX
- if (!GTK_WIDGET_VISIBLE(gwin_gtab))
+ if (!gtk_widget_get_visible(gwin_gtab))
#endif
gtk_widget_show(gwin_gtab);
 

Thanks,

-jserv

eliu

joined: 2007-08-09
posted: 11468
promoted: 617
bookmarked: 187
新竹, 台灣
2subject: Promote 0 Bookmark 02010-03-21quote  
這個 caleb也有 post 過,只是怕造成不相容的,看能不能用 #ifdef VERSION check 的方式

cht電腦資訊gcin已解決問題
adm Find login register
views:4650