From 0bb2c8c192dca83032aeef22b56d4e0eaaeee36e Mon Sep 17 00:00:00 2001 From: "Sergey V. Udaltsov" Date: Mon, 26 Jul 2004 23:07:03 +0000 Subject: [PATCH] preview as separate window --- capplets/keyboard/ChangeLog | 10 + .../keyboard/gnome-keyboard-properties-xkb.c | 4 +- .../keyboard/gnome-keyboard-properties-xkb.h | 6 +- .../gnome-keyboard-properties-xkbpv.c | 34 ++- .../keyboard/gnome-keyboard-properties.glade | 248 ++++++++---------- 5 files changed, 156 insertions(+), 146 deletions(-) diff --git a/capplets/keyboard/ChangeLog b/capplets/keyboard/ChangeLog index 8bd284d69..01fd85058 100644 --- a/capplets/keyboard/ChangeLog +++ b/capplets/keyboard/ChangeLog @@ -1,3 +1,13 @@ +2004-07-27 Sergey V. Udaltsov + + * The preview is separated to another window. + Looks nicer IMHO - but it depends on POV. + +2004-07-26 Sergey V. Udaltsov + + * Now models are handled using the popup window. + Looks a bit more polished. + 2004-07-22 Christian Neumair * gnome-keyboard-properties.glade: Use GTK_SHADOW_IN shadow for diff --git a/capplets/keyboard/gnome-keyboard-properties-xkb.c b/capplets/keyboard/gnome-keyboard-properties-xkb.c index 1a14ae8cc..6004eab66 100644 --- a/capplets/keyboard/gnome-keyboard-properties-xkb.c +++ b/capplets/keyboard/gnome-keyboard-properties-xkb.c @@ -172,7 +172,9 @@ setup_xkb_tabs (GladeXML * dialog, GConfChangeSet * changeset) enable_disable_restoring (dialog); - init_preview(dialog); + g_signal_connect_swapped (G_OBJECT (WID ("enable_preview")), "toggled", + G_CALLBACK (preview_toggled), dialog); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("enable_preview")), FALSE); } void diff --git a/capplets/keyboard/gnome-keyboard-properties-xkb.h b/capplets/keyboard/gnome-keyboard-properties-xkb.h index e1368b096..8f23fe421 100644 --- a/capplets/keyboard/gnome-keyboard-properties-xkb.h +++ b/capplets/keyboard/gnome-keyboard-properties-xkb.h @@ -56,11 +56,11 @@ extern char *xci_desc_to_utf8 (XklConfigItem * ci); extern void sort_tree_content (GtkWidget * treeView); -extern void enable_disable_restoring(GladeXML * dialog); +extern void enable_disable_restoring (GladeXML * dialog); -extern void init_preview(GladeXML * dialog); +extern void preview_toggled (GladeXML * dialog, GtkWidget * button); -extern void choose_model(GladeXML * dialog); +extern void choose_model (GladeXML * dialog); G_END_DECLS #endif /* __GNOME_KEYBOARD_PROPERTY_XKB_H */ diff --git a/capplets/keyboard/gnome-keyboard-properties-xkbpv.c b/capplets/keyboard/gnome-keyboard-properties-xkbpv.c index 0352aa9f8..350d96498 100644 --- a/capplets/keyboard/gnome-keyboard-properties-xkbpv.c +++ b/capplets/keyboard/gnome-keyboard-properties-xkbpv.c @@ -33,13 +33,39 @@ #include "gnome-keyboard-properties-xkb.h" #include "libkbdraw/keyboard-drawing.h" +static GtkWidget * previewWindow = NULL; + void -init_preview (GladeXML * dialog) +init_preview ( void ) { - GtkWidget *frame = WID ("preview_frame"); GtkWidget *kbdraw = keyboard_drawing_new (); + + previewWindow = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_destroy_with_parent (GTK_WINDOW (previewWindow), TRUE); + gtk_window_set_keep_above(GTK_WINDOW (previewWindow), TRUE); + gtk_window_set_resizable(GTK_WINDOW (previewWindow), TRUE); + gtk_window_set_skip_pager_hint(GTK_WINDOW (previewWindow), TRUE); + gtk_window_set_skip_taskbar_hint(GTK_WINDOW (previewWindow), TRUE); + gtk_window_set_default_size(GTK_WINDOW (previewWindow), 500, 300); + gtk_window_set_title(GTK_WINDOW (previewWindow), _("Keyboard layout preview")); + keyboard_drawing_set_track_group (KEYBOARD_DRAWING (kbdraw), TRUE); keyboard_drawing_set_track_config (KEYBOARD_DRAWING (kbdraw), TRUE); - gtk_container_add (GTK_CONTAINER (frame), kbdraw); - gtk_widget_show (kbdraw); + gtk_container_add (GTK_CONTAINER (previewWindow), kbdraw); + +} + +void +preview_toggled (GladeXML * dialog, GtkWidget * button) +{ + gboolean doShow = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)); + + if (doShow && previewWindow == NULL) + init_preview(); + + if (doShow) + gtk_widget_show_all (previewWindow); + else + if (previewWindow != NULL) + gtk_widget_hide_all (previewWindow); } diff --git a/capplets/keyboard/gnome-keyboard-properties.glade b/capplets/keyboard/gnome-keyboard-properties.glade index a821e2722..ded899986 100644 --- a/capplets/keyboard/gnome-keyboard-properties.glade +++ b/capplets/keyboard/gnome-keyboard-properties.glade @@ -140,7 +140,7 @@ - 5 + 6 True True True @@ -831,81 +831,6 @@ - - - True - True - GTK_RELIEF_NORMAL - True - - - - True - 0.5 - 0.5 - 0 - 0 - 0 - 0 - 0 - 0 - - - - True - False - 2 - - - - True - gtk-refresh - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - Reset to de_faults - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - - - - 0 - False - False - GTK_PACK_END - - - True @@ -923,26 +848,7 @@ - - True - 0 - 0.5 - 1 - 1 - 0 - 0 - 6 - 6 - - - - - - - 0 - True - True - + @@ -1189,6 +1095,114 @@ True + + + + True + False + 6 + + + + True + True + Preview + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + + + + + True + True + GTK_RELIEF_NORMAL + True + + + + True + 0.5 + 0.5 + 0 + 0 + 0 + 0 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-refresh + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + Reset to de_faults + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + GTK_PACK_END + + + + + + + + + 0 + False + False + GTK_PACK_END + + + + + 0 + True + True + + 0 @@ -1782,48 +1796,6 @@ tab - - - - 12 - True - 0.5 - 0.5 - 1 - 1 - 0 - 0 - 0 - 0 - - - - - - - False - True - - - - - - True - Layout Preview - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - tab - - 0