~ubuntu-branches/ubuntu/maverick/transmission/maverick-updates

« back to all changes in this revision

Viewing changes to gtk/msgwin.c

  • Committer: Bazaar Package Importer
  • Author(s): Chris Coulson, Krzysztof Klimonda, Chris Coulson
  • Date: 2009-09-09 09:06:11 UTC
  • mfrom: (1.1.27 upstream)
  • Revision ID: james.westby@ubuntu.com-20090909090611-09ai2hyo66h1dhv8
Tags: 1.74-0ubuntu1
[ Krzysztof Klimonda ]
* Merge from debian unstable, remaining changes:
  - debian/control:
    + Added replaces & provides clutch (now included as part of transmission).
    + add liblaunchpad-integration to Build-Depends
  - debian/rules:
    + Create a PO template during package build.
  - debian/patches/01_lpi.patch:
    + Integrate Transmission with Launchpad
  - debian/patches/20_add_X-Ubuntu-Gettext-Domain.diff:
    + Add X-Ubuntu-Gettext-Domain to .desktop file.
* debian/control:
  - add lsb-release to Build-Depends
* This includes the QT client in transmission-qt.

[ Chris Coulson ]
* Update to new upstream version 1.74 (LP: #418367):
  - Better data recovery in the case of an OS or Transmission crash
  - If a data file is moved, stop the torrent instead of redownloading 
    it (LP: #419304).
  - Fix bug that didn't list some peers in the resume file and in PEX
  - More helpful torrent error messages
  - DHT now honors the bind-address-ipv4 configuration option
  - Fix Debian build error with miniupnpc
  - Fix Cygwin build error with strtold
  - Update to a newer snapshot of miniupnpc
  - Fix crash that occurred when adding torrents on some desktops
  - Synchronize the statusbar's and torrent list's speeds
  - Fix the Properties dialog's "Origin" field for multiple torrents
* debian/rules, debian/control:
  - Don't run autoreconf at build time and don't build-dep on libtool.
* debian/control:
  - transmission-common replaces transmission-gtk (<< 1.74) rather than
    (<= 1.73-1).
* Refreshed patches:
  - 01_lpi.patch.
  - dont_build_libevent.patch.
  - qt_client_use_system_libevent.patch.
* Dropped patches not needed anymore:
  - updateminiupnpcstrings_double_escape_slash.patch
* Added 99_autoreconf.patch for autotools update.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 * This exemption does not extend to derived works not owned by
8
8
 * the Transmission project.
9
9
 *
10
 
 * $Id: msgwin.c 8724 2009-06-20 23:55:36Z charles $
 
10
 * $Id: msgwin.c 8846 2009-07-22 15:55:48Z charles $
11
11
 */
12
12
 
13
13
#include <errno.h>
75
75
}
76
76
 
77
77
static void
78
 
doSave( GtkWindow *      parent,
79
 
        struct MsgData * data,
80
 
        const char *     filename )
 
78
doSave( GtkWindow * parent, struct MsgData * data, const char * filename )
81
79
{
82
80
    FILE * fp = fopen( filename, "w+" );
83
81
 
84
82
    if( !fp )
85
83
    {
86
 
        errmsg( parent,
87
 
               _( "Couldn't save file \"%1$s\": %2$s" ),
88
 
               filename, g_strerror( errno ) );
 
84
        GtkWidget * w = gtk_message_dialog_new( parent, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, _( "Couldn't save \"%s\"" ), filename );
 
85
        gtk_message_dialog_format_secondary_text( GTK_MESSAGE_DIALOG( w ), "%s", g_strerror( errno ) );
 
86
        g_signal_connect_swapped( w, "response", G_CALLBACK( gtk_widget_destroy ), w );
 
87
        gtk_widget_show( w );
89
88
    }
90
89
    else
91
90
    {
92
 
        GtkTreeIter    iter;
 
91
        GtkTreeIter iter;
93
92
        GtkTreeModel * model = GTK_TREE_MODEL( data->sort );
94
93
        if( gtk_tree_model_iter_children( model, &iter, NULL ) ) do
95
 
            {
96
 
                char *                     date;
97
 
                const char *               levelStr;
98
 
                const struct tr_msg_list * node;
99
 
 
100
 
                gtk_tree_model_get( model, &iter,
101
 
                                    COL_TR_MSG, &node,
102
 
                                    -1 );
103
 
                date = gtr_localtime( node->when );
104
 
                switch( node->level )
105
 
                {
106
 
                    case TR_MSG_DBG:
107
 
                        levelStr = "debug"; break;
108
 
 
109
 
                    case TR_MSG_ERR:
110
 
                        levelStr = "error"; break;
111
 
 
112
 
                    default:
113
 
                        levelStr = "     "; break;
114
 
                }
115
 
                fprintf( fp, "%s\t%s\t%s\t%s\n", date, levelStr,
116
 
                        ( node->name ? node->name : "" ),
117
 
                        ( node->message ? node->message : "" ) );
118
 
 
119
 
                g_free( date );
 
94
        {
 
95
            char * date;
 
96
            const char * levelStr;
 
97
            const struct tr_msg_list * node;
 
98
 
 
99
            gtk_tree_model_get( model, &iter, COL_TR_MSG, &node, -1 );
 
100
            date = gtr_localtime( node->when );
 
101
            switch( node->level ) {
 
102
                case TR_MSG_DBG: levelStr = "debug"; break;
 
103
                case TR_MSG_ERR: levelStr = "error"; break;
 
104
                default:         levelStr = "     "; break;
120
105
            }
121
 
            while( gtk_tree_model_iter_next( model, &iter ) );
 
106
            fprintf( fp, "%s\t%s\t%s\t%s\n", date, levelStr,
 
107
                     ( node->name ? node->name : "" ),
 
108
                     ( node->message ? node->message : "" ) );
 
109
            g_free( date );
 
110
        }
 
111
        while( gtk_tree_model_iter_next( model, &iter ) );
122
112
 
123
113
        fclose( fp );
124
114
    }
125
115
}
126
116
 
127
117
static void
128
 
onSaveDialogResponse( GtkWidget * d,
129
 
                      int         response,
130
 
                      gpointer    data )
 
118
onSaveDialogResponse( GtkWidget * d, int response, gpointer data )
131
119
{
132
120
    if( response == GTK_RESPONSE_ACCEPT )
133
121
    {
134
 
        char * filename =
135
 
            gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( d ) );
136
 
        doSave( GTK_WINDOW( d ), data, filename );
137
 
        g_free( filename );
 
122
        char * file = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( d ) );
 
123
        doSave( GTK_WINDOW( d ), data, file );
 
124
        g_free( file );
138
125
    }
139
126
 
140
127
    gtk_widget_destroy( d );
145
132
               gpointer    data )
146
133
{
147
134
    GtkWindow * window = GTK_WINDOW( gtk_widget_get_toplevel( w ) );
148
 
    GtkWidget * d = gtk_file_chooser_dialog_new( _(
149
 
                                                     "Save Log" ), window,
 
135
    GtkWidget * d = gtk_file_chooser_dialog_new( _( "Save Log" ), window,
150
136
                                                 GTK_FILE_CHOOSER_ACTION_SAVE,
151
137
                                                 GTK_STOCK_CANCEL,
152
138
                                                 GTK_RESPONSE_CANCEL,