1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-04 02:28:03 +00:00

(gtk) #312: Attention notification when using "Open with"

This commit is contained in:
Charles Kerr 2008-02-19 05:52:37 +00:00
parent 3aae015468
commit bcecbbba99
5 changed files with 35 additions and 10 deletions

View file

@ -117,7 +117,7 @@ startToggled( GtkToggleButton * tb, gpointer ctor )
tr_ctorSetPaused( ctor, TR_FORCE, !gtk_toggle_button_get_active( tb ) ); tr_ctorSetPaused( ctor, TR_FORCE, !gtk_toggle_button_get_active( tb ) );
} }
void GtkWidget*
promptfordir( GtkWindow * parent, TrCore * core, GList * files, tr_ctor * ctor ) promptfordir( GtkWindow * parent, TrCore * core, GList * files, tr_ctor * ctor )
{ {
uint8_t flag = 0; 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_signal_connect( G_OBJECT( wind ), "response",
G_CALLBACK( promptresp ), stuff ); G_CALLBACK( promptresp ), stuff );
gtk_widget_show_all(wind); gtk_widget_show_all( wind );
return wind;
} }
/*** /***

View file

@ -30,7 +30,10 @@
#include "util.h" #include "util.h"
/* prompt for a download directory for torrents, then add them */ /* 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 */ /* prompt if the user wants to quit, calls func with cbdata if they do */
void askquit( TrCore*, GtkWindow* parent, callbackfunc_t func, void* cbdata ); void askquit( TrCore*, GtkWindow* parent, callbackfunc_t func, void* cbdata );

View file

@ -743,6 +743,17 @@ coreerr( TrCore * core UNUSED, enum tr_core_err code, const char * msg,
g_assert_not_reached(); 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 static void
coreprompt( TrCore * core, coreprompt( TrCore * core,
GList * paths, GList * paths,
@ -751,13 +762,21 @@ coreprompt( TrCore * core,
{ {
struct cbdata * cbdata = gdata; struct cbdata * cbdata = gdata;
const int len = g_list_length( paths ); const int len = g_list_length( paths );
GtkWidget * w;
if( len > 1 ) if( len > 1 )
promptfordir( cbdata->wind, core, paths, ctor ); w = promptfordir( cbdata->wind, core, paths, ctor );
else { else {
if( len == 1 ) if( len == 1 )
tr_ctorSetMetainfoFromFile( ctor, paths->data ); 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 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" )) 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")) else if (!strcmp (action_name, "show-stats"))
{ {

View file

@ -126,7 +126,7 @@ destinationChanged( GtkFileChooserButton * b, gpointer gdata )
***** *****
****/ ****/
void GtkWidget*
makeaddwind( GtkWindow * parent, makeaddwind( GtkWindow * parent,
TrCore * core, TrCore * core,
tr_ctor * ctor ) tr_ctor * ctor )
@ -233,4 +233,5 @@ makeaddwind( GtkWindow * parent,
gtk_box_pack_start_defaults( GTK_BOX( GTK_DIALOG( d )->vbox ), t ); gtk_box_pack_start_defaults( GTK_BOX( GTK_DIALOG( d )->vbox ), t );
gtk_widget_show_all( d ); gtk_widget_show_all( d );
return d;
} }

View file

@ -16,8 +16,8 @@
#include <gtk/gtkwindow.h> #include <gtk/gtkwindow.h>
#include "tr_core.h" #include "tr_core.h"
void makeaddwind( GtkWindow * parent, GtkWidget* makeaddwind( GtkWindow * parent,
TrCore * core, TrCore * core,
tr_ctor * ctor ); tr_ctor * ctor );
#endif /* TR_GTK_OPEN_DIALOG */ #endif /* TR_GTK_OPEN_DIALOG */