Changeset 4903 for trunk/gtk/main.c


Ignore:
Timestamp:
Feb 3, 2008, 1:43:47 AM (15 years ago)
Author:
charles
Message:

(gtk) #611: don't hide in the systray without letting the user know

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/main.c

    r4861 r4903  
    109109    GHashTable   * tor2details;
    110110    GHashTable   * details2tor;
     111    gboolean       minimized;
    111112};
    112113
     
    334335    cbdata->closing    = FALSE;
    335336    cbdata->errqueue   = NULL;
     337    cbdata->minimized  = minimized;
    336338
    337339    actions_set_core( cbdata->core );
     
    375377
    376378    /* show the window */
    377     if( !minimized )
    378         gtk_widget_show( GTK_WIDGET(wind) );
     379    if( minimized )
     380        gtk_window_iconify( wind );
     381    gtk_widget_show( GTK_WIDGET( wind ) );
     382}
     383
     384static void
     385setMainWindowMinimized( struct cbdata * data, gboolean minimized )
     386{
     387    GtkWindow * window = GTK_WINDOW( data->wind );
     388
     389    if(( data->minimized = minimized ))
     390        gtk_window_iconify( window );
     391    else
     392        gtk_window_deiconify( window );
     393}
     394
     395static void
     396toggleMainWindow( struct cbdata * data )
     397{
     398    setMainWindowMinimized( data, !data->minimized );
    379399}
    380400
     
    385405
    386406    if( cbdata->icon != NULL )
    387         gtk_widget_hide( GTK_WIDGET( cbdata->wind ) );
     407        setMainWindowMinimized( cbdata, TRUE );
    388408    else
    389409        askquit( cbdata->core, cbdata->wind, wannaquit, cbdata );
     
    915935}
    916936
    917 static void
    918 toggleMainWindow( struct cbdata * data )
    919 {
    920     static int x=0, y=0;
    921     GtkWidget * w = GTK_WIDGET( data->wind );
    922     GtkWindow * window = GTK_WINDOW( w );
    923 
    924     if( GTK_WIDGET_VISIBLE( w ) )
    925     {
    926         gtk_window_get_position( window, &x, &y );
    927         gtk_widget_hide( w );
    928     }
    929     else
    930     {
    931         gtk_window_move( window, x, y );
    932         gtk_window_present( window );
    933     }
    934 }
    935 
    936937void
    937938doAction ( const char * action_name, gpointer user_data )
     
    940941    gboolean changed = FALSE;
    941942
    942     if (!strcmp (action_name, "add-torrent"))
     943    if (!strcmp (action_name, "open-torrent"))
    943944    {
    944945        makeaddwind( data->wind, data->core );
Note: See TracChangeset for help on using the changeset viewer.