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
19 #include <string.h>
20
21 #include "gui/app/app.h"
22 #include "gui/app/gui.h"
23 #include "help_mp.h"
24
25 #include "dialog.h"
26 #include "icons.h"
27 #include "msgbox.h"
28 #include "tools.h"
29
30 GtkWidget * gtkMessageBoxText;
31 GtkWidget * MessageBox = NULL;
32 GtkWidget * InformationImage;
33 GtkWidget * WarningImage;
34 GtkWidget * ErrorImage;
35
on_Ok_released(GtkButton * button,gpointer user_data)36 static void on_Ok_released( GtkButton * button,gpointer user_data )
37 {
38 (void) button;
39 (void) user_data;
40
41 gtk_widget_destroy( MessageBox );
42 }
43
CreateMessageBox(void)44 static GtkWidget * CreateMessageBox( void )
45 {
46 GtkWidget * vbox1;
47 GtkWidget * hbox1;
48 GtkWidget * hbuttonbox1;
49 GtkWidget * Ok;
50 GtkAccelGroup * accel_group;
51 GdkPixbuf * pixbuf;
52
53 accel_group=gtk_accel_group_new();
54
55 MessageBox=gtk_window_new( GTK_WINDOW_TOPLEVEL );
56 gtk_window_set_title( GTK_WINDOW( MessageBox ),MPlayer" …");
57 gtk_window_set_position( GTK_WINDOW( MessageBox ),GTK_WIN_POS_CENTER );
58 gtk_window_set_modal( GTK_WINDOW( MessageBox ),TRUE );
59 gtk_window_set_policy( GTK_WINDOW( MessageBox ),FALSE,FALSE,TRUE );
60 gtk_window_set_wmclass( GTK_WINDOW( MessageBox ),"Message",MPlayer );
61
62 gtk_widget_realize( MessageBox );
63 gtkAddIcon( MessageBox );
64
65 vbox1=gtkAddVBox( gtkAddDialogFrame( MessageBox ),0 );
66 hbox1=gtkAddHBox( vbox1,1 );
67
68 pixbuf = gdk_pixbuf_new_from_inline(-1, information_png, FALSE, NULL);
69 InformationImage = gtk_image_new_from_pixbuf(pixbuf);
70 g_object_unref(pixbuf);
71
72 gtk_widget_hide( InformationImage );
73 gtk_box_pack_start( GTK_BOX( hbox1 ),InformationImage,FALSE,FALSE,2 );
74
75 pixbuf = gdk_pixbuf_new_from_inline(-1, warning_png, FALSE, NULL);
76 WarningImage = gtk_image_new_from_pixbuf(pixbuf);
77 g_object_unref(pixbuf);
78
79 gtk_widget_hide( WarningImage );
80 gtk_box_pack_start( GTK_BOX( hbox1 ),WarningImage,FALSE,FALSE,2 );
81
82 pixbuf = gdk_pixbuf_new_from_inline(-1, error_png, FALSE, NULL);
83 ErrorImage = gtk_image_new_from_pixbuf(pixbuf);
84 g_object_unref(pixbuf);
85
86 gtk_widget_hide( ErrorImage );
87 gtk_box_pack_start( GTK_BOX( hbox1 ),ErrorImage,FALSE,FALSE,2 );
88
89 gtkMessageBoxText=gtk_label_new( "Text jol. Ha ezt megerted,akkor neked nagyon jo a magyar tudasod,te." );
90 gtk_widget_show( gtkMessageBoxText );
91 gtk_box_pack_start( GTK_BOX( hbox1 ),gtkMessageBoxText,FALSE,FALSE,4 );
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
96 gtkAddHSeparator( vbox1 );
97 hbuttonbox1=gtkAddHButtonBox( vbox1 );
98 Ok=gtkAddButton( _(MSGTR_GUI_Ok),hbuttonbox1 );
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
103 gtk_signal_connect( GTK_OBJECT( MessageBox ),"destroy",GTK_SIGNAL_FUNC( gtk_widget_destroyed ),&MessageBox );
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 }
110
ShowMessageBox(const char * msg)111 void ShowMessageBox( const char * msg )
112 {
113 (void) msg;
114
115 if ( MessageBox ) gtk_widget_destroy( MessageBox );
116 MessageBox=CreateMessageBox();
117 }
118