summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alan F <ajf@eth0.org.uk>2014-02-05 21:13:12 +0000
committerGravatar Alan F <ajf@eth0.org.uk>2014-02-05 21:13:12 +0000
commit37d2c80cfa0bdd8e4af4e2a246c5395bb6681074 (patch)
tree2ef44eeeb22ceb9d2d9afc636dddd7c0aead99d7
parent98eb06aaeb6ee3d1f1440c3000311e73367778d7 (diff)
the very first steps of an RSS viewer - bit of autotools integration with rss-glib and an empty window.
-rw-r--r--configure.ac6
-rw-r--r--src/Makefile.am5
-rw-r--r--src/trg-main-window.c20
-rw-r--r--src/trg-menu-bar.c17
4 files changed, 43 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac
index 40f9545..16e7214 100644
--- a/configure.ac
+++ b/configure.ac
@@ -73,6 +73,8 @@ AM_CONDITIONAL([HAVE_GEOIP], [test "x$have_geoip" = "xyes"])
AC_ARG_WITH([libnotify], AC_HELP_STRING([--without-libnotify], [disable libnotify]))
have_libnotify=no
+AC_ARG_WITH([librssglib], AC_HELP_STRING([--without-rssglib], [disable rssglib support]))
+have_librssglib=no
AC_ARG_WITH([libproxy], AC_HELP_STRING([--without-libproxy], [disable libproxy]))
have_libproxy=no
AC_ARG_WITH([libappindicator], AC_HELP_STRING([--without-libappindicator], [disable libappindicator]))
@@ -82,6 +84,10 @@ if test x$with_libnotify != xno; then
PKG_CHECK_MODULES([notify], [libnotify], AC_DEFINE(HAVE_LIBNOTIFY, 1, [Define if libnotify is available]), AC_MSG_WARN([libnotify is required for popup desktop notifications]))
fi
+if test x$with_librssglib != xno; then
+ PKG_CHECK_MODULES([rssglib], [rss-glib-1.0], AC_DEFINE(HAVE_RSSGLIB, 1, [Define if rss-glib is available]), AC_MSG_WARN([rss-glib is required for RSS viewer functionality]))
+fi
+
if test x$with_libproxy != xno; then
PKG_CHECK_MODULES([libproxy], [libproxy-1.0], AC_DEFINE(HAVE_LIBPROXY, 1, [Define if libproxy is available]), AC_MSG_WARN([libproxy is required for HTTP proxy support]))
fi
diff --git a/src/Makefile.am b/src/Makefile.am
index e43e66f..1feb5fb 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) $(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) $(rssglib_CFLAGS)
transmission_remote_gtk_SOURCES = \
trg-cell-renderer-speed.c \
@@ -105,9 +105,10 @@ transmission_remote_gtk_SOURCES = \
trg-client.c \
trg-main-window.c \
main.c \
+ trg-rss-dialog.c \
$(NULL)
-transmission_remote_gtk_LDFLAGS = -lm $(jsonglib_LIBS) $(gtk_LIBS) $(gthread_LIBS) $(GEOIP_LIBS) $(gio_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) $(rssglib_LIBS)
if WIN32
.rc.o:
diff --git a/src/trg-main-window.c b/src/trg-main-window.c
index 906a384..cc72527 100644
--- a/src/trg-main-window.c
+++ b/src/trg-main-window.c
@@ -73,6 +73,7 @@
#include "trg-menu-bar.h"
#include "trg-status-bar.h"
#include "trg-stats-dialog.h"
+#include "trg-rss-dialog.h"
#include "trg-remote-prefs-dialog.h"
#include "trg-preferences-dialog.h"
@@ -924,6 +925,19 @@ static void view_stats_toggled_cb(GtkWidget * w, gpointer data)
}
}
+static void view_rss_toggled_cb(GtkWidget * w, gpointer data)
+{
+ TrgMainWindow *win = TRG_MAIN_WINDOW(data);
+ TrgMainWindowPrivate *priv = win->priv;
+
+ if (trg_client_is_connected(priv->client)) {
+ TrgRssDialog *dlg =
+ trg_rss_dialog_get_instance(TRG_MAIN_WINDOW(data));
+
+ gtk_widget_show_all(GTK_WIDGET(dlg));
+ }
+}
+
static void
view_states_toggled_cb(GtkCheckMenuItem * w, TrgMainWindow * win)
{
@@ -1731,7 +1745,7 @@ static TrgMenuBar *trg_main_window_menu_bar_new(TrgMainWindow * win)
GObject *b_disconnect, *b_add, *b_resume, *b_pause, *b_verify,
*b_remove, *b_delete, *b_props, *b_local_prefs, *b_remote_prefs,
- *b_about, *b_view_states, *b_view_notebook, *b_view_stats,
+ *b_about, *b_view_states, *b_view_notebook, *b_view_stats, *b_view_rss,
*b_add_url, *b_quit, *b_move, *b_reannounce, *b_pause_all,
*b_resume_all, *b_dir_filters, *b_tracker_filters, *b_up_queue,
*b_down_queue, *b_top_queue, *b_bottom_queue,
@@ -1762,7 +1776,7 @@ static TrgMenuBar *trg_main_window_menu_bar_new(TrgMainWindow * win)
"view-states-button", &b_view_states, "view-stats-button",
&b_view_stats, "about-button", &b_about, "quit-button",
&b_quit, "dir-filters", &b_dir_filters, "tracker-filters",
- &b_tracker_filters,
+ &b_tracker_filters, "view-rss-button", &b_view_rss,
#if TRG_WITH_GRAPH
"show-graph", &b_show_graph,
#endif
@@ -1810,6 +1824,8 @@ static TrgMenuBar *trg_main_window_menu_bar_new(TrgMainWindow * win)
G_CALLBACK(view_states_toggled_cb), win);
g_signal_connect(b_view_stats, "activate",
G_CALLBACK(view_stats_toggled_cb), win);
+ g_signal_connect(b_view_rss, "activate",
+ G_CALLBACK(view_rss_toggled_cb), win);
#if TRG_WITH_GRAPH
g_signal_connect(b_show_graph, "toggled",
G_CALLBACK(trg_main_window_toggle_graph_cb), win);
diff --git a/src/trg-menu-bar.c b/src/trg-menu-bar.c
index df96240..f6ca4c5 100644
--- a/src/trg-menu-bar.c
+++ b/src/trg-menu-bar.c
@@ -49,6 +49,7 @@ enum {
PROP_LOCAL_PREFS_BUTTON,
PROP_ABOUT_BUTTON,
PROP_VIEW_STATS_BUTTON,
+ PROP_VIEW_RSS_BUTTON,
PROP_VIEW_STATES_BUTTON,
PROP_VIEW_NOTEBOOK_BUTTON,
PROP_QUIT,
@@ -96,6 +97,7 @@ struct _TrgMenuBarPrivate {
GtkWidget *mb_view_states;
GtkWidget *mb_view_notebook;
GtkWidget *mb_view_stats;
+ GtkWidget *mb_view_rss;
GtkWidget *mb_about;
GtkWidget *mb_quit;
GtkWidget *mb_directory_filters;
@@ -140,6 +142,7 @@ void trg_menu_bar_connected_change(TrgMenuBar * mb, gboolean connected)
gtk_widget_set_sensitive(priv->mb_disconnect, connected);
gtk_widget_set_sensitive(priv->mb_remote_prefs, connected);
gtk_widget_set_sensitive(priv->mb_view_stats, connected);
+ gtk_widget_set_sensitive(priv->mb_view_rss, connected);
gtk_widget_set_sensitive(priv->mb_resume_all, connected);
gtk_widget_set_sensitive(priv->mb_pause_all, connected);
}
@@ -273,6 +276,9 @@ trg_menu_bar_get_property(GObject * object, guint property_id,
case PROP_VIEW_STATS_BUTTON:
g_value_set_object(value, priv->mb_view_stats);
break;
+ case PROP_VIEW_RSS_BUTTON:
+ g_value_set_object(value, priv->mb_view_rss);
+ break;
case PROP_QUIT:
g_value_set_object(value, priv->mb_quit);
break;
@@ -542,6 +548,12 @@ static GtkWidget *trg_menu_bar_view_menu_new(TrgMenuBar * mb)
gtk_widget_set_sensitive(priv->mb_view_stats, FALSE);
gtk_menu_shell_append(GTK_MENU_SHELL(viewMenu), priv->mb_view_stats);
+ priv->mb_view_rss =
+ gtk_menu_item_new_with_mnemonic(_("_RSS"));
+ //trg_menu_bar_accel_add(mb, priv->mb_view_rss, GDK_F7, 0);
+ gtk_widget_set_sensitive(priv->mb_view_rss, FALSE);
+ gtk_menu_shell_append(GTK_MENU_SHELL(viewMenu), priv->mb_view_rss);
+
return view;
}
@@ -578,7 +590,7 @@ trg_menu_bar_file_connect_item_new(TrgMainWindow * win,
{
GtkWidget *item = gtk_check_menu_item_new_with_label(text);
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), checked);
+ gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM(item), checked);
g_object_set_data(G_OBJECT(item), "profile", profile);
gtk_check_menu_item_set_draw_as_radio(GTK_CHECK_MENU_ITEM(item), TRUE);
@@ -870,6 +882,9 @@ static void trg_menu_bar_class_init(TrgMenuBarClass * klass)
trg_menu_bar_install_widget_prop(object_class, PROP_VIEW_STATS_BUTTON,
"view-stats-button",
"View stats button");
+ trg_menu_bar_install_widget_prop(object_class, PROP_VIEW_RSS_BUTTON,
+ "view-rss-button",
+ "View rss button");
trg_menu_bar_install_widget_prop(object_class, PROP_VIEW_STATES_BUTTON,
"view-states-button",
"View states Button");