2006-08-13 00:26:52 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* $Id$
|
|
|
|
*
|
2008-01-01 17:20:20 +00:00
|
|
|
* Copyright (c) 2005-2008 Transmission authors and contributors
|
2006-08-13 00:26:52 +00:00
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
|
|
|
*****************************************************************************/
|
2006-07-16 19:39:23 +00:00
|
|
|
|
|
|
|
#include <errno.h>
|
2007-07-19 03:55:00 +00:00
|
|
|
#include <stdio.h>
|
2006-07-16 19:39:23 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
#include <glib/gi18n.h>
|
|
|
|
|
2007-07-18 23:04:26 +00:00
|
|
|
#include <libtransmission/transmission.h>
|
|
|
|
|
2006-07-16 19:39:23 +00:00
|
|
|
#include "conf.h"
|
|
|
|
#include "dialogs.h"
|
2007-07-16 18:45:51 +00:00
|
|
|
#include "hig.h"
|
2007-05-23 00:49:31 +00:00
|
|
|
#include "tr_core.h"
|
2007-02-19 22:09:05 +00:00
|
|
|
#include "tr_icon.h"
|
|
|
|
#include "tr_prefs.h"
|
2006-07-16 19:39:23 +00:00
|
|
|
#include "util.h"
|
|
|
|
|
2007-02-23 11:27:59 +00:00
|
|
|
#define UPDATE_INTERVAL 1000
|
2007-02-19 22:09:05 +00:00
|
|
|
#define PREFNAME "transmission-dialog-pref-name"
|
2007-02-23 06:18:45 +00:00
|
|
|
#define FILESWIND_EXTRA_INDENT 4
|
|
|
|
|
|
|
|
#define STRIPROOT( path ) \
|
|
|
|
( g_path_is_absolute( (path) ) ? g_path_skip_root( (path) ) : (path) )
|
2006-07-16 19:39:23 +00:00
|
|
|
|
2007-05-24 02:50:28 +00:00
|
|
|
struct addcb
|
|
|
|
{
|
|
|
|
GtkWidget * widget;
|
|
|
|
TrCore * core;
|
2006-07-16 19:39:23 +00:00
|
|
|
gboolean autostart;
|
|
|
|
gboolean usingaltdir;
|
|
|
|
GtkFileChooser *altdir;
|
|
|
|
GtkButtonBox *altbox;
|
|
|
|
};
|
|
|
|
|
2007-02-07 02:59:25 +00:00
|
|
|
struct dirdata
|
|
|
|
{
|
2007-05-24 02:50:28 +00:00
|
|
|
GtkWidget * widget;
|
|
|
|
TrCore * core;
|
2007-05-23 19:26:29 +00:00
|
|
|
GList * files;
|
2007-05-24 10:37:07 +00:00
|
|
|
uint8_t * data;
|
|
|
|
size_t size;
|
2007-05-23 19:26:29 +00:00
|
|
|
enum tr_torrent_action action;
|
|
|
|
gboolean paused;
|
2007-02-07 02:59:25 +00:00
|
|
|
};
|
|
|
|
|
2007-05-24 02:50:28 +00:00
|
|
|
static void
|
|
|
|
addwindnocore( gpointer gdata, GObject * core );
|
2006-07-16 19:39:23 +00:00
|
|
|
static void
|
|
|
|
autoclick(GtkWidget *widget, gpointer gdata);
|
|
|
|
static void
|
|
|
|
dirclick(GtkWidget *widget, gpointer gdata);
|
|
|
|
static void
|
|
|
|
addresp(GtkWidget *widget, gint resp, gpointer gdata);
|
2007-02-07 02:59:25 +00:00
|
|
|
static void
|
2007-05-24 02:50:28 +00:00
|
|
|
promptdirnocore( gpointer gdata, GObject * core );
|
|
|
|
static void
|
2007-02-07 02:59:25 +00:00
|
|
|
promptresp( GtkWidget * widget, gint resp, gpointer data );
|
2006-07-16 19:39:23 +00:00
|
|
|
|
|
|
|
void
|
2007-05-24 02:50:28 +00:00
|
|
|
makeaddwind( GtkWindow * parent, TrCore * core )
|
|
|
|
{
|
2007-10-10 18:20:52 +00:00
|
|
|
GtkWidget *wind = gtk_file_chooser_dialog_new(_("Open Torrent"), parent,
|
2006-07-16 19:39:23 +00:00
|
|
|
GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
|
|
|
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
|
|
|
|
struct addcb *data = g_new(struct addcb, 1);
|
|
|
|
GtkWidget *vbox = gtk_vbox_new(FALSE, 3);
|
|
|
|
GtkWidget *bbox = gtk_hbutton_box_new();
|
|
|
|
GtkWidget *autocheck = gtk_check_button_new_with_mnemonic(
|
|
|
|
_("Automatically _start torrent"));
|
|
|
|
GtkWidget *dircheck = gtk_check_button_new_with_mnemonic(
|
|
|
|
_("Use alternate _download directory"));
|
|
|
|
GtkFileFilter *filter = gtk_file_filter_new();
|
|
|
|
GtkFileFilter *unfilter = gtk_file_filter_new();
|
|
|
|
GtkWidget *getdir = gtk_file_chooser_button_new(
|
|
|
|
_("Choose a download directory"), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
|
2007-09-27 20:57:58 +00:00
|
|
|
char * pref;
|
2006-07-16 19:39:23 +00:00
|
|
|
|
2007-05-24 02:50:28 +00:00
|
|
|
data->widget = wind;
|
|
|
|
data->core = core;
|
2006-07-16 19:39:23 +00:00
|
|
|
data->autostart = TRUE;
|
|
|
|
data->usingaltdir = FALSE;
|
|
|
|
data->altdir = GTK_FILE_CHOOSER(getdir);
|
|
|
|
data->altbox = GTK_BUTTON_BOX(bbox);
|
|
|
|
|
2007-05-24 02:50:28 +00:00
|
|
|
g_object_weak_ref( G_OBJECT( core ), addwindnocore, data );
|
|
|
|
|
2006-07-16 19:39:23 +00:00
|
|
|
gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_EDGE);
|
|
|
|
gtk_box_pack_start_defaults(GTK_BOX(bbox), dircheck);
|
|
|
|
gtk_box_pack_start_defaults(GTK_BOX(bbox), getdir);
|
|
|
|
|
|
|
|
gtk_box_pack_start_defaults(GTK_BOX(vbox), autocheck);
|
|
|
|
gtk_box_pack_start_defaults(GTK_BOX(vbox), bbox);
|
|
|
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(autocheck), TRUE);
|
2007-09-27 20:57:58 +00:00
|
|
|
pref = pref_string_get( PREF_KEY_DIR_DEFAULT );
|
|
|
|
if( pref != NULL ) {
|
2007-04-02 18:15:42 +00:00
|
|
|
gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER( wind ), pref );
|
2007-09-27 20:57:58 +00:00
|
|
|
g_free( pref );
|
2007-02-28 00:58:15 +00:00
|
|
|
}
|
2006-07-16 19:39:23 +00:00
|
|
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dircheck), FALSE);
|
|
|
|
gtk_widget_set_sensitive(getdir, FALSE);
|
|
|
|
|
|
|
|
gtk_file_filter_set_name(filter, _("Torrent files"));
|
|
|
|
gtk_file_filter_add_pattern(filter, "*.torrent");
|
|
|
|
gtk_file_filter_set_name(unfilter, _("All files"));
|
|
|
|
gtk_file_filter_add_pattern(unfilter, "*");
|
|
|
|
|
|
|
|
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(wind), filter);
|
|
|
|
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(wind), unfilter);
|
|
|
|
gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(wind), TRUE);
|
|
|
|
gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(wind), vbox);
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(autocheck), "clicked", G_CALLBACK(autoclick),data);
|
|
|
|
g_signal_connect(G_OBJECT(dircheck), "clicked", G_CALLBACK(dirclick), data);
|
|
|
|
g_signal_connect(G_OBJECT(wind), "response", G_CALLBACK(addresp), data);
|
|
|
|
|
|
|
|
gtk_widget_show_all(wind);
|
|
|
|
}
|
|
|
|
|
2007-05-24 02:50:28 +00:00
|
|
|
void
|
2008-01-19 05:04:38 +00:00
|
|
|
addwindnocore( gpointer gdata, GObject * core UNUSED )
|
2007-05-24 02:50:28 +00:00
|
|
|
{
|
|
|
|
struct addcb * data = gdata;
|
|
|
|
|
|
|
|
/* prevent the response callback from trying to remove the weak
|
|
|
|
reference which no longer exists */
|
|
|
|
data->core = NULL;
|
|
|
|
|
|
|
|
gtk_dialog_response( GTK_DIALOG( data->widget ), GTK_RESPONSE_NONE );
|
|
|
|
}
|
|
|
|
|
2006-07-16 19:39:23 +00:00
|
|
|
static void
|
|
|
|
autoclick(GtkWidget *widget, gpointer gdata) {
|
|
|
|
struct addcb *data = gdata;
|
|
|
|
|
|
|
|
data->autostart = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
dirclick(GtkWidget *widget, gpointer gdata) {
|
|
|
|
struct addcb *data = gdata;
|
|
|
|
|
|
|
|
data->usingaltdir = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
|
|
|
gtk_widget_set_sensitive(GTK_WIDGET(data->altdir), data->usingaltdir);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
addresp(GtkWidget *widget, gint resp, gpointer gdata) {
|
|
|
|
struct addcb *data = gdata;
|
|
|
|
GSList *files, *ii;
|
|
|
|
GList *stupidgtk;
|
|
|
|
char *dir;
|
2007-05-23 19:26:29 +00:00
|
|
|
enum tr_torrent_action action;
|
2006-07-16 19:39:23 +00:00
|
|
|
|
|
|
|
if(GTK_RESPONSE_ACCEPT == resp) {
|
|
|
|
dir = NULL;
|
|
|
|
if(data->usingaltdir)
|
|
|
|
dir = gtk_file_chooser_get_filename(data->altdir);
|
|
|
|
files = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(widget));
|
2007-09-27 20:57:58 +00:00
|
|
|
action = tr_prefs_get_action( PREF_KEY_ADDSTD );
|
|
|
|
|
2007-05-24 02:50:28 +00:00
|
|
|
if( NULL == dir )
|
|
|
|
{
|
|
|
|
stupidgtk = NULL;
|
|
|
|
for( ii = files; NULL != ii; ii = ii->next )
|
|
|
|
{
|
|
|
|
stupidgtk = g_list_append( stupidgtk, ii->data );
|
|
|
|
}
|
|
|
|
tr_core_add_list( data->core, stupidgtk, action, !data->autostart );
|
|
|
|
freestrlist(stupidgtk);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for( ii = files; NULL != ii; ii = ii->next )
|
|
|
|
{
|
|
|
|
tr_core_add_dir( data->core, ii->data, dir,
|
|
|
|
action, !data->autostart );
|
|
|
|
g_free( ii->data );
|
|
|
|
}
|
|
|
|
g_free( dir );
|
|
|
|
}
|
|
|
|
tr_core_torrents_added( data->core );
|
2006-07-16 19:39:23 +00:00
|
|
|
g_slist_free(files);
|
2007-05-24 02:50:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( NULL != data->core )
|
|
|
|
{
|
|
|
|
g_object_weak_unref( G_OBJECT( data->core ), addwindnocore, data );
|
2006-07-16 19:39:23 +00:00
|
|
|
}
|
|
|
|
|
2007-02-07 02:59:25 +00:00
|
|
|
g_free( data );
|
2006-07-16 19:39:23 +00:00
|
|
|
gtk_widget_destroy(widget);
|
|
|
|
}
|
|
|
|
|
2007-04-04 00:32:58 +00:00
|
|
|
void
|
|
|
|
fmtpeercount( GtkLabel * label, int count )
|
|
|
|
{
|
|
|
|
char str[16];
|
|
|
|
|
|
|
|
if( 0 > count )
|
|
|
|
{
|
2007-10-08 19:40:34 +00:00
|
|
|
gtk_label_set_text( label, "?" );
|
2007-04-04 00:32:58 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-07-30 20:48:43 +00:00
|
|
|
g_snprintf( str, sizeof str, "%i", count );
|
2007-04-04 00:32:58 +00:00
|
|
|
gtk_label_set_text( label, str );
|
|
|
|
}
|
2006-07-16 19:39:23 +00:00
|
|
|
}
|
2007-02-07 02:59:25 +00:00
|
|
|
|
|
|
|
void
|
2007-05-24 10:37:07 +00:00
|
|
|
promptfordir( GtkWindow * parent, TrCore * core, GList * files, uint8_t * data,
|
|
|
|
size_t size, enum tr_torrent_action act, gboolean paused )
|
2007-02-07 02:59:25 +00:00
|
|
|
{
|
2007-09-27 20:57:58 +00:00
|
|
|
char * path;
|
2007-02-07 02:59:25 +00:00
|
|
|
struct dirdata * stuff;
|
|
|
|
GtkWidget * wind;
|
|
|
|
|
2007-05-24 10:37:07 +00:00
|
|
|
stuff = g_new0( struct dirdata, 1 );
|
2007-05-24 02:50:28 +00:00
|
|
|
stuff->core = core;
|
2007-05-24 10:37:07 +00:00
|
|
|
if( NULL != files )
|
|
|
|
{
|
|
|
|
stuff->files = dupstrlist( files );
|
|
|
|
}
|
|
|
|
if( NULL != data )
|
|
|
|
{
|
|
|
|
stuff->data = g_new( uint8_t, size );
|
|
|
|
memcpy( stuff->data, data, size );
|
|
|
|
stuff->size = size;
|
|
|
|
}
|
2007-05-23 19:26:29 +00:00
|
|
|
stuff->action = act;
|
|
|
|
stuff->paused = paused;
|
2007-02-07 02:59:25 +00:00
|
|
|
|
2007-05-24 02:50:28 +00:00
|
|
|
g_object_weak_ref( G_OBJECT( core ), promptdirnocore, stuff );
|
|
|
|
|
2007-02-07 02:59:25 +00:00
|
|
|
wind = gtk_file_chooser_dialog_new( _("Choose a directory"), parent,
|
|
|
|
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
|
|
|
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
|
|
|
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
|
|
|
|
NULL );
|
|
|
|
gtk_file_chooser_set_local_only( GTK_FILE_CHOOSER( wind ), TRUE );
|
|
|
|
gtk_file_chooser_set_select_multiple( GTK_FILE_CHOOSER( wind ), FALSE );
|
2007-09-27 20:57:58 +00:00
|
|
|
path = getdownloaddir( );
|
|
|
|
gtk_file_chooser_set_filename( GTK_FILE_CHOOSER( wind ), path );
|
|
|
|
g_free( path );
|
2007-02-07 02:59:25 +00:00
|
|
|
|
2007-05-24 02:50:28 +00:00
|
|
|
stuff->widget = wind;
|
|
|
|
|
2007-02-07 02:59:25 +00:00
|
|
|
g_signal_connect( G_OBJECT( wind ), "response",
|
|
|
|
G_CALLBACK( promptresp ), stuff );
|
|
|
|
|
|
|
|
gtk_widget_show_all(wind);
|
|
|
|
}
|
|
|
|
|
2007-05-24 02:50:28 +00:00
|
|
|
void
|
2008-01-19 05:04:38 +00:00
|
|
|
promptdirnocore( gpointer gdata, GObject * core UNUSED )
|
2007-05-24 02:50:28 +00:00
|
|
|
{
|
|
|
|
struct dirdata * stuff = gdata;
|
|
|
|
|
|
|
|
/* prevent the response callback from trying to remove the weak
|
|
|
|
reference which no longer exists */
|
|
|
|
stuff->core = NULL;
|
|
|
|
|
|
|
|
gtk_dialog_response( GTK_DIALOG( stuff->widget ), GTK_RESPONSE_NONE );
|
|
|
|
}
|
|
|
|
|
2007-02-07 02:59:25 +00:00
|
|
|
static void
|
|
|
|
promptresp( GtkWidget * widget, gint resp, gpointer data )
|
|
|
|
{
|
|
|
|
struct dirdata * stuff;
|
|
|
|
char * dir;
|
2007-05-24 02:50:28 +00:00
|
|
|
GList * ii;
|
2007-02-07 02:59:25 +00:00
|
|
|
|
|
|
|
stuff = data;
|
|
|
|
|
|
|
|
if( GTK_RESPONSE_ACCEPT == resp )
|
|
|
|
{
|
|
|
|
dir = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( widget ) );
|
|
|
|
/* it seems that we will always get a directory */
|
|
|
|
g_assert( NULL != dir );
|
2007-05-24 02:50:28 +00:00
|
|
|
for( ii = g_list_first( stuff->files ); NULL != ii; ii = ii->next )
|
|
|
|
{
|
|
|
|
tr_core_add_dir( stuff->core, ii->data, dir,
|
|
|
|
stuff->action, stuff->paused );
|
|
|
|
}
|
2007-05-24 10:37:07 +00:00
|
|
|
if( NULL != stuff->data )
|
|
|
|
{
|
|
|
|
tr_core_add_data_dir( stuff->core, stuff->data, stuff->size, dir,
|
|
|
|
stuff->paused );
|
|
|
|
}
|
2007-05-24 02:50:28 +00:00
|
|
|
tr_core_torrents_added( stuff->core );
|
2007-02-07 02:59:25 +00:00
|
|
|
g_free( dir );
|
|
|
|
}
|
|
|
|
|
2007-05-24 02:50:28 +00:00
|
|
|
if( NULL != stuff->core )
|
|
|
|
{
|
|
|
|
g_object_weak_unref( G_OBJECT( stuff->core ), promptdirnocore, stuff );
|
|
|
|
}
|
|
|
|
|
2007-02-07 02:59:25 +00:00
|
|
|
freestrlist( stuff->files );
|
2007-05-24 10:37:07 +00:00
|
|
|
g_free( stuff->data );
|
2007-02-07 02:59:25 +00:00
|
|
|
g_free( stuff );
|
|
|
|
gtk_widget_destroy( widget );
|
|
|
|
}
|
2007-02-19 22:09:05 +00:00
|
|
|
|
2007-07-16 18:45:51 +00:00
|
|
|
/***
|
|
|
|
****
|
|
|
|
***/
|
|
|
|
|
|
|
|
struct quitdata
|
|
|
|
{
|
|
|
|
TrCore * core;
|
|
|
|
callbackfunc_t func;
|
|
|
|
void * cbdata;
|
|
|
|
GtkWidget * dontask;
|
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
|
|
|
quitresp( GtkWidget * widget, int response, gpointer data )
|
|
|
|
{
|
2007-09-27 20:57:58 +00:00
|
|
|
struct quitdata * stuff = data;
|
2007-07-16 18:45:51 +00:00
|
|
|
|
2007-09-27 20:57:58 +00:00
|
|
|
pref_flag_set( PREF_KEY_ASKQUIT,
|
|
|
|
!gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(stuff->dontask) ) );
|
2007-07-16 18:45:51 +00:00
|
|
|
|
|
|
|
if( response == GTK_RESPONSE_ACCEPT )
|
|
|
|
stuff->func( stuff->cbdata );
|
|
|
|
|
|
|
|
g_free( stuff );
|
|
|
|
gtk_widget_destroy( widget );
|
|
|
|
}
|
|
|
|
|
2007-02-19 22:09:05 +00:00
|
|
|
void
|
2007-07-16 18:45:51 +00:00
|
|
|
askquit( TrCore * core,
|
|
|
|
GtkWindow * parent,
|
|
|
|
callbackfunc_t func,
|
|
|
|
void * cbdata )
|
2007-02-19 22:09:05 +00:00
|
|
|
{
|
|
|
|
struct quitdata * stuff;
|
|
|
|
GtkWidget * wind;
|
2007-07-16 18:45:51 +00:00
|
|
|
GtkWidget * dontask;
|
2007-02-19 22:09:05 +00:00
|
|
|
|
2008-01-21 15:51:53 +00:00
|
|
|
/* if the user doesn't want to be asked, don't ask */
|
|
|
|
if( !pref_flag_get( PREF_KEY_ASKQUIT ) ) {
|
|
|
|
func( cbdata );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if there aren't any torrents, don't ask */
|
|
|
|
if( !tr_torrentCount( tr_core_handle( core ) ) ) {
|
2007-04-05 22:28:02 +00:00
|
|
|
func( cbdata );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-02-19 22:09:05 +00:00
|
|
|
stuff = g_new( struct quitdata, 1 );
|
|
|
|
stuff->func = func;
|
|
|
|
stuff->cbdata = cbdata;
|
2007-07-16 18:45:51 +00:00
|
|
|
stuff->core = core;
|
2007-02-19 22:09:05 +00:00
|
|
|
|
2007-07-27 01:40:46 +00:00
|
|
|
wind = gtk_message_dialog_new_with_markup( parent,
|
|
|
|
GTK_DIALOG_DESTROY_WITH_PARENT,
|
|
|
|
GTK_MESSAGE_QUESTION,
|
|
|
|
GTK_BUTTONS_NONE,
|
|
|
|
_("<b>Really Quit %s?</b>"),
|
|
|
|
g_get_application_name() );
|
|
|
|
|
|
|
|
gtk_message_dialog_format_secondary_text( GTK_MESSAGE_DIALOG(wind),
|
|
|
|
_("This will close all active torrents."));
|
2007-07-16 18:45:51 +00:00
|
|
|
gtk_dialog_add_buttons( GTK_DIALOG(wind),
|
|
|
|
GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
|
|
|
|
GTK_STOCK_QUIT, GTK_RESPONSE_ACCEPT,
|
|
|
|
NULL );
|
2007-07-27 01:40:46 +00:00
|
|
|
gtk_dialog_set_default_response( GTK_DIALOG( wind ),
|
|
|
|
GTK_RESPONSE_ACCEPT );
|
2007-02-19 22:09:05 +00:00
|
|
|
|
2007-07-16 18:45:51 +00:00
|
|
|
dontask = gtk_check_button_new_with_mnemonic( _("_Don't Ask Me This Again") );
|
|
|
|
stuff->dontask = dontask;
|
2007-02-19 22:09:05 +00:00
|
|
|
|
2007-07-16 18:45:51 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(wind)->vbox), dontask, FALSE, FALSE, GUI_PAD );
|
2007-02-19 22:09:05 +00:00
|
|
|
|
2007-07-16 18:45:51 +00:00
|
|
|
g_signal_connect( G_OBJECT( wind ), "response",
|
|
|
|
G_CALLBACK( quitresp ), stuff );
|
2007-02-19 22:09:05 +00:00
|
|
|
|
2007-07-16 18:45:51 +00:00
|
|
|
gtk_widget_show_all( wind );
|
2007-02-19 22:09:05 +00:00
|
|
|
}
|