From 2158ef37cd7e8f87b75261b57e563950d6656d78 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 3 Apr 2008 02:11:15 +0000 Subject: [PATCH] (gtk) "open torrent" --> "add torrent" --- gtk/Makefile.am | 4 +-- gtk/actions.c | 4 +-- gtk/{open-dialog.c => add-dialog.c} | 40 ++++++++++++++--------------- gtk/{open-dialog.h => add-dialog.h} | 16 ++++++------ gtk/main.c | 9 ++++--- gtk/tr-prefs.c | 4 +-- gtk/ui.h | 6 ++--- po/POTFILES.in | 2 +- 8 files changed, 43 insertions(+), 42 deletions(-) rename gtk/{open-dialog.c => add-dialog.c} (92%) rename gtk/{open-dialog.h => add-dialog.h} (58%) diff --git a/gtk/Makefile.am b/gtk/Makefile.am index 084aae478..b52acfbe1 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -15,6 +15,7 @@ AM_CFLAGS = \ noinst_HEADERS = \ actions.h \ + add-dialog.h \ conf.h \ details.h \ dialogs.h \ @@ -26,7 +27,6 @@ noinst_HEADERS = \ makemeta-ui.h \ msgwin.h \ notify.h \ - open-dialog.h \ stats.h \ sexy-icon-entry.h \ torrent-cell-renderer.h \ @@ -43,6 +43,7 @@ bin_PROGRAMS = transmission transmission_SOURCES = \ actions.c \ + add-dialog.c \ conf.c \ details.c \ dialogs.c \ @@ -53,7 +54,6 @@ transmission_SOURCES = \ makemeta-ui.c \ msgwin.c \ notify.c \ - open-dialog.c \ sexy-icon-entry.c \ stats.c \ torrent-cell-renderer.c \ diff --git a/gtk/actions.c b/gtk/actions.c index 8006bd82a..6b881e225 100644 --- a/gtk/actions.c +++ b/gtk/actions.c @@ -99,8 +99,8 @@ static GtkActionEntry entries[] = { "sort-menu", NULL, N_("_Sort Torrents By"), NULL, NULL, NULL }, { "edit-menu", NULL, N_("_Edit"), NULL, NULL, NULL }, { "help-menu", NULL, N_("_Help"), NULL, NULL, NULL }, - { "open-torrent-toolbar", GTK_STOCK_OPEN, NULL, NULL, N_("Open a torrent"), G_CALLBACK(action_cb) }, - { "open-torrent-menu", GTK_STOCK_OPEN, N_("_Open..."), NULL, N_("Open a torrent"), G_CALLBACK(action_cb) }, + { "add-torrent-toolbar", GTK_STOCK_ADD, NULL, NULL, N_("Add a torrent"), G_CALLBACK(action_cb) }, + { "add-torrent-menu", GTK_STOCK_ADD, N_("_Add..."), NULL, N_("Add a torrent"), G_CALLBACK(action_cb) }, { "start-torrent", GTK_STOCK_MEDIA_PLAY, N_("_Start"), "S", N_("Start torrent"), G_CALLBACK(action_cb) }, { "show-stats", NULL, N_("_Statistics"), NULL, NULL, G_CALLBACK(action_cb) }, diff --git a/gtk/open-dialog.c b/gtk/add-dialog.c similarity index 92% rename from gtk/open-dialog.c rename to gtk/add-dialog.c index c58d3e86d..bff4968f0 100644 --- a/gtk/open-dialog.c +++ b/gtk/add-dialog.c @@ -12,13 +12,13 @@ #include #include +#include "add-dialog.h" #include "conf.h" #include "file-list.h" #include "hig.h" -#include "open-dialog.h" #include "tr-prefs.h" -struct OpenData +struct AddData { TrCore * core; GtkWidget * list; @@ -31,7 +31,7 @@ struct OpenData }; static void -deleteOldTorrent( struct OpenData * data ) +deleteOldTorrent( struct AddData * data ) { if( data->gtor ) { @@ -44,9 +44,9 @@ deleteOldTorrent( struct OpenData * data ) } static void -openResponseCB( GtkDialog * dialog, gint response, gpointer gdata ) +addResponseCB( GtkDialog * dialog, gint response, gpointer gdata ) { - struct OpenData * data = gdata; + struct AddData * data = gdata; if( data->gtor ) { @@ -69,7 +69,7 @@ openResponseCB( GtkDialog * dialog, gint response, gpointer gdata ) } static void -updateTorrent( struct OpenData * o ) +updateTorrent( struct AddData * o ) { if( o->gtor ) tr_torrentSetFolder( tr_torrent_handle( o->gtor ), o->destination ); @@ -80,7 +80,7 @@ updateTorrent( struct OpenData * o ) static void sourceChanged( GtkFileChooserButton * b, gpointer gdata ) { - struct OpenData * data = gdata; + struct AddData * data = gdata; deleteOldTorrent( data ); @@ -106,7 +106,7 @@ sourceChanged( GtkFileChooserButton * b, gpointer gdata ) static void verifyRequested( GtkButton * button UNUSED, gpointer gdata ) { - struct OpenData * data = gdata; + struct AddData * data = gdata; if( data->gtor ) tr_torrentVerify( tr_torrent_handle( data->gtor ) ); } @@ -114,7 +114,7 @@ verifyRequested( GtkButton * button UNUSED, gpointer gdata ) static void destinationChanged( GtkFileChooserButton * b, gpointer gdata ) { - struct OpenData * data = gdata; + struct AddData * data = gdata; g_free( data->destination ); data->destination = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( b ) ); @@ -144,9 +144,9 @@ addTorrentFilters( GtkFileChooser * chooser ) ****/ GtkWidget* -openSingleTorrentDialog( GtkWindow * parent, - TrCore * core, - tr_ctor * ctor ) +addSingleTorrentDialog( GtkWindow * parent, + TrCore * core, + tr_ctor * ctor ) { int row; int col; @@ -155,14 +155,14 @@ openSingleTorrentDialog( GtkWindow * parent, GtkWidget * d; GtkWidget * t; GtkWidget * l; - struct OpenData * data; + struct AddData * data; uint8_t flag; /* make the dialog */ d = gtk_dialog_new_with_buttons( _( "Torrent Options" ), parent, GTK_DIALOG_DESTROY_WITH_PARENT|GTK_DIALOG_NO_SEPARATOR, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, + GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT, NULL ); gtk_dialog_set_default_response( GTK_DIALOG( d ), GTK_RESPONSE_ACCEPT ); @@ -174,17 +174,17 @@ openSingleTorrentDialog( GtkWindow * parent, if( tr_ctorGetDestination( ctor, TR_FORCE, &str ) ) g_assert_not_reached( ); - data = g_new0( struct OpenData, 1 ); + data = g_new0( struct AddData, 1 ); data->core = core; data->ctor = ctor; data->filename = g_strdup( tr_ctorGetSourceFile( ctor ) ); data->destination = g_strdup( str ); data->list = file_list_new( NULL ); data->trash_check = gtk_check_button_new_with_mnemonic( _( "Mo_ve source file to Trash" ) ); - data->run_check = gtk_check_button_new_with_mnemonic( _( "_Start when opened" ) ); + data->run_check = gtk_check_button_new_with_mnemonic( _( "_Start when added" ) ); g_signal_connect( G_OBJECT( d ), "response", - G_CALLBACK( openResponseCB ), data ); + G_CALLBACK( addResponseCB ), data ); t = gtk_table_new( 6, 2, FALSE ); gtk_container_set_border_width( GTK_CONTAINER( t ), GUI_PAD_BIG ); @@ -281,8 +281,8 @@ onOpenDialogResponse( GtkDialog * dialog, int response, gpointer core ) } GtkWidget* -openDialog( GtkWindow * parent, - TrCore * core ) +addDialog( GtkWindow * parent, + TrCore * core ) { GtkWidget * w; GtkWidget * c; @@ -291,7 +291,7 @@ openDialog( GtkWindow * parent, w = gtk_file_chooser_dialog_new( _( "Open a Torrent" ), parent, GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, + GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT, NULL ); gtk_dialog_set_alternative_button_order( GTK_DIALOG( w ), GTK_RESPONSE_ACCEPT, diff --git a/gtk/open-dialog.h b/gtk/add-dialog.h similarity index 58% rename from gtk/open-dialog.h rename to gtk/add-dialog.h index 22fd631aa..2977175eb 100644 --- a/gtk/open-dialog.h +++ b/gtk/add-dialog.h @@ -10,18 +10,18 @@ * $Id$ */ -#ifndef TR_GTK_OPEN_DIALOG_H -#define TR_GTK_OPEN_DIALOG_H +#ifndef TR_GTK_ADD_DIALOG_H +#define TR_GTK_ADD_DIALOG_H #include #include "tr-core.h" /* This dialog assumes ownership of the ctor */ -GtkWidget* openSingleTorrentDialog( GtkWindow * parent, - TrCore * core, - tr_ctor * ctor ); +GtkWidget* addSingleTorrentDialog( GtkWindow * parent, + TrCore * core, + tr_ctor * ctor ); -GtkWidget* openDialog( GtkWindow * parent, - TrCore * core ); +GtkWidget* addDialog( GtkWindow * parent, + TrCore * core ); -#endif /* TR_GTK_OPEN_DIALOG */ +#endif /* TR_GTK_ADD_DIALOG */ diff --git a/gtk/main.c b/gtk/main.c index 7a6837e8c..fddfd5837 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -41,6 +41,7 @@ #endif #include "actions.h" +#include "add-dialog.h" #include "conf.h" #include "details.h" #include "dialogs.h" @@ -49,7 +50,6 @@ #include "makemeta-ui.h" #include "msgwin.h" #include "notify.h" -#include "open-dialog.h" #include "stats.h" #include "tr-core.h" #include "tr-icon.h" @@ -780,7 +780,7 @@ static void onAddTorrent( TrCore * core, tr_ctor * ctor, gpointer gdata ) { struct cbdata * cbdata = gdata; - GtkWidget * w = openSingleTorrentDialog( cbdata->wind, core, ctor ); + GtkWidget * w = addSingleTorrentDialog( cbdata->wind, core, ctor ); #if GTK_CHECK_VERSION(2,8,0) g_signal_connect( w, "focus-in-event", G_CALLBACK(on_main_window_focus_in), cbdata ); gtk_window_set_urgency_hint( cbdata->wind, TRUE ); @@ -1009,9 +1009,10 @@ doAction ( const char * action_name, gpointer user_data ) struct cbdata * data = user_data; gboolean changed = FALSE; - if ( !strcmp (action_name, "open-torrent-menu") || !strcmp( action_name, "open-torrent-toolbar" )) + if ( !strcmp (action_name, "add-torrent-menu") || + !strcmp( action_name, "add-torrent-toolbar" )) { - openDialog( data->wind, data->core ); + addDialog( data->wind, data->core ); } else if (!strcmp (action_name, "show-stats")) { diff --git a/gtk/tr-prefs.c b/gtk/tr-prefs.c index 970e08ef9..c9e981711 100644 --- a/gtk/tr-prefs.c +++ b/gtk/tr-prefs.c @@ -230,7 +230,7 @@ torrentPage( GObject * core ) #endif t = hig_workarea_create( ); - hig_workarea_add_section_title( t, &row, _( "Opening Torrents" ) ); + hig_workarea_add_section_title( t, &row, _( "Adding Torrents" ) ); #ifdef HAVE_GIO s = _( "Automatically add torrents from:" ); @@ -245,7 +245,7 @@ torrentPage( GObject * core ) w = new_check_button( s, PREF_KEY_OPTIONS_PROMPT, core ); hig_workarea_add_wide_control( t, &row, w ); - s = _( "_Start when opened" ); + s = _( "_Start when added" ); w = new_check_button( s, PREF_KEY_START, core ); hig_workarea_add_wide_control( t, &row, w ); diff --git a/gtk/ui.h b/gtk/ui.h index a39b8a57d..b76c61b75 100644 --- a/gtk/ui.h +++ b/gtk/ui.h @@ -2,7 +2,7 @@ const char * fallback_ui_file = "\n" " \n" " \n" -" \n" +" \n" " \n" " \n" " \n" @@ -46,7 +46,7 @@ const char * fallback_ui_file = " \n" "\n" " \n" -" \n" +" \n" " \n" " \n" " \n" @@ -67,7 +67,7 @@ const char * fallback_ui_file = " \n" "\n" " \n" -" \n" +" \n" " \n" " \n" " \n" diff --git a/po/POTFILES.in b/po/POTFILES.in index 8dd079ba3..4ab5a7a33 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,5 +1,6 @@ [encoding: UTF-8] gtk/actions.c +gtk/add-dialog.c gtk/conf.c gtk/details.c gtk/dialogs.c @@ -10,7 +11,6 @@ gtk/main.c gtk/makemeta-ui.c gtk/msgwin.c gtk/notify.c -gtk/open-dialog.c gtk/sexy-icon-entry.c gtk/stats.c gtk/torrent-cell-renderer.c