summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alan F <ajf@eth0.org.uk>2014-01-07 09:10:20 +0000
committerGravatar Alan F <ajf@eth0.org.uk>2014-01-07 09:12:35 +0000
commita5fa39775707a998df915abeaae15d0d99f64785 (patch)
treeec23a7f2ece7559b18626a6ef8b3e55fd03d23d9
parent0b0eb52a5b2c82a4bbcc0d04d523883623124c4f (diff)
remove all support for gtk2
-rw-r--r--configure.ac26
-rw-r--r--src/Makefile.am4
-rw-r--r--src/main.c120
-rw-r--r--src/torrent-cell-renderer.c43
-rw-r--r--src/trg-destination-combo.c6
-rw-r--r--src/trg-gtk-app.c4
-rw-r--r--src/trg-main-window.c9
-rw-r--r--src/trg-menu-bar.c2
-rw-r--r--src/trg-toolbar.c4
-rw-r--r--src/trg-torrent-add-dialog.c4
-rw-r--r--src/trg-torrent-tree-view.c4
-rw-r--r--src/trg-tree-view.c10
-rw-r--r--src/util.c8
13 files changed, 26 insertions, 218 deletions
diff --git a/configure.ac b/configure.ac
index 2260c49..0b398ac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -71,8 +71,6 @@ if test "x$have_geoip" = "xyes"; then
fi
AM_CONDITIONAL([HAVE_GEOIP], [test "x$have_geoip" = "xyes"])
-AC_ARG_WITH([libunique], AC_HELP_STRING([--without-libunique], [disable libunique]))
-have_libunique=no
AC_ARG_WITH([libnotify], AC_HELP_STRING([--without-libnotify], [disable libnotify]))
have_libnotify=no
AC_ARG_WITH([libproxy], AC_HELP_STRING([--without-libproxy], [disable libproxy]))
@@ -96,7 +94,6 @@ fi
AC_ARG_ENABLE(gtk3, [AS_HELP_STRING(--enable-gtk3,
[use gtk3 support (now default, left for compatability)])])
-AC_ARG_ENABLE(gtk2, [AS_HELP_STRING(--enable-gtk2,
[use old gtk2 support])])
PKG_CHECK_MODULES([jsonglib], [json-glib-1.0 >= 0.8])
@@ -111,22 +108,15 @@ fi
], [$1])
])
-AC_DEFUN([TRG_GTK2_CONFIGURE], [
-AC_MSG_NOTICE([attempting gtk-2.0 build])
-PKG_CHECK_MODULES([gtk], [gtk+-2.0 >= 2.16])
-if test x$with_libappindicator != xno; then
- PKG_CHECK_MODULES([libappindicator], [appindicator-0.1], AC_DEFINE(HAVE_LIBAPPINDICATOR, 1, [Define if libappindicator is available]), AC_MSG_WARN([Ubuntu Unity users should consider building with libappindicator]))
-fi
-if test x$with_libunique != xno; then
- PKG_CHECK_MODULES([unique], [unique-1.0], AC_DEFINE(HAVE_LIBUNIQUE, 1, [Define if libunique is available]), AC_MSG_WARN([libunique is required for opening torrents on gtk+-2.0. not needed for gtk+-3.0 or win32. ]))
-fi
-])
+#AC_DEFUN([TRG_GTK2_CONFIGURE], [
+#AC_MSG_NOTICE([attempting gtk-2.0 build])
+#PKG_CHECK_MODULES([gtk], [gtk+-2.0 >= 2.16])
+#if test x$with_libappindicator != xno; then
+# PKG_CHECK_MODULES([libappindicator], [appindicator-0.1], AC_DEFINE(HAVE_LIBAPPINDICATOR, 1, [Define if libappindicator is available]), AC_MSG_WARN([Ubuntu Unity users should consider building with libappindicator]))
+#fi
+#])
-if test x$enable_gtk2 = xyes; then
- TRG_GTK2_CONFIGURE([])
-else
- TRG_GTK3_CONFIGURE()
-fi
+TRG_GTK3_CONFIGURE()
PKG_CHECK_MODULES([libcurl], [libcurl])
PKG_CHECK_MODULES([gio], [gio-2.0 >= 2.22])
diff --git a/src/Makefile.am b/src/Makefile.am
index 0c1abd6..e43e66f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -44,7 +44,7 @@ desktop_DATA = transmission-remote-gtk.desktop
endif
bin_PROGRAMS = transmission-remote-gtk
-INCLUDES = -std=c99 -Wall -I.. -Wno-overflow -DTRGLICENSE=\""$(trglicense)"\" $(libcurl_CFLAGS) $(jsonglib_CFLAGS) $(gthread_CFLAGS) $(gtk_CFLAGS) $(gio_CFLAGS) $(unique_CFLAGS) $(notify_CFLAGS) $(libproxy_CFLAGS) $(libappindicator_CFLAGS)
+INCLUDES = -std=c99 -Wall -I.. -Wno-overflow -DTRGLICENSE=\""$(trglicense)"\" $(libcurl_CFLAGS) $(jsonglib_CFLAGS) $(gthread_CFLAGS) $(gtk_CFLAGS) $(gio_CFLAGS) $(notify_CFLAGS) $(libproxy_CFLAGS) $(libappindicator_CFLAGS)
transmission_remote_gtk_SOURCES = \
trg-cell-renderer-speed.c \
@@ -107,7 +107,7 @@ transmission_remote_gtk_SOURCES = \
main.c \
$(NULL)
-transmission_remote_gtk_LDFLAGS = -lm $(jsonglib_LIBS) $(gtk_LIBS) $(gthread_LIBS) $(GEOIP_LIBS) $(gio_LIBS) $(unique_LIBS) $(notify_LIBS) $(libproxy_LIBS) $(libcurl_LIBS) $(libappindicator_LIBS)
+transmission_remote_gtk_LDFLAGS = -lm $(jsonglib_LIBS) $(gtk_LIBS) $(gthread_LIBS) $(GEOIP_LIBS) $(gio_LIBS) $(notify_LIBS) $(libproxy_LIBS) $(libcurl_LIBS) $(libappindicator_LIBS)
if WIN32
.rc.o:
diff --git a/src/main.c b/src/main.c
index f7570ce..5fdbf5f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -32,11 +32,8 @@
#include <json-glib/json-glib.h>
#include <fontconfig/fontconfig.h>
-#if !GTK_CHECK_VERSION( 3, 0, 0 ) && HAVE_LIBUNIQUE
-#include <unique/unique.h>
-#elif GTK_CHECK_VERSION( 3, 0, 0 )
#include "trg-gtk-app.h"
-#elif WIN32
+#if WIN32
#include "win32-mailslot.h"
#endif
@@ -44,105 +41,16 @@
#include "trg-client.h"
#include "util.h"
-/* Handle arguments and start the main window. Unfortunately, there's three
- * different ways to achieve a unique instance and pass arguments around. :(
+/* Handle arguments and start the main window.
*
- * 1) libunique - GTK2 (non-win32). deprecated in GTK3 for GtkApplication.
- * 2) GtkApplication - replaces libunique, GTK3 only, and non-win32.
- * 3) win32 API mailslots.
- */
-
-/*
- * libunique.
+ * either GtkApplication - replaces libunique, GTK3 only, and non-win32.
+ * or win32 API mailslots.
+ *
+ * win32 could possibly run from GtkApplication now, mailslots were needed
+ * for GTK2 (support removed).
*/
-#if !GTK_CHECK_VERSION( 3, 0, 0 ) && HAVE_LIBUNIQUE
-
-enum {
- COMMAND_0,
- COMMAND_ADD
-};
-
-static UniqueResponse
-message_received_cb(UniqueApp * app G_GNUC_UNUSED,
- gint command,
- UniqueMessageData * message,
- guint time_, gpointer user_data)
-{
- TrgMainWindow *win;
- UniqueResponse res;
- gchar **uris;
-
- win = TRG_MAIN_WINDOW(user_data);
-
- switch (command) {
- case UNIQUE_ACTIVATE:
- gtk_window_set_screen(GTK_WINDOW(user_data),
- unique_message_data_get_screen(message));
- gtk_window_present_with_time(GTK_WINDOW(user_data), time_);
- res = UNIQUE_RESPONSE_OK;
- break;
- case COMMAND_ADD:
- uris = unique_message_data_get_uris(message);
- res =
- trg_add_from_filename(win,
- uris) ? UNIQUE_RESPONSE_OK :
- UNIQUE_RESPONSE_FAIL;
- break;
- default:
- res = UNIQUE_RESPONSE_OK;
- break;
- }
-
- return res;
-}
-
-static gint
-trg_libunique_init(TrgClient * client, int argc,
- gchar * argv[], gchar ** args)
-{
- UniqueApp *app = unique_app_new_with_commands("uk.org.eth0.trg", NULL,
- "add", COMMAND_ADD,
- NULL);
- TrgMainWindow *window;
-
- if (unique_app_is_running(app)) {
- UniqueCommand command;
- UniqueResponse response;
- UniqueMessageData *message;
-
- if (args) {
- command = COMMAND_ADD;
- message = unique_message_data_new();
- unique_message_data_set_uris(message, args);
- g_strfreev(args);
- } else {
- command = UNIQUE_ACTIVATE;
- message = NULL;
- }
-
- response = unique_app_send_message(app, command, message);
- unique_message_data_free(message);
-
- if (response != UNIQUE_RESPONSE_OK)
- return EXIT_FAILURE;
- } else {
- window =
- trg_main_window_new(client, should_be_minimised(argc, argv));
- g_signal_connect(app, "message-received",
- G_CALLBACK(message_received_cb), window);
-
- trg_main_window_set_start_args(window, args);
- auto_connect_if_required(window);
- gtk_main();
- }
-
- g_object_unref(app);
-
- return EXIT_SUCCESS;
-}
-
-#elif !WIN32 && GTK_CHECK_VERSION( 3, 0, 0 )
+#if !WIN32
/* GtkApplication - the replacement for libunique.
* This is implemented in trg-gtk-app.c
@@ -216,7 +124,7 @@ static void trg_cleanup()
curl_global_cleanup();
}
-#if WIN32 || !GTK_CHECK_VERSION( 3, 0, 0 )
+#if WIN32
static gchar **convert_args(int argc, char *argv[])
{
@@ -261,7 +169,7 @@ static gchar **convert_args(int argc, char *argv[])
int main(int argc, char *argv[])
{
-#if WIN32 || !GTK_CHECK_VERSION( 3, 0, 0 )
+#if WIN32
gchar **args;
#endif
gint exitCode = EXIT_SUCCESS;
@@ -271,7 +179,7 @@ int main(int argc, char *argv[])
g_thread_init(NULL);
gtk_init(&argc, &argv);
-#if WIN32 || !GTK_CHECK_VERSION( 3, 0, 0 )
+#if WIN32
args = convert_args(argc, argv);
#endif
@@ -286,13 +194,7 @@ int main(int argc, char *argv[])
exitCode = trg_win32_init(client, argc, argv, args);
#else
trg_non_win32_init();
-#if !GTK_CHECK_VERSION( 3, 0, 0 ) && HAVE_LIBUNIQUE
- exitCode = trg_libunique_init(client, argc, argv, args);
-#elif GTK_CHECK_VERSION( 3, 0, 0 )
exitCode = trg_gtkapp_init(client, argc, argv);
-#else
- exitCode = trg_simple_init(client, argc, argv, args);
-#endif
#endif
trg_cleanup();
diff --git a/src/torrent-cell-renderer.c b/src/torrent-cell-renderer.c
index 95f4d37..654d7bd 100644
--- a/src/torrent-cell-renderer.c
+++ b/src/torrent-cell-renderer.c
@@ -58,17 +58,10 @@ enum {
#define COMPACT_ICON_SIZE GTK_ICON_SIZE_MENU
#define FULL_ICON_SIZE GTK_ICON_SIZE_DND
-#if GTK_CHECK_VERSION( 3, 0, 0 )
#define FOREGROUND_COLOR_KEY "foreground-rgba"
typedef GdkRGBA GtrColor;
typedef cairo_t GtrDrawable;
typedef GtkRequisition GtrRequisition;
-#else
-#define FOREGROUND_COLOR_KEY "foreground-gdk"
-typedef GdkColor GtrColor;
-typedef GdkWindow GtrDrawable;
-typedef GdkRectangle GtrRequisition;
-#endif
/***
****
@@ -401,18 +394,8 @@ gtr_cell_renderer_get_preferred_size(GtkCellRenderer * renderer,
GtkRequisition * minimum_size,
GtkRequisition * natural_size)
{
-#if GTK_CHECK_VERSION( 3, 0, 0 )
gtk_cell_renderer_get_preferred_size(renderer, widget, minimum_size,
natural_size);
-#else
- GtkRequisition r;
- gtk_cell_renderer_get_size(renderer, widget, NULL, NULL, NULL,
- &r.width, &r.height);
- if (minimum_size)
- *minimum_size = r;
- if (natural_size)
- *natural_size = r;
-#endif
}
static void
@@ -526,11 +509,7 @@ get_size_full(TorrentCellRenderer * cell,
static void
torrent_cell_renderer_get_size(GtkCellRenderer * cell, GtkWidget * widget,
-#if GTK_CHECK_VERSION( 3,0,0 )
const GdkRectangle * cell_area,
-#else
- GdkRectangle * cell_area,
-#endif
gint * x_offset,
gint * y_offset,
gint * width, gint * height)
@@ -570,7 +549,6 @@ get_text_color(TorrentCellRenderer * r, GtkWidget * widget,
GtrColor * setme)
{
struct TorrentCellRendererPrivate *p = r->priv;
-#if GTK_CHECK_VERSION( 3,0,0 )
static const GdkRGBA red = { 1.0, 0, 0, 0 };
if (p->error)
@@ -581,16 +559,6 @@ get_text_color(TorrentCellRenderer * r, GtkWidget * widget,
else
gtk_style_context_get_color(gtk_widget_get_style_context(widget),
GTK_STATE_FLAG_NORMAL, setme);
-#else
- static const GdkColor red = { 0, 65535, 0, 0 };
-
- if (p->error)
- *setme = red;
- else if (p->flags & TORRENT_FLAG_PAUSED)
- *setme = gtk_widget_get_style(widget)->text[GTK_STATE_INSENSITIVE];
- else
- *setme = gtk_widget_get_style(widget)->text[GTK_STATE_NORMAL];
-#endif
}
static double get_percent_done(TorrentCellRenderer * r, gboolean * seed)
@@ -623,26 +591,15 @@ gtr_cell_renderer_render(GtkCellRenderer * renderer,
const GdkRectangle * area,
GtkCellRendererState flags)
{
-#if GTK_CHECK_VERSION( 3, 0, 0 )
gtk_cell_renderer_render(renderer, drawable, widget, area, area,
flags);
-#else
- gtk_cell_renderer_render(renderer, drawable, widget, area, area, area,
- flags);
-#endif
}
static void
torrent_cell_renderer_render(GtkCellRenderer * cell,
GtrDrawable * window, GtkWidget * widget,
-#if GTK_CHECK_VERSION( 3,0,0 )
const GdkRectangle * background_area,
const GdkRectangle * cell_area,
-#else
- GdkRectangle * background_area,
- GdkRectangle * cell_area,
- GdkRectangle * expose_area,
-#endif
GtkCellRendererState flags)
{
TorrentCellRenderer *self = TORRENT_CELL_RENDERER(cell);
diff --git a/src/trg-destination-combo.c b/src/trg-destination-combo.c
index d2e3eb0..099b6a5 100644
--- a/src/trg-destination-combo.c
+++ b/src/trg-destination-combo.c
@@ -163,16 +163,10 @@ gtk_combo_box_entry_active_changed(GtkComboBox * combo_box,
editableEntry = FALSE;
}
}
-#if GTK_CHECK_VERSION( 3, 0, 0 )
gtk_editable_set_editable(GTK_EDITABLE
(trg_destination_combo_get_entry
(TRG_DESTINATION_COMBO(combo_box))),
editableEntry);
-#else
- gtk_entry_set_editable(trg_destination_combo_get_entry
- (TRG_DESTINATION_COMBO(combo_box)),
- editableEntry);
-#endif
}
gboolean trg_destination_combo_has_text(TrgDestinationCombo * combo)
diff --git a/src/trg-gtk-app.c b/src/trg-gtk-app.c
index a0c9ac4..fd346d2 100644
--- a/src/trg-gtk-app.c
+++ b/src/trg-gtk-app.c
@@ -19,8 +19,6 @@
#include <gtk/gtk.h>
-#if GTK_CHECK_VERSION( 3, 0, 0 )
-
#include "trg-main-window.h"
#include "trg-gtk-app.h"
#include "util.h"
@@ -227,5 +225,3 @@ TrgGtkApp *trg_gtk_app_new(TrgClient * client)
"flags", G_APPLICATION_HANDLES_COMMAND_LINE,
"trg-client", client, NULL);
}
-
-#endif
diff --git a/src/trg-main-window.c b/src/trg-main-window.c
index 975e68f..1549292 100644
--- a/src/trg-main-window.c
+++ b/src/trg-main-window.c
@@ -31,9 +31,7 @@
#include <gtk/gtk.h>
#include <json-glib/json-glib.h>
#include <gdk/gdkkeysyms.h>
-#if GTK_CHECK_VERSION( 3, 0, 0 )
#include <gdk/gdkkeysyms-compat.h>
-#endif
#include <curl/curl.h>
#ifdef HAVE_LIBNOTIFY
#include <libnotify/notify.h>
@@ -421,7 +419,7 @@ destroy_window(TrgMainWindow * win, gpointer data G_GNUC_UNUSED)
TRG_TREE_VIEW_PERSIST_LAYOUT);
trg_prefs_save(prefs);
-#if ! GTK_CHECK_VERSION( 3, 0, 0 )
+#if WIN32
gtk_main_quit();
#else
g_application_quit (g_application_get_default ());
@@ -2738,13 +2736,8 @@ static GObject *trg_main_window_constructor(GType type,
gtk_box_pack_start(GTK_BOX(outerVbox), GTK_WIDGET(toolbarHbox), FALSE,
FALSE, 0);
-#if GTK_CHECK_VERSION( 3, 0, 0 )
priv->hpaned = gtk_paned_new(GTK_ORIENTATION_HORIZONTAL);
priv->vpaned = gtk_paned_new(GTK_ORIENTATION_VERTICAL);
-#else
- priv->vpaned = gtk_vpaned_new();
- priv->hpaned = gtk_hpaned_new();
-#endif
gtk_box_pack_start(GTK_BOX(outerVbox), priv->vpaned, TRUE, TRUE, 0);
gtk_paned_pack1(GTK_PANED(priv->vpaned), priv->hpaned, TRUE, TRUE);
diff --git a/src/trg-menu-bar.c b/src/trg-menu-bar.c
index 4fcd06c..df96240 100644
--- a/src/trg-menu-bar.c
+++ b/src/trg-menu-bar.c
@@ -20,9 +20,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
-#if GTK_CHECK_VERSION( 3, 0, 0 )
#include <gdk/gdkkeysyms-compat.h>
-#endif
#include "trg-prefs.h"
#include "trg-torrent-graph.h"
diff --git a/src/trg-toolbar.c b/src/trg-toolbar.c
index 96dd95d..8d9ae1f 100644
--- a/src/trg-toolbar.c
+++ b/src/trg-toolbar.c
@@ -243,10 +243,6 @@ static GObject *trg_toolbar_constructor(GType type,
trg_toolbar_item_new(TRG_TOOLBAR(obj), _("Remote Preferences"),
&position, GTK_STOCK_NETWORK, FALSE);
-#if !GTK_CHECK_VERSION( 3, 0, 0 )
- gtk_toolbar_set_tooltips(GTK_TOOLBAR(obj), TRUE);
-#endif
-
g_signal_connect(G_OBJECT(priv->prefs), "pref-profile-changed",
G_CALLBACK(trg_toolbar_refresh_menu), obj);
diff --git a/src/trg-torrent-add-dialog.c b/src/trg-torrent-add-dialog.c
index bde24eb..517797e 100644
--- a/src/trg-torrent-add-dialog.c
+++ b/src/trg-torrent-add-dialog.c
@@ -431,11 +431,7 @@ GtkWidget *gtr_file_list_new(GtkTreeStore ** store)
static GtkWidget *gtr_dialog_get_content_area(GtkDialog * dialog)
{
-#if GTK_CHECK_VERSION( 2,14,0 )
return gtk_dialog_get_content_area(dialog);
-#else
- return dialog->vbox;
-#endif
}
static void gtr_dialog_set_content(GtkDialog * dialog, GtkWidget * content)
diff --git a/src/trg-torrent-tree-view.c b/src/trg-torrent-tree-view.c
index 207bef7..d97a8be 100644
--- a/src/trg-torrent-tree-view.c
+++ b/src/trg-torrent-tree-view.c
@@ -206,11 +206,7 @@ trg_torrent_tree_view_renderer_pref_changed(TrgPrefs * p,
TRG_STYLE_TR_COMPACT;
g_object_set(G_OBJECT(data), "compact", GINT_TO_POINTER(compact),
NULL);
-#if GTK_CHECK_VERSION( 3,0,0 )
g_signal_emit_by_name(tv, "style-updated", NULL, NULL);
-#else
- g_signal_emit_by_name(tv, "style-set", NULL, NULL);
-#endif
}
}
diff --git a/src/trg-tree-view.c b/src/trg-tree-view.c
index 3f7b95e..bdd78a8 100644
--- a/src/trg-tree-view.c
+++ b/src/trg-tree-view.c
@@ -417,6 +417,7 @@ trg_tree_view_add_column_after(TrgTreeView * tv,
{
GtkCellRenderer *renderer;
GtkTreeViewColumn *column = NULL;
+ GtkButton *column_button = NULL;
switch (desc->type) {
case TRG_COLTYPE_TEXT:
@@ -552,14 +553,11 @@ trg_tree_view_add_column_after(TrgTreeView * tv,
gtk_tree_view_move_column_after(GTK_TREE_VIEW(tv), column,
after_col);
-#if GTK_CHECK_VERSION( 3,0,0 )
- g_signal_connect(gtk_tree_view_column_get_button(column),
+ column_button = gtk_tree_view_column_get_button(column);
+
+ g_signal_connect(column_button,
"button-press-event", G_CALLBACK(col_onButtonPressed),
column);
-#else
- g_signal_connect(column->button, "button-press-event",
- G_CALLBACK(col_onButtonPressed), column);
-#endif
if (desc->out)
*(desc->out) = column;
diff --git a/src/util.c b/src/util.c
index 312c564..5ef7768 100644
--- a/src/util.c
+++ b/src/util.c
@@ -616,24 +616,16 @@ gboolean should_be_minimised(int argc, char *argv[])
GtkWidget *trg_hbox_new(gboolean homogeneous, gint spacing)
{
GtkWidget *box;
-#if GTK_CHECK_VERSION( 3, 0, 0 )
box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, spacing);
gtk_box_set_homogeneous(GTK_BOX(box), homogeneous);
-#else
- box = gtk_hbox_new(homogeneous, spacing);
-#endif
return box;
}
GtkWidget *trg_vbox_new(gboolean homogeneous, gint spacing)
{
GtkWidget *box;
-#if GTK_CHECK_VERSION( 3, 0, 0 )
box = gtk_box_new(GTK_ORIENTATION_VERTICAL, spacing);
gtk_box_set_homogeneous(GTK_BOX(box), homogeneous);
-#else
- box = gtk_vbox_new(homogeneous, spacing);
-#endif
return box;
}