(gtk) "open torrent" --> "add torrent"
This commit is contained in:
parent
41b50abfa9
commit
2158ef37cd
|
@ -15,6 +15,7 @@ AM_CFLAGS = \
|
||||||
|
|
||||||
noinst_HEADERS = \
|
noinst_HEADERS = \
|
||||||
actions.h \
|
actions.h \
|
||||||
|
add-dialog.h \
|
||||||
conf.h \
|
conf.h \
|
||||||
details.h \
|
details.h \
|
||||||
dialogs.h \
|
dialogs.h \
|
||||||
|
@ -26,7 +27,6 @@ noinst_HEADERS = \
|
||||||
makemeta-ui.h \
|
makemeta-ui.h \
|
||||||
msgwin.h \
|
msgwin.h \
|
||||||
notify.h \
|
notify.h \
|
||||||
open-dialog.h \
|
|
||||||
stats.h \
|
stats.h \
|
||||||
sexy-icon-entry.h \
|
sexy-icon-entry.h \
|
||||||
torrent-cell-renderer.h \
|
torrent-cell-renderer.h \
|
||||||
|
@ -43,6 +43,7 @@ bin_PROGRAMS = transmission
|
||||||
|
|
||||||
transmission_SOURCES = \
|
transmission_SOURCES = \
|
||||||
actions.c \
|
actions.c \
|
||||||
|
add-dialog.c \
|
||||||
conf.c \
|
conf.c \
|
||||||
details.c \
|
details.c \
|
||||||
dialogs.c \
|
dialogs.c \
|
||||||
|
@ -53,7 +54,6 @@ transmission_SOURCES = \
|
||||||
makemeta-ui.c \
|
makemeta-ui.c \
|
||||||
msgwin.c \
|
msgwin.c \
|
||||||
notify.c \
|
notify.c \
|
||||||
open-dialog.c \
|
|
||||||
sexy-icon-entry.c \
|
sexy-icon-entry.c \
|
||||||
stats.c \
|
stats.c \
|
||||||
torrent-cell-renderer.c \
|
torrent-cell-renderer.c \
|
||||||
|
|
|
@ -99,8 +99,8 @@ static GtkActionEntry entries[] =
|
||||||
{ "sort-menu", NULL, N_("_Sort Torrents By"), NULL, NULL, NULL },
|
{ "sort-menu", NULL, N_("_Sort Torrents By"), NULL, NULL, NULL },
|
||||||
{ "edit-menu", NULL, N_("_Edit"), NULL, NULL, NULL },
|
{ "edit-menu", NULL, N_("_Edit"), NULL, NULL, NULL },
|
||||||
{ "help-menu", NULL, N_("_Help"), 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) },
|
{ "add-torrent-toolbar", GTK_STOCK_ADD, NULL, NULL, N_("Add 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-menu", GTK_STOCK_ADD, N_("_Add..."), NULL, N_("Add a torrent"), G_CALLBACK(action_cb) },
|
||||||
{ "start-torrent", GTK_STOCK_MEDIA_PLAY,
|
{ "start-torrent", GTK_STOCK_MEDIA_PLAY,
|
||||||
N_("_Start"), "<control>S", N_("Start torrent"), G_CALLBACK(action_cb) },
|
N_("_Start"), "<control>S", N_("Start torrent"), G_CALLBACK(action_cb) },
|
||||||
{ "show-stats", NULL, N_("_Statistics"), NULL, NULL, G_CALLBACK(action_cb) },
|
{ "show-stats", NULL, N_("_Statistics"), NULL, NULL, G_CALLBACK(action_cb) },
|
||||||
|
|
|
@ -12,13 +12,13 @@
|
||||||
|
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
#include "add-dialog.h"
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
#include "file-list.h"
|
#include "file-list.h"
|
||||||
#include "hig.h"
|
#include "hig.h"
|
||||||
#include "open-dialog.h"
|
|
||||||
#include "tr-prefs.h"
|
#include "tr-prefs.h"
|
||||||
|
|
||||||
struct OpenData
|
struct AddData
|
||||||
{
|
{
|
||||||
TrCore * core;
|
TrCore * core;
|
||||||
GtkWidget * list;
|
GtkWidget * list;
|
||||||
|
@ -31,7 +31,7 @@ struct OpenData
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
deleteOldTorrent( struct OpenData * data )
|
deleteOldTorrent( struct AddData * data )
|
||||||
{
|
{
|
||||||
if( data->gtor )
|
if( data->gtor )
|
||||||
{
|
{
|
||||||
|
@ -44,9 +44,9 @@ deleteOldTorrent( struct OpenData * data )
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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 )
|
if( data->gtor )
|
||||||
{
|
{
|
||||||
|
@ -69,7 +69,7 @@ openResponseCB( GtkDialog * dialog, gint response, gpointer gdata )
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
updateTorrent( struct OpenData * o )
|
updateTorrent( struct AddData * o )
|
||||||
{
|
{
|
||||||
if( o->gtor )
|
if( o->gtor )
|
||||||
tr_torrentSetFolder( tr_torrent_handle( o->gtor ), o->destination );
|
tr_torrentSetFolder( tr_torrent_handle( o->gtor ), o->destination );
|
||||||
|
@ -80,7 +80,7 @@ updateTorrent( struct OpenData * o )
|
||||||
static void
|
static void
|
||||||
sourceChanged( GtkFileChooserButton * b, gpointer gdata )
|
sourceChanged( GtkFileChooserButton * b, gpointer gdata )
|
||||||
{
|
{
|
||||||
struct OpenData * data = gdata;
|
struct AddData * data = gdata;
|
||||||
|
|
||||||
deleteOldTorrent( data );
|
deleteOldTorrent( data );
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ sourceChanged( GtkFileChooserButton * b, gpointer gdata )
|
||||||
static void
|
static void
|
||||||
verifyRequested( GtkButton * button UNUSED, gpointer gdata )
|
verifyRequested( GtkButton * button UNUSED, gpointer gdata )
|
||||||
{
|
{
|
||||||
struct OpenData * data = gdata;
|
struct AddData * data = gdata;
|
||||||
if( data->gtor )
|
if( data->gtor )
|
||||||
tr_torrentVerify( tr_torrent_handle( data->gtor ) );
|
tr_torrentVerify( tr_torrent_handle( data->gtor ) );
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ verifyRequested( GtkButton * button UNUSED, gpointer gdata )
|
||||||
static void
|
static void
|
||||||
destinationChanged( GtkFileChooserButton * b, gpointer gdata )
|
destinationChanged( GtkFileChooserButton * b, gpointer gdata )
|
||||||
{
|
{
|
||||||
struct OpenData * data = gdata;
|
struct AddData * data = gdata;
|
||||||
|
|
||||||
g_free( data->destination );
|
g_free( data->destination );
|
||||||
data->destination = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( b ) );
|
data->destination = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( b ) );
|
||||||
|
@ -144,9 +144,9 @@ addTorrentFilters( GtkFileChooser * chooser )
|
||||||
****/
|
****/
|
||||||
|
|
||||||
GtkWidget*
|
GtkWidget*
|
||||||
openSingleTorrentDialog( GtkWindow * parent,
|
addSingleTorrentDialog( GtkWindow * parent,
|
||||||
TrCore * core,
|
TrCore * core,
|
||||||
tr_ctor * ctor )
|
tr_ctor * ctor )
|
||||||
{
|
{
|
||||||
int row;
|
int row;
|
||||||
int col;
|
int col;
|
||||||
|
@ -155,14 +155,14 @@ openSingleTorrentDialog( GtkWindow * parent,
|
||||||
GtkWidget * d;
|
GtkWidget * d;
|
||||||
GtkWidget * t;
|
GtkWidget * t;
|
||||||
GtkWidget * l;
|
GtkWidget * l;
|
||||||
struct OpenData * data;
|
struct AddData * data;
|
||||||
uint8_t flag;
|
uint8_t flag;
|
||||||
|
|
||||||
/* make the dialog */
|
/* make the dialog */
|
||||||
d = gtk_dialog_new_with_buttons( _( "Torrent Options" ), parent,
|
d = gtk_dialog_new_with_buttons( _( "Torrent Options" ), parent,
|
||||||
GTK_DIALOG_DESTROY_WITH_PARENT|GTK_DIALOG_NO_SEPARATOR,
|
GTK_DIALOG_DESTROY_WITH_PARENT|GTK_DIALOG_NO_SEPARATOR,
|
||||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||||
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
|
GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT,
|
||||||
NULL );
|
NULL );
|
||||||
gtk_dialog_set_default_response( GTK_DIALOG( d ),
|
gtk_dialog_set_default_response( GTK_DIALOG( d ),
|
||||||
GTK_RESPONSE_ACCEPT );
|
GTK_RESPONSE_ACCEPT );
|
||||||
|
@ -174,17 +174,17 @@ openSingleTorrentDialog( GtkWindow * parent,
|
||||||
if( tr_ctorGetDestination( ctor, TR_FORCE, &str ) )
|
if( tr_ctorGetDestination( ctor, TR_FORCE, &str ) )
|
||||||
g_assert_not_reached( );
|
g_assert_not_reached( );
|
||||||
|
|
||||||
data = g_new0( struct OpenData, 1 );
|
data = g_new0( struct AddData, 1 );
|
||||||
data->core = core;
|
data->core = core;
|
||||||
data->ctor = ctor;
|
data->ctor = ctor;
|
||||||
data->filename = g_strdup( tr_ctorGetSourceFile( ctor ) );
|
data->filename = g_strdup( tr_ctorGetSourceFile( ctor ) );
|
||||||
data->destination = g_strdup( str );
|
data->destination = g_strdup( str );
|
||||||
data->list = file_list_new( NULL );
|
data->list = file_list_new( NULL );
|
||||||
data->trash_check = gtk_check_button_new_with_mnemonic( _( "Mo_ve source file to Trash" ) );
|
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_signal_connect( G_OBJECT( d ), "response",
|
||||||
G_CALLBACK( openResponseCB ), data );
|
G_CALLBACK( addResponseCB ), data );
|
||||||
|
|
||||||
t = gtk_table_new( 6, 2, FALSE );
|
t = gtk_table_new( 6, 2, FALSE );
|
||||||
gtk_container_set_border_width( GTK_CONTAINER( t ), GUI_PAD_BIG );
|
gtk_container_set_border_width( GTK_CONTAINER( t ), GUI_PAD_BIG );
|
||||||
|
@ -281,8 +281,8 @@ onOpenDialogResponse( GtkDialog * dialog, int response, gpointer core )
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget*
|
GtkWidget*
|
||||||
openDialog( GtkWindow * parent,
|
addDialog( GtkWindow * parent,
|
||||||
TrCore * core )
|
TrCore * core )
|
||||||
{
|
{
|
||||||
GtkWidget * w;
|
GtkWidget * w;
|
||||||
GtkWidget * c;
|
GtkWidget * c;
|
||||||
|
@ -291,7 +291,7 @@ openDialog( GtkWindow * parent,
|
||||||
w = gtk_file_chooser_dialog_new( _( "Open a Torrent" ), parent,
|
w = gtk_file_chooser_dialog_new( _( "Open a Torrent" ), parent,
|
||||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||||
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
|
GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT,
|
||||||
NULL );
|
NULL );
|
||||||
gtk_dialog_set_alternative_button_order( GTK_DIALOG( w ),
|
gtk_dialog_set_alternative_button_order( GTK_DIALOG( w ),
|
||||||
GTK_RESPONSE_ACCEPT,
|
GTK_RESPONSE_ACCEPT,
|
|
@ -10,18 +10,18 @@
|
||||||
* $Id$
|
* $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TR_GTK_OPEN_DIALOG_H
|
#ifndef TR_GTK_ADD_DIALOG_H
|
||||||
#define TR_GTK_OPEN_DIALOG_H
|
#define TR_GTK_ADD_DIALOG_H
|
||||||
|
|
||||||
#include <gtk/gtkwindow.h>
|
#include <gtk/gtkwindow.h>
|
||||||
#include "tr-core.h"
|
#include "tr-core.h"
|
||||||
|
|
||||||
/* This dialog assumes ownership of the ctor */
|
/* This dialog assumes ownership of the ctor */
|
||||||
GtkWidget* openSingleTorrentDialog( GtkWindow * parent,
|
GtkWidget* addSingleTorrentDialog( GtkWindow * parent,
|
||||||
TrCore * core,
|
TrCore * core,
|
||||||
tr_ctor * ctor );
|
tr_ctor * ctor );
|
||||||
|
|
||||||
GtkWidget* openDialog( GtkWindow * parent,
|
GtkWidget* addDialog( GtkWindow * parent,
|
||||||
TrCore * core );
|
TrCore * core );
|
||||||
|
|
||||||
#endif /* TR_GTK_OPEN_DIALOG */
|
#endif /* TR_GTK_ADD_DIALOG */
|
|
@ -41,6 +41,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "actions.h"
|
#include "actions.h"
|
||||||
|
#include "add-dialog.h"
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
#include "details.h"
|
#include "details.h"
|
||||||
#include "dialogs.h"
|
#include "dialogs.h"
|
||||||
|
@ -49,7 +50,6 @@
|
||||||
#include "makemeta-ui.h"
|
#include "makemeta-ui.h"
|
||||||
#include "msgwin.h"
|
#include "msgwin.h"
|
||||||
#include "notify.h"
|
#include "notify.h"
|
||||||
#include "open-dialog.h"
|
|
||||||
#include "stats.h"
|
#include "stats.h"
|
||||||
#include "tr-core.h"
|
#include "tr-core.h"
|
||||||
#include "tr-icon.h"
|
#include "tr-icon.h"
|
||||||
|
@ -780,7 +780,7 @@ static void
|
||||||
onAddTorrent( TrCore * core, tr_ctor * ctor, gpointer gdata )
|
onAddTorrent( TrCore * core, tr_ctor * ctor, gpointer gdata )
|
||||||
{
|
{
|
||||||
struct cbdata * cbdata = 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)
|
#if GTK_CHECK_VERSION(2,8,0)
|
||||||
g_signal_connect( w, "focus-in-event", G_CALLBACK(on_main_window_focus_in), cbdata );
|
g_signal_connect( w, "focus-in-event", G_CALLBACK(on_main_window_focus_in), cbdata );
|
||||||
gtk_window_set_urgency_hint( cbdata->wind, TRUE );
|
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;
|
struct cbdata * data = user_data;
|
||||||
gboolean changed = FALSE;
|
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"))
|
else if (!strcmp (action_name, "show-stats"))
|
||||||
{
|
{
|
||||||
|
|
|
@ -230,7 +230,7 @@ torrentPage( GObject * core )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
t = hig_workarea_create( );
|
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
|
#ifdef HAVE_GIO
|
||||||
s = _( "Automatically add torrents from:" );
|
s = _( "Automatically add torrents from:" );
|
||||||
|
@ -245,7 +245,7 @@ torrentPage( GObject * core )
|
||||||
w = new_check_button( s, PREF_KEY_OPTIONS_PROMPT, core );
|
w = new_check_button( s, PREF_KEY_OPTIONS_PROMPT, core );
|
||||||
hig_workarea_add_wide_control( t, &row, w );
|
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 );
|
w = new_check_button( s, PREF_KEY_START, core );
|
||||||
hig_workarea_add_wide_control( t, &row, w );
|
hig_workarea_add_wide_control( t, &row, w );
|
||||||
|
|
||||||
|
|
6
gtk/ui.h
6
gtk/ui.h
|
@ -2,7 +2,7 @@ const char * fallback_ui_file =
|
||||||
"<ui>\n"
|
"<ui>\n"
|
||||||
" <menubar name='main-window-menu'>\n"
|
" <menubar name='main-window-menu'>\n"
|
||||||
" <menu action='torrent-menu'>\n"
|
" <menu action='torrent-menu'>\n"
|
||||||
" <menuitem action='open-torrent-menu'/>\n"
|
" <menuitem action='add-torrent-menu'/>\n"
|
||||||
" <menuitem action='new-torrent'/>\n"
|
" <menuitem action='new-torrent'/>\n"
|
||||||
" <separator/>\n"
|
" <separator/>\n"
|
||||||
" <menuitem action='start-torrent'/>\n"
|
" <menuitem action='start-torrent'/>\n"
|
||||||
|
@ -46,7 +46,7 @@ const char * fallback_ui_file =
|
||||||
" </menubar>\n"
|
" </menubar>\n"
|
||||||
"\n"
|
"\n"
|
||||||
" <toolbar name='main-window-toolbar'>\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='start-torrent'/>\n"
|
||||||
" <toolitem action='pause-torrent'/>\n"
|
" <toolitem action='pause-torrent'/>\n"
|
||||||
" <toolitem action='remove-torrent'/>\n"
|
" <toolitem action='remove-torrent'/>\n"
|
||||||
|
@ -67,7 +67,7 @@ const char * fallback_ui_file =
|
||||||
" </popup>\n"
|
" </popup>\n"
|
||||||
"\n"
|
"\n"
|
||||||
" <popup name='icon-popup'>\n"
|
" <popup name='icon-popup'>\n"
|
||||||
" <menuitem action='open-torrent-menu'/>\n"
|
" <menuitem action='add-torrent-menu'/>\n"
|
||||||
" <separator/>\n"
|
" <separator/>\n"
|
||||||
" <menuitem action='toggle-main-window'/>\n"
|
" <menuitem action='toggle-main-window'/>\n"
|
||||||
" <menuitem action='toggle-message-log'/>\n"
|
" <menuitem action='toggle-message-log'/>\n"
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
[encoding: UTF-8]
|
[encoding: UTF-8]
|
||||||
gtk/actions.c
|
gtk/actions.c
|
||||||
|
gtk/add-dialog.c
|
||||||
gtk/conf.c
|
gtk/conf.c
|
||||||
gtk/details.c
|
gtk/details.c
|
||||||
gtk/dialogs.c
|
gtk/dialogs.c
|
||||||
|
@ -10,7 +11,6 @@ gtk/main.c
|
||||||
gtk/makemeta-ui.c
|
gtk/makemeta-ui.c
|
||||||
gtk/msgwin.c
|
gtk/msgwin.c
|
||||||
gtk/notify.c
|
gtk/notify.c
|
||||||
gtk/open-dialog.c
|
|
||||||
gtk/sexy-icon-entry.c
|
gtk/sexy-icon-entry.c
|
||||||
gtk/stats.c
|
gtk/stats.c
|
||||||
gtk/torrent-cell-renderer.c
|
gtk/torrent-cell-renderer.c
|
||||||
|
|
Loading…
Reference in New Issue