diff --git a/gtk/dialogs.c b/gtk/dialogs.c index 15b48b6aa..d4f9cce7d 100644 --- a/gtk/dialogs.c +++ b/gtk/dialogs.c @@ -117,7 +117,7 @@ startToggled( GtkToggleButton * tb, gpointer ctor ) tr_ctorSetPaused( ctor, TR_FORCE, !gtk_toggle_button_get_active( tb ) ); } -void +GtkWidget* promptfordir( GtkWindow * parent, TrCore * core, GList * files, tr_ctor * ctor ) { uint8_t flag = 0; @@ -171,7 +171,8 @@ promptfordir( GtkWindow * parent, TrCore * core, GList * files, tr_ctor * ctor ) g_signal_connect( G_OBJECT( wind ), "response", G_CALLBACK( promptresp ), stuff ); - gtk_widget_show_all(wind); + gtk_widget_show_all( wind ); + return wind; } /*** diff --git a/gtk/dialogs.h b/gtk/dialogs.h index e2aadcef1..0963df76d 100644 --- a/gtk/dialogs.h +++ b/gtk/dialogs.h @@ -30,7 +30,10 @@ #include "util.h" /* prompt for a download directory for torrents, then add them */ -void promptfordir( GtkWindow* parent, TrCore*, GList* filenames, tr_ctor* ); +GtkWidget* promptfordir( GtkWindow * parent, + TrCore * core, + GList * filenames, + tr_ctor * ctor ); /* prompt if the user wants to quit, calls func with cbdata if they do */ void askquit( TrCore*, GtkWindow* parent, callbackfunc_t func, void* cbdata ); diff --git a/gtk/main.c b/gtk/main.c index d7d6ede92..8679345e1 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -743,6 +743,17 @@ coreerr( TrCore * core UNUSED, enum tr_core_err code, const char * msg, g_assert_not_reached(); } +#if GTK_CHECK_VERSION(2,8,0) +static void +on_main_window_focus_in( GtkWidget * widget UNUSED, + GdkEventFocus * event UNUSED, + gpointer gdata ) +{ + struct cbdata * cbdata = gdata; + gtk_window_set_urgency_hint( GTK_WINDOW( cbdata->wind ), FALSE ); +} +#endif + static void coreprompt( TrCore * core, GList * paths, @@ -751,13 +762,21 @@ coreprompt( TrCore * core, { struct cbdata * cbdata = gdata; const int len = g_list_length( paths ); + GtkWidget * w; + if( len > 1 ) - promptfordir( cbdata->wind, core, paths, ctor ); + w = promptfordir( cbdata->wind, core, paths, ctor ); else { if( len == 1 ) tr_ctorSetMetainfoFromFile( ctor, paths->data ); - makeaddwind( cbdata->wind, core, ctor ); + w = makeaddwind( cbdata->wind, core, ctor ); } + +#if GTK_CHECK_VERSION(2,8,0) + gtk_window_set_urgency_hint( GTK_WINDOW( cbdata->wind ), TRUE ); + g_signal_connect( w, "focus-in-event", + G_CALLBACK(on_main_window_focus_in), cbdata ); +#endif } static void @@ -990,7 +1009,8 @@ doAction ( const char * action_name, gpointer user_data ) if ( !strcmp (action_name, "open-torrent-menu") || !strcmp( action_name, "open-torrent-toolbar" )) { - tr_core_add_list( data->core, NULL, tr_ctorNew( tr_core_handle( data->core ) ) ); + tr_core_add_list( data->core, NULL, + tr_ctorNew( tr_core_handle( data->core ) ) ); } else if (!strcmp (action_name, "show-stats")) { diff --git a/gtk/open-dialog.c b/gtk/open-dialog.c index 8c19927b8..0b830495d 100644 --- a/gtk/open-dialog.c +++ b/gtk/open-dialog.c @@ -126,7 +126,7 @@ destinationChanged( GtkFileChooserButton * b, gpointer gdata ) ***** ****/ -void +GtkWidget* makeaddwind( GtkWindow * parent, TrCore * core, tr_ctor * ctor ) @@ -233,4 +233,5 @@ makeaddwind( GtkWindow * parent, gtk_box_pack_start_defaults( GTK_BOX( GTK_DIALOG( d )->vbox ), t ); gtk_widget_show_all( d ); + return d; } diff --git a/gtk/open-dialog.h b/gtk/open-dialog.h index 088715301..05df6b19f 100644 --- a/gtk/open-dialog.h +++ b/gtk/open-dialog.h @@ -16,8 +16,8 @@ #include #include "tr_core.h" -void makeaddwind( GtkWindow * parent, - TrCore * core, - tr_ctor * ctor ); +GtkWidget* makeaddwind( GtkWindow * parent, + TrCore * core, + tr_ctor * ctor ); #endif /* TR_GTK_OPEN_DIALOG */