mirror of
https://github.com/transmission/transmission
synced 2024-12-24 08:43:27 +00:00
(gtk) #611: don't hide in the systray without letting the user know
This commit is contained in:
parent
c09df07801
commit
21f91ae5be
3 changed files with 28 additions and 27 deletions
|
@ -101,7 +101,7 @@ static GtkActionEntry entries[] =
|
||||||
{ "sort-menu", NULL, N_("_Sort Torrents By"), NULL, NULL, NULL },
|
{ "sort-menu", NULL, N_("_Sort Torrents By"), NULL, NULL, NULL },
|
||||||
{ "edit-menu", NULL, N_("_Edit"), NULL, NULL, NULL },
|
{ "edit-menu", NULL, N_("_Edit"), NULL, NULL, NULL },
|
||||||
{ "help-menu", NULL, N_("_Help"), NULL, NULL, NULL },
|
{ "help-menu", NULL, N_("_Help"), NULL, NULL, NULL },
|
||||||
{ "add-torrent", GTK_STOCK_OPEN,
|
{ "open-torrent", GTK_STOCK_OPEN,
|
||||||
NULL, NULL, N_("Open Torrent"), G_CALLBACK(action_cb) },
|
NULL, NULL, N_("Open Torrent"), G_CALLBACK(action_cb) },
|
||||||
{ "start-torrent", GTK_STOCK_MEDIA_PLAY,
|
{ "start-torrent", GTK_STOCK_MEDIA_PLAY,
|
||||||
N_("_Start"), "<control>S", NULL, G_CALLBACK(action_cb) },
|
N_("_Start"), "<control>S", NULL, G_CALLBACK(action_cb) },
|
||||||
|
|
47
gtk/main.c
47
gtk/main.c
|
@ -108,6 +108,7 @@ struct cbdata
|
||||||
GList * errqueue;
|
GList * errqueue;
|
||||||
GHashTable * tor2details;
|
GHashTable * tor2details;
|
||||||
GHashTable * details2tor;
|
GHashTable * details2tor;
|
||||||
|
gboolean minimized;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define CBDATA_PTR "callback-data-pointer"
|
#define CBDATA_PTR "callback-data-pointer"
|
||||||
|
@ -333,6 +334,7 @@ appsetup( TrWindow * wind, GList * args,
|
||||||
cbdata->timer = 0;
|
cbdata->timer = 0;
|
||||||
cbdata->closing = FALSE;
|
cbdata->closing = FALSE;
|
||||||
cbdata->errqueue = NULL;
|
cbdata->errqueue = NULL;
|
||||||
|
cbdata->minimized = minimized;
|
||||||
|
|
||||||
actions_set_core( cbdata->core );
|
actions_set_core( cbdata->core );
|
||||||
|
|
||||||
|
@ -374,8 +376,26 @@ appsetup( TrWindow * wind, GList * args,
|
||||||
updatemodel( cbdata );
|
updatemodel( cbdata );
|
||||||
|
|
||||||
/* show the window */
|
/* show the window */
|
||||||
if( !minimized )
|
if( minimized )
|
||||||
gtk_widget_show( GTK_WIDGET(wind) );
|
gtk_window_iconify( wind );
|
||||||
|
gtk_widget_show( GTK_WIDGET( wind ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
setMainWindowMinimized( struct cbdata * data, gboolean minimized )
|
||||||
|
{
|
||||||
|
GtkWindow * window = GTK_WINDOW( data->wind );
|
||||||
|
|
||||||
|
if(( data->minimized = minimized ))
|
||||||
|
gtk_window_iconify( window );
|
||||||
|
else
|
||||||
|
gtk_window_deiconify( window );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
toggleMainWindow( struct cbdata * data )
|
||||||
|
{
|
||||||
|
setMainWindowMinimized( data, !data->minimized );
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -384,7 +404,7 @@ winclose( GtkWidget * w UNUSED, GdkEvent * event UNUSED, gpointer gdata )
|
||||||
struct cbdata * cbdata = gdata;
|
struct cbdata * cbdata = gdata;
|
||||||
|
|
||||||
if( cbdata->icon != NULL )
|
if( cbdata->icon != NULL )
|
||||||
gtk_widget_hide( GTK_WIDGET( cbdata->wind ) );
|
setMainWindowMinimized( cbdata, TRUE );
|
||||||
else
|
else
|
||||||
askquit( cbdata->core, cbdata->wind, wannaquit, cbdata );
|
askquit( cbdata->core, cbdata->wind, wannaquit, cbdata );
|
||||||
|
|
||||||
|
@ -914,32 +934,13 @@ msgwinclosed()
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
toggleMainWindow( struct cbdata * data )
|
|
||||||
{
|
|
||||||
static int x=0, y=0;
|
|
||||||
GtkWidget * w = GTK_WIDGET( data->wind );
|
|
||||||
GtkWindow * window = GTK_WINDOW( w );
|
|
||||||
|
|
||||||
if( GTK_WIDGET_VISIBLE( w ) )
|
|
||||||
{
|
|
||||||
gtk_window_get_position( window, &x, &y );
|
|
||||||
gtk_widget_hide( w );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gtk_window_move( window, x, y );
|
|
||||||
gtk_window_present( window );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
doAction ( const char * action_name, gpointer user_data )
|
doAction ( const char * action_name, gpointer user_data )
|
||||||
{
|
{
|
||||||
struct cbdata * data = user_data;
|
struct cbdata * data = user_data;
|
||||||
gboolean changed = FALSE;
|
gboolean changed = FALSE;
|
||||||
|
|
||||||
if (!strcmp (action_name, "add-torrent"))
|
if (!strcmp (action_name, "open-torrent"))
|
||||||
{
|
{
|
||||||
makeaddwind( data->wind, data->core );
|
makeaddwind( data->wind, data->core );
|
||||||
}
|
}
|
||||||
|
|
6
gtk/ui.h
6
gtk/ui.h
|
@ -2,7 +2,7 @@ const char * fallback_ui_file =
|
||||||
"<ui>\n"
|
"<ui>\n"
|
||||||
" <menubar name='main-window-menu'>\n"
|
" <menubar name='main-window-menu'>\n"
|
||||||
" <menu action='torrent-menu'>\n"
|
" <menu action='torrent-menu'>\n"
|
||||||
" <menuitem action='add-torrent'/>\n"
|
" <menuitem action='open-torrent'/>\n"
|
||||||
" <menuitem action='start-torrent'/>\n"
|
" <menuitem action='start-torrent'/>\n"
|
||||||
" <menuitem action='update-tracker'/>\n"
|
" <menuitem action='update-tracker'/>\n"
|
||||||
" <menuitem action='pause-torrent'/>\n"
|
" <menuitem action='pause-torrent'/>\n"
|
||||||
|
@ -43,7 +43,7 @@ const char * fallback_ui_file =
|
||||||
" </menubar>\n"
|
" </menubar>\n"
|
||||||
"\n"
|
"\n"
|
||||||
" <toolbar name='main-window-toolbar'>\n"
|
" <toolbar name='main-window-toolbar'>\n"
|
||||||
" <toolitem action='add-torrent'/>\n"
|
" <toolitem action='open-torrent'/>\n"
|
||||||
" <toolitem action='start-torrent'/>\n"
|
" <toolitem action='start-torrent'/>\n"
|
||||||
" <toolitem action='pause-torrent'/>\n"
|
" <toolitem action='pause-torrent'/>\n"
|
||||||
" <toolitem action='remove-torrent'/>\n"
|
" <toolitem action='remove-torrent'/>\n"
|
||||||
|
@ -63,7 +63,7 @@ const char * fallback_ui_file =
|
||||||
" </popup>\n"
|
" </popup>\n"
|
||||||
"\n"
|
"\n"
|
||||||
" <popup name='icon-popup'>\n"
|
" <popup name='icon-popup'>\n"
|
||||||
" <menuitem action='add-torrent'/>\n"
|
" <menuitem action='open-torrent'/>\n"
|
||||||
" <separator/>\n"
|
" <separator/>\n"
|
||||||
" <menuitem action='toggle-main-window'/>\n"
|
" <menuitem action='toggle-main-window'/>\n"
|
||||||
" <menuitem action='toggle-message-log'/>\n"
|
" <menuitem action='toggle-message-log'/>\n"
|
||||||
|
|
Loading…
Reference in a new issue