Ticket #339: transmission_toggle.diff

File transmission_toggle.diff, 5.3 KB (added by infernux, 15 years ago)

New Patch

  • gtk/actions.c

     
    5252  set_selected_file_priority ( priority );
    5353}
    5454
     55static GtkToggleActionEntry show_toggle_entries[] =
     56{
     57  { "toggle-main-window", NULL,
     58    N_("Show _Main Window"), NULL, NULL, G_CALLBACK(action_cb), TRUE },
     59  { "toggle-debug-window", NULL,
     60    N_("Show _Debug Window"), NULL, NULL, G_CALLBACK(action_cb), FALSE }
     61};
    5562
    5663static GtkActionEntry entries[] =
    5764{
     
    8491    N_("_Torrent Info"), NULL, NULL, G_CALLBACK(action_cb) },
    8592  { "show-about-dialog", GTK_STOCK_ABOUT,
    8693    N_("_About Transmission"), NULL, NULL, G_CALLBACK(action_cb) },
    87   { "show-debug-window", NULL,
    88     N_("Show _Debug Window"), NULL, NULL, G_CALLBACK(action_cb) },
    89   { "toggle-main-window", "ICON_TRANSMISSION",
    90     N_("Show / Hide _Transmission"), NULL, NULL, G_CALLBACK(action_cb) },
    9194  { "update-tracker", GTK_STOCK_REFRESH,
    9295    N_("Update Tracker"), NULL, NULL, G_CALLBACK(action_cb) }
    9396};
     
    174177                                      TR_PRI_NORMAL,
    175178                                      G_CALLBACK(priority_changed_cb), NULL);
    176179
     180  gtk_action_group_add_toggle_actions ( action_group,
     181                                        show_toggle_entries,
     182                                        G_N_ELEMENTS(show_toggle_entries),
     183                                        callback_user_data );
     184
    177185  gtk_action_group_add_actions( action_group,
    178186                                entries, n_entries,
    179187                                callback_user_data );
  • gtk/msgwin.c

     
    229229  int ii, curlevel;
    230230
    231231  win = gtk_window_new( GTK_WINDOW_TOPLEVEL );
     232  gtk_window_set_title( GTK_WINDOW( win ), "Transmission Debug Window" );
    232233  gtk_window_set_default_size( GTK_WINDOW( win ), 600, 400 );
    233234  gtk_window_set_role( GTK_WINDOW( win ), "debug-window" );
    234235  vbox = gtk_vbox_new( FALSE, 0 );
     
    299300
    300301  gtk_box_pack_start( GTK_BOX( vbox ), scroll, TRUE, TRUE, 0 );
    301302
    302 
    303303  msgwin_update( );
    304304  gtk_container_add( GTK_CONTAINER( win ), vbox );
    305305  gtk_widget_show_all( win );
  • gtk/ui.h

     
    2222"      <menuitem action='edit-preferences'/>\n"
    2323"    </menu>\n"
    2424"    <menu action='help-menu'>\n"
    25 "      <menuitem action='show-debug-window'/>\n"
     25"      <menuitem action='toggle-debug-window'/>\n"
    2626"      <separator/>\n"
    2727"      <menuitem action='show-about-dialog'/>\n"
    2828"    </menu>\n"
     
    5151"    <menuitem action='add-torrent'/>\n"
    5252"    <separator/>\n"
    5353"    <menuitem action='toggle-main-window'/>\n"
    54 "    <menuitem action='show-debug-window'/>\n"
     54"    <menuitem action='toggle-debug-window'/>\n"
    5555"    <menuitem action='show-about-dialog'/>\n"
    5656"    <separator/>\n"
    5757"    <menuitem action='quit'/>\n"
  • gtk/main.c

     
    104104    GtkWindow    * wind;
    105105    TrCore       * core;
    106106    GtkWidget    * icon;
     107    GtkWidget    * msgwin;
    107108    TrPrefs      * prefs;
    108109    guint          timer;
    109     gboolean       msgwinopen;
    110110    gboolean       closing;
    111111    GList        * errqueue;
    112112};
     
    161161setpex( tr_torrent_t * tor, void * arg );
    162162static gboolean
    163163updatemodel(gpointer gdata);
    164 static void
    165 boolwindclosed(GtkWidget *widget, gpointer gdata);
    166164static GList *
    167165getselection( struct cbdata * cbdata );
    168166
     
    408406    cbdata->wind       = NULL;
    409407    cbdata->core       = tr_core_new();
    410408    cbdata->icon       = NULL;
     409    cbdata->msgwin     = NULL;
    411410    cbdata->prefs      = NULL;
    412411    cbdata->timer      = 0;
    413     cbdata->msgwinopen = FALSE;
    414412    cbdata->closing    = FALSE;
    415413    cbdata->errqueue   = NULL;
    416414
     
    867865  return TRUE;
    868866}
    869867
    870 static void
    871 boolwindclosed(GtkWidget *widget SHUTUP, gpointer gdata) {
    872   gboolean *preachy_gcc = gdata;
    873  
    874   *preachy_gcc = FALSE;
    875 }
    876 
    877868/* returns a GList containing a GtkTreeRowReference to each selected row */
    878869static GList *
    879870getselection( struct cbdata * cbdata )
     
    984975    g_object_unref( G_OBJECT( gtor ) );
    985976}
    986977
     978static gboolean
     979msgwinclosed()
     980{
     981  action_toggle( "toggle-debug-window", FALSE );
     982  return FALSE;
     983}
     984
    987985void
    988986doAction ( const char * action_name, gpointer user_data )
    989987{
     
    10741072            gtk_widget_show( GTK_WIDGET( data->prefs ) );
    10751073        }
    10761074    }
    1077     else if (!strcmp (action_name, "show-debug-window"))
     1075    else if (!strcmp (action_name, "toggle-debug-window"))
    10781076    {
    1079         if( !data->msgwinopen )
     1077        if( !data->msgwin )
    10801078        {
    10811079            GtkWidget * win = msgwin_create( data->core );
    1082             g_signal_connect( win, "destroy", G_CALLBACK( boolwindclosed ),
    1083                                 &data->msgwinopen );
    1084             data->msgwinopen = TRUE;
     1080            g_signal_connect( win, "destroy", G_CALLBACK( msgwinclosed ),
     1081                             NULL );
     1082            data->msgwin = GTK_WINDOW( win );
    10851083        }
     1084        else
     1085        {
     1086            action_toggle("toggle-debug-window", FALSE);
     1087            gtk_widget_destroy( data->msgwin );
     1088            data->msgwin = NULL;
     1089        }
    10861090    }
    10871091    else if (!strcmp (action_name, "show-about-dialog"))
    10881092    {