Changeset 6807


Ignore:
Timestamp:
Sep 27, 2008, 6:01:31 PM (13 years ago)
Author:
charles
Message:

(gtk) #1306: clicking in a blank area in a list clears the selection.

Location:
trunk/gtk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/details.c

    r6795 r6807  
    701701        m = webseed_model_new( tr_torrent_handle( gtor ) );
    702702        webtree = gtk_tree_view_new_with_model( m );
     703        g_signal_connect( webtree, "button-release-event",
     704                          G_CALLBACK( on_tree_view_button_released ), NULL );
    703705        gtk_tree_view_set_rules_hint( GTK_TREE_VIEW( webtree ), TRUE );
    704706        p->webseeds = GTK_LIST_STORE( m );
     
    746748    gtk_widget_set_size_request( v, 550, 0 );
    747749    g_object_unref ( G_OBJECT( m ) );
     750    g_signal_connect( v, "button-release-event",
     751                      G_CALLBACK( on_tree_view_button_released ), NULL );
    748752
    749753    for( i = 0; i < G_N_ELEMENTS( view_columns ); ++i )
  • trunk/gtk/file-list.c

    r6795 r6807  
    755755    g_signal_connect( view, "button-press-event",
    756756                      G_CALLBACK( onViewButtonPressed ), data );
     757    g_signal_connect( view, "button-release-event",
     758                      G_CALLBACK( on_tree_view_button_released ), NULL );
     759
    757760
    758761    /* set up view */
  • trunk/gtk/msgwin.c

    r6795 r6807  
    527527
    528528    view = gtk_tree_view_new_with_model( data->sort );
     529    g_signal_connect( view, "button-release-event",
     530                      G_CALLBACK( on_tree_view_button_released ), NULL );
    529531    data->view = GTK_TREE_VIEW( view );
    530532    gtk_tree_view_set_rules_hint( data->view, TRUE );
  • trunk/gtk/tr-prefs.c

    r6801 r6807  
    854854        page->store = GTK_LIST_STORE( m );
    855855        w = gtk_tree_view_new_with_model( m );
     856        g_signal_connect( w, "button-release-event",
     857                          G_CALLBACK( on_tree_view_button_released ), NULL );
    856858
    857859        page->widgets = g_slist_append( page->widgets, w );
  • trunk/gtk/tr-window.c

    r6795 r6807  
    172172                      G_CALLBACK( on_tree_view_button_pressed ),
    173173                      (void *) on_popup_menu );
     174    g_signal_connect( view, "button-release-event",
     175                      G_CALLBACK( on_tree_view_button_released ), NULL );
    174176    g_signal_connect( view, "row-activated",
    175177                      G_CALLBACK( view_row_activated ), NULL );
  • trunk/gtk/tracker-list.c

    r6795 r6807  
    302302    page->store = GTK_LIST_STORE( m );
    303303    w = gtk_tree_view_new_with_model( m );
     304    g_signal_connect( w, "button-release-event",
     305                      G_CALLBACK( on_tree_view_button_released ), NULL );
    304306    page->view = GTK_TREE_VIEW( w );
    305307    gtk_tree_view_set_enable_search( page->view, FALSE );
  • trunk/gtk/util.c

    r6795 r6807  
    481481}
    482482
     483/* if the user clicked in an empty area of the list,
     484 * clear all the selections. */
     485gboolean
     486on_tree_view_button_released( GtkWidget *      view,
     487                              GdkEventButton * event,
     488                              gpointer         unused UNUSED )
     489{
     490    GtkTreeView * tv = GTK_TREE_VIEW( view );
     491
     492    if( !gtk_tree_view_get_path_at_pos ( tv,
     493                                         (gint) event->x,
     494                                         (gint) event->y,
     495                                         NULL, NULL, NULL, NULL ) )
     496    {
     497        GtkTreeSelection * selection = gtk_tree_view_get_selection( tv );
     498        gtk_tree_selection_unselect_all ( selection );
     499        return TRUE;
     500    }
     501
     502    return FALSE;
     503}
     504
    483505gpointer
    484506tr_object_ref_sink( gpointer object )
  • trunk/gtk/util.h

    r6795 r6807  
    120120                                         gpointer         unused );
    121121
     122/* if the click didn't specify a row, clear the selection */
     123gboolean    on_tree_view_button_released( GtkWidget *      view,
     124                                          GdkEventButton * event,
     125                                          gpointer         unused );
     126
     127
     128
    122129gpointer    tr_object_ref_sink( gpointer object );
    123130
Note: See TracChangeset for help on using the changeset viewer.