From: Darren S. <ds...@us...> - 2004-10-29 01:33:26
|
Update of /cvsroot/xine/gnome-xine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1437/src Modified Files: script_engine.c Log Message: Alter the About window implementation a bit :-) Index: script_engine.c =================================================================== RCS file: /cvsroot/xine/gnome-xine/src/script_engine.c,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- script_engine.c 25 Oct 2004 23:42:39 -0000 1.24 +++ script_engine.c 29 Oct 2004 01:33:15 -0000 1.25 @@ -134,14 +134,67 @@ return JS_TRUE; } +static GtkWidget *about = NULL; +static gboolean about_visible = FALSE; + +static void about_cb (GtkDialog *d, gint arg, gpointer data) +{ + about_visible = FALSE; + gtk_widget_hide (about); +} + static JSBool show_about (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { - display_info ("About gxine", - "About gxine %s\n\n" - "A gtk media player frontend for xine\n" - "(C) 2002-2003 by Guenter Bartsch " - "and the xine project team\n", VERSION); + if (about == NULL) + { + static const gchar content[] = + "<big><b>About gxine " VERSION "</b></big>\n" + "\n" + "A GTK media player frontend for xine\n" + "\n" + "© 2002-2004 Guenter Bartsch\n" + "and the xine project team\n"; + + GtkWidget *layout, *text, *buffer; + gchar *file; + gint pos = 0; + + about = gtk_dialog_new_with_buttons ("About gxine", NULL, 0, + GTK_STOCK_CLOSE, GTK_RESPONSE_ACCEPT, + NULL); + gtk_dialog_set_has_separator (GTK_DIALOG(about), FALSE); + + layout = gtk_table_new (1, 2, FALSE); + + file = g_strconcat (pixmapdir, "/gxine-logo.png", NULL); + gtk_table_attach (GTK_TABLE (layout), gtk_image_new_from_file (file), + 0, 1, 0, 1, 0, 0, 8, 8); + g_free (file); + + text = gtk_label_new (content); + gtk_label_set_use_markup (GTK_LABEL(text), TRUE); + gtk_label_set_line_wrap (GTK_LABEL(text), TRUE); + gtk_table_attach (GTK_TABLE (layout), text, 1, 2, 0, 1, + GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 8, 8); + + gtk_box_pack_start (GTK_BOX(GTK_DIALOG(about)->vbox), layout, + TRUE, TRUE, 0); + + g_signal_connect (GTK_OBJECT(about), "response", + G_CALLBACK(about_cb), NULL); + g_signal_connect (GTK_OBJECT(about), "delete_event", + G_CALLBACK(about_cb), NULL); + } + + if (about_visible) { + gtk_widget_hide (about); + about_visible = FALSE; + } else { + gtk_widget_show_all (about); + gtk_widget_map (about); + about_visible = TRUE; + } return JS_TRUE; } |