[gftp/autotools: 4/12] Only support GLib2 / GTK+2
- From: Javier Jardón <jjardon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gftp/autotools: 4/12] Only support GLib2 / GTK+2
- Date: Sun, 29 Sep 2013 23:38:53 +0000 (UTC)
commit a3a5bce74f32fbbdfa56190fe9b582af4f2c367f
Author: Javier Jardón <jjardon gnome org>
Date: Sun Sep 29 23:38:07 2013 +0100
Only support GLib2 / GTK+2
GLib 1 and GTK+ 1 are obsoleted and not present in modern distros
configure.ac | 41 +++-------
lib/charset-conv.c | 37 ---------
lib/gftp.h | 2 -
lib/misc.c | 10 ---
lib/protocols.c | 2 -
lib/sslcommon.c | 5 -
src/gtk/Makefile.am | 2 +-
src/gtk/bookmarks.c | 83 --------------------
src/gtk/chmod_dialog.c | 33 --------
src/gtk/gftp-gtk.c | 56 --------------
src/gtk/gftp-gtk.h | 12 ---
src/gtk/gtkui.c | 20 -----
src/gtk/gtkui_transfer.c | 45 -----------
src/gtk/menu-items.c | 72 -----------------
src/gtk/misc-gtk.c | 191 ----------------------------------------------
src/gtk/options_dialog.c | 171 -----------------------------------------
src/gtk/view_dialog.c | 42 ----------
17 files changed, 13 insertions(+), 811 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 2c1348e..208dc78 100644
--- a/configure.ac
+++ b/configure.ac
@@ -13,11 +13,6 @@ AC_ARG_ENABLE(gtk20,
enable_gtk20=$enableval,
enable_gtk20="yes")
-AC_ARG_ENABLE(gtkport,
- [ --disable-gtkport Disable compiling the GTK+ port],
- enable_gtkport=$enableval,
- enable_gtkport="yes")
-
AC_ARG_ENABLE(textport,
[ --disable-textport Disable compiling the text port],
enable_textport=$enableval,
@@ -67,16 +62,6 @@ AC_CHECK_TYPE(union semun, ,AC_DEFINE(_SEM_SEMUN_UNDEFINED,1,[Define if you do n
#include <sys/sem.h>
])
-if test "x$enable_gtk20" = "xyes" ; then
- PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.0.0, found_glib20=1, found_glib20=0)
-else
- found_glib20=0;
-fi
-
-if test "x$GFTP_TEXT" = "x" -a $found_glib20 = 0 ; then
- AM_PATH_GLIB(1.2.3, , AC_MSG_ERROR(gFTP needs GLIB 1.2.3 or higher))
-fi
-
EXTRA_LIBS=""
# FreeBSD needs this
@@ -180,21 +165,20 @@ GFTP_GTK=""
PTHREAD_CFLAGS=""
PTHREAD_LIBS=""
-# I don't have PKG_CHECK_MODULES or AM_PATH_GLIB check for gthread because
-# the text port doesn't need to be compiled against the thread libraries
-GTHREAD_LIBS=""
+GLIB_REQUIRED_VERSION=2.0
+GTK_REQUIRED_VERSION=2.0
-if test "x$enable_gtkport" = "xyes" ; then
- if test $found_glib20 = 1 -a "x$enable_gtk20" = "xyes" ; then
- PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.0.0, GFTP_GTK=gftp-gtk, AC_MSG_ERROR(You have GLIB 2.0 installed
but I cannot find GTK+ 2.0. Run configure with --disable-gtk20 or install GTK+ 2.0))
- fi
+PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $GLIB_REQUIRED_VERSION])
- if test "x$GFTP_GTK" = "x" ; then
- AM_PATH_GTK(1.2.3, GFTP_GTK=gftp-gtk, AC_MSG_WARN(gFTP needs GTK+ 1.2.3 or higher for the graphical
version. Only building the text version))
- GTHREAD_LIBS="-lgthread"
- else
- GTHREAD_LIBS="-lgthread-2.0"
- fi
+if test "x$enable_gtk20" = "xyes" ; then
+ PKG_CHECK_MODULES([GTK],
+ [
+ glib-2.0 >= $GLIB_REQUIRED_VERSION
+ gthread-2.0 >= $GLIB_REQUIRED_VERSION
+ gtk+-2.0 >= $GTK_REQUIRED_VERSION
+ ],
+ [GFTP_GTK=gftp-gtk],
+ [AC_MSG_ERROR(You have GLIB 2.0 installed but I cannot find GTK+ 2.0. Run configure
with --disable-gtk20 or install GTK+ 2.0)])
if test "x$GFTP_GTK" = xgftp-gtk; then
case $host in
@@ -264,7 +248,6 @@ if test "x$enable_gtkport" = "xyes" ; then
fi
AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_LIBS)
-AC_SUBST(GTHREAD_LIBS)
AC_SUBST(GFTP_GTK)
SSL_LIBS=""
diff --git a/lib/charset-conv.c b/lib/charset-conv.c
index 427b4ad..8b52338 100644
--- a/lib/charset-conv.c
+++ b/lib/charset-conv.c
@@ -21,8 +21,6 @@
#include "gftp.h"
static const char cvsid[] = "$Id: protocols.c 952 2008-01-24 23:31:26Z masneyb $";
-#if GLIB_MAJOR_VERSION > 1
-
static /* null@*/ char *
_gftp_get_next_charset (char **curpos)
{
@@ -226,38 +224,3 @@ gftp_filename_from_utf8 (gftp_request * request, const char *str,
{
return (_do_convert_string (request, 1, 0, str, dest_len, 1));
}
-
-#else
-
-char *
-gftp_string_to_utf8 (gftp_request * request, const char *str, size_t dest_len)
-{
- return (NULL);
-}
-
-
-char *
-gftp_string_from_utf8 (gftp_request * request, int force_local, const char *str,
- size_t dest_len)
-{
- return (NULL);
-}
-
-
-char *
-gftp_filename_to_utf8 (gftp_request * request, const char *str, size_t dest_len)
-{
- return (NULL);
-}
-
-
-char *
-gftp_filename_from_utf8 (gftp_request * request, int force_local,
- const char *str, size_t dest_len)
-{
- return (NULL);
-}
-
-#endif
-
-
diff --git a/lib/gftp.h b/lib/gftp.h
index db3e94b..098ef13 100644
--- a/lib/gftp.h
+++ b/lib/gftp.h
@@ -494,12 +494,10 @@ struct gftp_request_tag
SSL * ssl;
#endif
-#if GLIB_MAJOR_VERSION > 1
GIConv iconv_to, iconv_from;
unsigned int iconv_from_initialized : 1,
iconv_to_initialized : 1;
char *iconv_charset;
-#endif
};
diff --git a/lib/misc.c b/lib/misc.c
index 04a6d1d..f149258 100644
--- a/lib/misc.c
+++ b/lib/misc.c
@@ -544,20 +544,12 @@ compare_request (gftp_request * request1, gftp_request * request2,
gftp_transfer *
gftp_tdata_new (void)
{
-#if GLIB_MAJOR_VERSION == 1
- static GStaticMutex init_mutex = G_STATIC_MUTEX_INIT;
-#endif
gftp_transfer * tdata;
tdata = g_malloc0 (sizeof (*tdata));
-#if GLIB_MAJOR_VERSION == 1
- tdata->statmutex = init_mutex;
- tdata->structmutex = init_mutex;
-#else
g_static_mutex_init (&tdata->statmutex);
g_static_mutex_init (&tdata->structmutex);
-#endif
return (tdata);
}
@@ -1172,9 +1164,7 @@ gftp_locale_init (void)
textdomain ("gftp");
bindtextdomain ("gftp", LOCALE_DIR);
-#if GLIB_MAJOR_VERSION > 1
bind_textdomain_codeset ("gftp", "UTF-8");
-#endif
#endif /* HAVE_GETTEXT */
}
diff --git a/lib/protocols.c b/lib/protocols.c
index 27176c7..05c5466 100644
--- a/lib/protocols.c
+++ b/lib/protocols.c
@@ -150,7 +150,6 @@ gftp_disconnect (gftp_request * request)
}
#endif
-#if GLIB_MAJOR_VERSION > 1
if (request->iconv_from_initialized)
{
g_iconv_close (request->iconv_from);
@@ -168,7 +167,6 @@ gftp_disconnect (gftp_request * request)
g_free (request->iconv_charset);
request->iconv_charset = NULL;
}
-#endif
request->cached = 0;
if (request->disconnect == NULL)
diff --git a/lib/sslcommon.c b/lib/sslcommon.c
index 475c9e1..9e64653 100644
--- a/lib/sslcommon.c
+++ b/lib/sslcommon.c
@@ -219,12 +219,7 @@ _gftp_ssl_locking_function (int mode, int n, const char * file, int line)
static unsigned long
_gftp_ssl_id_function (void)
{
-#if GLIB_MAJOR_VERSION > 1
return ((unsigned long) g_thread_self ());
-#else
- /* FIXME - call pthread version. */
- return (0);
-#endif
}
diff --git a/src/gtk/Makefile.am b/src/gtk/Makefile.am
index 9a6e111..39d7f1c 100644
--- a/src/gtk/Makefile.am
+++ b/src/gtk/Makefile.am
@@ -6,5 +6,5 @@ gftp_gtk_SOURCES = bookmarks.c chmod_dialog.c delete_dialog.c dnd.c \
gftp-gtk.c gtkui.c gtkui_transfer.c menu-items.c \
misc-gtk.c options_dialog.c transfer.c view_dialog.c
INCLUDES = @GTK_CFLAGS@ @PTHREAD_CFLAGS@ -I../../intl
-LDADD = ../../lib/libgftp.a ../../lib/fsplib/libfsp.a ../uicommon/libgftpui.a @GTK_LIBS@ @PTHREAD_LIBS@
@EXTRA_LIBS@ @GTHREAD_LIBS@ @SSL_LIBS@ @LIBINTL@
+LDADD = ../../lib/libgftp.a ../../lib/fsplib/libfsp.a ../uicommon/libgftpui.a @GTK_LIBS@ @PTHREAD_LIBS@
@EXTRA_LIBS@ @SSL_LIBS@ @LIBINTL@
noinst_HEADERS = gftp-gtk.h
diff --git a/src/gtk/bookmarks.c b/src/gtk/bookmarks.c
index 2d59d79..47997d7 100644
--- a/src/gtk/bookmarks.c
+++ b/src/gtk/bookmarks.c
@@ -385,7 +385,6 @@ bm_close_dialog (GtkWidget * widget, GtkWidget * dialog)
}
-#if GTK_MAJOR_VERSION > 1
static void
editbm_action (GtkWidget * widget, gint response, gpointer user_data)
{
@@ -398,7 +397,6 @@ editbm_action (GtkWidget * widget, gint response, gpointer user_data)
bm_close_dialog (NULL, widget);
}
}
-#endif
static void
@@ -422,16 +420,9 @@ do_make_new (gpointer data, gftp_dialog_data * ddata)
}
newentry = g_malloc0 (sizeof (*newentry));
-#if GTK_MAJOR_VERSION == 1
- newentry->path = g_strdup (str);
-
- while ((pos = strchr (str, '/')) != NULL)
- *pos++ = ' ';
-#else
newentry->path = g_strdup (str);
while ((pos = g_utf8_strchr (newentry->path, -1, '/')) != NULL)
*pos++ = ' ';
-#endif
newentry->prev = new_bookmarks;
if (data)
@@ -793,18 +784,6 @@ entry_apply_changes (GtkWidget * widget, gftp_bookmarks_var * entry)
}
-#if GTK_MAJOR_VERSION == 1
-
-static void
-entry_close_dialog (void * data)
-{
- gtk_widget_destroy (bm_dialog);
- bm_dialog = NULL;
-}
-
-
-#else
-
static void
bmedit_action (GtkWidget * widget, gint response, gpointer user_data)
{
@@ -818,7 +797,6 @@ bmedit_action (GtkWidget * widget, gint response, gpointer user_data)
bm_dialog = NULL;
}
}
-#endif
static void
@@ -844,18 +822,12 @@ edit_entry (gpointer data)
if (entry == NULL || entry == new_bookmarks)
return;
-#if GTK_MAJOR_VERSION == 1
- bm_dialog = gtk_dialog_new ();
- gtk_window_set_title (GTK_WINDOW (bm_dialog), _("Edit Entry"));
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (bm_dialog)->action_area), 15);
-#else
bm_dialog = gtk_dialog_new_with_buttons (_("Edit Entry"), NULL, 0,
GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE,
GTK_RESPONSE_OK,
NULL);
-#endif
gtk_window_set_wmclass (GTK_WINDOW (bm_dialog), "Edit Bookmark Entry",
"gFTP");
gtk_window_set_position (GTK_WINDOW (bm_dialog), GTK_WIN_POS_MOUSE);
@@ -1038,30 +1010,8 @@ edit_entry (gpointer data)
}
gtk_widget_show (anon_chk);
-#if GTK_MAJOR_VERSION == 1
- tempwid = gtk_button_new_with_label (_("OK"));
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (bm_dialog)->action_area), tempwid,
- TRUE, TRUE, 0);
- gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
- GTK_SIGNAL_FUNC (entry_apply_changes),
- (gpointer) entry);
- gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
- GTK_SIGNAL_FUNC (entry_close_dialog), NULL);
- GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
- gtk_widget_show (tempwid);
-
- tempwid = gtk_button_new_with_label (_(" Cancel "));
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (bm_dialog)->action_area), tempwid,
- TRUE, TRUE, 0);
- gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
- GTK_SIGNAL_FUNC (entry_close_dialog), NULL);
- GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
- gtk_widget_grab_focus (tempwid);
- gtk_widget_show (tempwid);
-#else
g_signal_connect (GTK_OBJECT (bm_dialog), "response",
G_CALLBACK (bmedit_action), (gpointer) entry);
-#endif
gftp_gtk_setup_bookmark_options (notebook, entry);
@@ -1210,9 +1160,6 @@ edit_bookmarks (gpointer data)
{N_("/File/sep"), NULL, 0, 0, MN_("<Separator>")},
{N_("/File/_Close"), NULL, gtk_widget_destroy, 0, MS_(GTK_STOCK_CLOSE)}
};
-#if GTK_MAJOR_VERSION == 1
- GtkWidget * tempwid;
-#endif
if (edit_bookmarks_dialog != NULL)
{
@@ -1223,12 +1170,6 @@ edit_bookmarks (gpointer data)
new_bookmarks = copy_bookmarks (gftp_bookmarks);
new_bookmarks_htable = build_bookmarks_hash_table (new_bookmarks);
-#if GTK_MAJOR_VERSION == 1
- edit_bookmarks_dialog = gtk_dialog_new ();
- gtk_window_set_title (GTK_WINDOW (edit_bookmarks_dialog),
- _("Edit Bookmarks"));
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (edit_bookmarks_dialog)->action_area), 15);
-#else
edit_bookmarks_dialog = gtk_dialog_new_with_buttons (_("Edit Bookmarks"),
NULL, 0,
GTK_STOCK_CANCEL,
@@ -1236,7 +1177,6 @@ edit_bookmarks (gpointer data)
GTK_STOCK_SAVE,
GTK_RESPONSE_OK,
NULL);
-#endif
gtk_window_set_wmclass (GTK_WINDOW(edit_bookmarks_dialog), "Edit Bookmarks",
"gFTP");
gtk_window_set_position (GTK_WINDOW (edit_bookmarks_dialog),
@@ -1288,31 +1228,8 @@ edit_bookmarks (gpointer data)
gtk_ctree_set_drag_compare_func (GTK_CTREE(tree), &move_possible);
gtk_widget_show (tree);
-#if GTK_MAJOR_VERSION == 1
- tempwid = gtk_button_new_with_label (_("OK"));
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (edit_bookmarks_dialog)->action_area),
- tempwid, TRUE, TRUE, 0);
- gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
- GTK_SIGNAL_FUNC (bm_apply_changes), NULL);
- gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
- GTK_SIGNAL_FUNC (bm_close_dialog),
- (gpointer) edit_bookmarks_dialog);
- GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
- gtk_widget_show (tempwid);
-
- tempwid = gtk_button_new_with_label (_(" Cancel "));
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (edit_bookmarks_dialog)->action_area),
- tempwid, TRUE, TRUE, 0);
- gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
- GTK_SIGNAL_FUNC (bm_close_dialog),
- (gpointer) edit_bookmarks_dialog);
- GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
- gtk_widget_grab_focus (tempwid);
- gtk_widget_show (tempwid);
-#else
g_signal_connect (GTK_OBJECT (edit_bookmarks_dialog), "response",
G_CALLBACK (editbm_action), NULL);
-#endif
gtk_widget_show (edit_bookmarks_dialog);
diff --git a/src/gtk/chmod_dialog.c b/src/gtk/chmod_dialog.c
index db26a07..42b0b09 100644
--- a/src/gtk/chmod_dialog.c
+++ b/src/gtk/chmod_dialog.c
@@ -103,7 +103,6 @@ dochmod (GtkWidget * widget, gftp_window_data * wdata)
}
-#if GTK_MAJOR_VERSION > 1
static void
chmod_action (GtkWidget * widget, gint response, gpointer wdata)
{
@@ -116,7 +115,6 @@ chmod_action (GtkWidget * widget, gint response, gpointer wdata)
gtk_widget_destroy (widget);
}
}
-#endif
void
@@ -132,20 +130,12 @@ chmod_dialog (gpointer data)
if (!check_status (_("Chmod"), wdata, gftpui_common_use_threads (wdata->request), 0, 1,
wdata->request->chmod != NULL))
return;
-#if GTK_MAJOR_VERSION == 1
- dialog = gtk_dialog_new ();
- gtk_window_set_title (GTK_WINDOW (dialog), _("Chmod"));
- gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area),
- 5);
- gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->action_area), TRUE);
-#else
dialog = gtk_dialog_new_with_buttons (_("Chmod"), NULL, 0,
GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL,
GTK_STOCK_OK,
GTK_RESPONSE_OK,
NULL);
-#endif
gtk_window_set_wmclass (GTK_WINDOW(dialog), "Chmod", "gFTP");
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 5);
@@ -249,31 +239,8 @@ chmod_dialog (gpointer data)
gtk_box_pack_start (GTK_BOX (vbox), ox, FALSE, FALSE, 0);
gtk_widget_show (ox);
-#if GTK_MAJOR_VERSION == 1
- tempwid = gtk_button_new_with_label (_("OK"));
- GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid,
- TRUE, TRUE, 0);
- gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
- GTK_SIGNAL_FUNC (dochmod), (gpointer) wdata);
- gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- GTK_OBJECT (dialog));
- gtk_widget_grab_default (tempwid);
- gtk_widget_show (tempwid);
-
- tempwid = gtk_button_new_with_label (_(" Cancel "));
- GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid,
- TRUE, TRUE, 0);
- gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- GTK_OBJECT (dialog));
- gtk_widget_show (tempwid);
-#else
g_signal_connect (GTK_OBJECT (dialog), "response",
G_CALLBACK (chmod_action), wdata);
-#endif
if (IS_ONE_SELECTED (wdata))
{
diff --git a/src/gtk/gftp-gtk.c b/src/gtk/gftp-gtk.c
index 1ed3474..ad98cf8 100644
--- a/src/gtk/gftp-gtk.c
+++ b/src/gtk/gftp-gtk.c
@@ -30,9 +30,7 @@ GtkWidget * stop_btn, * hostedit, * useredit, * passedit, * portedit, * logwdw,
* upload_right_arrow, * openurl_btn;
GtkTooltips * openurl_tooltip;
GtkAdjustment * logwdw_vadj;
-#if GTK_MAJOR_VERSION > 1
GtkTextMark * logwdw_textmark;
-#endif
int local_start, remote_start, trans_start;
GHashTable * graphic_hash_table = NULL;
GtkItemFactoryEntry * menus = NULL;
@@ -484,11 +482,7 @@ CreateConnectToolbar (GtkWidget * parent)
gtk_container_border_width (GTK_CONTAINER (openurl_btn), 1);
gtk_box_pack_start (GTK_BOX (box), openurl_btn, FALSE, FALSE, 0);
-#if GTK_MAJOR_VERSION == 1
- tempwid = gtk_label_new (_("Host: "));
-#else
tempwid = gtk_label_new_with_mnemonic (_("_Host: "));
-#endif
gtk_box_pack_start (GTK_BOX (box), tempwid, FALSE, FALSE, 0);
@@ -507,10 +501,8 @@ CreateConnectToolbar (GtkWidget * parent)
gftp_lookup_global_option ("host_value", &tempstr);
gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (hostedit)->entry), tempstr);
-#if GTK_MAJOR_VERSION > 1
gtk_label_set_mnemonic_widget (GTK_LABEL (tempwid),
GTK_COMBO (hostedit)->entry);
-#endif
gtk_box_pack_start (GTK_BOX (box), hostedit, TRUE, TRUE, 0);
tempwid = gtk_label_new (_("Port: "));
@@ -533,11 +525,7 @@ CreateConnectToolbar (GtkWidget * parent)
gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (portedit)->entry), tempstr);
gtk_box_pack_start (GTK_BOX (box), portedit, FALSE, FALSE, 0);
-#if GTK_MAJOR_VERSION == 1
- tempwid = gtk_label_new (_("User: "));
-#else
tempwid = gtk_label_new_with_mnemonic (_("_User: "));
-#endif
gtk_box_pack_start (GTK_BOX (box), tempwid, FALSE, FALSE, 0);
useredit = gtk_combo_new ();
@@ -555,10 +543,8 @@ CreateConnectToolbar (GtkWidget * parent)
gftp_lookup_global_option ("user_value", &tempstr);
gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (useredit)->entry), tempstr);
-#if GTK_MAJOR_VERSION > 1
gtk_label_set_mnemonic_widget (GTK_LABEL (tempwid),
GTK_COMBO (useredit)->entry);
-#endif
gtk_box_pack_start (GTK_BOX (box), useredit, TRUE, TRUE, 0);
tempwid = gtk_label_new (_("Pass: "));
@@ -600,12 +586,8 @@ CreateConnectToolbar (GtkWidget * parent)
gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), protocol_menu);
gtk_option_menu_set_history (GTK_OPTION_MENU (optionmenu), num);
-#if GTK_MAJOR_VERSION == 1
- tempwid = toolbar_pixmap (parent, "stop.xpm");
-#else
tempwid = gtk_image_new_from_stock (GTK_STOCK_STOP,
GTK_ICON_SIZE_LARGE_TOOLBAR);
-#endif
stop_btn = gtk_button_new ();
@@ -910,12 +892,10 @@ CreateFTPWindows (GtkWidget * ui)
gftp_config_list_vars * tmplistvar;
char *dltitles[2];
intptr_t tmplookup;
-#if GTK_MAJOR_VERSION > 1
GtkTextBuffer * textbuf;
GtkTextIter iter;
GtkTextTag *tag;
GdkColor * fore;
-#endif
memset (&window1, 0, sizeof (window1));
memset (&window2, 0, sizeof (window2));
@@ -951,12 +931,8 @@ CreateFTPWindows (GtkWidget * ui)
gtk_container_border_width (GTK_CONTAINER (dlbox), 5);
gtk_box_pack_start (GTK_BOX (box), dlbox, FALSE, FALSE, 0);
-#if GTK_MAJOR_VERSION == 1
- tempwid = toolbar_pixmap (ui, "right.xpm");
-#else
tempwid = gtk_image_new_from_stock (GTK_STOCK_GO_FORWARD,
GTK_ICON_SIZE_SMALL_TOOLBAR);
-#endif
upload_right_arrow = gtk_button_new ();
gtk_box_pack_start (GTK_BOX (dlbox), upload_right_arrow, TRUE, FALSE, 0);
@@ -964,12 +940,8 @@ CreateFTPWindows (GtkWidget * ui)
GTK_SIGNAL_FUNC (put_files), NULL);
gtk_container_add (GTK_CONTAINER (upload_right_arrow), tempwid);
-#if GTK_MAJOR_VERSION == 1
- tempwid = toolbar_pixmap (ui, "left.xpm");
-#else
tempwid = gtk_image_new_from_stock (GTK_STOCK_GO_BACK,
GTK_ICON_SIZE_SMALL_TOOLBAR);
-#endif
download_left_arrow = gtk_button_new ();
gtk_box_pack_start (GTK_BOX (dlbox), download_left_arrow, TRUE, FALSE, 0);
@@ -1017,24 +989,6 @@ CreateFTPWindows (GtkWidget * ui)
gftp_lookup_global_option ("log_height", &tmplookup);
gtk_widget_set_size_request (log_table, -1, tmplookup);
-#if GTK_MAJOR_VERSION == 1
- logwdw = gtk_text_new (NULL, NULL);
-
- gtk_text_set_editable (GTK_TEXT (logwdw), FALSE);
- gtk_text_set_word_wrap (GTK_TEXT (logwdw), TRUE);
-
- gtk_table_attach (GTK_TABLE (log_table), logwdw, 0, 1, 0, 1,
- GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND | GTK_SHRINK,
- 0, 0);
- gtk_signal_connect (GTK_OBJECT (logwdw), "button_press_event",
- GTK_SIGNAL_FUNC (menu_mouse_click),
- (gpointer) log_factory);
-
- tempwid = gtk_vscrollbar_new (GTK_TEXT (logwdw)->vadj);
- gtk_table_attach (GTK_TABLE (log_table), tempwid, 1, 2, 0, 1,
- GTK_FILL, GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, 0);
- logwdw_vadj = GTK_TEXT (logwdw)->vadj;
-#else
logwdw = gtk_text_view_new ();
gtk_text_view_set_editable (GTK_TEXT_VIEW (logwdw), FALSE);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (logwdw), FALSE);
@@ -1069,7 +1023,6 @@ CreateFTPWindows (GtkWidget * ui)
logwdw_vadj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (tempwid));
gtk_text_buffer_get_iter_at_offset (textbuf, &iter, 0);
logwdw_textmark = gtk_text_buffer_create_mark (textbuf, "end", &iter, 1);
-#endif
gtk_paned_pack2 (GTK_PANED (logpane), log_table, 1, 1);
gtk_box_pack_start (GTK_BOX (mainvbox), logpane, TRUE, TRUE, 0);
@@ -1209,19 +1162,12 @@ sortrows (GtkCList * clist, gint column, gpointer data)
{
sort_wid = gtk_clist_get_column_widget (clist, 0);
gtk_widget_destroy (sort_wid);
-#if GTK_MAJOR_VERSION == 1
- if (sortasds)
- sort_wid = toolbar_pixmap (wdata->listbox, "down.xpm");
- else
- sort_wid = toolbar_pixmap (wdata->listbox, "up.xpm");
-#else
if (sortasds)
sort_wid = gtk_image_new_from_stock (GTK_STOCK_SORT_ASCENDING,
GTK_ICON_SIZE_SMALL_TOOLBAR);
else
sort_wid = gtk_image_new_from_stock (GTK_STOCK_SORT_DESCENDING,
GTK_ICON_SIZE_SMALL_TOOLBAR);
-#endif
gtk_clist_set_column_widget (clist, 0, sort_wid);
}
@@ -1372,9 +1318,7 @@ main (int argc, char **argv)
g_thread_init (NULL);
-#if GTK_MAJOR_VERSION > 1
gdk_threads_init();
-#endif
GDK_THREADS_ENTER ();
main_thread_id = pthread_self ();
gtk_set_locale ();
diff --git a/src/gtk/gftp-gtk.h b/src/gtk/gftp-gtk.h
index b5f1614..d0f0802 100644
--- a/src/gtk/gftp-gtk.h
+++ b/src/gtk/gftp-gtk.h
@@ -50,22 +50,12 @@
trequest->datafd > 0 && !trequest->always_connected && \
compare_request (trequest, (wdata)->request, 0))
-#if GTK_MAJOR_VERSION == 1
- #define gtk_widget_set_size_request(widget, width, height) \
- gtk_widget_set_usize (widget, width, height)
-#endif
-
/* These 2 defines are for creating menu items with stock icons in GTK+ 2.0.
If we are using version 1.2, it will disable the stock items since it's not
supported */
-#if GTK_MAJOR_VERSION < 2
-#define MS_(a) NULL
-#define MN_(a) a
-#else
#define MS_(a) "<StockItem>",a
#define MN_(a) a,NULL
-#endif
/* These are used for the MakeEditDialog function. I have these types to make
it easier for creating dialogs with GTK+ 1.2 and GTK+ 2.0 */
@@ -183,9 +173,7 @@ extern GtkWidget * stop_btn, * hostedit, * useredit, * passedit,
* upload_right_arrow, * openurl_btn;
extern GtkTooltips * openurl_tooltip;
extern GtkAdjustment * logwdw_vadj;
-#if GTK_MAJOR_VERSION > 1
extern GtkTextMark * logwdw_textmark;
-#endif
extern int local_start, remote_start, trans_start;
extern GHashTable * graphic_hash_table;
extern GtkItemFactoryEntry * menus;
diff --git a/src/gtk/gtkui.c b/src/gtk/gtkui.c
index f3619af..323f411 100644
--- a/src/gtk/gtkui.c
+++ b/src/gtk/gtkui.c
@@ -127,11 +127,7 @@ gftpui_prompt_username (void *uidata, gftp_request * request)
while (request->stopable)
{
GDK_THREADS_LEAVE ();
-#if GTK_MAJOR_VERSION == 1
- g_main_iteration (TRUE);
-#else
g_main_context_iteration (NULL, TRUE);
-#endif
}
}
@@ -149,11 +145,7 @@ gftpui_prompt_password (void *uidata, gftp_request * request)
while (request->stopable)
{
GDK_THREADS_LEAVE ();
-#if GTK_MAJOR_VERSION == 1
- g_main_iteration (TRUE);
-#else
g_main_context_iteration (NULL, TRUE);
-#endif
}
}
@@ -249,11 +241,7 @@ gftpui_generic_thread (void * (*func) (void *), void *data)
while (wdata->request->stopable)
{
GDK_THREADS_LEAVE ();
-#if GTK_MAJOR_VERSION == 1
- g_main_iteration (TRUE);
-#else
g_main_context_iteration (NULL, TRUE);
-#endif
}
_gftpui_teardown_wakeup_main_thread (cdata->request, handler);
@@ -535,11 +523,7 @@ gftpui_protocol_ask_yes_no (gftp_request * request, char *title,
while (answer == -1)
{
GDK_THREADS_LEAVE ();
-#if GTK_MAJOR_VERSION == 1
- g_main_iteration (TRUE);
-#else
g_main_context_iteration (NULL, TRUE);
-#endif
}
}
@@ -591,11 +575,7 @@ gftpui_protocol_ask_user_input (gftp_request * request, char *title,
while (*buf == '\0' && *(buf + 1) == ' ')
{
GDK_THREADS_LEAVE ();
-#if GTK_MAJOR_VERSION == 1
- g_main_iteration (TRUE);
-#else
g_main_context_iteration (NULL, TRUE);
-#endif
}
}
diff --git a/src/gtk/gtkui_transfer.c b/src/gtk/gtkui_transfer.c
index 75596c0..40e54f7 100644
--- a/src/gtk/gtkui_transfer.c
+++ b/src/gtk/gtkui_transfer.c
@@ -193,7 +193,6 @@ gftpui_gtk_cancel (GtkWidget * widget, gpointer data)
}
-#if GTK_MAJOR_VERSION > 1
static void
gftpui_gtk_transfer_action (GtkWidget * widget, gint response,
gpointer user_data)
@@ -211,7 +210,6 @@ gftpui_gtk_transfer_action (GtkWidget * widget, gint response,
gtk_widget_destroy (widget);
}
}
-#endif
void
@@ -230,25 +228,12 @@ gftpui_ask_transfer (gftp_transfer * tdata)
dltitles[2] = tdata->toreq->hostname;
dltitles[3] = _("Action");
-#if GTK_MAJOR_VERSION == 1
- dialog = gtk_dialog_new ();
- gtk_grab_add (dialog);
- gtk_window_set_title (GTK_WINDOW (dialog), _("Transfer Files"));
- gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->action_area), 35);
- gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->action_area), TRUE);
-
- gtk_signal_connect_object (GTK_OBJECT (dialog), "delete_event",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- GTK_OBJECT (dialog));
-#else
dialog = gtk_dialog_new_with_buttons (_("Transfer Files"), NULL, 0,
GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL,
GTK_STOCK_OK,
GTK_RESPONSE_OK,
NULL);
-#endif
gtk_window_set_wmclass (GTK_WINDOW(dialog), "transfer", "gFTP");
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 10);
@@ -267,13 +252,8 @@ gftpui_ask_transfer (gftp_transfer * tdata)
tdata->clist = gtk_clist_new_with_titles (4, dltitles);
gtk_container_add (GTK_CONTAINER (scroll), tdata->clist);
-#if GTK_MAJOR_VERSION == 1
- gtk_clist_set_selection_mode (GTK_CLIST (tdata->clist),
- GTK_SELECTION_EXTENDED);
-#else
gtk_clist_set_selection_mode (GTK_CLIST (tdata->clist),
GTK_SELECTION_MULTIPLE);
-#endif
gtk_clist_set_column_width (GTK_CLIST (tdata->clist), 0, 100);
gtk_clist_set_column_justification (GTK_CLIST (tdata->clist), 1,
GTK_JUSTIFY_RIGHT);
@@ -372,33 +352,8 @@ gftpui_ask_transfer (gftp_transfer * tdata)
GTK_SIGNAL_FUNC (gftpui_gtk_trans_unselectall), (gpointer) tdata);
gtk_widget_show (tempwid);
-#if GTK_MAJOR_VERSION == 1
- tempwid = gtk_button_new_with_label (_("OK"));
- GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid,
- TRUE, TRUE, 0);
- gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
- GTK_SIGNAL_FUNC (gftpui_gtk_ok), (gpointer) tdata);
- gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- GTK_OBJECT (dialog));
- gtk_widget_grab_default (tempwid);
- gtk_widget_show (tempwid);
-
- tempwid = gtk_button_new_with_label (_(" Cancel "));
- GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid,
- TRUE, TRUE, 0);
- gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
- GTK_SIGNAL_FUNC (gftpui_gtk_cancel), (gpointer) tdata);
- gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- GTK_OBJECT (dialog));
- gtk_widget_show (tempwid);
-#else
g_signal_connect (GTK_OBJECT (dialog), "response",
G_CALLBACK (gftpui_gtk_transfer_action),(gpointer) tdata);
-#endif
gtk_widget_show (dialog);
dialog = NULL;
diff --git a/src/gtk/menu-items.c b/src/gtk/menu-items.c
index 339836a..d60207d 100644
--- a/src/gtk/menu-items.c
+++ b/src/gtk/menu-items.c
@@ -263,11 +263,6 @@ clearlog (gpointer data)
{
gint len;
-#if GTK_MAJOR_VERSION == 1
- len = gtk_text_get_length (GTK_TEXT (logwdw));
- gtk_text_set_point (GTK_TEXT (logwdw), len);
- gtk_text_backward_delete (GTK_TEXT (logwdw), len);
-#else
GtkTextBuffer * textbuf;
GtkTextIter iter, iter2;
@@ -276,7 +271,6 @@ clearlog (gpointer data)
gtk_text_buffer_get_iter_at_offset (textbuf, &iter, 0);
gtk_text_buffer_get_iter_at_offset (textbuf, &iter2, len);
gtk_text_buffer_delete (textbuf, &iter, &iter2);
-#endif
}
@@ -287,10 +281,8 @@ viewlog (gpointer data)
gint textlen;
ssize_t len;
int fd;
-#if GTK_MAJOR_VERSION > 1
GtkTextBuffer * textbuf;
GtkTextIter iter, iter2;
-#endif
tempstr = g_strconcat (g_get_tmp_dir (), "/gftp-view.XXXXXXXXXX", NULL);
if ((fd = mkstemp (tempstr)) < 0)
@@ -303,10 +295,6 @@ viewlog (gpointer data)
}
chmod (tempstr, S_IRUSR | S_IWUSR);
-#if GTK_MAJOR_VERSION == 1
- textlen = gtk_text_get_length (GTK_TEXT (logwdw));
- txt = gtk_editable_get_chars (GTK_EDITABLE (logwdw), 0, -1);
-#else
textbuf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (logwdw));
textlen = gtk_text_buffer_get_char_count (textbuf);
gtk_text_buffer_get_iter_at_offset (textbuf, &iter, 0);
@@ -316,7 +304,6 @@ viewlog (gpointer data)
/* gtk_text_buffer_get_char_count() returns the number of characters,
not bytes. So get the number of bytes that need to be written out */
textlen = strlen (txt);
-#endif
pos = txt;
while (textlen > 0)
@@ -351,10 +338,8 @@ dosavelog (GtkWidget * widget, GtkFileSelection * fs)
ssize_t len;
FILE *fd;
int ok;
-#if GTK_MAJOR_VERSION > 1
GtkTextBuffer * textbuf;
GtkTextIter iter, iter2;
-#endif
filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs));
if ((fd = fopen (filename, "w")) == NULL)
@@ -365,10 +350,6 @@ dosavelog (GtkWidget * widget, GtkFileSelection * fs)
return;
}
-#if GTK_MAJOR_VERSION == 1
- textlen = gtk_text_get_length (GTK_TEXT (logwdw));
- txt = gtk_editable_get_chars (GTK_EDITABLE (logwdw), 0, -1);
-#else
textbuf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (logwdw));
textlen = gtk_text_buffer_get_char_count (textbuf);
gtk_text_buffer_get_iter_at_offset (textbuf, &iter, 0);
@@ -378,7 +359,6 @@ dosavelog (GtkWidget * widget, GtkFileSelection * fs)
/* gtk_text_buffer_get_char_count() returns the number of characters,
not bytes. So get the number of bytes that need to be written out */
textlen = strlen (txt);
-#endif
ok = 1;
pos = txt;
@@ -440,27 +420,17 @@ about_dialog (gpointer data)
char *tempstr, *temp1str, *no_license_agreement, *str, buf[255], *share_dir;
size_t len;
FILE * fd;
-#if GTK_MAJOR_VERSION > 1
GtkTextBuffer * textbuf;
GtkTextIter iter;
gint textlen;
-#endif
share_dir = gftp_get_share_dir ();
no_license_agreement = g_strdup_printf (_("Cannot find the license agreement file COPYING. Please make
sure it is in either %s or in %s"), BASE_CONF_DIR, share_dir);
-#if GTK_MAJOR_VERSION == 1
- dialog = gtk_dialog_new ();
- gtk_window_set_title (GTK_WINDOW (dialog), _("About gFTP"));
- gtk_container_border_width (GTK_CONTAINER
- (GTK_DIALOG (dialog)->action_area), 5);
- gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->action_area), TRUE);
-#else
dialog = gtk_dialog_new_with_buttons (_("About gFTP"), NULL, 0,
GTK_STOCK_CLOSE,
GTK_RESPONSE_CLOSE,
NULL);
-#endif
gtk_window_set_wmclass (GTK_WINDOW(dialog), "about", "gFTP");
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 10);
@@ -513,21 +483,6 @@ about_dialog (gpointer data)
gtk_box_pack_start (GTK_BOX (box), tempwid, TRUE, TRUE, 0);
gtk_widget_show (tempwid);
-#if GTK_MAJOR_VERSION == 1
- view = gtk_text_new (NULL, NULL);
- gtk_text_set_editable (GTK_TEXT (view), FALSE);
- gtk_text_set_word_wrap (GTK_TEXT (view), TRUE);
-
- gtk_table_attach (GTK_TABLE (tempwid), view, 0, 1, 0, 1,
- GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND | GTK_SHRINK,
- 0, 0);
- gtk_widget_show (view);
-
- vscroll = gtk_vscrollbar_new (GTK_TEXT (view)->vadj);
- gtk_table_attach (GTK_TABLE (tempwid), vscroll, 1, 2, 0, 1,
- GTK_FILL, GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, 0);
- gtk_widget_show (vscroll);
-#else
view = gtk_text_view_new ();
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
@@ -547,28 +502,15 @@ about_dialog (gpointer data)
gtk_widget_show (vscroll);
textbuf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
-#endif
label = gtk_label_new (_("License Agreement"));
gtk_widget_show (label);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), box, label);
-#if GTK_MAJOR_VERSION == 1
- tempwid = gtk_button_new_with_label (_(" Close "));
- GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid,
- FALSE, FALSE, 0);
- gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- GTK_OBJECT (dialog));
- gtk_widget_grab_default (tempwid);
- gtk_widget_show (tempwid);
-#else
g_signal_connect_swapped (GTK_OBJECT (dialog), "response",
G_CALLBACK (gtk_widget_destroy),
GTK_OBJECT (dialog));
-#endif
tempstr = g_strconcat ("/usr/share/common-licenses/GPL", NULL);
if (access (tempstr, F_OK) != 0)
@@ -583,14 +525,9 @@ about_dialog (gpointer data)
tempstr = gftp_expand_path (NULL, BASE_CONF_DIR "/COPYING");
if (access (tempstr, F_OK) != 0)
{
-#if GTK_MAJOR_VERSION == 1
- gtk_text_insert (GTK_TEXT (view), NULL, NULL, NULL,
- no_license_agreement, -1);
-#else
textlen = gtk_text_buffer_get_char_count (textbuf);
gtk_text_buffer_get_iter_at_offset (textbuf, &iter, textlen);
gtk_text_buffer_insert (textbuf, &iter, no_license_agreement, -1);
-#endif
gtk_widget_show (dialog);
return;
}
@@ -599,14 +536,9 @@ about_dialog (gpointer data)
if ((fd = fopen (tempstr, "r")) == NULL)
{
-#if GTK_MAJOR_VERSION == 1
- gtk_text_insert (GTK_TEXT (view), NULL, NULL, NULL,
- no_license_agreement, -1);
-#else
textlen = gtk_text_buffer_get_char_count (textbuf);
gtk_text_buffer_get_iter_at_offset (textbuf, &iter, textlen);
gtk_text_buffer_insert (textbuf, &iter, no_license_agreement, -1);
-#endif
gtk_widget_show (dialog);
g_free (tempstr);
return;
@@ -617,13 +549,9 @@ about_dialog (gpointer data)
while ((len = fread (buf, 1, sizeof (buf) - 1, fd)))
{
buf[len] = '\0';
-#if GTK_MAJOR_VERSION == 1
- gtk_text_insert (GTK_TEXT (view), NULL, NULL, NULL, buf, -1);
-#else
textlen = gtk_text_buffer_get_char_count (textbuf);
gtk_text_buffer_get_iter_at_offset (textbuf, &iter, textlen);
gtk_text_buffer_insert (textbuf, &iter, buf, -1);
-#endif
}
fclose (fd);
gtk_widget_show (dialog);
diff --git a/src/gtk/misc-gtk.c b/src/gtk/misc-gtk.c
index 2d5458e..fed6232 100644
--- a/src/gtk/misc-gtk.c
+++ b/src/gtk/misc-gtk.c
@@ -46,16 +46,11 @@ ftp_log (gftp_logging_level level, gftp_request * request,
char *logstr;
va_list argp;
size_t len;
-#if GTK_MAJOR_VERSION == 1
- gftp_color * color;
- GdkColor fore;
-#else
GtkTextBuffer * textbuf;
GtkTextIter iter, iter2;
const char *descr;
char *utf8_str;
size_t destlen;
-#endif
va_start (argp, string);
if (strcmp (string, "%s") == 0)
@@ -70,7 +65,6 @@ ftp_log (gftp_logging_level level, gftp_request * request,
}
va_end (argp);
-#if GTK_MAJOR_VERSION > 1
if ((utf8_str = gftp_string_to_utf8 (request, logstr, &destlen)) != NULL)
{
if (free_logstr)
@@ -80,7 +74,6 @@ ftp_log (gftp_logging_level level, gftp_request * request,
logstr = utf8_str;
}
-#endif
if (pthread_self () != main_thread_id)
{
@@ -119,46 +112,6 @@ ftp_log (gftp_logging_level level, gftp_request * request,
gftp_lookup_global_option ("max_log_window_size", &max_log_window_size);
-#if GTK_MAJOR_VERSION == 1
- switch (level)
- {
- case gftp_logging_send:
- gftp_lookup_global_option ("send_color", &color);
- break;
- case gftp_logging_recv:
- gftp_lookup_global_option ("recv_color", &color);
- break;
- case gftp_logging_error:
- gftp_lookup_global_option ("error_color", &color);
- break;
- default:
- gftp_lookup_global_option ("misc_color", &color);
- break;
- }
-
- memset (&fore, 0, sizeof (fore));
- fore.red = color->red;
- fore.green = color->green;
- fore.blue = color->blue;
-
- gtk_text_freeze (GTK_TEXT (logwdw));
- gtk_text_insert (GTK_TEXT (logwdw), NULL, &fore, NULL, logstr, -1);
-
- len = gtk_text_get_length (GTK_TEXT (logwdw));
- if (max_log_window_size > 0 && len > max_log_window_size)
- {
- delsize = len - max_log_window_size;
- gtk_text_set_point (GTK_TEXT (logwdw), delsize);
- gtk_text_backward_delete (GTK_TEXT (logwdw), delsize);
- len = max_log_window_size;
- }
- gtk_text_set_point (GTK_TEXT (logwdw), len);
-
- gtk_text_thaw (GTK_TEXT (logwdw));
-
- if (upd)
- gtk_adjustment_set_value (logwdw_vadj, logwdw_vadj->upper);
-#else
switch (level)
{
case gftp_logging_send:
@@ -199,7 +152,6 @@ ftp_log (gftp_logging_level level, gftp_request * request,
gtk_text_buffer_delete (textbuf, &iter, &iter2);
}
}
-#endif
if (free_logstr)
g_free (logstr);
@@ -448,13 +400,8 @@ gftp_free_pixmap (char *filename)
if ((graphic = g_hash_table_lookup (graphic_hash_table, filename)) == NULL)
return;
-#if GTK_MAJOR_VERSION == 1
- gdk_pixmap_unref (graphic->pixmap);
- gdk_bitmap_unref (graphic->bitmap);
-#else
g_object_unref (graphic->pixmap);
g_object_unref (graphic->bitmap);
-#endif
g_hash_table_remove (graphic_hash_table, filename);
g_free (graphic->filename);
@@ -788,48 +735,6 @@ destroy_dialog (gftp_dialog_data * ddata)
}
-#if GTK_MAJOR_VERSION == 1
-static void
-ok_dialog_response (GtkWidget * widget, gftp_dialog_data * ddata)
-{
- if (ddata->edit == NULL)
- {
- gtk_widget_destroy (ddata->dialog);
- ddata->dialog = NULL;
- ddata->checkbox = NULL;
- }
-
- if (ddata->yesfunc != NULL)
- ddata->yesfunc (ddata->yespointer, ddata);
-
- if (ddata->edit != NULL &&
- ddata->dialog != NULL)
- gtk_widget_destroy (ddata->dialog);
-
- g_free (ddata);
-}
-
-
-static void
-cancel_dialog_response (GtkWidget * widget, gftp_dialog_data * ddata)
-{
- if (ddata->edit == NULL)
- {
- gtk_widget_destroy (ddata->dialog);
- ddata->dialog = NULL;
- ddata->checkbox = NULL;
- }
-
- if (ddata->nofunc != NULL)
- ddata->nofunc (ddata->nopointer, ddata);
-
- if (ddata->edit != NULL &&
- ddata->dialog != NULL)
- gtk_widget_destroy (ddata->dialog);
-
- g_free (ddata);
-}
-#else
static void
dialog_response (GtkWidget * widget, gint response, gftp_dialog_data * ddata)
{
@@ -858,7 +763,6 @@ dialog_response (GtkWidget * widget, gint response, gftp_dialog_data * ddata)
g_free (ddata);
}
-#endif
static gint
@@ -869,20 +773,12 @@ dialog_keypress (GtkWidget * widget, GdkEventKey * event, gpointer data)
if (event->keyval == GDK_KP_Enter || event->keyval == GDK_Return)
{
-#if GTK_MAJOR_VERSION == 1
- ok_dialog_response (widget, data);
-#else
dialog_response (widget, GTK_RESPONSE_YES, data);
-#endif
return (TRUE);
}
else if (event->keyval == GDK_Escape)
{
-#if GTK_MAJOR_VERSION == 1
- cancel_dialog_response (widget, data);
-#else
dialog_response (widget, GTK_RESPONSE_NO, data);
-#endif
return (TRUE);
}
@@ -906,14 +802,6 @@ MakeEditDialog (char *diagtxt, char *infotxt, char *deftext, int passwd_item,
ddata->nofunc = cancelfunc;
ddata->nopointer = cancelptr;
-#if GTK_MAJOR_VERSION == 1
- dialog = gtk_dialog_new ();
- gtk_window_set_title (GTK_WINDOW (dialog), diagtxt);
- gtk_container_border_width (GTK_CONTAINER
- (GTK_DIALOG (dialog)->action_area), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->action_area), 15);
- gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->action_area), TRUE);
-#else
switch (okbutton)
{
case gftp_dialog_button_ok:
@@ -942,7 +830,6 @@ MakeEditDialog (char *diagtxt, char *infotxt, char *deftext, int passwd_item,
yes_text,
GTK_RESPONSE_YES,
NULL);
-#endif
gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 10);
gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 5);
gtk_window_set_wmclass (GTK_WINDOW(dialog), "edit", "gFTP");
@@ -988,51 +875,8 @@ MakeEditDialog (char *diagtxt, char *infotxt, char *deftext, int passwd_item,
gtk_widget_show (ddata->checkbox);
}
-#if GTK_MAJOR_VERSION == 1
- switch (okbutton)
- {
- case gftp_dialog_button_ok:
- yes_text = _("OK");
- break;
- case gftp_dialog_button_create:
- yes_text = _("Add");
- break;
- case gftp_dialog_button_change:
- yes_text = _("Change");
- break;
- case gftp_dialog_button_connect:
- yes_text = _("Connect");
- break;
- case gftp_dialog_button_rename:
- yes_text = _("Rename");
- break;
- default:
- yes_text = "";
- break;
- }
-
- tempwid = gtk_button_new_with_label (yes_text);
- GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid,
- TRUE, TRUE, 0);
- gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
- GTK_SIGNAL_FUNC (ok_dialog_response),
- ddata);
- gtk_widget_grab_default (tempwid);
- gtk_widget_show (tempwid);
-
- tempwid = gtk_button_new_with_label (_("Cancel"));
- GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid,
- TRUE, TRUE, 0);
- gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
- GTK_SIGNAL_FUNC (cancel_dialog_response),
- ddata);
- gtk_widget_show (tempwid);
-#else
g_signal_connect (GTK_OBJECT (dialog), "response",
G_CALLBACK (dialog_response), ddata);
-#endif
gtk_widget_show (dialog);
}
@@ -1045,9 +889,6 @@ MakeYesNoDialog (char *diagtxt, char *infotxt,
{
GtkWidget * text, * dialog;
gftp_dialog_data * ddata;
-#if GTK_MAJOR_VERSION == 1
- GtkWidget * tempwid;
-#endif
ddata = g_malloc0 (sizeof (*ddata));
ddata->yesfunc = yesfunc;
@@ -1055,21 +896,12 @@ MakeYesNoDialog (char *diagtxt, char *infotxt,
ddata->nofunc = nofunc;
ddata->nopointer = nopointer;
-#if GTK_MAJOR_VERSION == 1
- dialog = gtk_dialog_new ();
- gtk_window_set_title (GTK_WINDOW (dialog), diagtxt);
- gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area),
- 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->action_area), 15);
- gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->action_area), TRUE);
-#else
dialog = gtk_dialog_new_with_buttons (_(diagtxt), NULL, 0,
GTK_STOCK_NO,
GTK_RESPONSE_NO,
GTK_STOCK_YES,
GTK_RESPONSE_YES,
NULL);
-#endif
gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 10);
gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 5);
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
@@ -1090,29 +922,8 @@ MakeYesNoDialog (char *diagtxt, char *infotxt,
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), text, TRUE, TRUE, 0);
gtk_widget_show (text);
-#if GTK_MAJOR_VERSION == 1
- tempwid = gtk_button_new_with_label (_(" Yes "));
- GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid,
- FALSE, FALSE, 0);
- gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
- GTK_SIGNAL_FUNC (ok_dialog_response), ddata);
-
- gtk_widget_grab_default (tempwid);
- gtk_widget_show (tempwid);
-
- tempwid = gtk_button_new_with_label (_(" No "));
- GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid,
- FALSE, FALSE, 0);
- gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
- GTK_SIGNAL_FUNC (cancel_dialog_response), ddata);
- gtk_widget_show (tempwid);
-
-#else
g_signal_connect (GTK_OBJECT (dialog), "response",
G_CALLBACK (dialog_response), ddata);
-#endif
gtk_widget_show (dialog);
}
@@ -1154,9 +965,7 @@ update_directory_download_progress (gftp_transfer * transfer)
{
dialog = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
-#if GTK_MAJOR_VERSION > 1
gtk_window_set_decorated (GTK_WINDOW (dialog), 0);
-#endif
gtk_grab_add (dialog);
gtk_signal_connect (GTK_OBJECT (dialog), "delete_event",
GTK_SIGNAL_FUNC (delete_event), NULL);
diff --git a/src/gtk/options_dialog.c b/src/gtk/options_dialog.c
index 0524c63..23352ed 100644
--- a/src/gtk/options_dialog.c
+++ b/src/gtk/options_dialog.c
@@ -229,36 +229,22 @@ _textcomboedt_toggle (GtkList * list, GtkWidget * child, gpointer data)
gftp_textcomboedt_data * tedata;
char *insert_text;
int num, isedit;
-#if GTK_MAJOR_VERSION > 1
GtkTextIter iter, iter2;
GtkTextBuffer * textbuf;
gint len;
-#endif
widdata = data;
tedata = widdata->cv->listdata;
num = gtk_list_child_position (list, child);
isedit = tedata[num].flags & GFTP_TEXTCOMBOEDT_EDITABLE;
-#if GTK_MAJOR_VERSION == 1
- gtk_text_set_editable (GTK_TEXT (widdata->text), isedit);
-#else
gtk_text_view_set_editable (GTK_TEXT_VIEW (widdata->text), isedit);
-#endif
if (isedit)
insert_text = widdata->custom_edit_value;
else
insert_text = tedata[num].text;
-#if GTK_MAJOR_VERSION == 1
- gtk_text_set_point (GTK_TEXT (widdata->text), 0);
- gtk_text_forward_delete (GTK_TEXT (widdata->text),
- gtk_text_get_length (GTK_TEXT (widdata->text)));
-
- gtk_text_insert (GTK_TEXT (widdata->text), NULL, NULL, NULL,
- insert_text, -1);
-#else
textbuf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widdata->text));
len = gtk_text_buffer_get_char_count (textbuf);
gtk_text_buffer_get_iter_at_offset (textbuf, &iter, 0);
@@ -268,7 +254,6 @@ _textcomboedt_toggle (GtkList * list, GtkWidget * child, gpointer data)
len = gtk_text_buffer_get_char_count (textbuf);
gtk_text_buffer_get_iter_at_offset (textbuf, &iter, len);
gtk_text_buffer_insert (textbuf, &iter, insert_text, -1);
-#endif
}
@@ -396,14 +381,6 @@ _print_option_type_textcomboedt (gftp_config_vars * cv, void *user_data, void *v
gtk_table_resize (GTK_TABLE (option_data->table),
option_data->tbl_row_num, 2);
-#if GTK_MAJOR_VERSION == 1
- textwid = gtk_text_new (NULL, NULL);
- gtk_widget_set_size_request (textwid, -1, 75);
- gtk_table_attach_defaults (GTK_TABLE (option_data->table), textwid, 0, 2,
- option_data->tbl_row_num - 1,
- option_data->tbl_row_num);
- gtk_widget_show (textwid);
-#else
box = gtk_hbox_new (FALSE, 0);
gtk_table_attach_defaults (GTK_TABLE (option_data->table), box, 0, 2,
option_data->tbl_row_num - 1,
@@ -428,7 +405,6 @@ _print_option_type_textcomboedt (gftp_config_vars * cv, void *user_data, void *v
textwid = gtk_text_view_new ();
gtk_container_add (GTK_CONTAINER (tempwid), GTK_WIDGET (textwid));
gtk_widget_show (textwid);
-#endif
widdata = g_malloc0 (sizeof (*widdata));
widdata->combo = combo;
@@ -463,40 +439,19 @@ _save_option_type_textcomboedt (gftp_config_vars * cv, void *user_data)
gftp_options_dialog_data * option_data;
char *newstr, *proxy_config;
int freeit;
-#if GTK_MAJOR_VERSION == 1
- char tmp[128];
-#else
GtkTextBuffer * textbuf;
GtkTextIter iter, iter2;
size_t len;
-#endif
option_data = user_data;
widdata = cv->user_data;
-#if GTK_MAJOR_VERSION == 1
- /*
- GTK_TEXT uses wchar_t instead of char in environment of multibyte encoding
- locale (ex Japanese), so we must convert from wide character
- to multibyte charator.... Yasuyuki Furukawa (yasu on cs keio ac jp)
- */
- if (GTK_TEXT (widdata->text)->use_wchar)
- {
- wcstombs (tmp, (wchar_t *) GTK_TEXT (widdata->text)->text.wc, sizeof (tmp));
- newstr = tmp;
- }
- else
- newstr = (char *) GTK_TEXT (widdata->text)->text.ch;
-
- freeit = 0;
-#else
textbuf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widdata->text));
len = gtk_text_buffer_get_char_count (textbuf);
gtk_text_buffer_get_iter_at_offset (textbuf, &iter, 0);
gtk_text_buffer_get_iter_at_offset (textbuf, &iter2, len);
newstr = gtk_text_buffer_get_text (textbuf, &iter, &iter2, 0);
freeit = 1;
-#endif
proxy_config = _gftp_convert_from_newlines (newstr);
@@ -752,7 +707,6 @@ apply_changes (GtkWidget * widget, gpointer data)
}
-#if GTK_MAJOR_VERSION > 1
static void
options_action (GtkWidget * widget, gint response, gpointer user_data)
{
@@ -766,7 +720,6 @@ options_action (GtkWidget * widget, gint response, gpointer user_data)
gtk_widget_destroy (widget);
}
}
-#endif
static void
@@ -871,7 +824,6 @@ add_ok (GtkWidget * widget, gpointer data)
}
-#if GTK_MAJOR_VERSION > 1
static void
proxyhosts_action (GtkWidget * widget, gint response, gpointer user_data)
{
@@ -884,7 +836,6 @@ proxyhosts_action (GtkWidget * widget, gint response, gpointer user_data)
gtk_widget_destroy (widget);
}
}
-#endif
static void
@@ -954,16 +905,6 @@ add_proxy_host (GtkWidget * widget, gpointer data)
}
title = hosts ? _("Edit Host") : _("Add Host");
-#if GTK_MAJOR_VERSION == 1
- dialog = gtk_dialog_new ();
- gtk_window_set_title (GTK_WINDOW (dialog), title);
- gtk_container_border_width (GTK_CONTAINER
- (GTK_DIALOG (dialog)->action_area), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->action_area), 15);
- gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->action_area), TRUE);
- gtk_grab_add (dialog);
- gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 10);
-#else
dialog = gtk_dialog_new_with_buttons (title, NULL, 0,
GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL,
@@ -973,12 +914,10 @@ add_proxy_host (GtkWidget * widget, gpointer data)
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
-#endif
gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2);
gtk_window_set_wmclass (GTK_WINDOW(dialog), "hostinfo", "Gftp");
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
-#if GTK_MAJOR_VERSION > 1
if (gftp_icon != NULL)
{
if ((tempstr = get_xpm_path (gftp_icon->filename, 0)) != NULL)
@@ -987,7 +926,6 @@ add_proxy_host (GtkWidget * widget, gpointer data)
g_free (tempstr);
}
}
-#endif
vbox = gtk_vbox_new (FALSE, 6);
gtk_container_border_width (GTK_CONTAINER (vbox), 5);
@@ -998,11 +936,7 @@ add_proxy_host (GtkWidget * widget, gpointer data)
gtk_box_pack_start (GTK_BOX (vbox), box, FALSE, FALSE, 0);
gtk_widget_show (box);
-#if GTK_MAJOR_VERSION == 1
- tempwid = gtk_label_new (_("Type:"));
-#else
tempwid = gtk_label_new_with_mnemonic (_("_Type:"));
-#endif
gtk_misc_set_alignment (GTK_MISC (tempwid), 0, 0);
gtk_box_pack_start (GTK_BOX (box), tempwid, FALSE, FALSE, 0);
gtk_widget_show (tempwid);
@@ -1020,9 +954,7 @@ add_proxy_host (GtkWidget * widget, gpointer data)
_("Network"));
gtk_signal_connect (GTK_OBJECT (nradio), "toggled",
GTK_SIGNAL_FUNC (add_toggle), NULL);
-#if GTK_MAJOR_VERSION > 1
gtk_label_set_mnemonic_widget (GTK_LABEL (tempwid), nradio);
-#endif
gtk_box_pack_start (GTK_BOX (rbox), nradio, TRUE, TRUE, 0);
gtk_widget_show (nradio);
@@ -1043,11 +975,7 @@ add_proxy_host (GtkWidget * widget, gpointer data)
gtk_box_pack_start (GTK_BOX (box), table, FALSE, FALSE, 0);
gtk_widget_show (table);
-#if GTK_MAJOR_VERSION == 1
- tempwid = gtk_label_new (_("Network Address"));
-#else
tempwid = gtk_label_new_with_mnemonic (_("_Network address:"));
-#endif
network_label = tempwid;
gtk_misc_set_alignment (GTK_MISC (tempwid), 0, 0.5);
gtk_table_attach_defaults (GTK_TABLE (table), tempwid, 0, 1, 0, 1);
@@ -1059,9 +987,7 @@ add_proxy_host (GtkWidget * widget, gpointer data)
network1 = gtk_entry_new ();
gtk_widget_set_size_request (network1, 36, -1);
-#if GTK_MAJOR_VERSION > 1
gtk_label_set_mnemonic_widget (GTK_LABEL (tempwid), network1);
-#endif
gtk_box_pack_start (GTK_BOX (box), network1, TRUE, TRUE, 0);
gtk_widget_show (network1);
@@ -1084,11 +1010,7 @@ add_proxy_host (GtkWidget * widget, gpointer data)
gtk_box_pack_start (GTK_BOX (box), network4, TRUE, TRUE, 0);
gtk_widget_show (network4);
-#if GTK_MAJOR_VERSION == 1
- tempwid = gtk_label_new (_("Netmask"));
-#else
tempwid = gtk_label_new_with_mnemonic (_("N_etmask:"));
-#endif
netmask_label = tempwid;
gtk_misc_set_alignment (GTK_MISC (tempwid), 0, 0.5);
gtk_table_attach_defaults (GTK_TABLE (table), tempwid, 0, 1, 1, 2);
@@ -1100,9 +1022,7 @@ add_proxy_host (GtkWidget * widget, gpointer data)
netmask1 = gtk_entry_new ();
gtk_widget_set_size_request (netmask1, 36, -1);
-#if GTK_MAJOR_VERSION > 1
gtk_label_set_mnemonic_widget (GTK_LABEL (tempwid), netmask1);
-#endif
gtk_box_pack_start (GTK_BOX (box), netmask1, TRUE, TRUE, 0);
gtk_widget_show (netmask1);
@@ -1133,11 +1053,7 @@ add_proxy_host (GtkWidget * widget, gpointer data)
gtk_box_pack_start (GTK_BOX (box), tempwid, FALSE, FALSE, 0);
gtk_widget_show (tempwid);
-#if GTK_MAJOR_VERSION == 1
- tempwid = gtk_label_new (_("Domain"));
-#else
tempwid = gtk_label_new_with_mnemonic (_("_Domain:"));
-#endif
domain_label = tempwid;
gtk_misc_set_alignment (GTK_MISC (tempwid), 0, 0.5);
gtk_box_pack_start (GTK_BOX (box), tempwid, FALSE, FALSE, 0);
@@ -1146,9 +1062,7 @@ add_proxy_host (GtkWidget * widget, gpointer data)
new_proxy_domain = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX (box), new_proxy_domain, TRUE, TRUE, 0);
gtk_widget_show (new_proxy_domain);
-#if GTK_MAJOR_VERSION > 1
gtk_label_set_mnemonic_widget (GTK_LABEL (tempwid), new_proxy_domain);
-#endif
if (!hosts || !hosts->domain)
{
@@ -1201,30 +1115,8 @@ add_proxy_host (GtkWidget * widget, gpointer data)
}
}
-#if GTK_MAJOR_VERSION == 1
- tempwid = gtk_button_new_with_label (_("OK"));
- GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid,
- TRUE, TRUE, 0);
- gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
- GTK_SIGNAL_FUNC (add_ok), (gpointer) templist);
- gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- GTK_OBJECT (dialog));
- gtk_widget_show (tempwid);
-
- tempwid = gtk_button_new_with_label (_(" Cancel "));
- GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid,
- TRUE, TRUE, 0);
- gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- GTK_OBJECT (dialog));
- gtk_widget_show (tempwid);
-#else
g_signal_connect (GTK_OBJECT (dialog), "response",
G_CALLBACK (proxyhosts_action), NULL);
-#endif
gtk_widget_show (dialog);
}
@@ -1273,24 +1165,14 @@ make_proxy_hosts_tab (GtkWidget * notebook)
gtk_box_pack_start (GTK_BOX (box), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
-#if GTK_MAJOR_VERSION == 1
- tempwid = gtk_button_new_with_label (_("Add"));
-#else
tempwid = gtk_button_new_from_stock (GTK_STOCK_ADD);
-#endif
GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
gtk_box_pack_start (GTK_BOX (hbox), tempwid, TRUE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
GTK_SIGNAL_FUNC (add_proxy_host), NULL);
gtk_widget_show (tempwid);
-#if GTK_MAJOR_VERSION == 1
- tempwid = gtk_button_new_with_label (_("Edit"));
-#elif GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION < 5
- tempwid = gtk_button_new_with_mnemonic (_("_Edit"));
-#else
tempwid = gtk_button_new_from_stock (GTK_STOCK_EDIT);
-#endif
edit_button = tempwid;
GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
gtk_box_pack_start (GTK_BOX (hbox), tempwid, TRUE, TRUE, 0);
@@ -1298,11 +1180,7 @@ make_proxy_hosts_tab (GtkWidget * notebook)
GTK_SIGNAL_FUNC (add_proxy_host), (gpointer) 1);
gtk_widget_show (tempwid);
-#if GTK_MAJOR_VERSION == 1
- tempwid = gtk_button_new_with_label (_("Delete"));
-#else
tempwid = gtk_button_new_from_stock (GTK_STOCK_DELETE);
-#endif
delete_button = tempwid;
GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
gtk_box_pack_start (GTK_BOX (hbox), tempwid, TRUE, TRUE, 0);
@@ -1356,19 +1234,9 @@ options_dialog (gpointer data)
GList * templist;
void *value;
int i;
-#if GTK_MAJOR_VERSION == 1
- GtkWidget * tempwid;
-#endif
gftp_option_data = _init_option_data ();
-#if GTK_MAJOR_VERSION == 1
- gftp_option_data->dialog = gtk_dialog_new ();
- gtk_window_set_title (GTK_WINDOW (gftp_option_data->dialog), _("Options"));
- gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (gftp_option_data->dialog)->action_area), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (gftp_option_data->dialog)->action_area), 15);
- gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (gftp_option_data->dialog)->action_area), TRUE);
-#else
gftp_option_data->dialog = gtk_dialog_new_with_buttons (_("Options"), NULL, 0,
GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL,
@@ -1378,14 +1246,10 @@ options_dialog (gpointer data)
gtk_container_set_border_width (GTK_CONTAINER (gftp_option_data->dialog), 5);
gtk_dialog_set_has_separator (GTK_DIALOG (gftp_option_data->dialog), FALSE);
gtk_window_set_resizable (GTK_WINDOW (gftp_option_data->dialog), FALSE);
-#endif
gtk_window_set_wmclass (GTK_WINDOW(gftp_option_data->dialog),
"options", "gFTP");
gtk_window_set_position (GTK_WINDOW (gftp_option_data->dialog),
GTK_WIN_POS_MOUSE);
-#if GTK_MAJOR_VERSION == 1
- gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (gftp_option_data->dialog)->vbox), 10);
-#endif
gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (gftp_option_data->dialog)->vbox), 2);
gtk_widget_realize (gftp_option_data->dialog);
@@ -1400,9 +1264,7 @@ options_dialog (gpointer data)
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (gftp_option_data->dialog)->vbox),
gftp_option_data->notebook, TRUE, TRUE, 0);
gtk_widget_show (gftp_option_data->notebook);
-#if GTK_MAJOR_VERSION > 1
gtk_container_border_width (GTK_CONTAINER (gftp_option_data->notebook), 5);
-#endif
cv = gftp_options_list->data;
gftp_option_data->last_option = cv[0].otype;
@@ -1433,41 +1295,8 @@ options_dialog (gpointer data)
make_proxy_hosts_tab (gftp_option_data->notebook);
-#if GTK_MAJOR_VERSION == 1
- tempwid = gtk_button_new_with_label (_("OK"));
- GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (gftp_option_data->dialog)->action_area),
- tempwid, TRUE, TRUE, 0);
- gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
- GTK_SIGNAL_FUNC (apply_changes), NULL);
- gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- GTK_OBJECT (gftp_option_data->dialog));
- gtk_widget_show (tempwid);
-
- tempwid = gtk_button_new_with_label (_(" Cancel "));
- GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (gftp_option_data->dialog)->action_area),
- tempwid, TRUE, TRUE, 0);
- gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
- GTK_SIGNAL_FUNC (clean_old_changes), NULL);
- gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- GTK_OBJECT (gftp_option_data->dialog));
- gtk_widget_show (tempwid);
-
- tempwid = gtk_button_new_with_label (_("Apply"));
- GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (gftp_option_data->dialog)->action_area),
- tempwid, TRUE, TRUE, 0);
- gtk_signal_connect (GTK_OBJECT (tempwid), "clicked",
- GTK_SIGNAL_FUNC (apply_changes), NULL);
- gtk_widget_grab_default (tempwid);
- gtk_widget_show (tempwid);
-#else
g_signal_connect (GTK_OBJECT (gftp_option_data->dialog), "response",
G_CALLBACK (options_action), NULL);
-#endif
gtk_widget_show (gftp_option_data->dialog);
}
diff --git a/src/gtk/view_dialog.c b/src/gtk/view_dialog.c
index 5244c80..e8dd7dd 100644
--- a/src/gtk/view_dialog.c
+++ b/src/gtk/view_dialog.c
@@ -221,10 +221,8 @@ view_file (char *filename, int fd, unsigned int viewedit, unsigned int del_file,
int doclose;
ssize_t n;
char * non_utf8;
-#if GTK_MAJOR_VERSION > 1
GtkTextBuffer * textbuf;
GtkTextIter iter;
-#endif
doclose = 1;
stlen = strlen (filename);
@@ -314,18 +312,10 @@ view_file (char *filename, int fd, unsigned int viewedit, unsigned int del_file,
if (non_utf8 != filename && non_utf8)
g_free (non_utf8);
-#if GTK_MAJOR_VERSION == 1
- dialog = gtk_dialog_new ();
- gtk_window_set_title (GTK_WINDOW (dialog), filename);
- gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area),
- 5);
- gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->action_area), TRUE);
-#else
dialog = gtk_dialog_new_with_buttons (filename, NULL, 0,
GTK_STOCK_CLOSE,
GTK_RESPONSE_CLOSE,
NULL);
-#endif
gtk_window_set_wmclass (GTK_WINDOW(dialog), "fileview", "gFTP");
gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 5);
gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 5);
@@ -341,23 +331,6 @@ view_file (char *filename, int fd, unsigned int viewedit, unsigned int del_file,
table = gtk_table_new (1, 2, FALSE);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), table, TRUE, TRUE, 0);
-#if GTK_MAJOR_VERSION == 1
- view = gtk_text_new (NULL, NULL);
- gtk_text_set_editable (GTK_TEXT (view), FALSE);
- gtk_text_set_word_wrap (GTK_TEXT (view), TRUE);
-
- gtk_table_attach (GTK_TABLE (table), view, 0, 1, 0, 1,
- GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND | GTK_SHRINK,
- 0, 0);
- gtk_widget_show (view);
-
- tempwid = gtk_vscrollbar_new (GTK_TEXT (view)->vadj);
- gtk_table_attach (GTK_TABLE (table), tempwid, 1, 2, 0, 1,
- GTK_FILL, GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, 0);
- gtk_widget_show (tempwid);
-
- vadj = GTK_TEXT (view)->vadj;
-#else
view = gtk_text_view_new ();
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
@@ -377,35 +350,20 @@ view_file (char *filename, int fd, unsigned int viewedit, unsigned int del_file,
gtk_widget_show (tempwid);
vadj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (tempwid));
-#endif
gtk_widget_set_size_request (table, 500, 400);
gtk_widget_show (table);
-#if GTK_MAJOR_VERSION == 1
- tempwid = gtk_button_new_with_label (_(" Close "));
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid,
- FALSE, FALSE, 0);
- gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- GTK_OBJECT (dialog));
- gtk_widget_show (tempwid);
-#else
g_signal_connect_swapped (GTK_OBJECT (dialog), "response",
G_CALLBACK (gtk_widget_destroy),
GTK_OBJECT (dialog));
-#endif
buf[sizeof (buf) - 1] = '\0';
while ((n = read (fd, buf, sizeof (buf) - 1)) > 0)
{
buf[n] = '\0';
-#if GTK_MAJOR_VERSION == 1
- gtk_text_insert (GTK_TEXT (view), NULL, NULL, NULL, buf, -1);
-#else
textbuf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
gtk_text_buffer_get_iter_at_offset (textbuf, &iter, -1);
gtk_text_buffer_insert (textbuf, &iter, buf, -1);
-#endif
}
if (doclose)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]