(trunk gtk) general cleanup to make function's naming scheme and API more consistent. This is only a fraction of what the GTK+ client's codebase needs, unfortunately.
This commit is contained in:
parent
0372797e6f
commit
5eafe91824
|
@ -31,15 +31,13 @@
|
|||
|
||||
#define UNUSED G_GNUC_UNUSED
|
||||
|
||||
static TrCore * myCore = NULL;
|
||||
|
||||
static TrCore * myCore = NULL;
|
||||
static GtkActionGroup * myGroup = NULL;
|
||||
|
||||
static void
|
||||
action_cb( GtkAction * a,
|
||||
gpointer user_data )
|
||||
action_cb( GtkAction * a, gpointer user_data )
|
||||
{
|
||||
doAction ( gtk_action_get_name( a ), user_data );
|
||||
gtr_actions_handler( gtk_action_get_name( a ), user_data );
|
||||
}
|
||||
|
||||
#if !GTK_CHECK_VERSION( 2, 8, 0 )
|
||||
|
@ -193,14 +191,13 @@ register_my_icons( void )
|
|||
static GtkUIManager * myUIManager = NULL;
|
||||
|
||||
void
|
||||
actions_set_core( TrCore * core )
|
||||
gtr_actions_set_core( TrCore * core )
|
||||
{
|
||||
myCore = core;
|
||||
}
|
||||
|
||||
void
|
||||
actions_init( GtkUIManager * ui_manager,
|
||||
gpointer callback_user_data )
|
||||
gtr_actions_init( GtkUIManager * ui_manager, gpointer callback_user_data )
|
||||
{
|
||||
int i, n;
|
||||
int active;
|
||||
|
@ -292,7 +289,7 @@ get_action( const char* name )
|
|||
}
|
||||
|
||||
void
|
||||
action_activate( const char * name )
|
||||
gtr_action_activate( const char * name )
|
||||
{
|
||||
GtkAction * action = get_action( name );
|
||||
|
||||
|
@ -301,8 +298,7 @@ action_activate( const char * name )
|
|||
}
|
||||
|
||||
void
|
||||
action_sensitize( const char * name,
|
||||
gboolean b )
|
||||
gtr_action_set_sensitive( const char * name, gboolean b )
|
||||
{
|
||||
GtkAction * action = get_action( name );
|
||||
|
||||
|
@ -311,7 +307,7 @@ action_sensitize( const char * name,
|
|||
}
|
||||
|
||||
void
|
||||
action_set_important( const char * name, gboolean b )
|
||||
gtr_action_set_important( const char * name, gboolean b )
|
||||
{
|
||||
GtkAction * action = get_action( name );
|
||||
|
||||
|
@ -320,8 +316,7 @@ action_set_important( const char * name, gboolean b )
|
|||
}
|
||||
|
||||
void
|
||||
action_toggle( const char * name,
|
||||
gboolean b )
|
||||
gtr_action_set_toggled( const char * name, gboolean b )
|
||||
{
|
||||
GtkAction * action = get_action( name );
|
||||
|
||||
|
@ -329,7 +324,7 @@ action_toggle( const char * name,
|
|||
}
|
||||
|
||||
GtkWidget*
|
||||
action_get_widget( const char * path )
|
||||
gtr_action_get_widget( const char * path )
|
||||
{
|
||||
return gtk_ui_manager_get_widget( myUIManager, path );
|
||||
}
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef TR_ACTIONS_H
|
||||
#define TR_ACTIONS_H
|
||||
#ifndef GTR_ACTIONS_H
|
||||
#define GTR_ACTIONS_H
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "tr-core.h"
|
||||
|
@ -21,25 +21,14 @@
|
|||
#define NOTIFICATION_ICON "transmission-notification-icon"
|
||||
|
||||
|
||||
void actions_init( GtkUIManager * ui_manager,
|
||||
gpointer callback_user_data );
|
||||
void gtr_actions_init( GtkUIManager * ui_manager, gpointer callback_user_data );
|
||||
void gtr_actions_set_core( TrCore * core );
|
||||
void gtr_actions_handler( const char * action_name, gpointer user_data );
|
||||
|
||||
void actions_set_core( TrCore * core );
|
||||
|
||||
void action_activate( const char * name );
|
||||
|
||||
void action_sensitize( const char * name,
|
||||
gboolean b );
|
||||
|
||||
void action_toggle( const char * name,
|
||||
gboolean b );
|
||||
|
||||
void action_set_important( const char * name, gboolean b );
|
||||
|
||||
|
||||
GtkWidget* action_get_widget( const char * path );
|
||||
|
||||
void doAction( const char * action_name,
|
||||
gpointer user_data );
|
||||
void gtr_action_activate ( const char * action_name );
|
||||
void gtr_action_set_sensitive ( const char * action_name, gboolean is_sensitive );
|
||||
void gtr_action_set_toggled ( const char * action_name, gboolean is_toggled );
|
||||
void gtr_action_set_important ( const char * action_name, gboolean is_important );
|
||||
GtkWidget* gtr_action_get_widget ( const char * path );
|
||||
|
||||
#endif
|
||||
|
|
|
@ -206,7 +206,7 @@ sourceChanged( GtkFileChooserButton * b, gpointer gdata )
|
|||
}
|
||||
else if( new_file )
|
||||
{
|
||||
addTorrentErrorDialog( GTK_WIDGET( b ), err, data->filename );
|
||||
gtr_add_torrent_error_dialog( GTK_WIDGET( b ), err, data->filename );
|
||||
}
|
||||
|
||||
updateTorrent( data );
|
||||
|
@ -252,7 +252,7 @@ addTorrentFilters( GtkFileChooser * chooser )
|
|||
****/
|
||||
|
||||
GtkWidget*
|
||||
addSingleTorrentDialog( GtkWindow * parent, TrCore * core, tr_ctor * ctor )
|
||||
gtr_torrent_options_dialog_new( GtkWindow * parent, TrCore * core, tr_ctor * ctor )
|
||||
{
|
||||
int row;
|
||||
int col;
|
||||
|
@ -384,7 +384,6 @@ addSingleTorrentDialog( GtkWindow * parent, TrCore * core, tr_ctor * ctor )
|
|||
gtk_box_pack_start( GTK_BOX( GTK_DIALOG( d )->vbox ), t, TRUE, TRUE, 0 );
|
||||
|
||||
gtk_widget_grab_focus( grab );
|
||||
gtk_widget_show_all( d );
|
||||
return d;
|
||||
}
|
||||
|
||||
|
@ -423,8 +422,7 @@ onAddDialogResponse( GtkDialog * dialog,
|
|||
}
|
||||
|
||||
GtkWidget*
|
||||
addDialog( GtkWindow * parent,
|
||||
TrCore * core )
|
||||
gtr_torrent_add_from_file_dialog_new( GtkWindow * parent, TrCore * core )
|
||||
{
|
||||
GtkWidget * w;
|
||||
GtkWidget * c;
|
||||
|
@ -453,7 +451,6 @@ addDialog( GtkWindow * parent,
|
|||
gtk_file_chooser_set_extra_widget( GTK_FILE_CHOOSER( w ), c );
|
||||
gtk_widget_show( c );
|
||||
|
||||
gtk_widget_show( w );
|
||||
return w;
|
||||
}
|
||||
|
||||
|
@ -518,7 +515,7 @@ paste_clipboard_url_into_entry( GtkWidget * e )
|
|||
}
|
||||
|
||||
GtkWidget*
|
||||
addURLDialog( GtkWindow * parent, TrCore * core )
|
||||
gtr_torrent_add_from_url_dialog_new( GtkWindow * parent, TrCore * core )
|
||||
{
|
||||
int row;
|
||||
GtkWidget * e;
|
||||
|
@ -547,6 +544,5 @@ addURLDialog( GtkWindow * parent, TrCore * core )
|
|||
|
||||
gtk_box_pack_start( GTK_BOX( GTK_DIALOG( w )->vbox ), t, TRUE, TRUE, 0 );
|
||||
gtk_widget_show_all( t );
|
||||
gtk_widget_show( w );
|
||||
return w;
|
||||
}
|
||||
|
|
|
@ -10,21 +10,16 @@
|
|||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef TR_GTK_ADD_DIALOG_H
|
||||
#define TR_GTK_ADD_DIALOG_H
|
||||
#ifndef GTR_ADD_DIALOG_H
|
||||
#define GTR_ADD_DIALOG_H
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "tr-core.h"
|
||||
|
||||
GtkWidget* gtr_torrent_add_from_url_dialog_new ( GtkWindow * parent, TrCore * core );
|
||||
GtkWidget* gtr_torrent_add_from_file_dialog_new( GtkWindow * parent, TrCore * core );
|
||||
|
||||
/* This dialog assumes ownership of the ctor */
|
||||
GtkWidget* addSingleTorrentDialog( GtkWindow * parent,
|
||||
TrCore * core,
|
||||
tr_ctor * ctor );
|
||||
GtkWidget* gtr_torrent_options_dialog_new( GtkWindow * parent, TrCore * core, tr_ctor * ctor );
|
||||
|
||||
GtkWidget* addDialog( GtkWindow * parent,
|
||||
TrCore * core );
|
||||
|
||||
GtkWidget* addURLDialog( GtkWindow * parent,
|
||||
TrCore * core );
|
||||
|
||||
#endif /* TR_GTK_ADD_DIALOG */
|
||||
#endif /* GTR_ADD_DIALOG */
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
* DEALINGS IN THE SOFTWARE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef TG_CONF_H
|
||||
#define TG_CONF_H
|
||||
#ifndef GTR_CONFIG_H
|
||||
#define GTR_CONFIG_H
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <libtransmission/transmission.h>
|
||||
|
@ -71,4 +71,4 @@ gboolean cf_init( const char *confdir,
|
|||
gboolean cf_lock( gtr_lockfile_state_t * tr_state,
|
||||
char ** errstr );
|
||||
|
||||
#endif /* TG_CONF_H */
|
||||
#endif /* GTR_CONFIG_H */
|
||||
|
|
|
@ -2320,7 +2320,7 @@ details_free( gpointer gdata )
|
|||
}
|
||||
|
||||
GtkWidget*
|
||||
torrent_inspector_new( GtkWindow * parent, TrCore * core )
|
||||
gtr_torrent_details_dialog_new( GtkWindow * parent, TrCore * core )
|
||||
{
|
||||
GtkWidget * d, * n, * w, * l;
|
||||
struct DetailsImpl * di = g_new0( struct DetailsImpl, 1 );
|
||||
|
@ -2376,7 +2376,7 @@ torrent_inspector_new( GtkWindow * parent, TrCore * core )
|
|||
}
|
||||
|
||||
void
|
||||
torrent_inspector_set_torrents( GtkWidget * w, GSList * ids )
|
||||
gtr_torrent_details_dialog_set_torrents( GtkWidget * w, GSList * ids )
|
||||
{
|
||||
struct DetailsImpl * di = g_object_get_data( G_OBJECT( w ), DETAILS_KEY );
|
||||
const int len = g_slist_length( ids );
|
||||
|
|
|
@ -10,17 +10,16 @@
|
|||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef GTK_TORRENT_INSPECTOR_H
|
||||
#define GTK_TORRENT_INSPECTOR_H
|
||||
#ifndef GTR_TORRENT_DETAILS_H
|
||||
#define GTR_TORRENT_DETAILS_H
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "tr-core.h"
|
||||
#include "tr-torrent.h"
|
||||
|
||||
GtkWidget* torrent_inspector_new( GtkWindow * parent,
|
||||
TrCore * core );
|
||||
GtkWidget* gtr_torrent_details_dialog_new ( GtkWindow * parent,
|
||||
TrCore * core );
|
||||
|
||||
void torrent_inspector_set_torrents( GtkWidget * widgets,
|
||||
GSList * torrent_ids );
|
||||
void gtr_torrent_details_dialog_set_torrents ( GtkWidget * details_dialog,
|
||||
GSList * torrent_ids );
|
||||
|
||||
#endif /* TG_PREFS_H */
|
||||
#endif /* GTR_TORRENT_DETAILS_H */
|
||||
|
|
|
@ -65,10 +65,10 @@ quitresp( GtkWidget * widget,
|
|||
}
|
||||
|
||||
GtkWidget *
|
||||
askquit( TrCore * core,
|
||||
GtkWindow * parent,
|
||||
callbackfunc_t func,
|
||||
void * cbdata )
|
||||
gtr_confirm_quit( GtkWindow * parent,
|
||||
TrCore * core,
|
||||
callbackfunc_t func,
|
||||
void * cbdata )
|
||||
{
|
||||
struct quitdata * stuff;
|
||||
GtkWidget * w;
|
||||
|
@ -168,10 +168,10 @@ countBusyTorrents( gpointer gtor, gpointer gdata )
|
|||
}
|
||||
|
||||
void
|
||||
confirmRemove( GtkWindow * parent,
|
||||
TrCore * core,
|
||||
GSList * torrents,
|
||||
gboolean delete_files )
|
||||
gtr_confirm_remove( GtkWindow * parent,
|
||||
TrCore * core,
|
||||
GSList * torrents,
|
||||
gboolean delete_files )
|
||||
{
|
||||
GtkWidget * d;
|
||||
const int count = g_slist_length( torrents );
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
* DEALINGS IN THE SOFTWARE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef TG_PREFS_H
|
||||
#define TG_PREFS_H
|
||||
#ifndef GTR_DIALOGS_H
|
||||
#define GTR_DIALOGS_H
|
||||
|
||||
#include "tr-core.h"
|
||||
#include "tr-torrent.h"
|
||||
|
@ -33,15 +33,21 @@
|
|||
/* used for a callback function with a data parameter */
|
||||
typedef void ( *callbackfunc_t )( gpointer );
|
||||
|
||||
/* prompt if the user wants to quit, calls func with cbdata if they do */
|
||||
GtkWidget * askquit( TrCore * core,
|
||||
GtkWindow * parent,
|
||||
callbackfunc_t func,
|
||||
gpointer cbdata );
|
||||
/**
|
||||
* Prompt the user to confirm exiting the app.
|
||||
* Call func(cbdata) if user confirms.
|
||||
*/
|
||||
GtkWidget * gtr_confirm_quit ( GtkWindow * parent,
|
||||
TrCore * core,
|
||||
callbackfunc_t func,
|
||||
gpointer cbdata );
|
||||
|
||||
void confirmRemove( GtkWindow * parent,
|
||||
TrCore * core,
|
||||
GSList * gtorrents,
|
||||
gboolean doDelete );
|
||||
/**
|
||||
* Prompt the user to confirm removing a torrent.
|
||||
*/
|
||||
void gtr_confirm_remove ( GtkWindow * parent,
|
||||
TrCore * core,
|
||||
GSList * gtorrents,
|
||||
gboolean doDelete );
|
||||
|
||||
#endif /* TG_PREFS_H */
|
||||
#endif /* GTR_DIALOGS_H */
|
||||
|
|
|
@ -428,8 +428,8 @@ buildTree( GNode * node, gpointer gdata )
|
|||
struct row_struct *child_data = node->data;
|
||||
const gboolean isLeaf = node->children == NULL;
|
||||
|
||||
const char * mime_type = isLeaf ? get_mime_type_from_filename( child_data->name ) : DIRECTORY_MIME_TYPE;
|
||||
GdkPixbuf * icon = get_mime_type_icon( mime_type, GTK_ICON_SIZE_MENU, build->w );
|
||||
const char * mime_type = isLeaf ? gtr_get_mime_type_from_filename( child_data->name ) : DIRECTORY_MIME_TYPE;
|
||||
GdkPixbuf * icon = gtr_get_mime_type_icon( mime_type, GTK_ICON_SIZE_MENU, build->w );
|
||||
const tr_info * inf = tr_torrentInfo( build->tor );
|
||||
const int priority = isLeaf ? inf->files[ child_data->index ].priority : 0;
|
||||
const gboolean enabled = isLeaf ? !inf->files[ child_data->index ].dnd : TRUE;
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __HIG_H__
|
||||
#define __HIG_H__
|
||||
#ifndef GTR_HIG_H
|
||||
#define GTR_HIG_H
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
|
@ -83,4 +83,4 @@ enum
|
|||
GUI_PAD_LARGE = 12
|
||||
};
|
||||
|
||||
#endif /* __HIG_H__ */
|
||||
#endif /* GTR_HIG_H */
|
||||
|
|
|
@ -256,9 +256,9 @@ icon_cache_get_mime_type_icon( IconCache * icon_cache, const char * mime_type )
|
|||
|
||||
|
||||
GdkPixbuf *
|
||||
get_mime_type_icon( const char * mime_type,
|
||||
GtkIconSize icon_size,
|
||||
GtkWidget * for_widget )
|
||||
gtr_get_mime_type_icon( const char * mime_type,
|
||||
GtkIconSize icon_size,
|
||||
GtkWidget * for_widget )
|
||||
{
|
||||
int n;
|
||||
|
||||
|
@ -280,7 +280,7 @@ get_mime_type_icon( const char * mime_type,
|
|||
|
||||
|
||||
const char *
|
||||
get_mime_type_from_filename( const char * file G_GNUC_UNUSED )
|
||||
gtr_get_mime_type_from_filename( const char * file G_GNUC_UNUSED )
|
||||
{
|
||||
#ifdef USE_GIO_ICONS
|
||||
char * tmp = g_content_type_guess( file, NULL, 0, NULL );
|
||||
|
|
12
gtk/icons.h
12
gtk/icons.h
|
@ -5,16 +5,16 @@
|
|||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef ICONS_H
|
||||
#define ICONS_H
|
||||
#ifndef GTR_ICONS_H
|
||||
#define GTR_ICONS_H
|
||||
|
||||
#define DIRECTORY_MIME_TYPE "folder"
|
||||
#define UNKNOWN_MIME_TYPE "unknown"
|
||||
|
||||
const char * get_mime_type_from_filename( const char *file );
|
||||
const char * gtr_get_mime_type_from_filename( const char *file );
|
||||
|
||||
GdkPixbuf * get_mime_type_icon( const char * mime_type,
|
||||
GtkIconSize icon_size,
|
||||
GtkWidget * for_widget );
|
||||
GdkPixbuf * gtr_get_mime_type_icon( const char * mime_type,
|
||||
GtkIconSize icon_size,
|
||||
GtkWidget * for_widget );
|
||||
|
||||
#endif
|
||||
|
|
148
gtk/main.c
148
gtk/main.c
|
@ -141,7 +141,7 @@ getSelectedTorrentIds( struct cbdata * data )
|
|||
GList * l;
|
||||
|
||||
/* build a list of the selected torrents' ids */
|
||||
s = tr_window_get_selection( data->wind );
|
||||
s = gtr_window_get_selection( data->wind );
|
||||
for( paths=l=gtk_tree_selection_get_selected_rows(s,&model); l; l=l->next ) {
|
||||
GtkTreeIter iter;
|
||||
if( gtk_tree_model_get_iter( model, &iter, l->data ) ) {
|
||||
|
@ -193,28 +193,23 @@ findDetailsDialogFromWidget( struct cbdata * cbdata, gpointer w )
|
|||
****
|
||||
***/
|
||||
|
||||
static void appsetup( TrWindow * wind,
|
||||
GSList * args,
|
||||
struct cbdata *,
|
||||
gboolean paused,
|
||||
gboolean minimized );
|
||||
static void appsetup( TrWindow * wind,
|
||||
GSList * args,
|
||||
struct cbdata * cbdata,
|
||||
gboolean paused,
|
||||
gboolean minimized );
|
||||
|
||||
static void winsetup( struct cbdata * cbdata,
|
||||
TrWindow * wind );
|
||||
static void winsetup( struct cbdata * cbdata, TrWindow * wind );
|
||||
|
||||
static void wannaquit( gpointer vdata );
|
||||
static void wannaquit( gpointer vdata );
|
||||
|
||||
static void coreerr( TrCore *, guint, const char *, struct cbdata * );
|
||||
|
||||
static void onAddTorrent( TrCore *,
|
||||
tr_ctor *,
|
||||
gpointer );
|
||||
static void onAddTorrent( TrCore *, tr_ctor *, gpointer );
|
||||
|
||||
static void prefschanged( TrCore * core,
|
||||
const char * key,
|
||||
gpointer data );
|
||||
static void prefschanged( TrCore * core, const char * key, gpointer );
|
||||
|
||||
static gboolean updatemodel( gpointer gdata );
|
||||
static gboolean updatemodel( gpointer gdata );
|
||||
|
||||
/***
|
||||
****
|
||||
|
@ -316,33 +311,33 @@ refreshActions( gpointer gdata )
|
|||
struct cbdata * data = gdata;
|
||||
|
||||
getTorrentCounts( data, &counts );
|
||||
action_sensitize( "pause-torrent", counts.activeCount != 0 );
|
||||
action_sensitize( "start-torrent", counts.inactiveCount != 0 );
|
||||
action_sensitize( "remove-torrent", counts.totalCount != 0 );
|
||||
action_sensitize( "delete-torrent", counts.totalCount != 0 );
|
||||
action_sensitize( "verify-torrent", counts.totalCount != 0 );
|
||||
action_sensitize( "relocate-torrent", counts.totalCount != 0 );
|
||||
action_sensitize( "show-torrent-properties", counts.totalCount != 0 );
|
||||
action_sensitize( "open-torrent-folder", counts.totalCount == 1 );
|
||||
action_sensitize( "copy-magnet-link-to-clipboard", counts.totalCount == 1 );
|
||||
gtr_action_set_sensitive( "pause-torrent", counts.activeCount != 0 );
|
||||
gtr_action_set_sensitive( "start-torrent", counts.inactiveCount != 0 );
|
||||
gtr_action_set_sensitive( "remove-torrent", counts.totalCount != 0 );
|
||||
gtr_action_set_sensitive( "delete-torrent", counts.totalCount != 0 );
|
||||
gtr_action_set_sensitive( "verify-torrent", counts.totalCount != 0 );
|
||||
gtr_action_set_sensitive( "relocate-torrent", counts.totalCount != 0 );
|
||||
gtr_action_set_sensitive( "show-torrent-properties", counts.totalCount != 0 );
|
||||
gtr_action_set_sensitive( "open-torrent-folder", counts.totalCount == 1 );
|
||||
gtr_action_set_sensitive( "copy-magnet-link-to-clipboard", counts.totalCount == 1 );
|
||||
|
||||
canUpdate = 0;
|
||||
gtk_tree_selection_selected_foreach( data->sel, accumulateCanUpdateForeach, &canUpdate );
|
||||
action_sensitize( "update-tracker", canUpdate != 0 );
|
||||
gtr_action_set_sensitive( "update-tracker", canUpdate != 0 );
|
||||
|
||||
{
|
||||
GtkTreeView * view = gtk_tree_selection_get_tree_view( data->sel );
|
||||
GtkTreeModel * model = gtk_tree_view_get_model( view );
|
||||
const int torrentCount = gtk_tree_model_iter_n_children( model, NULL ) != 0;
|
||||
action_sensitize( "select-all", torrentCount != 0 );
|
||||
action_sensitize( "deselect-all", torrentCount != 0 );
|
||||
gtr_action_set_sensitive( "select-all", torrentCount != 0 );
|
||||
gtr_action_set_sensitive( "deselect-all", torrentCount != 0 );
|
||||
}
|
||||
|
||||
{
|
||||
const size_t total = tr_core_get_torrent_count( data->core );
|
||||
const size_t active = tr_core_get_active_torrent_count( data->core );
|
||||
action_sensitize( "pause-all-torrents", active != 0 );
|
||||
action_sensitize( "start-all-torrents", active != total );
|
||||
gtr_action_set_sensitive( "pause-all-torrents", active != 0 );
|
||||
gtr_action_set_sensitive( "start-all-torrents", active != total );
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
@ -393,7 +388,7 @@ signal_handler( int sig )
|
|||
case SIGINT:
|
||||
case SIGTERM:
|
||||
g_message( _( "Got signal %d; trying to shut down cleanly. Do it again if it gets stuck." ), sig );
|
||||
doAction( "quit", sighandler_cbdata );
|
||||
gtr_actions_handler( "quit", sighandler_cbdata );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -716,7 +711,7 @@ main( int argc, char ** argv )
|
|||
if( configDir == NULL )
|
||||
configDir = (char*) tr_getDefaultConfigDir( MY_CONFIG_NAME );
|
||||
|
||||
tr_notify_init( );
|
||||
gtr_notify_init( );
|
||||
didinit = cf_init( configDir, NULL ); /* must come before actions_init */
|
||||
|
||||
setupsighandlers( ); /* set up handlers for fatal signals */
|
||||
|
@ -794,13 +789,13 @@ main( int argc, char ** argv )
|
|||
|
||||
/* init the ui manager */
|
||||
myUIManager = gtk_ui_manager_new ( );
|
||||
actions_init ( myUIManager, cbdata );
|
||||
gtr_actions_init ( myUIManager, cbdata );
|
||||
gtk_ui_manager_add_ui_from_string ( myUIManager, fallback_ui_file, -1, NULL );
|
||||
gtk_ui_manager_ensure_update ( myUIManager );
|
||||
gtk_window_set_default_icon_name ( MY_CONFIG_NAME );
|
||||
|
||||
/* create main window now to be a parent to any error dialogs */
|
||||
win = GTK_WINDOW( tr_window_new( myUIManager, cbdata->core ) );
|
||||
win = GTK_WINDOW( gtr_window_new( myUIManager, cbdata->core ) );
|
||||
g_signal_connect( win, "size-allocate", G_CALLBACK( onMainWindowSizeAllocated ), cbdata );
|
||||
|
||||
appsetup( win, argfiles, cbdata, startpaused, startminimized );
|
||||
|
@ -839,7 +834,7 @@ main( int argc, char ** argv )
|
|||
static void
|
||||
onCoreBusy( TrCore * core UNUSED, gboolean busy, struct cbdata * c )
|
||||
{
|
||||
tr_window_set_busy( c->wind, busy );
|
||||
gtr_window_set_busy( c->wind, busy );
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -867,7 +862,7 @@ appsetup( TrWindow * wind,
|
|||
if( isIconified )
|
||||
pref_flag_set( PREF_KEY_SHOW_TRAY_ICON, TRUE );
|
||||
|
||||
actions_set_core( cbdata->core );
|
||||
gtr_actions_set_core( cbdata->core );
|
||||
|
||||
/* set up core handlers */
|
||||
g_signal_connect( cbdata->core, "busy", G_CALLBACK( onCoreBusy ), cbdata );
|
||||
|
@ -900,7 +895,7 @@ appsetup( TrWindow * wind,
|
|||
gtk_window_set_skip_taskbar_hint( cbdata->wind,
|
||||
cbdata->icon != NULL );
|
||||
cbdata->isIconified = FALSE; // ensure that the next toggle iconifies
|
||||
action_toggle( "toggle-main-window", FALSE );
|
||||
gtr_action_set_toggled( "toggle-main-window", FALSE );
|
||||
}
|
||||
|
||||
if( !pref_flag_get( PREF_KEY_USER_HAS_GIVEN_INFORMED_CONSENT ) )
|
||||
|
@ -939,7 +934,7 @@ tr_window_present( GtkWindow * window )
|
|||
static void
|
||||
toggleMainWindow( struct cbdata * cbdata )
|
||||
{
|
||||
GtkWindow * window = GTK_WINDOW( cbdata->wind );
|
||||
GtkWindow * window = cbdata->wind;
|
||||
const int doShow = cbdata->isIconified;
|
||||
static int x = 0;
|
||||
static int y = 0;
|
||||
|
@ -975,7 +970,7 @@ maybeaskquit( struct cbdata * cbdata )
|
|||
wannaquit( cbdata );
|
||||
else {
|
||||
if( cbdata->quit_dialog == NULL ) {
|
||||
cbdata->quit_dialog = askquit( cbdata->core, cbdata->wind, wannaquit, cbdata );
|
||||
cbdata->quit_dialog = gtr_confirm_quit( cbdata->wind, cbdata->core, wannaquit, cbdata );
|
||||
g_object_add_weak_pointer( G_OBJECT( cbdata->quit_dialog ), &cbdata->quit_dialog );
|
||||
}
|
||||
gtk_window_present( GTK_WINDOW( cbdata->quit_dialog ) );
|
||||
|
@ -990,7 +985,7 @@ winclose( GtkWidget * w UNUSED,
|
|||
struct cbdata * cbdata = gdata;
|
||||
|
||||
if( cbdata->icon != NULL )
|
||||
action_activate ( "toggle-main-window" );
|
||||
gtr_action_activate ( "toggle-main-window" );
|
||||
else
|
||||
maybeaskquit( cbdata );
|
||||
|
||||
|
@ -1061,7 +1056,7 @@ winsetup( struct cbdata * cbdata, TrWindow * wind )
|
|||
|
||||
g_assert( NULL == cbdata->wind );
|
||||
cbdata->wind = GTK_WINDOW( wind );
|
||||
cbdata->sel = sel = GTK_TREE_SELECTION( tr_window_get_selection( cbdata->wind ) );
|
||||
cbdata->sel = sel = GTK_TREE_SELECTION( gtr_window_get_selection( cbdata->wind ) );
|
||||
|
||||
g_signal_connect( sel, "changed", G_CALLBACK( selectionChangedCB ), cbdata );
|
||||
selectionChangedCB( sel, cbdata );
|
||||
|
@ -1125,8 +1120,7 @@ sessionCloseThreadFunc( gpointer gdata )
|
|||
}
|
||||
|
||||
static void
|
||||
do_exit_cb( GtkWidget *w UNUSED,
|
||||
gpointer data UNUSED )
|
||||
exit_now_cb( GtkWidget *w UNUSED, gpointer data UNUSED )
|
||||
{
|
||||
exit( 0 );
|
||||
}
|
||||
|
@ -1168,7 +1162,7 @@ wannaquit( gpointer vdata )
|
|||
|
||||
b = gtk_alignment_new( 0.0, 1.0, 0.01, 0.01 );
|
||||
w = gtk_button_new_with_mnemonic( _( "_Quit Now" ) );
|
||||
g_signal_connect( w, "clicked", G_CALLBACK( do_exit_cb ), NULL );
|
||||
g_signal_connect( w, "clicked", G_CALLBACK( exit_now_cb ), NULL );
|
||||
gtk_container_add( GTK_CONTAINER( b ), w );
|
||||
gtk_table_attach( GTK_TABLE( p ), b, 1, 2, 2, 3, GTK_FILL, GTK_FILL, 0, 10 );
|
||||
|
||||
|
@ -1227,14 +1221,14 @@ static void
|
|||
showTorrentErrors( struct cbdata * cbdata )
|
||||
{
|
||||
if( cbdata->errqueue )
|
||||
flushAddTorrentErrors( GTK_WINDOW( cbdata->wind ),
|
||||
flushAddTorrentErrors( cbdata->wind,
|
||||
gtr_ngettext( "Couldn't add corrupt torrent",
|
||||
"Couldn't add corrupt torrents",
|
||||
g_slist_length( cbdata->errqueue ) ),
|
||||
&cbdata->errqueue );
|
||||
|
||||
if( cbdata->dupqueue )
|
||||
flushAddTorrentErrors( GTK_WINDOW( cbdata->wind ),
|
||||
flushAddTorrentErrors( cbdata->wind,
|
||||
gtr_ngettext( "Couldn't add duplicate torrent",
|
||||
"Couldn't add duplicate torrents",
|
||||
g_slist_length( cbdata->dupqueue ) ),
|
||||
|
@ -1274,18 +1268,16 @@ on_main_window_focus_in( GtkWidget * widget UNUSED,
|
|||
struct cbdata * cbdata = gdata;
|
||||
|
||||
if( cbdata->wind )
|
||||
gtk_window_set_urgency_hint( GTK_WINDOW( cbdata->wind ), FALSE );
|
||||
gtk_window_set_urgency_hint( cbdata->wind, FALSE );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void
|
||||
onAddTorrent( TrCore * core,
|
||||
tr_ctor * ctor,
|
||||
gpointer gdata )
|
||||
onAddTorrent( TrCore * core, tr_ctor * ctor, gpointer gdata )
|
||||
{
|
||||
struct cbdata * cbdata = gdata;
|
||||
GtkWidget * w = addSingleTorrentDialog( cbdata->wind, core, ctor );
|
||||
GtkWidget * w = gtr_torrent_options_dialog_new( cbdata->wind, core, ctor );
|
||||
|
||||
#if GTK_CHECK_VERSION( 2, 8, 0 )
|
||||
g_signal_connect( w, "focus-in-event",
|
||||
|
@ -1329,7 +1321,7 @@ prefschanged( TrCore * core UNUSED, const char * key, gpointer data )
|
|||
{
|
||||
const int show = pref_flag_get( key );
|
||||
if( show && !cbdata->icon )
|
||||
cbdata->icon = tr_icon_new( cbdata->core );
|
||||
cbdata->icon = gtr_icon_new( cbdata->core );
|
||||
else if( !show && cbdata->icon ) {
|
||||
g_object_unref( cbdata->icon );
|
||||
cbdata->icon = NULL;
|
||||
|
@ -1427,7 +1419,7 @@ prefschanged( TrCore * core UNUSED, const char * key, gpointer data )
|
|||
{
|
||||
const gboolean b = pref_flag_get( key );
|
||||
tr_sessionUseAltSpeed( tr, b );
|
||||
action_toggle( key, b );
|
||||
gtr_action_set_toggled( key, b );
|
||||
}
|
||||
else if( !strcmp( key, TR_PREFS_KEY_ALT_SPEED_TIME_BEGIN ) )
|
||||
{
|
||||
|
@ -1486,16 +1478,16 @@ updatemodel( gpointer gdata )
|
|||
/* update the torrent data in the model */
|
||||
tr_core_update( data->core );
|
||||
|
||||
/* update the main window's statusbar and toolbar buttons */
|
||||
/* refresh the main window's statusbar and toolbar buttons */
|
||||
if( data->wind != NULL )
|
||||
tr_window_update( data->wind );
|
||||
gtr_window_refresh( data->wind );
|
||||
|
||||
/* update the actions */
|
||||
refreshActions( data );
|
||||
|
||||
/* update the status tray icon */
|
||||
if( data->icon != NULL )
|
||||
tr_icon_refresh( data->icon );
|
||||
gtr_icon_refresh( data->icon );
|
||||
}
|
||||
|
||||
return !done;
|
||||
|
@ -1558,7 +1550,7 @@ rpcOnSelectedTorrents( struct cbdata * data, const char * method )
|
|||
tr_benc top, *args, *ids;
|
||||
gboolean invoked = FALSE;
|
||||
tr_session * session = tr_core_session( data->core );
|
||||
GtkTreeSelection * s = tr_window_get_selection( data->wind );
|
||||
GtkTreeSelection * s = gtr_window_get_selection( data->wind );
|
||||
|
||||
tr_bencInitDict( &top, 2 );
|
||||
tr_bencDictAddStr( &top, "method", method );
|
||||
|
@ -1595,7 +1587,7 @@ openFolderForeach( GtkTreeModel * model,
|
|||
static gboolean
|
||||
msgwinclosed( void )
|
||||
{
|
||||
action_toggle( "toggle-message-log", FALSE );
|
||||
gtr_action_set_toggled( "toggle-message-log", FALSE );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1617,13 +1609,13 @@ static void
|
|||
removeSelected( struct cbdata * data, gboolean delete_files )
|
||||
{
|
||||
GSList * l = NULL;
|
||||
GtkTreeSelection * s = tr_window_get_selection( data->wind );
|
||||
GtkTreeSelection * s = gtr_window_get_selection( data->wind );
|
||||
|
||||
gtk_tree_selection_selected_foreach( s, accumulateSelectedTorrents, &l );
|
||||
|
||||
if( l != NULL ) {
|
||||
l = g_slist_reverse( l );
|
||||
confirmRemove( data->wind, data->core, l, delete_files );
|
||||
gtr_confirm_remove( data->wind, data->core, l, delete_files );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1647,7 +1639,7 @@ static tr_torrent*
|
|||
getFirstSelectedTorrent( struct cbdata * data )
|
||||
{
|
||||
tr_torrent * tor = NULL;
|
||||
GtkTreeSelection * s = tr_window_get_selection( data->wind );
|
||||
GtkTreeSelection * s = gtr_window_get_selection( data->wind );
|
||||
GtkTreeModel * m;
|
||||
GList * l = gtk_tree_selection_get_selected_rows( s, &m );
|
||||
if( l != NULL ) {
|
||||
|
@ -1698,23 +1690,25 @@ copyMagnetLinkToClipboard( GtkWidget * w, tr_torrent * tor )
|
|||
}
|
||||
|
||||
void
|
||||
doAction( const char * action_name, gpointer user_data )
|
||||
gtr_actions_handler( const char * action_name, gpointer user_data )
|
||||
{
|
||||
struct cbdata * data = user_data;
|
||||
gboolean changed = FALSE;
|
||||
|
||||
if( !strcmp( action_name, "add-torrent-from-url" ) )
|
||||
{
|
||||
addURLDialog( data->wind, data->core );
|
||||
GtkWidget * w = gtr_torrent_add_from_url_dialog_new( data->wind, data->core );
|
||||
gtk_widget_show( w );
|
||||
}
|
||||
else if( !strcmp( action_name, "add-torrent-menu" )
|
||||
|| !strcmp( action_name, "add-torrent-toolbar" ) )
|
||||
{
|
||||
addDialog( data->wind, data->core );
|
||||
GtkWidget * w = gtr_torrent_add_from_file_dialog_new( data->wind, data->core );
|
||||
gtk_widget_show( w );
|
||||
}
|
||||
else if( !strcmp( action_name, "show-stats" ) )
|
||||
{
|
||||
GtkWidget * dialog = stats_dialog_create( data->wind, data->core );
|
||||
GtkWidget * dialog = gtr_stats_dialog_new( data->wind, data->core );
|
||||
gtk_widget_show( dialog );
|
||||
}
|
||||
else if( !strcmp( action_name, "donate" ) )
|
||||
|
@ -1742,7 +1736,7 @@ doAction( const char * action_name, gpointer user_data )
|
|||
GSList * ids = getSelectedTorrentIds( data );
|
||||
if( ids != NULL )
|
||||
{
|
||||
GtkWindow * parent = GTK_WINDOW( data->wind );
|
||||
GtkWindow * parent = data->wind;
|
||||
GtkWidget * w = gtr_relocate_dialog_new( parent, data->core, ids );
|
||||
gtk_widget_show( w );
|
||||
}
|
||||
|
@ -1765,7 +1759,7 @@ doAction( const char * action_name, gpointer user_data )
|
|||
}
|
||||
else if( !strcmp( action_name, "open-torrent-folder" ) )
|
||||
{
|
||||
GtkTreeSelection * s = tr_window_get_selection( data->wind );
|
||||
GtkTreeSelection * s = gtr_window_get_selection( data->wind );
|
||||
gtk_tree_selection_selected_foreach( s, openFolderForeach, data );
|
||||
}
|
||||
else if( !strcmp( action_name, "show-torrent-properties" ) )
|
||||
|
@ -1778,18 +1772,19 @@ doAction( const char * action_name, gpointer user_data )
|
|||
else {
|
||||
h = g_new( struct DetailsDialogHandle, 1 );
|
||||
h->key = getDetailsDialogKey( ids );
|
||||
h->dialog = w = torrent_inspector_new( GTK_WINDOW( data->wind ), data->core );
|
||||
torrent_inspector_set_torrents( w, ids );
|
||||
h->dialog = w = gtr_torrent_details_dialog_new( data->wind, data->core );
|
||||
gtr_torrent_details_dialog_set_torrents( w, ids );
|
||||
data->details = g_slist_append( data->details, h );
|
||||
g_object_weak_ref( G_OBJECT( w ), detailsClosed, data );
|
||||
gtk_widget_show( w );
|
||||
}
|
||||
gtk_window_present( GTK_WINDOW( w ) );
|
||||
g_slist_free( ids );
|
||||
}
|
||||
else if( !strcmp( action_name, "new-torrent" ) )
|
||||
{
|
||||
GtkWidget * w = make_meta_ui( GTK_WINDOW( data->wind ), data->core );
|
||||
gtk_widget_show_all( w );
|
||||
GtkWidget * w = gtr_torrent_creation_dialog_new( data->wind, data->core );
|
||||
gtk_widget_show( w );
|
||||
}
|
||||
else if( !strcmp( action_name, "remove-torrent" ) )
|
||||
{
|
||||
|
@ -1805,20 +1800,19 @@ doAction( const char * action_name, gpointer user_data )
|
|||
}
|
||||
else if( !strcmp( action_name, "select-all" ) )
|
||||
{
|
||||
GtkTreeSelection * s = tr_window_get_selection( data->wind );
|
||||
GtkTreeSelection * s = gtr_window_get_selection( data->wind );
|
||||
gtk_tree_selection_select_all( s );
|
||||
}
|
||||
else if( !strcmp( action_name, "deselect-all" ) )
|
||||
{
|
||||
GtkTreeSelection * s = tr_window_get_selection( data->wind );
|
||||
GtkTreeSelection * s = gtr_window_get_selection( data->wind );
|
||||
gtk_tree_selection_unselect_all( s );
|
||||
}
|
||||
else if( !strcmp( action_name, "edit-preferences" ) )
|
||||
{
|
||||
if( NULL == data->prefs )
|
||||
{
|
||||
data->prefs = tr_prefs_dialog_new( G_OBJECT( data->core ),
|
||||
data->wind );
|
||||
data->prefs = gtr_prefs_dialog_new( data->wind, G_OBJECT( data->core ) );
|
||||
g_signal_connect( data->prefs, "destroy",
|
||||
G_CALLBACK( gtk_widget_destroyed ), &data->prefs );
|
||||
gtk_widget_show( GTK_WIDGET( data->prefs ) );
|
||||
|
@ -1828,13 +1822,13 @@ doAction( const char * action_name, gpointer user_data )
|
|||
{
|
||||
if( !data->msgwin )
|
||||
{
|
||||
GtkWidget * win = msgwin_new( data->core, data->wind );
|
||||
GtkWidget * win = gtr_message_log_window_new( data->core, data->wind );
|
||||
g_signal_connect( win, "destroy", G_CALLBACK( msgwinclosed ), NULL );
|
||||
data->msgwin = win;
|
||||
}
|
||||
else
|
||||
{
|
||||
action_toggle( "toggle-message-log", FALSE );
|
||||
gtr_action_set_toggled( "toggle-message-log", FALSE );
|
||||
gtk_widget_destroy( data->msgwin );
|
||||
data->msgwin = NULL;
|
||||
}
|
||||
|
|
|
@ -421,7 +421,7 @@ on_drag_data_received( GtkWidget * widget UNUSED,
|
|||
}
|
||||
|
||||
GtkWidget*
|
||||
make_meta_ui( GtkWindow * parent, TrCore * core )
|
||||
gtr_torrent_creation_dialog_new( GtkWindow * parent, TrCore * core )
|
||||
{
|
||||
int row = 0;
|
||||
const char * str;
|
||||
|
@ -523,5 +523,6 @@ make_meta_ui( GtkWindow * parent, TrCore * core )
|
|||
gtk_drag_dest_add_uri_targets( d );
|
||||
g_signal_connect( d, "drag-data-received", G_CALLBACK( on_drag_data_received ), ui );
|
||||
|
||||
gtk_widget_show_all( t );
|
||||
return d;
|
||||
}
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef MAKE_META_UI__H
|
||||
#define MAKE_META_UI__H
|
||||
#ifndef GTR_TORRENT_CREATION_DIALOG_H
|
||||
#define GTR_TORRENT_CREATION_DIALOG_H
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "tr-core.h"
|
||||
|
||||
GtkWidget* make_meta_ui( GtkWindow * parent, TrCore * core );
|
||||
GtkWidget* gtr_torrent_creation_dialog_new( GtkWindow * parent, TrCore * core );
|
||||
|
||||
#endif
|
||||
|
|
|
@ -374,7 +374,7 @@ debug_level_combo_new( void )
|
|||
**/
|
||||
|
||||
GtkWidget *
|
||||
msgwin_new( TrCore * core, GtkWindow * parent )
|
||||
gtr_message_log_window_new( TrCore * core, GtkWindow * parent )
|
||||
{
|
||||
GtkWidget * win;
|
||||
GtkWidget * vbox;
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef TG_MSGWIN_H
|
||||
#define TG_MSGWIN_H
|
||||
#ifndef GTR_MSGWIN_H
|
||||
#define GTR_MSGWIN_H
|
||||
|
||||
GtkWidget * msgwin_new( TrCore * core, GtkWindow * parent );
|
||||
GtkWidget * gtr_message_log_window_new( TrCore * core, GtkWindow * parent );
|
||||
|
||||
#endif
|
||||
|
|
12
gtk/notify.c
12
gtk/notify.c
|
@ -29,15 +29,15 @@
|
|||
|
||||
#ifndef HAVE_LIBNOTIFY
|
||||
|
||||
void tr_notify_init( void ) { }
|
||||
void tr_notify_send( TrTorrent * tor UNUSED ) { }
|
||||
void tr_notify_added( const char * name UNUSED ) { }
|
||||
void gtr_notify_init( void ) { }
|
||||
void gtr_notify_send( TrTorrent * tor UNUSED ) { }
|
||||
void gtr_notify_added( const char * name UNUSED ) { }
|
||||
|
||||
#else
|
||||
#include <libnotify/notify.h>
|
||||
|
||||
void
|
||||
tr_notify_init( void )
|
||||
gtr_notify_init( void )
|
||||
{
|
||||
notify_init( "Transmission" );
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ addIcon( NotifyNotification * notify )
|
|||
}
|
||||
|
||||
void
|
||||
tr_notify_send( TrTorrent *tor )
|
||||
gtr_notify_send( TrTorrent *tor )
|
||||
{
|
||||
#ifdef HAVE_LIBCANBERRA
|
||||
if( pref_flag_get( PREF_KEY_PLAY_DOWNLOAD_COMPLETE_SOUND ) )
|
||||
|
@ -155,7 +155,7 @@ tr_notify_send( TrTorrent *tor )
|
|||
}
|
||||
|
||||
void
|
||||
tr_notify_added( const char * name )
|
||||
gtr_notify_added( const char * name )
|
||||
{
|
||||
if( pref_flag_get( PREF_KEY_SHOW_DESKTOP_NOTIFICATION ) )
|
||||
{
|
||||
|
|
10
gtk/notify.h
10
gtk/notify.h
|
@ -10,15 +10,15 @@
|
|||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __TR_NOTIFY_H__
|
||||
#define __TR_NOTIFY_H__
|
||||
#ifndef GTR_NOTIFY_H
|
||||
#define GTR_NOTIFY_H
|
||||
|
||||
#include "tr-torrent.h"
|
||||
|
||||
void tr_notify_init( void );
|
||||
void gtr_notify_init( void );
|
||||
|
||||
void tr_notify_send( TrTorrent * tor );
|
||||
void gtr_notify_send( TrTorrent * tor );
|
||||
|
||||
void tr_notify_added( const char * name );
|
||||
void gtr_notify_added( const char * name );
|
||||
|
||||
#endif
|
||||
|
|
|
@ -134,8 +134,7 @@ dialogResponse( GtkDialog * dialog,
|
|||
}
|
||||
|
||||
GtkWidget*
|
||||
stats_dialog_create( GtkWindow * parent,
|
||||
TrCore * core )
|
||||
gtr_stats_dialog_new( GtkWindow * parent, TrCore * core )
|
||||
{
|
||||
guint i;
|
||||
int row = 0;
|
||||
|
|
|
@ -10,13 +10,12 @@
|
|||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __TR_GTK_STATS_H__
|
||||
#define __TR_GTK_STATS_H__
|
||||
#ifndef GTR_STATS_DIALOG_H
|
||||
#define GTR_STATS_DIALOG_H
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "tr-core.h"
|
||||
|
||||
GtkWidget* stats_dialog_create( GtkWindow * parent,
|
||||
TrCore * core );
|
||||
GtkWidget* gtr_stats_dialog_new( GtkWindow * parent, TrCore * core );
|
||||
|
||||
#endif
|
||||
#endif /* GTR_STATS_DIALOG_H */
|
||||
|
|
|
@ -361,9 +361,9 @@ get_icon( const tr_torrent * tor, GtkIconSize icon_size, GtkWidget * for_widget
|
|||
else if( strchr( info->files[0].name, '/' ) != NULL )
|
||||
mime_type = DIRECTORY_MIME_TYPE;
|
||||
else
|
||||
mime_type = get_mime_type_from_filename( info->files[0].name );
|
||||
mime_type = gtr_get_mime_type_from_filename( info->files[0].name );
|
||||
|
||||
return get_mime_type_icon( mime_type, icon_size, for_widget );
|
||||
return gtr_get_mime_type_icon( mime_type, icon_size, for_widget );
|
||||
}
|
||||
|
||||
static GtkCellRenderer*
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef TORRENT_CELL_RENDERER_H
|
||||
#define TORRENT_CELL_RENDERER_H
|
||||
#ifndef GTR_TORRENT_CELL_RENDERER_H
|
||||
#define GTR_TORRENT_CELL_RENDERER_H
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
@ -42,4 +42,4 @@ GType torrent_cell_renderer_get_type( void );
|
|||
|
||||
GtkCellRenderer * torrent_cell_renderer_new( void );
|
||||
|
||||
#endif
|
||||
#endif /* GTR_TORRENT_CELL_RENDERER_H */
|
||||
|
|
|
@ -904,7 +904,7 @@ tr_core_add_torrent( TrCore * self,
|
|||
-1 );
|
||||
|
||||
if( doNotify )
|
||||
tr_notify_added( inf->name );
|
||||
gtr_notify_added( inf->name );
|
||||
|
||||
/* cleanup */
|
||||
g_object_unref( G_OBJECT( gtor ) );
|
||||
|
@ -1180,7 +1180,7 @@ tr_core_present_window( TrCore * core UNUSED,
|
|||
{
|
||||
/* Setting the toggle-main-window GtkCheckMenuItem to
|
||||
make sure its state is correctly set */
|
||||
action_toggle( "toggle-main-window", TRUE);
|
||||
gtr_action_set_toggled( "toggle-main-window", TRUE);
|
||||
|
||||
*success = TRUE;
|
||||
return TRUE;
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
* DEALINGS IN THE SOFTWARE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef TR_CORE_H
|
||||
#define TR_CORE_H
|
||||
#ifndef GTR_CORE_H
|
||||
#define GTR_CORE_H
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
@ -202,4 +202,4 @@ enum
|
|||
MC_ROW_COUNT
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif /* GTR_CORE_H */
|
||||
|
|
|
@ -24,31 +24,20 @@
|
|||
#define ICON_NAME "transmission"
|
||||
|
||||
#ifndef STATUS_ICON_SUPPORTED
|
||||
|
||||
gpointer
|
||||
tr_icon_new( TrCore * core )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
tr_icon_refresh( gpointer vicon UNUSED )
|
||||
{
|
||||
}
|
||||
|
||||
gpointer gtr_icon_new( TrCore * core UNUSED ) { return NULL; }
|
||||
void gtr_icon_refresh( gpointer vicon UNUSED ) { }
|
||||
#else
|
||||
|
||||
#ifdef HAVE_LIBAPPINDICATOR
|
||||
void
|
||||
tr_icon_refresh( gpointer vindicator UNUSED )
|
||||
gtr_icon_refresh( gpointer vindicator UNUSED )
|
||||
{
|
||||
}
|
||||
#else
|
||||
static void
|
||||
activated( GtkStatusIcon * self UNUSED,
|
||||
gpointer user_data UNUSED )
|
||||
activated( GtkStatusIcon * self UNUSED, gpointer user_data UNUSED )
|
||||
{
|
||||
action_activate ( "toggle-main-window" );
|
||||
gtr_action_activate( "toggle-main-window" );
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -57,7 +46,7 @@ popup( GtkStatusIcon * self,
|
|||
guint when,
|
||||
gpointer data UNUSED )
|
||||
{
|
||||
GtkWidget * w = action_get_widget( "/icon-popup" );
|
||||
GtkWidget * w = gtr_action_get_widget( "/icon-popup" );
|
||||
|
||||
gtk_menu_popup ( GTK_MENU( w ), NULL, NULL,
|
||||
gtk_status_icon_position_menu,
|
||||
|
@ -65,7 +54,7 @@ popup( GtkStatusIcon * self,
|
|||
}
|
||||
|
||||
void
|
||||
tr_icon_refresh( gpointer vicon )
|
||||
gtr_icon_refresh( gpointer vicon )
|
||||
{
|
||||
double KBps;
|
||||
double limit;
|
||||
|
@ -147,20 +136,20 @@ getIconName( void )
|
|||
|
||||
#ifdef HAVE_LIBAPPINDICATOR
|
||||
gpointer
|
||||
tr_icon_new( TrCore * core)
|
||||
gtr_icon_new( TrCore * core)
|
||||
{
|
||||
GtkWidget * w;
|
||||
const char * icon_name = getIconName( );
|
||||
AppIndicator * indicator = app_indicator_new( ICON_NAME, icon_name, APP_INDICATOR_CATEGORY_SYSTEM_SERVICES );
|
||||
app_indicator_set_status( indicator, APP_INDICATOR_STATUS_ACTIVE );
|
||||
w = action_get_widget( "/icon-popup" );
|
||||
w = gtr_action_get_widget( "/icon-popup" );
|
||||
app_indicator_set_menu( indicator, GTK_MENU ( w ) );
|
||||
g_object_set_data( G_OBJECT( indicator ), "tr-core", core );
|
||||
return indicator;
|
||||
}
|
||||
#else
|
||||
gpointer
|
||||
tr_icon_new( TrCore * core )
|
||||
gtr_icon_new( TrCore * core )
|
||||
{
|
||||
const char * icon_name = getIconName( );
|
||||
GtkStatusIcon * icon = gtk_status_icon_new_from_icon_name( icon_name );
|
||||
|
|
|
@ -10,18 +10,17 @@
|
|||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef TR_ICON_H
|
||||
#define TR_ICON_H
|
||||
#ifndef GTR_ICON_H
|
||||
#define GTR_ICON_H
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "tr-core.h"
|
||||
|
||||
#if GTK_CHECK_VERSION( 2, 10, 0 )
|
||||
#if GTK_CHECK_VERSION( 2,10,0 )
|
||||
#define STATUS_ICON_SUPPORTED
|
||||
#endif
|
||||
|
||||
gpointer tr_icon_new( TrCore * core );
|
||||
gpointer gtr_icon_new ( TrCore * core );
|
||||
void gtr_icon_refresh ( gpointer );
|
||||
|
||||
void tr_icon_refresh( gpointer );
|
||||
|
||||
#endif
|
||||
#endif /* GTR_ICON_H */
|
||||
|
|
|
@ -1232,8 +1232,7 @@ networkPage( GObject * core )
|
|||
****/
|
||||
|
||||
GtkWidget *
|
||||
tr_prefs_dialog_new( GObject * core,
|
||||
GtkWindow * parent )
|
||||
gtr_prefs_dialog_new( GtkWindow * parent, GObject * core )
|
||||
{
|
||||
GtkWidget * d;
|
||||
GtkWidget * n;
|
||||
|
|
|
@ -10,13 +10,12 @@
|
|||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef TR_PREFS_H
|
||||
#define TR_PREFS_H
|
||||
#ifndef GTR_PREFS_H
|
||||
#define GTR_PREFS_H
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
GtkWidget * tr_prefs_dialog_new( GObject * core,
|
||||
GtkWindow * parent );
|
||||
GtkWidget * gtr_prefs_dialog_new( GtkWindow * parent, GObject * core );
|
||||
|
||||
/* if you add a key here, you /must/ add its
|
||||
* default in tr_prefs_init_defaults( void ) */
|
||||
|
@ -55,4 +54,4 @@ enum
|
|||
SECONDARY_WINDOW_REFRESH_INTERVAL_SECONDS = 2
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif /* GTR_PREFS_H */
|
||||
|
|
|
@ -147,7 +147,7 @@ tr_torrent_info( TrTorrent * tor )
|
|||
static gboolean
|
||||
notifyInMainThread( gpointer user_data )
|
||||
{
|
||||
tr_notify_send( TR_TORRENT( user_data ) );
|
||||
gtr_notify_send( TR_TORRENT( user_data ) );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
* DEALINGS IN THE SOFTWARE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef TR_TORRENT_H
|
||||
#define TR_TORRENT_H
|
||||
#ifndef GTR_TORRENT_H
|
||||
#define GTR_TORRENT_H
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <libtransmission/transmission.h>
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <glib/gi18n.h>
|
||||
|
||||
#include <libtransmission/transmission.h>
|
||||
#include <libtransmission/utils.h> /* tr_formatter_speed_KBps() */
|
||||
|
||||
#include "actions.h"
|
||||
#include "conf.h"
|
||||
|
@ -95,7 +96,7 @@ static void
|
|||
on_popup_menu( GtkWidget * self UNUSED,
|
||||
GdkEventButton * event )
|
||||
{
|
||||
GtkWidget * menu = action_get_widget ( "/main-window-popup" );
|
||||
GtkWidget * menu = gtr_action_get_widget ( "/main-window-popup" );
|
||||
|
||||
gtk_menu_popup ( GTK_MENU( menu ), NULL, NULL, NULL, NULL,
|
||||
( event ? event->button : 0 ),
|
||||
|
@ -108,7 +109,7 @@ view_row_activated( GtkTreeView * tree_view UNUSED,
|
|||
GtkTreeViewColumn * column UNUSED,
|
||||
gpointer user_data UNUSED )
|
||||
{
|
||||
action_activate( "show-torrent-properties" );
|
||||
gtr_action_activate( "show-torrent-properties" );
|
||||
}
|
||||
|
||||
static GtkWidget*
|
||||
|
@ -195,7 +196,7 @@ prefsChanged( TrCore * core UNUSED,
|
|||
}
|
||||
else if( !strcmp( key, PREF_KEY_STATUSBAR_STATS ) )
|
||||
{
|
||||
tr_window_update( (TrWindow*)wind );
|
||||
gtr_window_refresh( (TrWindow*)wind );
|
||||
}
|
||||
else if( !strcmp( key, TR_PREFS_KEY_ALT_SPEED_ENABLED ) ||
|
||||
!strcmp( key, TR_PREFS_KEY_ALT_SPEED_UP_KBps ) ||
|
||||
|
@ -564,7 +565,7 @@ onOptionsClicked( GtkButton * button UNUSED, gpointer vp )
|
|||
***/
|
||||
|
||||
GtkWidget *
|
||||
tr_window_new( GtkUIManager * ui_mgr, TrCore * core )
|
||||
gtr_window_new( GtkUIManager * ui_mgr, TrCore * core )
|
||||
{
|
||||
int i, n;
|
||||
const char * pch;
|
||||
|
@ -597,17 +598,17 @@ tr_window_new( GtkUIManager * ui_mgr, TrCore * core )
|
|||
gtk_container_add ( GTK_CONTAINER( self ), vbox );
|
||||
|
||||
/* main menu */
|
||||
mainmenu = action_get_widget( "/main-window-menu" );
|
||||
w = action_get_widget( "/main-window-menu/torrent-menu/update-tracker" );
|
||||
mainmenu = gtr_action_get_widget( "/main-window-menu" );
|
||||
w = gtr_action_get_widget( "/main-window-menu/torrent-menu/update-tracker" );
|
||||
#if GTK_CHECK_VERSION( 2, 12, 0 )
|
||||
g_signal_connect( w, "query-tooltip",
|
||||
G_CALLBACK( onAskTrackerQueryTooltip ), p );
|
||||
#endif
|
||||
|
||||
/* toolbar */
|
||||
toolbar = p->toolbar = action_get_widget( "/main-window-toolbar" );
|
||||
action_set_important( "add-torrent-toolbar", TRUE );
|
||||
action_set_important( "show-torrent-properties", TRUE );
|
||||
toolbar = p->toolbar = gtr_action_get_widget( "/main-window-toolbar" );
|
||||
gtr_action_set_important( "add-torrent-toolbar", TRUE );
|
||||
gtr_action_set_important( "show-torrent-properties", TRUE );
|
||||
|
||||
/* filter */
|
||||
h = filter = p->filter = gtr_filter_bar_new( tr_core_session( core ),
|
||||
|
@ -841,7 +842,7 @@ updateSpeeds( PrivateData * p )
|
|||
}
|
||||
|
||||
void
|
||||
tr_window_update( TrWindow * self )
|
||||
gtr_window_refresh( TrWindow * self )
|
||||
{
|
||||
PrivateData * p = get_private_data( self );
|
||||
|
||||
|
@ -855,13 +856,13 @@ tr_window_update( TrWindow * self )
|
|||
}
|
||||
|
||||
GtkTreeSelection*
|
||||
tr_window_get_selection( TrWindow * w )
|
||||
gtr_window_get_selection( TrWindow * w )
|
||||
{
|
||||
return get_private_data( w )->selection;
|
||||
}
|
||||
|
||||
void
|
||||
tr_window_set_busy( TrWindow * w, gboolean isBusy )
|
||||
gtr_window_set_busy( TrWindow * w, gboolean isBusy )
|
||||
{
|
||||
if( w && gtr_widget_get_realized( GTK_WIDGET( w ) ) )
|
||||
{
|
||||
|
|
|
@ -22,21 +22,17 @@
|
|||
* DEALINGS IN THE SOFTWARE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef TR_WINDOW_H
|
||||
#define TR_WINDOW_H
|
||||
#ifndef GTR_WINDOW_H
|
||||
#define GTR_WINDOW_H
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <libtransmission/utils.h> /* tr_formatter_speed_KBps() */
|
||||
#include "tr-core.h"
|
||||
|
||||
typedef GtkWindow TrWindow;
|
||||
|
||||
GtkTreeSelection * tr_window_get_selection( TrWindow * );
|
||||
GtkWidget * gtr_window_new( GtkUIManager * uim, TrCore * core );
|
||||
GtkTreeSelection * gtr_window_get_selection( TrWindow * );
|
||||
void gtr_window_set_busy( TrWindow *, gboolean isBusy );
|
||||
void gtr_window_refresh( TrWindow * );
|
||||
|
||||
GtkWidget * tr_window_new( GtkUIManager * uim, TrCore * core );
|
||||
|
||||
void tr_window_update( TrWindow * );
|
||||
|
||||
void tr_window_set_busy( TrWindow *, gboolean isBusy );
|
||||
|
||||
#endif
|
||||
#endif /* GTR_WINDOW_H */
|
||||
|
|
|
@ -312,9 +312,7 @@ getWindow( GtkWidget * w )
|
|||
}
|
||||
|
||||
void
|
||||
addTorrentErrorDialog( GtkWidget * child,
|
||||
int err,
|
||||
const char * filename )
|
||||
gtr_add_torrent_error_dialog( GtkWidget * child, int err, const char * file )
|
||||
{
|
||||
char * secondary;
|
||||
const char * fmt;
|
||||
|
@ -327,7 +325,7 @@ addTorrentErrorDialog( GtkWidget * child,
|
|||
case TR_PARSE_DUPLICATE: fmt = _( "The torrent file \"%s\" is already in use." ); break;
|
||||
default: fmt = _( "The torrent file \"%s\" encountered an unknown error." ); break;
|
||||
}
|
||||
secondary = g_strdup_printf( fmt, filename );
|
||||
secondary = g_strdup_printf( fmt, file );
|
||||
|
||||
w = gtk_message_dialog_new( win,
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
|
|
|
@ -170,9 +170,9 @@ void gtr_unrecognized_url_dialog( GtkWidget * parent, const char * url );
|
|||
|
||||
void gtr_http_failure_dialog( GtkWidget * parent, const char * url, long response_code );
|
||||
|
||||
void addTorrentErrorDialog( GtkWidget * window_or_child,
|
||||
int err,
|
||||
const char * filename );
|
||||
void gtr_add_torrent_error_dialog( GtkWidget * window_or_child,
|
||||
int err,
|
||||
const char * filename );
|
||||
|
||||
/* pop up the context menu if a user right-clicks.
|
||||
if the row they right-click on isn't selected, select it. */
|
||||
|
|
Loading…
Reference in New Issue