Changeset 1647 for trunk/gtk/dialogs.c


Ignore:
Timestamp:
Apr 3, 2007, 8:18:53 AM (15 years ago)
Author:
joshe
Message:

Make evil initial window sizing magic a bit less evil and a bit less magic.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/dialogs.c

    r1633 r1647  
    9090stylekludge( GObject * obj, GParamSpec * spec, gpointer data );
    9191static void
    92 setscroll( void * arg );
    93 static void
    94 fileswindresp( GtkWidget * widget, gint resp, gpointer data );
     92fileswinddead( GtkWidget * widget, gpointer data );
    9593static void
    9694filestorclosed( gpointer data, GObject * tor );
     
    428426    int                 ii;
    429427    GtkWidget         * view, * scroll, * frame, * wind;
    430     GtkCellRenderer   * rend;
     428    GtkCellRenderer   * rend, * elip;
    431429    GtkTreeViewColumn * col;
    432430    GtkTreeSelection  * sel;
     
    452450    /* add file column */
    453451    col = gtk_tree_view_column_new();
     452    gtk_tree_view_column_set_expand( col, TRUE );
     453    gtk_tree_view_column_set_sizing( col, GTK_TREE_VIEW_COLUMN_AUTOSIZE );
    454454    gtk_tree_view_column_set_title( col, _("File") );
    455455    /* add icon renderer */
     
    459459    /* add text renderer */
    460460    rend = gtk_cell_renderer_text_new();
     461    elip = rend;
    461462    gtk_tree_view_column_pack_start( col, rend, TRUE );
    462463    gtk_tree_view_column_add_attribute( col, rend, "markup", FC_LABEL );
     
    484485    /* create the scrolled window and stick the view in it */
    485486    scroll = gtk_scrolled_window_new( NULL, NULL );
    486     gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scroll ),
    487                                     GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC );
    488487    gtk_container_add( GTK_CONTAINER( scroll ), view );
    489488    gtk_widget_show( scroll );
     
    517516
    518517    g_object_weak_ref( G_OBJECT( tor ), filestorclosed, fw );
    519     g_signal_connect( wind, "response", G_CALLBACK( fileswindresp ), fw );
     518    g_signal_connect( wind, "destroy", G_CALLBACK( fileswinddead ), fw );
     519    g_signal_connect( wind, "response", G_CALLBACK( gtk_widget_destroy ), 0 );
    520520    fileswindupdate( fw );
    521521
    522     /* show the window with a nice initial size */
    523     windowsizehack( wind, scroll, view, setscroll, scroll );
     522    sizingmagic( GTK_WINDOW( wind ), GTK_SCROLLED_WINDOW( scroll ),
     523                 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
     524    g_object_set( elip, "ellipsize", PANGO_ELLIPSIZE_END, NULL );
     525    gtk_widget_show( wind );
    524526}
    525527
     
    538540
    539541static void
    540 setscroll( void * arg )
    541 {
    542     gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( arg ),
    543         GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
    544 }
    545 
    546 static void
    547 fileswindresp( GtkWidget * widget SHUTUP, gint resp SHUTUP, gpointer data )
     542fileswinddead( GtkWidget * widget SHUTUP, gpointer data )
    548543{
    549544    struct fileswind * fw = data;
Note: See TracChangeset for help on using the changeset viewer.