[rygel] ui: Port from Dialog to Window
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] ui: Port from Dialog to Window
- Date: Sun, 1 Jun 2014 18:03:45 +0000 (UTC)
commit 5e7ec5573302c5bd5db81e9bdf6b9118cd5516f3
Author: Jens Georg <mail jensge org>
Date: Sun Jun 1 20:01:26 2014 +0200
ui: Port from Dialog to Window
Get rid of "Gtk-Message: GtkDialog mapped without a transient parent. This is
discouraged."
Signed-off-by: Jens Georg <mail jensge org>
data/rygel-preferences.ui | 52 +++++++++++-----------------------
src/ui/rygel-preferences-dialog.vala | 22 ++++++++++++--
2 files changed, 36 insertions(+), 38 deletions(-)
---
diff --git a/data/rygel-preferences.ui b/data/rygel-preferences.ui
index bc93c57..679659f 100644
--- a/data/rygel-preferences.ui
+++ b/data/rygel-preferences.ui
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.18.3 -->
<interface>
- <!-- interface-requires gtk+ 3.0 -->
+ <requires lib="gtk+" version="3.0"/>
<object class="GtkListStore" id="iface-liststore">
<columns>
<!-- column-name interface -->
@@ -13,7 +14,7 @@
<column type="gchararray"/>
</columns>
</object>
- <object class="GtkDialog" id="preferences-dialog">
+ <object class="GtkWindow" id="preferences-dialog">
<property name="width_request">480</property>
<property name="height_request">240</property>
<property name="can_focus">False</property>
@@ -22,9 +23,9 @@
<property name="border_width">6</property>
<property name="title" translatable="yes">Rygel Preferences</property>
<property name="default_height">600</property>
- <property name="type_hint">dialog</property>
- <child internal-child="vbox">
- <object class="GtkBox" id="dialog-vbox1">
+ <property name="deletable">False</property>
+ <child>
+ <object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
@@ -78,8 +79,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -88,9 +87,6 @@
<property name="can_focus">False</property>
<property name="toolbar_style">icons</property>
<property name="icon_size">1</property>
- <style>
- <class name="inline-toolbar"/>
- </style>
<child>
<object class="GtkToolButton" id="add-button">
<property name="visible">True</property>
@@ -117,12 +113,13 @@
<property name="homogeneous">True</property>
</packing>
</child>
+ <style>
+ <class name="inline-toolbar"/>
+ </style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
</object>
@@ -130,7 +127,6 @@
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">2</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -145,8 +141,6 @@
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -163,8 +157,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
</object>
@@ -172,7 +164,6 @@
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">2</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -223,8 +214,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -233,9 +222,6 @@
<property name="can_focus">False</property>
<property name="toolbar_style">icons</property>
<property name="icon_size">1</property>
- <style>
- <class name="inline-toolbar"/>
- </style>
<child>
<object class="GtkToolButton" id="network-add-button">
<property name="visible">True</property>
@@ -266,12 +252,13 @@
<property name="homogeneous">True</property>
</packing>
</child>
+ <style>
+ <class name="inline-toolbar"/>
+ </style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
</object>
@@ -279,7 +266,6 @@
<property name="left_attach">0</property>
<property name="top_attach">3</property>
<property name="width">2</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -295,8 +281,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -309,13 +293,13 @@
<property name="position">0</property>
</packing>
</child>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="dialog-action_area1">
+ <child>
+ <object class="GtkButtonBox" id="buttonbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
- <object class="GtkButton" id="button3">
+ <object class="GtkButton" id="close-button">
<property name="label">gtk-close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -336,20 +320,18 @@
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
- <property name="position">0</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
</child>
- <action-widgets>
- <action-widget response="-7">button3</action-widget>
- </action-widgets>
</object>
<object class="GtkFileChooserDialog" id="uris-dialog">
<property name="can_focus">False</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="border_width">5</property>
+ <property name="type">popup</property>
<property name="title" translatable="yes">Select folders</property>
<property name="modal">True</property>
<property name="destroy_with_parent">True</property>
diff --git a/src/ui/rygel-preferences-dialog.vala b/src/ui/rygel-preferences-dialog.vala
index 18cbfd9..506cb9c 100644
--- a/src/ui/rygel-preferences-dialog.vala
+++ b/src/ui/rygel-preferences-dialog.vala
@@ -30,12 +30,14 @@ public class Rygel.PreferencesDialog : GLib.Object {
const string DIALOG = "preferences-dialog";
const string ICON = BuildConfig.SMALL_ICON_DIR + "/rygel.png";
const string UPNP_CHECKBUTTON = "upnp-checkbutton";
+ const string CLOSE_BUTTON = "close-button";
private WritableUserConfig config;
private Builder builder;
- private Dialog dialog;
+ private Window dialog;
private Switch upnp_check;
private ArrayList<PreferencesSection> sections;
+ private MainLoop loop;
public PreferencesDialog () throws Error {
this.config = new WritableUserConfig ();
@@ -43,7 +45,7 @@ public class Rygel.PreferencesDialog : GLib.Object {
this.builder.add_from_file (UI_FILE);
- this.dialog = (Dialog) this.builder.get_object (DIALOG);
+ this.dialog = (Window) this.builder.get_object (DIALOG);
assert (this.dialog != null);
this.upnp_check = (Switch) builder.get_object (UPNP_CHECKBUTTON);
assert (this.upnp_check != null);
@@ -61,10 +63,24 @@ public class Rygel.PreferencesDialog : GLib.Object {
this.upnp_check.notify["active"].connect ( () => {
this.on_upnp_switch_toggled ();
});
+
+ this.dialog.delete_event.connect ( () => {
+ this.dialog.hide ();
+ this.loop.quit ();
+
+ return true;
+ });
+
+ (builder.get_object (CLOSE_BUTTON) as Button).clicked.connect ( () => {
+ this.dialog.hide ();
+ this.loop.quit ();
+ });
}
public void run () {
- this.dialog.run ();
+ this.dialog.show ();
+ this.loop = new MainLoop (null, false);
+ this.loop.run ();
this.dialog.hide ();
this.config.set_upnp_enabled (this.upnp_check.active);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]