preview as separate window

This commit is contained in:
Sergey V. Udaltsov 2004-07-26 23:07:03 +00:00
parent 7b52ac4456
commit 0bb2c8c192
5 changed files with 156 additions and 146 deletions

View file

@ -1,3 +1,13 @@
2004-07-27 Sergey V. Udaltsov <svu@gnome.org>
* The preview is separated to another window.
Looks nicer IMHO - but it depends on POV.
2004-07-26 Sergey V. Udaltsov <svu@gnome.org>
* Now models are handled using the popup window.
Looks a bit more polished.
2004-07-22 Christian Neumair <chris@gnome-de.org>
* gnome-keyboard-properties.glade: Use GTK_SHADOW_IN shadow for

View file

@ -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

View file

@ -58,7 +58,7 @@ extern void sort_tree_content (GtkWidget * treeView);
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);

View file

@ -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);
}

View file

@ -140,7 +140,7 @@
<child>
<widget class="GtkNotebook" id="keyboard_notebook">
<property name="border_width">5</property>
<property name="border_width">6</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="show_tabs">True</property>
@ -831,81 +831,6 @@
</packing>
</child>
<child>
<widget class="GtkButton" id="xkb_reset_to_defaults">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<child>
<widget class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox29">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image3">
<property name="visible">True</property>
<property name="stock">gtk-refresh</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label51">
<property name="visible">True</property>
<property name="label" translatable="yes">Reset to de_faults</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="xkb_model_pick">
<property name="visible">True</property>
@ -922,29 +847,10 @@
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment3">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xscale">1</property>
<property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">6</property>
<property name="right_padding">6</property>
<child>
<placeholder/>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
@ -1189,6 +1095,114 @@
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox30">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
<child>
<widget class="GtkCheckButton" id="enable_preview">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Preview</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="xkb_reset_to_defaults">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<child>
<widget class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox29">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image3">
<property name="visible">True</property>
<property name="stock">gtk-refresh</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label51">
<property name="visible">True</property>
<property name="label" translatable="yes">Reset to de_faults</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
@ -1782,48 +1796,6 @@
<property name="type">tab</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="preview_frame">
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">1</property>
<property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child>
<placeholder/>
</child>
</widget>
<packing>
<property name="tab_expand">False</property>
<property name="tab_fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label58">
<property name="visible">True</property>
<property name="label" translatable="yes">Layout Preview</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="type">tab</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>