Changeset 5662 for trunk/gtk/util.c


Ignore:
Timestamp:
Apr 21, 2008, 8:58:39 PM (14 years ago)
Author:
charles
Message:

(gtk) remember window size & location between sessions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/util.c

    r5658 r5662  
    266266}
    267267
    268 /**
    269  * don't use more than 50% the height of the screen, nor 80% the width.
    270  * but don't be too small, either -- set the minimums to 500 x 300
    271  */
    272 void
    273 sizingmagic( GtkWindow         * wind,
    274              GtkScrolledWindow * scroll,
    275              GtkPolicyType       hscroll,
    276              GtkPolicyType       vscroll )
    277 {
    278     int width;
    279     int height;
    280     GtkRequisition req;
    281 
    282     GdkScreen * screen = gtk_widget_get_screen( GTK_WIDGET( wind ) );
    283 
    284     gtk_scrolled_window_set_policy( scroll, GTK_POLICY_NEVER,
    285                                             GTK_POLICY_NEVER );
    286 
    287     gtk_widget_size_request( GTK_WIDGET( wind ), &req );
    288     req.height = MAX( req.height, 300 );
    289     height = MIN( req.height, gdk_screen_get_height( screen ) / 5 * 4 );
    290 
    291     gtk_scrolled_window_set_policy( scroll, GTK_POLICY_NEVER, vscroll );
    292     gtk_widget_size_request( GTK_WIDGET( wind ), &req );
    293     req.width = MAX( req.width, 500 );
    294     width = MIN( req.width, gdk_screen_get_width( screen ) / 2 );
    295 
    296     gtk_window_set_default_size( wind, width, height );
    297     gtk_scrolled_window_set_policy( scroll, hscroll, vscroll );
    298 }
    299 
    300268static void
    301269onErrorResponse(GtkWidget * dialog, int resp UNUSED, gpointer glist)
Note: See TracChangeset for help on using the changeset viewer.