[PATCH xoo 6/8] Use GtkAboutDialog
Yaakov (Cygwin/X)
yselkowitz at users.sourceforge.net
Wed Oct 10 16:07:01 PDT 2012
From: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
Also, use stock About menu item.
Signed-off-by: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
---
data/xoo.ui | 95 +++----------------------------------------------------
src/callbacks.c | 9 +++++-
src/fakedev.h | 1 -
src/main.c | 13 -------
4 files changed, 13 insertions(+), 105 deletions(-)
diff --git a/data/xoo.ui b/data/xoo.ui
index 3219d17..58a74bd 100644
--- a/data/xoo.ui
+++ b/data/xoo.ui
@@ -1,92 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <!-- interface-requires gtk+ 2.12 -->
- <!-- interface-naming-policy toplevel-contextual -->
- <object class="GtkWindow" id="aboutwindow">
- <property name="can_focus">False</property>
- <property name="title" translatable="yes">Xoo</property>
- <property name="resizable">False</property>
- <property name="type_hint">dialog</property>
- <signal name="delete-event" handler="on_delete_event_hide" swapped="no"/>
- <child>
- <object class="GtkVBox" id="vbox3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="border_width">8</property>
- <property name="spacing">8</property>
- <child>
- <object class="GtkLabel" id="label6">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes"><span size="xx-large"><b>Xoo</b></span></property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label7">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">A tool for simulating X-based small-screen devices.</property>
- <property name="justify">center</property>
- <property name="wrap">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label8">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes"><small>Copyright © 2004 OpenedHand Ltd
-info at o-hand.com</small></property>
- <property name="use_markup">True</property>
- <property name="justify">center</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkHButtonBox" id="hbuttonbox2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkButton" id="button_about_close">
- <property name="label">gtk-close</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
- <property name="use_stock">True</property>
- <signal name="clicked" handler="on_about_close_clicked" swapped="no"/>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">False</property>
- <property name="position">3</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
+ <!-- interface-requires gtk+ 3.0 -->
<object class="GtkMenuBar" id="popupmenubar">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -452,12 +366,13 @@ info at o-hand.com</small></property>
<object class="GtkMenu" id="menuitem4_menu">
<property name="can_focus">False</property>
<child>
- <object class="GtkMenuItem" id="about">
+ <object class="GtkImageMenuItem" id="about">
+ <property name="label">gtk-about</property>
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
- <property name="label" translatable="yes">_About</property>
<property name="use_underline">True</property>
+ <property name="use_stock">True</property>
<signal name="activate" handler="on_about_activate" swapped="no"/>
</object>
</child>
diff --git a/src/callbacks.c b/src/callbacks.c
index 499b584..c941633 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -116,7 +116,14 @@ on_show_decorations_toggle (GtkCheckMenuItem * menuitem, FakeApp * app)
void
on_about_activate (GtkMenuItem * menuitem, FakeApp * app)
{
- gtk_window_present (GTK_WINDOW (app->about_window));
+ gtk_show_about_dialog (NULL,
+ "program-name", "Xoo",
+ "version", VERSION,
+ "copyright", "Copyright © 2004 OpenedHand Ltd\ninfo at o-hand.com",
+ "comments", "A tool for simulating X-based small-screen devices",
+ "logo-icon-name", "xoo",
+ "license-type", GTK_LICENSE_GPL_2_0,
+ NULL);
}
gboolean
diff --git a/src/fakedev.h b/src/fakedev.h
index b5fd137..c211869 100644
--- a/src/fakedev.h
+++ b/src/fakedev.h
@@ -44,7 +44,6 @@ struct FakeApp
GtkWidget *prefs_window;
GtkWidget *entry_display, *entry_server, *entry_options, *entry_start;
- GtkWidget *about_window;
int device_width;
int device_height;
diff --git a/src/main.c b/src/main.c
index f85114e..83a0e31 100644
--- a/src/main.c
+++ b/src/main.c
@@ -106,18 +106,10 @@ fakeapp_new (void)
g_signal_connect (G_OBJECT (widget), "activate",
G_CALLBACK (on_show_decorations_toggle), app);
- widget = GTK_WIDGET (gtk_builder_get_object (builder, "aboutwindow"));
- g_signal_connect (G_OBJECT (widget), "delete_event",
- G_CALLBACK (on_delete_event_hide), app);
-
widget = GTK_WIDGET (gtk_builder_get_object (builder, "prefswindow"));
g_signal_connect (G_OBJECT (widget), "delete_event",
G_CALLBACK (on_delete_event_hide), app);
- widget = GTK_WIDGET (gtk_builder_get_object (builder, "aboutwindow"));
- g_signal_connect (G_OBJECT (widget), "delete_event",
- G_CALLBACK (on_delete_event_hide), app);
-
widget = GTK_WIDGET (gtk_builder_get_object (builder, "select_device"));
g_signal_connect (G_OBJECT (widget), "activate",
G_CALLBACK (on_select_device), app);
@@ -174,11 +166,6 @@ fakeapp_new (void)
app->debug_menu = widget;
widget = GTK_WIDGET (gtk_builder_get_object (builder, "popupmenu_menu"));
app->popupmenu = widget;
- widget = GTK_WIDGET (gtk_builder_get_object (builder, "aboutwindow"));
- app->about_window = widget;
-
- gtk_window_set_transient_for (GTK_WINDOW (app->about_window),
- GTK_WINDOW (app->window));
widget = GTK_WIDGET (gtk_builder_get_object (builder, "button_about_close"));
g_signal_connect_swapped (widget, "clicked",
--
1.7.9
More information about the xorg-devel
mailing list