From 745c0913f6b5e37005d5bc02871c410eb9aa52e8 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Sat, 27 Oct 2012 23:44:17 +0200 Subject: Redesign the About dialog a'la XChat --- src/common/cfgfiles.c | 1 + src/fe-gtk/about.c | 148 ++++++++++++++++++++++++++------------------------ 2 files changed, 79 insertions(+), 70 deletions(-) (limited to 'src') diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c index 392b218c..daff0f65 100644 --- a/src/common/cfgfiles.c +++ b/src/common/cfgfiles.c @@ -675,6 +675,7 @@ load_config (void) prefs.hex_gui_input_style = 1; prefs.hex_gui_join_dialog = 1; prefs.hex_gui_quit_dialog = 1; + prefs.hex_gui_slist_skip = 1; prefs.hex_gui_tab_chans = 1; prefs.hex_gui_tab_dialogs = 1; prefs.hex_gui_tab_dots = 1; diff --git a/src/fe-gtk/about.c b/src/fe-gtk/about.c index d33c6ae3..020df8ce 100644 --- a/src/fe-gtk/about.c +++ b/src/fe-gtk/about.c @@ -45,33 +45,6 @@ #include "gtkutil.h" #include "about.h" - -#if 0 /*def USE_GNOME*/ - -void -menu_about (GtkWidget * wid, gpointer sess) -{ - char buf[512]; - const gchar *author[] = { "Peter Zelezny ", 0 }; - - (snprintf) (buf, sizeof (buf), - "An IRC Client for UNIX.\n\n" - "This binary was compiled on "__DATE__"\n" - "Using GTK %d.%d.%d X %d\n" - "Running on %s", - gtk_major_version, gtk_minor_version, gtk_micro_version, -#ifdef USE_XLIB - VendorRelease (GDK_DISPLAY ()), get_cpu_str()); -#else - 666, get_cpu_str()); -#endif - - gtk_widget_show (gnome_about_new ("X-Chat", PACKAGE_VERSION, - "(C) 1998-2005 Peter Zelezny", author, buf, 0)); -} - -#endif - static GtkWidget *about = 0; static int @@ -84,10 +57,18 @@ about_close (void) void menu_about (GtkWidget * wid, gpointer sess) { - GtkWidget *vbox, *label, *hbox; - char buf[512]; + GtkWidget *vbox; /* the main vertical box inside the about dialog */ + GtkWidget *hbox_main; /* horizontal box for containing text on the left and logo on the right */ + GtkWidget *vbox_logo; /* vertical box for our logo */ + GtkWidget *vbox_text; /* vertical box for text */ + GtkWidget *label_title; /* label for the main title */ + GtkWidget *label_subtitle; /* label for the subtitle */ + GtkWidget *label_info; /* for the informative text */ + GtkWidget *label_copyright; /* for copyright notices */ + GdkColor color; /* color buffer for our nice paintings */ + char buf[512]; /* text buffer for the labels */ const char *locale = NULL; - extern GtkWindow *parent_window; /* maingui.c */ + extern GtkWindow *parent_window; /* maingui.c */ if (about) { @@ -95,71 +76,98 @@ menu_about (GtkWidget * wid, gpointer sess) return; } + /* general about dialog initialization */ about = gtk_dialog_new (); gtk_window_set_position (GTK_WINDOW (about), GTK_WIN_POS_CENTER_ON_PARENT); gtk_window_set_resizable (GTK_WINDOW (about), FALSE); gtk_window_set_title (GTK_WINDOW (about), _("About "DISPLAY_NAME)); if (parent_window) + { gtk_window_set_transient_for (GTK_WINDOW (about), parent_window); - g_signal_connect (G_OBJECT (about), "destroy", - G_CALLBACK (about_close), 0); - + } + g_signal_connect (G_OBJECT (about), "destroy", G_CALLBACK (about_close), 0); vbox = GTK_DIALOG (about)->vbox; - wid = gtk_image_new_from_pixbuf (pix_xchat); - gtk_container_add (GTK_CONTAINER (vbox), wid); - - label = gtk_label_new (NULL); - gtk_label_set_selectable (GTK_LABEL (label), TRUE); - gtk_container_add (GTK_CONTAINER (vbox), label); + /* main horizontal box, text on the left, logo on the right */ + hbox_main = gtk_hbox_new (FALSE, 0); + gtk_container_add (GTK_CONTAINER (vbox), GTK_WIDGET (hbox_main)); + + /* textbox on the left */ + vbox_text = gtk_vbox_new (FALSE, 0); + gtk_box_pack_start (GTK_BOX (hbox_main), vbox_text, 0, 0, 5); + + /* label for title */ + snprintf (buf, sizeof (buf), ""DISPLAY_NAME""); + label_title = gtk_label_new (NULL); + gtk_misc_set_alignment (GTK_MISC (label_title), 0, 0); + gtk_box_pack_start (GTK_BOX (vbox_text), label_title, 0, 0, 10); + color.red = 0xd7d7; + color.green = 0x4343; + color.blue = 0x0404; + gtk_widget_modify_fg (label_title, GTK_STATE_NORMAL, &color); + gtk_label_set_markup (GTK_LABEL (label_title), buf); + + /* label for subtitle */ + snprintf (buf, sizeof (buf), "%s", _("A multiplatform IRC Client")); + label_subtitle = gtk_label_new (NULL); + gtk_misc_set_alignment (GTK_MISC (label_subtitle), 0, 0); + gtk_box_pack_start (GTK_BOX (vbox_text), label_subtitle, 0, 0, 10); + color.red = 0x5555; + color.green = 0x5555; + color.blue = 0x5555; + gtk_widget_modify_fg (label_subtitle, GTK_STATE_NORMAL, &color); + gtk_label_set_markup (GTK_LABEL (label_subtitle), buf); + + /* label for additional info */ g_get_charset (&locale); (snprintf) (buf, sizeof (buf), - ""DISPLAY_NAME" "PACKAGE_VERSION"\n" - "\n%s\n\n" + "Version: "PACKAGE_VERSION"\n" "OS: %s\n" - "Charset: %s " -#ifdef WIN32 - "GTK+: %i.%i.%i\n" -#else - "Renderer: %s\n" -#endif - "XChat Revision: r"XCHAT_REVISION"\n" "Compiled: "__DATE__"\n" #ifdef WIN32 "Portable Mode: %s\n" "Build Type: x%d\n" #endif - "\n\302\251 1998-2010 Peter \305\275elezn\303\275 <zed@xchat.org>\n" - "\302\251 2009-2012 Berke Viktor <bviktor@hexchat.org>", - _("A multiplatform IRC Client"), + "Charset: %s", get_cpu_str (), - locale, #ifdef WIN32 - gtk_major_version, - gtk_minor_version, - gtk_micro_version, (portable_mode () ? "Yes" : "No"), - get_cpu_arch () -#else -#ifdef USE_XFT - "Xft" -#else - "Pango" -#endif + get_cpu_arch (), #endif - ); - gtk_label_set_markup (GTK_LABEL (label), buf); - gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER); - - hbox = gtk_hbox_new (0, 2); - gtk_container_add (GTK_CONTAINER (vbox), hbox); + locale); + + label_info = gtk_label_new (NULL); + gtk_misc_set_alignment (GTK_MISC (label_info), 0, 0); + gtk_box_pack_start (GTK_BOX (vbox_text), label_info, 0, 0, 10); + gtk_label_set_selectable (GTK_LABEL (label_info), TRUE); + gtk_label_set_markup (GTK_LABEL (label_info), buf); + + /* label for copyright notices */ + snprintf (buf, sizeof (buf), "\302\251 1998-2010 Peter \305\275elezn\303\275\n\302\251 2009-2012 Berke Viktor"); + label_copyright = gtk_label_new (NULL); + gtk_misc_set_alignment (GTK_MISC (label_copyright), 0, 0); + gtk_box_pack_start (GTK_BOX (vbox_text), label_copyright, 0, 0, 10); + gtk_label_set_markup (GTK_LABEL (label_copyright), buf); + + /* imagebox on the right */ + vbox_logo = gtk_vbox_new (FALSE, 0); + gtk_box_pack_start (GTK_BOX (hbox_main), vbox_logo, 0, 0, 10); + + /* the actual image */ + wid = gtk_image_new_from_pixbuf (pix_xchat); + gtk_box_pack_start (GTK_BOX (vbox_logo), wid, 0, 0, 10); + /* our close button on the bottom right */ wid = gtk_button_new_from_stock (GTK_STOCK_CLOSE); GTK_WIDGET_SET_FLAGS (GTK_WIDGET (wid), GTK_CAN_DEFAULT); gtk_box_pack_end (GTK_BOX (GTK_DIALOG (about)->action_area), wid, 0, 0, 0); gtk_widget_grab_default (wid); - g_signal_connect (G_OBJECT (wid), "clicked", - G_CALLBACK (gtkutil_destroy), about); + g_signal_connect (G_OBJECT (wid), "clicked", G_CALLBACK (gtkutil_destroy), about); + + /* pure white background for the whole about widget*/ + color.red = color.green = color.blue = 0xffff; + gtk_widget_modify_bg (about, GTK_STATE_NORMAL, &color); + /* show off! */ gtk_widget_show_all (about); } -- cgit 1.4.1