annotate Gui/mplayer/gtk/mb.c @ 8719:dc27303ae528

correct widget destroy event handler (thank for D J Hawkey Jr <hawkeyd@visi.com>)
author pontscho
date Thu, 02 Jan 2003 15:48:29 +0000
parents 5b67aed0fc28
children bc24dd70c6e2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
1
8043
e5dda05f9aab cleanup
pontscho
parents: 7009
diff changeset
2 #include "../../app.h"
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
3 #include "../../../config.h"
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
4 #include "../../../help_mp.h"
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
5
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
6 #include "../pixmaps/error.xpm"
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
7 #include "../pixmaps/warning.xpm"
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
8
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
9 #include "../widgets.h"
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
10 #include "mb.h"
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
11 #include "common.h"
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
12
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
13 GtkWidget * gtkMessageBoxText;
6146
b9651eb9749e fix some gtk bug...
pontscho
parents: 6044
diff changeset
14 GtkWidget * MessageBox;
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
15
6146
b9651eb9749e fix some gtk bug...
pontscho
parents: 6044
diff changeset
16 void ShowMessageBox( char * msg )
b9651eb9749e fix some gtk bug...
pontscho
parents: 6044
diff changeset
17 {
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
18 if ( MessageBox ) { gtk_widget_hide( MessageBox ); gtk_widget_destroy( MessageBox ); }
6898
138a7ff52a26 - fix fuckin' locale (?:)
pontscho
parents: 6854
diff changeset
19 MessageBox=create_MessageBox( 0 );
6146
b9651eb9749e fix some gtk bug...
pontscho
parents: 6044
diff changeset
20 if ( strlen( msg ) < 20 ) gtk_widget_set_usize( MessageBox,196,-1 );
b9651eb9749e fix some gtk bug...
pontscho
parents: 6044
diff changeset
21 }
b9651eb9749e fix some gtk bug...
pontscho
parents: 6044
diff changeset
22
b9651eb9749e fix some gtk bug...
pontscho
parents: 6044
diff changeset
23 static void on_Ok_released( GtkButton * button,gpointer user_data )
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
24 {
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
25 gtk_widget_hide( MessageBox );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
26 gtk_widget_destroy( MessageBox );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
27 MessageBox=NULL;
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
28 }
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
29
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
30 GtkWidget * create_MessageBox( int type )
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
31 {
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
32 GtkWidget * vbox1;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
33 GtkWidget * hbox1;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
34 GtkWidget * hbuttonbox1;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
35 GtkWidget * Ok;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
36 GtkAccelGroup * accel_group;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
37 GtkStyle * pixmapstyle;
6159
dcf195b784bf applied 64bit patch from Ulrich Hecht <uli@suse.de>
pontscho
parents: 6146
diff changeset
38 GdkPixmap * pixmapwid;
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
39 GdkBitmap * mask;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
40
6044
153fc4ed86ad fix gtk dialog box destroy bug
pontscho
parents: 4818
diff changeset
41 accel_group=gtk_accel_group_new();
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
42
6044
153fc4ed86ad fix gtk dialog box destroy bug
pontscho
parents: 4818
diff changeset
43 MessageBox=gtk_window_new( GTK_WINDOW_TOPLEVEL );
153fc4ed86ad fix gtk dialog box destroy bug
pontscho
parents: 4818
diff changeset
44 gtk_widget_set_name( MessageBox,"MessageBox" );
153fc4ed86ad fix gtk dialog box destroy bug
pontscho
parents: 4818
diff changeset
45 gtk_object_set_data( GTK_OBJECT( MessageBox ),"MessageBox",MessageBox );
153fc4ed86ad fix gtk dialog box destroy bug
pontscho
parents: 4818
diff changeset
46 gtk_widget_set_events( MessageBox,GDK_EXPOSURE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_VISIBILITY_NOTIFY_MASK );
153fc4ed86ad fix gtk dialog box destroy bug
pontscho
parents: 4818
diff changeset
47 gtk_window_set_title( GTK_WINDOW( MessageBox ),"MPlayer ..." );
153fc4ed86ad fix gtk dialog box destroy bug
pontscho
parents: 4818
diff changeset
48 gtk_window_set_position( GTK_WINDOW( MessageBox ),GTK_WIN_POS_CENTER );
153fc4ed86ad fix gtk dialog box destroy bug
pontscho
parents: 4818
diff changeset
49 gtk_window_set_modal( GTK_WINDOW( MessageBox ),TRUE );
153fc4ed86ad fix gtk dialog box destroy bug
pontscho
parents: 4818
diff changeset
50 gtk_window_set_policy( GTK_WINDOW( MessageBox ),TRUE,TRUE,FALSE );
6651
8f49c75a2824 - add icon (nice, but very ugly hakk:)
pontscho
parents: 6159
diff changeset
51 gtk_window_set_wmclass( GTK_WINDOW( MessageBox ),"Message","MPlayer" );
8f49c75a2824 - add icon (nice, but very ugly hakk:)
pontscho
parents: 6159
diff changeset
52
8f49c75a2824 - add icon (nice, but very ugly hakk:)
pontscho
parents: 6159
diff changeset
53 gtk_widget_realize( MessageBox );
8f49c75a2824 - add icon (nice, but very ugly hakk:)
pontscho
parents: 6159
diff changeset
54 gtkAddIcon( MessageBox );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
55
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
56 vbox1=AddVBox( AddDialogFrame( MessageBox ),0 );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
57 hbox1=AddHBox( vbox1,1 );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
58
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
59 pixmapstyle=gtk_widget_get_style( MessageBox );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
60
6146
b9651eb9749e fix some gtk bug...
pontscho
parents: 6044
diff changeset
61 pixmapwid=gdk_pixmap_colormap_create_from_xpm_d( MessageBox->window,gdk_colormap_get_system(),&mask,&pixmapstyle->bg[GTK_STATE_NORMAL],(gchar ** )warning_xpm );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
62 WarningPixmap=gtk_pixmap_new( pixmapwid,mask );
6146
b9651eb9749e fix some gtk bug...
pontscho
parents: 6044
diff changeset
63 pixmapwid=gdk_pixmap_colormap_create_from_xpm_d( MessageBox->window,gdk_colormap_get_system(),&mask,&pixmapstyle->bg[GTK_STATE_NORMAL],(gchar ** )error_xpm );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
64 ErrorPixmap=gtk_pixmap_new( pixmapwid,mask );
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
65
6044
153fc4ed86ad fix gtk dialog box destroy bug
pontscho
parents: 4818
diff changeset
66 gtk_widget_set_name( WarningPixmap,"pixmap1" );
153fc4ed86ad fix gtk dialog box destroy bug
pontscho
parents: 4818
diff changeset
67 gtk_widget_hide( WarningPixmap );
153fc4ed86ad fix gtk dialog box destroy bug
pontscho
parents: 4818
diff changeset
68 gtk_box_pack_start( GTK_BOX( hbox1 ),WarningPixmap,FALSE,FALSE,0 );
153fc4ed86ad fix gtk dialog box destroy bug
pontscho
parents: 4818
diff changeset
69 gtk_widget_set_usize( WarningPixmap,55,-2 );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
70
6044
153fc4ed86ad fix gtk dialog box destroy bug
pontscho
parents: 4818
diff changeset
71 gtk_widget_set_name( ErrorPixmap,"pixmap1" );
153fc4ed86ad fix gtk dialog box destroy bug
pontscho
parents: 4818
diff changeset
72 gtk_widget_hide( ErrorPixmap );
153fc4ed86ad fix gtk dialog box destroy bug
pontscho
parents: 4818
diff changeset
73 gtk_box_pack_start( GTK_BOX( hbox1 ),ErrorPixmap,FALSE,FALSE,0 );
153fc4ed86ad fix gtk dialog box destroy bug
pontscho
parents: 4818
diff changeset
74 gtk_widget_set_usize( ErrorPixmap,55,-2 );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
75
6044
153fc4ed86ad fix gtk dialog box destroy bug
pontscho
parents: 4818
diff changeset
76 gtkMessageBoxText=gtk_label_new( "Text jol. Ha ezt megerted,akkor neked nagyon jo a magyar tudasod,te." );
153fc4ed86ad fix gtk dialog box destroy bug
pontscho
parents: 4818
diff changeset
77 gtk_widget_set_name( gtkMessageBoxText,"gtkMessageBoxText" );
153fc4ed86ad fix gtk dialog box destroy bug
pontscho
parents: 4818
diff changeset
78 gtk_widget_show( gtkMessageBoxText );
153fc4ed86ad fix gtk dialog box destroy bug
pontscho
parents: 4818
diff changeset
79 gtk_box_pack_start( GTK_BOX( hbox1 ),gtkMessageBoxText,TRUE,TRUE,0 );
7009
98bed9e12087 - add dxr3 gui support (dialogbox, etc.)
pontscho
parents: 6903
diff changeset
80 // gtk_label_set_justify( GTK_LABEL( gtkMessageBoxText ),GTK_JUSTIFY_FILL );
98bed9e12087 - add dxr3 gui support (dialogbox, etc.)
pontscho
parents: 6903
diff changeset
81 gtk_label_set_justify( GTK_LABEL( gtkMessageBoxText ),GTK_JUSTIFY_CENTER );
6146
b9651eb9749e fix some gtk bug...
pontscho
parents: 6044
diff changeset
82 gtk_label_set_line_wrap( GTK_LABEL( gtkMessageBoxText ),FALSE );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
83
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
84 AddHSeparator( vbox1 );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
85 hbuttonbox1=AddHButtonBox( vbox1 );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
86 Ok=AddButton( MSGTR_Ok,hbuttonbox1 );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
87
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
88 gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE );
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
89 gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
90
8719
dc27303ae528 correct widget destroy event handler (thank for D J Hawkey Jr <hawkeyd@visi.com>)
pontscho
parents: 8299
diff changeset
91 gtk_signal_connect( GTK_OBJECT( MessageBox ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&MessageBox );
8299
5b67aed0fc28 - remove some unused/nonusable variables
pontscho
parents: 8043
diff changeset
92 gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( on_Ok_released ),NULL );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
93
6044
153fc4ed86ad fix gtk dialog box destroy bug
pontscho
parents: 4818
diff changeset
94 gtk_window_add_accel_group( GTK_WINDOW( MessageBox ),accel_group );
2901
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
95
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
96 return MessageBox;
f77f8379f28f rewrite ...
pontscho
parents:
diff changeset
97 }