Changeset 6559 for trunk/gtk/main.c


Ignore:
Timestamp:
Aug 17, 2008, 12:39:26 PM (13 years ago)
Author:
muks
Message:

Don't show an error when transmission is run twice

Instead, present the main window. This commit also auto-generates
the dbus bindings.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/main.c

    r6556 r6559  
    348348    char * domain = "transmission";
    349349    char * configDir = NULL;
     350    tr_lockfile_state_t tr_state;
    350351
    351352    GOptionEntry entries[] = {
     
    398399     * transmission that's running, OR if there are files to
    399400     * be added, delegate that to the running instance via dbus */
    400     didlock = cf_lock( &err );
     401    didlock = cf_lock( &tr_state, &err );
    401402    argfiles = checkfilenames( argc-1, argv+1 );
    402403    if( !didlock && argfiles )
     
    408409        if( delegated )
    409410            err = NULL;
     411    }
     412    else if( (!didlock) && (tr_state == TR_LOCKFILE_ELOCK) )
     413    {
     414        gtr_dbus_present_window();
     415        err = NULL;
    410416    }
    411417
     
    577583
    578584static void
    579 toggleMainWindow( struct cbdata * cbdata )
     585toggleMainWindow( struct cbdata * cbdata, gboolean present )
    580586{
    581587    GtkWindow * window = GTK_WINDOW( cbdata->wind );
     
    583589    static int x=0, y=0;
    584590
    585     if( hide )
     591    if( (!present) && hide )
    586592    {
    587593        gtk_window_get_position( window, &x, &y );
     
    593599    {
    594600        gtk_window_set_skip_taskbar_hint( window, FALSE );
    595         gtk_window_move( window, x, y );
     601        if ( x != 0 && y != 0 )
     602            gtk_window_move( window, x, y );
    596603        gtk_widget_show( GTK_WIDGET( window ) );
    597604        gtk_window_deiconify( window );
     
    13581365    else if (!strcmp (action_name, "toggle-main-window"))
    13591366    {
    1360         toggleMainWindow( data );
     1367        toggleMainWindow( data, FALSE );
     1368    }
     1369    else if (!strcmp (action_name, "present-main-window"))
     1370    {
     1371        toggleMainWindow( data, TRUE );
    13611372    }
    13621373    else g_error ("Unhandled action: %s", action_name );
Note: See TracChangeset for help on using the changeset viewer.