diff options
| -rw-r--r-- | gui/viewtorrents.glade | 76 | ||||
| -rw-r--r-- | 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 @@ <interface> <requires lib="gtk+" version="2.18"/> <!-- interface-naming-policy project-wide --> - <object class="GtkAccelGroup" id="accelgroup1"/> <object class="GtkActionGroup" id="actiongroup"> <child> - <object class="GtkAction" id="connectaction"> - <property name="label" translatable="yes">Connect</property> - <property name="tooltip" translatable="yes">Connect to rTorrent</property> - <property name="stock_id">gtk-connect</property> + <object class="GtkAction" id="rehashaction"> + <property name="label" translatable="yes">Rehash</property> + <property name="tooltip" translatable="yes">Rehash selected torrent</property> + <property name="stock_id">gtk-refresh</property> </object> + <accelerator key="r" modifiers="GDK_CONTROL_MASK"/> </child> <child> - <object class="GtkAction" id="disconnectaction"> - <property name="label" translatable="yes">Disconnect</property> - <property name="tooltip" translatable="yes">Disconnect from rTorrent</property> - <property name="stock_id">gtk-disconnect</property> + <object class="GtkAction" id="stopaction"> + <property name="label" translatable="yes">Stop</property> + <property name="tooltip" translatable="yes">Stop selected torrent</property> + <property name="stock_id">gtk-media-stop</property> </object> + <accelerator key="d" modifiers="GDK_CONTROL_MASK"/> </child> <child> <object class="GtkAction" id="startaction"> @@ -27,22 +28,58 @@ <accelerator key="s" modifiers="GDK_CONTROL_MASK"/> </child> <child> - <object class="GtkAction" id="stopaction"> - <property name="label" translatable="yes">Stop</property> - <property name="tooltip" translatable="yes">Stop selected torrent</property> - <property name="stock_id">gtk-media-stop</property> + <object class="GtkAction" id="disconnectaction"> + <property name="label" translatable="yes">Disconnect</property> + <property name="tooltip" translatable="yes">Disconnect from rTorrent</property> + <property name="stock_id">gtk-disconnect</property> </object> - <accelerator key="d" modifiers="GDK_CONTROL_MASK"/> </child> <child> - <object class="GtkAction" id="rehashaction"> - <property name="label" translatable="yes">Rehash</property> - <property name="tooltip" translatable="yes">Rehash selected torrent</property> - <property name="stock_id">gtk-refresh</property> + <object class="GtkAction" id="connectaction"> + <property name="label" translatable="yes">Connect</property> + <property name="tooltip" translatable="yes">Connect to rTorrent</property> + <property name="stock_id">gtk-connect</property> + </object> + </child> + </object> + <object class="GtkAboutDialog" id="aboutdialog"> + <property name="can_focus">False</property> + <property name="border_width">5</property> + <property name="title" translatable="yes">About</property> + <property name="window_position">center-on-parent</property> + <property name="destroy_with_parent">True</property> + <property name="type_hint">dialog</property> + <property name="transient_for">main</property> + <property name="program_name">Viewtorrents</property> + <property name="version">0.1</property> + <property name="copyright" translatable="yes">Copyright Joel Klinghed 2011</property> + <property name="authors">Joel Klinghed</property> + <property name="logo_icon_name">viewtorrents</property> + <child internal-child="vbox"> + <object class="GtkVBox" id="dialog-vbox4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">2</property> + <child internal-child="action_area"> + <object class="GtkHButtonBox" id="dialog-action_area4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="layout_style">end</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">end</property> + <property name="position">0</property> + </packing> + </child> + <child> + <placeholder/> + </child> </object> - <accelerator key="r" modifiers="GDK_CONTROL_MASK"/> </child> </object> + <object class="GtkAccelGroup" id="accelgroup1"/> <object class="GtkDialog" id="connectdlg"> <property name="can_focus">False</property> <property name="border_width">5</property> @@ -391,6 +428,7 @@ If authentication is needed, enter username and password as well.</property> <object class="GtkToolbar" id="toolbar"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="icon_size">1</property> <child> <object class="GtkToolButton" id="connecttoolitem"> <property name="related_action">connectaction</property> @@ -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); +} |
