From be0bd5488f13306a0d0afa713a3f3581a338fcbe Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Sat, 19 Nov 2011 00:12:38 +0100 Subject: Add about dialog. --- gui/viewtorrents.glade | 76 +++++++++++++++++++++++++++++++++++++------------- src/main.c | 22 ++++++++++++++- 2 files changed, 78 insertions(+), 20 deletions(-) diff --git a/gui/viewtorrents.glade b/gui/viewtorrents.glade index cee5b9a..55715d1 100644 --- a/gui/viewtorrents.glade +++ b/gui/viewtorrents.glade @@ -2,21 +2,22 @@ - - - Connect - Connect to rTorrent - gtk-connect + + Rehash + Rehash selected torrent + gtk-refresh + - - Disconnect - Disconnect from rTorrent - gtk-disconnect + + Stop + Stop selected torrent + gtk-media-stop + @@ -27,22 +28,58 @@ - - Stop - Stop selected torrent - gtk-media-stop + + Disconnect + Disconnect from rTorrent + gtk-disconnect - - - Rehash - Rehash selected torrent - gtk-refresh + + Connect + Connect to rTorrent + gtk-connect + + + + + False + 5 + About + center-on-parent + True + dialog + main + Viewtorrents + 0.1 + Copyright Joel Klinghed 2011 + Joel Klinghed + viewtorrents + + + True + False + 2 + + + True + False + end + + + False + True + end + 0 + + + + + - + False 5 @@ -391,6 +428,7 @@ If authentication is needed, enter username and password as well. True False + 1 connectaction diff --git a/src/main.c b/src/main.c index 5f0953e..37b864f 100644 --- a/src/main.c +++ b/src/main.c @@ -73,6 +73,8 @@ typedef struct GtkWidget* statusbar; guint status_contextid; + GtkWidget* aboutdlg; + GKeyFile* config; gchar* configfile; guint config_timer; @@ -259,6 +261,8 @@ static void do_start(GtkAction* action, gpointer data); static void do_stop(GtkAction* action, gpointer data); static void do_rehash(GtkAction* action, gpointer data); +static void do_about(GtkMenuItem* menuitem, gpointer data); + static gpointer worker_main(gpointer data); static gboolean incoming_msg(gpointer data); static gboolean sync_config(gpointer data); @@ -315,7 +319,7 @@ int main(int argc, char** argv) if (ret == 0) { g_clear_error(&error); - gladefile = "gui/viewtorrents.glade"; + gladefile = g_strdup("gui/viewtorrents.glade"); ret = gtk_builder_add_from_file(builder, gladefile, &error); } #endif @@ -338,6 +342,16 @@ int main(int argc, char** argv) g_signal_connect(gtk_builder_get_object(builder, "quitmenuitem"), "activate", G_CALLBACK(gtk_main_quit), NULL); + master.aboutdlg = GTK_WIDGET(gtk_builder_get_object(builder, + "aboutdialog")); + g_signal_connect_swapped(master.aboutdlg, + "response", + G_CALLBACK(gtk_widget_hide), + master.aboutdlg); + + g_signal_connect(gtk_builder_get_object(builder, "aboutmenuitem"), + "activate", G_CALLBACK(do_about), &master); + master.connectaction = GTK_ACTION(gtk_builder_get_object(builder, "connectaction")); g_signal_connect(master.connectaction, @@ -2234,3 +2248,9 @@ void listselection_changed(GtkTreeSelection* selection, gtk_action_set_sensitive(master->stopaction, FALSE); gtk_action_set_sensitive(master->rehashaction, FALSE); } + +void do_about(GtkMenuItem* G_GNUC_UNUSED menuitem, gpointer data) +{ + master_t* master = data; + gtk_widget_show_all(master->aboutdlg); +} -- cgit v1.2.3-70-g09d2