Changeset 10464


Ignore:
Timestamp:
Apr 11, 2010, 2:18:29 PM (12 years ago)
Author:
charles
Message:

(trunk gtk) #3132 "paste clipboard contents into textbox in Add URL dialog" -- implemented for 2.00

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/add-dialog.c

    r10356 r10464  
    493493}
    494494
     495static void
     496paste_clipboard_url_into_entry( GtkWidget * e )
     497{
     498  size_t i;
     499
     500  char * text[] = {
     501    gtk_clipboard_wait_for_text( gtk_clipboard_get( GDK_SELECTION_PRIMARY ) ),
     502    gtk_clipboard_wait_for_text( gtk_clipboard_get( GDK_SELECTION_CLIPBOARD ) )
     503  };
     504
     505  for( i=0; i<G_N_ELEMENTS(text); ++i ) {
     506      char * s = text[i];
     507      if( s && ( gtr_is_supported_url( s ) || gtr_is_magnet_link( s ) ) ) {
     508          gtk_entry_set_text( GTK_ENTRY( e ), s );
     509          break;
     510      }
     511  }
     512
     513  for( i=0; i<G_N_ELEMENTS(text); ++i )
     514    g_free( text[i] );
     515}
     516
    495517GtkWidget*
    496518addURLDialog( GtkWindow * parent, TrCore * core )
     
    516538    hig_workarea_add_section_title( t, &row, _( "Add torrent from URL" ) );
    517539    e = gtk_entry_new( );
     540    paste_clipboard_url_into_entry( e );
    518541    g_object_set_data( G_OBJECT( w ), "url-entry", e );
    519542    hig_workarea_add_row( t, &row, _( "_URL" ), e, NULL );
Note: See TracChangeset for help on using the changeset viewer.