From 76bf2f26705b06297ef8d54f7870092defc3adf9 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Fri, 18 Nov 2011 23:58:19 +0100 Subject: Fix loading glade file when installed. Added desktop entry. --- Makefile.am | 2 +- configure.ac | 2 +- desktop/.gitignore | 1 + desktop/Makefile.am | 15 +++++++++++ desktop/viewtorrents.desktop.in | 11 ++++++++ desktop/viewtorrents.png | Bin 0 -> 8987 bytes gui/viewtorrents.glade | 57 +++++++++++++++++++++------------------- src/main.c | 6 +++-- 8 files changed, 63 insertions(+), 31 deletions(-) create mode 100644 desktop/.gitignore create mode 100644 desktop/Makefile.am create mode 100644 desktop/viewtorrents.desktop.in create mode 100644 desktop/viewtorrents.png diff --git a/Makefile.am b/Makefile.am index 18f84ae..7c7029f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,4 +4,4 @@ MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \ config.sub configure depcomp install-sh ltmain.sh \ missing config.rpath mkinstalldirs -SUBDIRS = gui test src +SUBDIRS = gui desktop test src diff --git a/configure.ac b/configure.ac index cf80acf..aa41f75 100644 --- a/configure.ac +++ b/configure.ac @@ -51,4 +51,4 @@ AS_IF([test -x "$XMLRPC_C_CONFIG"], # End AM_CONFIG_HEADER([config.h]) -AC_OUTPUT([Makefile gui/Makefile test/Makefile src/Makefile]) +AC_OUTPUT([Makefile gui/Makefile desktop/Makefile test/Makefile src/Makefile]) diff --git a/desktop/.gitignore b/desktop/.gitignore new file mode 100644 index 0000000..dfd5cd8 --- /dev/null +++ b/desktop/.gitignore @@ -0,0 +1 @@ +/viewtorrents.desktop diff --git a/desktop/Makefile.am b/desktop/Makefile.am new file mode 100644 index 0000000..0ac91e2 --- /dev/null +++ b/desktop/Makefile.am @@ -0,0 +1,15 @@ +MAINTAINERCLEANFILES = Makefile.in + +Applicationdir = $(datadir)/applications +Applicationicondir = $(datadir)/icons/hicolor/128x128/apps + +Application_predata = viewtorrents.desktop.in +dist_Application_DATA = $(Application_predata:.desktop.in=.desktop) +dist_Applicationicon_DATA = viewtorrents.png + +EXTRA_DIST = $(Application_predata) + +%.desktop: %.desktop.in + cp $< $@ + +CONFIG_CLEAN_FILES = viewtorrents.desktop diff --git a/desktop/viewtorrents.desktop.in b/desktop/viewtorrents.desktop.in new file mode 100644 index 0000000..a532843 --- /dev/null +++ b/desktop/viewtorrents.desktop.in @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=viewtorrents +GenericName=GUI for rTorrent +Comment=View your list of torrents +Exec=viewtorrents +Terminal=false +Type=Application +Icon=viewtorrents +Categories=Utility +StartupNotify=true diff --git a/desktop/viewtorrents.png b/desktop/viewtorrents.png new file mode 100644 index 0000000..c83d662 Binary files /dev/null and b/desktop/viewtorrents.png differ diff --git a/gui/viewtorrents.glade b/gui/viewtorrents.glade index dee4204..cee5b9a 100644 --- a/gui/viewtorrents.glade +++ b/gui/viewtorrents.glade @@ -5,20 +5,18 @@ - - Rehash - Rehash selected torrent - gtk-refresh + + Connect + Connect to rTorrent + gtk-connect - - - Stop - Stop selected torrent - gtk-media-stop + + Disconnect + Disconnect from rTorrent + gtk-disconnect - @@ -29,18 +27,20 @@ - - Disconnect - Disconnect from rTorrent - gtk-disconnect + + Stop + Stop selected torrent + gtk-media-stop + - - Connect - Connect to rTorrent - gtk-connect + + Rehash + Rehash selected torrent + gtk-refresh + @@ -65,10 +65,10 @@ gtk-cancel + False True True True - False True @@ -80,11 +80,11 @@ gtk-connect + False True True True True - False True @@ -243,6 +243,8 @@ If authentication is needed, enter username and password as well. Viewtorrents 600 400 + viewtorrents + viewtorrents @@ -256,9 +258,9 @@ If authentication is needed, enter username and password as well. False + False True False - False _File True @@ -270,6 +272,7 @@ If authentication is needed, enter username and password as well. connectaction True False + True True accelgroup1 @@ -286,17 +289,17 @@ If authentication is needed, enter username and password as well. + False True False - False gtk-quit + False True False - False True True accelgroup1 @@ -353,9 +356,9 @@ If authentication is needed, enter username and password as well. + False True False - False _Help True @@ -365,9 +368,9 @@ If authentication is needed, enter username and password as well. gtk-about + False True False - False True True accelgroup1 @@ -600,10 +603,10 @@ If authentication is needed, enter username and password as well. gtk-cancel + False True True True - False True @@ -615,11 +618,11 @@ If authentication is needed, enter username and password as well. gtk-connect + False True True True True - False True diff --git a/src/main.c b/src/main.c index d2db45d..5f0953e 100644 --- a/src/main.c +++ b/src/main.c @@ -280,7 +280,7 @@ static gint liststore_default_compare_func(GtkTreeModel* model, int main(int argc, char** argv) { - const gchar* gladefile; + gchar* gladefile; GtkBuilder* builder; GError* error = NULL; guint ret; @@ -309,7 +309,7 @@ int main(int argc, char** argv) } builder = gtk_builder_new(); - gladefile = DATAROOTDIR "viewtorrents/viewtorrents.glade"; + gladefile = g_build_filename(DATAROOTDIR, "viewtorrents.glade", NULL); ret = gtk_builder_add_from_file(builder, gladefile, &error); #ifdef DEBUG if (ret == 0) @@ -322,9 +322,11 @@ int main(int argc, char** argv) if (ret == 0) { fprintf(stderr, "Unable to load %s: %s\n", gladefile, error->message); + g_free(gladefile); g_clear_error(&error); return EXIT_FAILURE; } + g_free(gladefile); master.torrents = g_hash_table_new_full(g_direct_hash, g_direct_equal, noop_destroy, torrent_destroy); -- cgit v1.2.3-70-g09d2