(gtk) "open torrent" --> "add torrent"

This commit is contained in:
Charles Kerr 2008-04-03 02:11:15 +00:00
parent 41b50abfa9
commit 2158ef37cd
8 changed files with 43 additions and 42 deletions

View File

@ -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 \

View File

@ -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"), "<control>S", N_("Start torrent"), G_CALLBACK(action_cb) },
{ "show-stats", NULL, N_("_Statistics"), NULL, NULL, G_CALLBACK(action_cb) },

View File

@ -12,13 +12,13 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#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,

View File

@ -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 <gtk/gtkwindow.h>
#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 */

View File

@ -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"))
{

View File

@ -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 );

View File

@ -2,7 +2,7 @@ const char * fallback_ui_file =
"<ui>\n"
" <menubar name='main-window-menu'>\n"
" <menu action='torrent-menu'>\n"
" <menuitem action='open-torrent-menu'/>\n"
" <menuitem action='add-torrent-menu'/>\n"
" <menuitem action='new-torrent'/>\n"
" <separator/>\n"
" <menuitem action='start-torrent'/>\n"
@ -46,7 +46,7 @@ const char * fallback_ui_file =
" </menubar>\n"
"\n"
" <toolbar name='main-window-toolbar'>\n"
" <toolitem action='open-torrent-toolbar'/>\n"
" <toolitem action='add-torrent-toolbar'/>\n"
" <toolitem action='start-torrent'/>\n"
" <toolitem action='pause-torrent'/>\n"
" <toolitem action='remove-torrent'/>\n"
@ -67,7 +67,7 @@ const char * fallback_ui_file =
" </popup>\n"
"\n"
" <popup name='icon-popup'>\n"
" <menuitem action='open-torrent-menu'/>\n"
" <menuitem action='add-torrent-menu'/>\n"
" <separator/>\n"
" <menuitem action='toggle-main-window'/>\n"
" <menuitem action='toggle-message-log'/>\n"

View File

@ -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