Mercurial > mplayer.hg
annotate gui/dialog/msgbox.c @ 36025:df87a3a24a7c
Remove unused declaration.
author | ib |
---|---|
date | Sun, 31 Mar 2013 21:58:33 +0000 |
parents | a04e8798227b |
children | 8ae2e20462a7 |
rev | line source |
---|---|
33572 | 1 /* |
2 * This file is part of MPlayer. | |
3 * | |
4 * MPlayer is free software; you can redistribute it and/or modify | |
5 * it under the terms of the GNU General Public License as published by | |
6 * the Free Software Foundation; either version 2 of the License, or | |
7 * (at your option) any later version. | |
8 * | |
9 * MPlayer is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 * GNU General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU General Public License along | |
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., | |
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
17 */ | |
18 | |
33738 | 19 #include <string.h> |
20 | |
35525 | 21 #include "gui/app/app.h" |
33572 | 22 #include "help_mp.h" |
23 | |
35526 | 24 #include "pixmaps/error.xpm" |
25 #include "pixmaps/warning.xpm" | |
33572 | 26 |
35529 | 27 #include "dialog.h" |
33572 | 28 #include "msgbox.h" |
29 #include "tools.h" | |
30 | |
31 GtkWidget * gtkMessageBoxText; | |
32 GtkWidget * MessageBox = NULL; | |
33 | |
34 static void on_Ok_released( GtkButton * button,gpointer user_data ) | |
35 { | |
36010 | 36 (void) button; |
37 (void) user_data; | |
38 | |
33572 | 39 gtk_widget_destroy( MessageBox ); |
40 } | |
41 | |
35996 | 42 static GtkWidget * CreateMessageBox( void ) |
33572 | 43 { |
44 GtkWidget * vbox1; | |
45 GtkWidget * hbox1; | |
46 GtkWidget * hbuttonbox1; | |
47 GtkWidget * Ok; | |
48 GtkAccelGroup * accel_group; | |
49 GtkStyle * pixmapstyle; | |
50 GdkPixmap * pixmapwid; | |
51 GdkBitmap * mask; | |
52 | |
53 accel_group=gtk_accel_group_new(); | |
54 | |
55 MessageBox=gtk_window_new( GTK_WINDOW_TOPLEVEL ); | |
56 gtk_widget_set_name( MessageBox,"MessageBox" ); | |
57 gtk_object_set_data( GTK_OBJECT( MessageBox ),"MessageBox",MessageBox ); | |
58 gtk_widget_set_events( MessageBox,GDK_EXPOSURE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_VISIBILITY_NOTIFY_MASK ); | |
59 gtk_window_set_title( GTK_WINDOW( MessageBox ),"MPlayer ..." ); | |
60 gtk_window_set_position( GTK_WINDOW( MessageBox ),GTK_WIN_POS_CENTER ); | |
61 gtk_window_set_modal( GTK_WINDOW( MessageBox ),TRUE ); | |
62 gtk_window_set_policy( GTK_WINDOW( MessageBox ),TRUE,TRUE,FALSE ); | |
63 gtk_window_set_wmclass( GTK_WINDOW( MessageBox ),"Message","MPlayer" ); | |
64 | |
65 gtk_widget_realize( MessageBox ); | |
66 gtkAddIcon( MessageBox ); | |
67 | |
36023
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36010
diff
changeset
|
68 vbox1=gtkAddVBox( gtkAddDialogFrame( MessageBox ),0 ); |
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36010
diff
changeset
|
69 hbox1=gtkAddHBox( vbox1,1 ); |
33572 | 70 |
71 pixmapstyle=gtk_widget_get_style( MessageBox ); | |
72 | |
73 pixmapwid=gdk_pixmap_colormap_create_from_xpm_d( MessageBox->window,gdk_colormap_get_system(),&mask,&pixmapstyle->bg[GTK_STATE_NORMAL],(gchar ** )warning_xpm ); | |
74 WarningPixmap=gtk_pixmap_new( pixmapwid,mask ); | |
75 pixmapwid=gdk_pixmap_colormap_create_from_xpm_d( MessageBox->window,gdk_colormap_get_system(),&mask,&pixmapstyle->bg[GTK_STATE_NORMAL],(gchar ** )error_xpm ); | |
76 ErrorPixmap=gtk_pixmap_new( pixmapwid,mask ); | |
77 | |
78 gtk_widget_set_name( WarningPixmap,"pixmap1" ); | |
79 gtk_widget_hide( WarningPixmap ); | |
80 gtk_box_pack_start( GTK_BOX( hbox1 ),WarningPixmap,FALSE,FALSE,0 ); | |
81 gtk_widget_set_usize( WarningPixmap,55,-2 ); | |
82 | |
83 gtk_widget_set_name( ErrorPixmap,"pixmap1" ); | |
84 gtk_widget_hide( ErrorPixmap ); | |
85 gtk_box_pack_start( GTK_BOX( hbox1 ),ErrorPixmap,FALSE,FALSE,0 ); | |
86 gtk_widget_set_usize( ErrorPixmap,55,-2 ); | |
87 | |
88 gtkMessageBoxText=gtk_label_new( "Text jol. Ha ezt megerted,akkor neked nagyon jo a magyar tudasod,te." ); | |
89 gtk_widget_set_name( gtkMessageBoxText,"gtkMessageBoxText" ); | |
90 gtk_widget_show( gtkMessageBoxText ); | |
91 gtk_box_pack_start( GTK_BOX( hbox1 ),gtkMessageBoxText,TRUE,TRUE,0 ); | |
92 // gtk_label_set_justify( GTK_LABEL( gtkMessageBoxText ),GTK_JUSTIFY_FILL ); | |
93 gtk_label_set_justify( GTK_LABEL( gtkMessageBoxText ),GTK_JUSTIFY_CENTER ); | |
94 gtk_label_set_line_wrap( GTK_LABEL( gtkMessageBoxText ),FALSE ); | |
95 | |
36023
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36010
diff
changeset
|
96 gtkAddHSeparator( vbox1 ); |
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36010
diff
changeset
|
97 hbuttonbox1=gtkAddHButtonBox( vbox1 ); |
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36010
diff
changeset
|
98 Ok=gtkAddButton( MSGTR_Ok,hbuttonbox1 ); |
33572 | 99 |
100 gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE ); | |
101 gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE ); | |
102 | |
36008 | 103 gtk_signal_connect( GTK_OBJECT( MessageBox ),"destroy",GTK_SIGNAL_FUNC( gtk_widget_destroyed ),&MessageBox ); |
33572 | 104 gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( on_Ok_released ),NULL ); |
105 | |
106 gtk_window_add_accel_group( GTK_WINDOW( MessageBox ),accel_group ); | |
107 | |
108 return MessageBox; | |
109 } | |
35991 | 110 |
111 void ShowMessageBox( const char * msg ) | |
112 { | |
36007
90ff4280cc80
There is no need to hide the widget prior to destruction.
ib
parents:
35996
diff
changeset
|
113 if ( MessageBox ) gtk_widget_destroy( MessageBox ); |
35996 | 114 MessageBox=CreateMessageBox(); |
35991 | 115 if ( strlen( msg ) < 20 ) gtk_widget_set_usize( MessageBox,196,-1 ); |
116 } |