[network-manager-applet/NMA_0_8] applet: use only one toplevel per .ui file
- From: Dan Williams <dcbw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/NMA_0_8] applet: use only one toplevel per .ui file
- Date: Tue, 29 Mar 2011 20:12:57 +0000 (UTC)
commit 79aa02ef11b33c4e45c3b7d37b0fef3d7172ab5c
Author: Dan Williams <dcbw redhat com>
Date: Tue Mar 29 15:08:29 2011 -0500
applet: use only one toplevel per .ui file
See related editor commit:
editor: fix widget refcounting by cleanup up .ui toplevel widgets
for what's going on here. Split up applet.ui into separate .ui files
for each of it's dialogs, and split the wireless dialog into two
ui files, one for wifi with the unused toplevel removed, and one
for wired 802.1x that's significantly simpler.
src/Makefile.am | 2 +-
src/applet-device-wired.c | 5 +-
src/applet-dialogs.c | 2 +-
src/applet.c | 14 +-
src/applet.h | 1 -
src/applet.ui | 724 ---------------------------------------------
src/gsm-unlock.ui | 285 ++++++++++++++++++
src/info.ui | 129 ++++++++
src/wifi.ui | 213 +++++++++++++
src/wired-8021x.ui | 165 ++++++++++
src/wired-dialog.c | 69 +----
src/wired-dialog.h | 7 +-
src/wireless-dialog.c | 4 +-
13 files changed, 819 insertions(+), 801 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 037577f..1d20dab 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -62,7 +62,7 @@ nm_applet_LDADD = \
${top_builddir}/src/wireless-security/libwireless-security.la
uidir = $(datadir)/nm-applet
-ui_DATA = applet.ui keyring.png
+ui_DATA = gsm-unlock.ui info.ui wired-8021x.ui wifi.ui keyring.png
CLEANFILES = *.bak
diff --git a/src/applet-device-wired.c b/src/applet-device-wired.c
index c1b0173..d073770 100644
--- a/src/applet-device-wired.c
+++ b/src/applet-device-wired.c
@@ -716,10 +716,7 @@ nm_8021x_get_secrets (NMDevice *device,
GtkWidget *dialog;
NM8021xInfo *info;
- dialog = nma_wired_dialog_new (applet->ui_file,
- applet->nm_client,
- g_object_ref (connection),
- device);
+ dialog = nma_wired_dialog_new (applet->nm_client, g_object_ref (connection), device);
if (!dialog) {
g_set_error (error,
NM_SETTINGS_INTERFACE_ERROR,
diff --git a/src/applet-dialogs.c b/src/applet-dialogs.c
index 28a3a05..42f3d2b 100644
--- a/src/applet-dialogs.c
+++ b/src/applet-dialogs.c
@@ -905,7 +905,7 @@ applet_mobile_pin_dialog_new (const char *title,
builder = gtk_builder_new ();
- if (!gtk_builder_add_from_file (builder, UIDIR "/applet.ui", &error)) {
+ if (!gtk_builder_add_from_file (builder, UIDIR "/gsm-unlock.ui", &error)) {
g_warning ("Couldn't load builder file: %s", error->message);
g_error_free (error);
g_object_unref (builder);
diff --git a/src/applet.c b/src/applet.c
index 792d82d..a4638a1 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -3035,19 +3035,10 @@ constructor (GType type,
g_set_application_name (_("NetworkManager Applet"));
gtk_window_set_default_icon_name (GTK_STOCK_NETWORK);
- applet->ui_file = g_build_filename (UIDIR, "/applet.ui", NULL);
- if (!applet->ui_file || !g_file_test (applet->ui_file, G_FILE_TEST_IS_REGULAR)) {
- GtkWidget *dialog;
- dialog = applet_warning_dialog_show (_("The NetworkManager Applet could not find some required resources (the .ui file was not found)."));
- gtk_dialog_run (GTK_DIALOG (dialog));
- goto error;
- }
-
applet->info_dialog_ui = gtk_builder_new ();
- if (!gtk_builder_add_from_file (applet->info_dialog_ui, applet->ui_file, &error))
- {
- g_warning ("Couldn't load builder file: %s", error->message);
+ if (!gtk_builder_add_from_file (applet->info_dialog_ui, UIDIR "/info.ui", &error)) {
+ g_warning ("Couldn't load info dialog ui file: %s", error->message);
g_error_free (error);
goto error;
}
@@ -3159,7 +3150,6 @@ static void finalize (GObject *object)
g_object_unref (applet->notification);
}
- g_free (applet->ui_file);
if (applet->info_dialog_ui)
g_object_unref (applet->info_dialog_ui);
diff --git a/src/applet.h b/src/applet.h
index 0386faa..dac6af7 100644
--- a/src/applet.h
+++ b/src/applet.h
@@ -89,7 +89,6 @@ typedef struct
NMAGConfSettings *gconf_settings;
GConfClient * gconf_client;
- char * ui_file;
guint update_timestamps_id;
diff --git a/src/gsm-unlock.ui b/src/gsm-unlock.ui
new file mode 100644
index 0000000..17a730d
--- /dev/null
+++ b/src/gsm-unlock.ui
@@ -0,0 +1,285 @@
+<?xml version="1.0"?>
+<interface>
+ <object class="GtkDialog" id="unlock_dialog">
+ <property name="border_width">5</property>
+ <property name="window_position">center</property>
+ <property name="default_width">400</property>
+ <property name="icon_name">dialog-password</property>
+ <property name="type_hint">dialog</property>
+ <property name="has_separator">False</property>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox4">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkHBox" id="hbox7">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkAlignment" id="alignment5">
+ <property name="visible">True</property>
+ <property name="yalign">0</property>
+ <child>
+ <object class="GtkImage" id="image7">
+ <property name="visible">True</property>
+ <property name="yalign">0</property>
+ <property name="stock">gtk-dialog-authentication</property>
+ <property name="icon-size">6</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="padding">6</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox3">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="header_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">label</property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="padding">12</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="desc_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">label</property>
+ <property name="wrap">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkAlignment" id="alignment6">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="top_padding">12</property>
+ <property name="bottom_padding">12</property>
+ <property name="left_padding">12</property>
+ <property name="right_padding">12</property>
+ <child>
+ <object class="GtkTable" id="table14">
+ <property name="visible">True</property>
+ <property name="n_rows">5</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="code1_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">label</property>
+ </object>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="code1_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_focus">True</property>
+ <property name="activates_default">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="code2_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">label</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="code2_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="activates_default">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="code3_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">label</property>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="code3_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="activates_default">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="progress_hbox">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkAlignment" id="spinner_alignment">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="progress_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="wrap">True</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ <property name="y_padding">6</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="show_password_checkbutton">
+ <property name="label" translatable="no">Show it</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area4">
+ <property name="visible">True</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="unlock_cancel_button">
+ <property name="label">gtk-cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="unlock_button">
+ <property name="label" translatable="yes">_Unlock</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-6">unlock_cancel_button</action-widget>
+ <action-widget response="-5">unlock_button</action-widget>
+ </action-widgets>
+ </object>
+</interface>
diff --git a/src/info.ui b/src/info.ui
new file mode 100644
index 0000000..e40cc46
--- /dev/null
+++ b/src/info.ui
@@ -0,0 +1,129 @@
+<?xml version="1.0"?>
+<interface>
+ <object class="GtkDialog" id="info_dialog">
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes">Connection Information</property>
+ <property name="resizable">False</property>
+ <property name="icon_name">gtk-info</property>
+ <property name="type_hint">dialog</property>
+ <property name="has_separator">False</property>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox3">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkVBox" id="vbox4">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkImage" id="image6">
+ <property name="visible">True</property>
+ <property name="yalign">0</property>
+ <property name="stock">gtk-dialog-info</property>
+ <property name="icon-size">6</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox2">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label68">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Active Network Connections</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ <attribute name="scale" value="1.2"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkNotebook" id="info_notebook">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <child>
+ <object class="GtkLabel" id="label69">
+ <property name="visible">True</property>
+ </object>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label65">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area3">
+ <property name="visible">True</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="closebutton1">
+ <property name="label">gtk-close</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-7">closebutton1</action-widget>
+ </action-widgets>
+ </object>
+</interface>
diff --git a/src/wifi.ui b/src/wifi.ui
new file mode 100644
index 0000000..d5a3bfb
--- /dev/null
+++ b/src/wifi.ui
@@ -0,0 +1,213 @@
+<?xml version="1.0"?>
+<interface>
+ <object class="GtkListStore" id="model1">
+ <columns>
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes"> </col>
+ </row>
+ </data>
+ </object>
+ <object class="GtkListStore" id="model2">
+ <columns>
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes"> </col>
+ </row>
+ </data>
+ </object>
+ <!-- interface-requires gtk+ 2.6 -->
+ <!-- interface-naming-policy toplevel-contextual -->
+ <object class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="yalign">0</property>
+ <property name="icon_name">network-wireless</property>
+ <property name="icon-size">6</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="caption_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="use_markup">True</property>
+ <property name="wrap">True</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkTable" id="table1">
+ <property name="visible">True</property>
+ <property name="n_rows">5</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <object class="GtkVBox" id="security_vbox">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="right_attach">2</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="security_combo_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Wireless security:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">security_combo</property>
+ </object>
+ <packing>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="security_combo">
+ <property name="visible">True</property>
+ <property name="model">model1</property>
+ <child>
+ <object class="GtkCellRendererText" id="renderer1"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="network_name_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Network name:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">network_name_entry</property>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="network_name_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="activates_default">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="connection_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Co_nnection:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">connection_combo</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="connection_combo">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="device_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Wireless _adapter:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">device_combo</property>
+ </object>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="device_combo">
+ <property name="visible">True</property>
+ <property name="model">model2</property>
+ <child>
+ <object class="GtkCellRendererText" id="renderer2"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+</interface>
diff --git a/src/wired-8021x.ui b/src/wired-8021x.ui
new file mode 100644
index 0000000..30cf592
--- /dev/null
+++ b/src/wired-8021x.ui
@@ -0,0 +1,165 @@
+<?xml version="1.0"?>
+<interface>
+ <!-- interface-requires gtk+ 2.6 -->
+ <!-- interface-naming-policy toplevel-contextual -->
+ <object class="GtkDialog" id="wired_8021x_dialog">
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes">Wired 802.1X authentication</property>
+ <property name="resizable">False</property>
+ <property name="modal">True</property>
+ <property name="window_position">center-always</property>
+ <property name="default_width">488</property>
+ <property name="icon_name">dialog-password</property>
+ <property name="type_hint">dialog</property>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="yalign">0</property>
+ <property name="icon_name">dialog-password</property>
+ <property name="icon-size">6</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="caption_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="use_markup">True</property>
+ <property name="wrap">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkTable" id="table1">
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="network_name_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Network name:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">network_name_entry</property>
+ </object>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="network_name_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property name="activates_default">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="security_vbox">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area1">
+ <property name="visible">True</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="cancel_button">
+ <property name="label">gtk-cancel</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_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="ok_button">
+ <property name="label">gtk-connect</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-6">cancel_button</action-widget>
+ <action-widget response="-5">ok_button</action-widget>
+ </action-widgets>
+ </object>
+</interface>
diff --git a/src/wired-dialog.c b/src/wired-dialog.c
index 3209eb3..9db89db 100644
--- a/src/wired-dialog.c
+++ b/src/wired-dialog.c
@@ -76,57 +76,19 @@ dialog_set_security (NMConnection *connection,
return security;
}
-static gboolean
-dialog_init (GtkWidget *dialog,
- GtkBuilder *builder,
- NMClient *nm_client,
- NMConnection *connection)
-{
- WirelessSecurity *security;
- GtkWidget *widget;
-
- /* Hide bunch of wireless specific widgets */
- gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (builder, "device_label")));
- gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (builder, "device_combo")));
- gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (builder, "security_combo_label")));
- gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (builder, "security_combo")));
-
- /* The dialog won't ever get called for more than one connection for wired */
- gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (builder, "connection_label")));
- gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (builder, "connection_combo")));
-
- gtk_window_set_title (GTK_WINDOW (GTK_WIDGET (gtk_builder_get_object (builder, "wireless_dialog"))),
- _("Wired 802.1X authentication"));
-
- dialog_set_network_name (connection, GTK_ENTRY (GTK_WIDGET (gtk_builder_get_object (builder, "network_name_entry"))));
- security = dialog_set_security (connection, builder, GTK_BOX (GTK_WIDGET (gtk_builder_get_object (builder, "security_vbox"))));
- wireless_security_set_changed_notify (security, stuff_changed_cb, GTK_WIDGET (gtk_builder_get_object (builder, "ok_button")));
-
- g_object_set_data_full (G_OBJECT (dialog),
- "security", security,
- (GDestroyNotify) wireless_security_unref);
-
- gtk_window_set_icon_name (GTK_WINDOW (dialog), "dialog-password");
- widget = GTK_WIDGET (gtk_builder_get_object (builder, "image1"));
- gtk_image_set_from_icon_name (GTK_IMAGE (widget), "dialog-password", GTK_ICON_SIZE_DIALOG);
-
- return TRUE;
-}
-
GtkWidget *
-nma_wired_dialog_new (const char *ui_file,
- NMClient *nm_client,
- NMSettingsConnectionInterface *connection,
- NMDevice *device)
+nma_wired_dialog_new (NMClient *nm_client,
+ NMSettingsConnectionInterface *connection,
+ NMDevice *device)
{
GtkBuilder *builder;
GtkWidget *dialog;
- gboolean success;
GError *error = NULL;
+ WirelessSecurity *security;
builder = gtk_builder_new ();
- if (!gtk_builder_add_from_file (builder, ui_file, &error)) {
+ if (!gtk_builder_add_from_file (builder, UIDIR "/wired-8021x.ui", &error)) {
g_warning ("Couldn't load builder file: %s", error->message);
g_error_free (error);
applet_warning_dialog_show (_("The NetworkManager Applet could not find some required resources (the .ui file was not found)."));
@@ -134,20 +96,23 @@ nma_wired_dialog_new (const char *ui_file,
return NULL;
}
- dialog = GTK_WIDGET (gtk_builder_get_object (builder, "wireless_dialog"));
+ dialog = (GtkWidget *) gtk_builder_get_object (builder, "wired_8021x_dialog");
if (!dialog) {
- nm_warning ("Couldn't find wireless_dialog widget.");
+ nm_warning ("Couldn't find wired_8021x_dialog widget.");
+ applet_warning_dialog_show (_("The NetworkManager Applet could not find some required resources (the .ui file was not found)."));
g_object_unref (builder);
return NULL;
}
- success = dialog_init (dialog, builder, nm_client, NM_CONNECTION (connection));
- if (!success) {
- nm_warning ("Couldn't create wired security dialog.");
- gtk_widget_destroy (dialog);
- g_object_unref (builder);
- return NULL;
- }
+ gtk_window_set_title (GTK_WINDOW (dialog), _("Wired 802.1X authentication"));
+ gtk_window_set_icon_name (GTK_WINDOW (dialog), "dialog-password");
+ dialog_set_network_name (NM_CONNECTION (connection), GTK_ENTRY (gtk_builder_get_object (builder, "network_name_entry")));
+
+ security = dialog_set_security (NM_CONNECTION (connection), builder, GTK_BOX (gtk_builder_get_object (builder, "security_vbox")));
+ wireless_security_set_changed_notify (security, stuff_changed_cb, GTK_WIDGET (gtk_builder_get_object (builder, "ok_button")));
+ g_object_set_data_full (G_OBJECT (dialog),
+ "security", security,
+ (GDestroyNotify) wireless_security_unref);
g_object_set_data_full (G_OBJECT (dialog),
"connection", g_object_ref (connection),
diff --git a/src/wired-dialog.h b/src/wired-dialog.h
index f89b540..702ab5f 100644
--- a/src/wired-dialog.h
+++ b/src/wired-dialog.h
@@ -30,10 +30,9 @@
#include <nm-device.h>
#include <nm-settings-connection-interface.h>
-GtkWidget *nma_wired_dialog_new (const char *ui_file,
- NMClient *nm_client,
- NMSettingsConnectionInterface *connection,
- NMDevice *device);
+GtkWidget *nma_wired_dialog_new (NMClient *nm_client,
+ NMSettingsConnectionInterface *connection,
+ NMDevice *device);
NMSettingsConnectionInterface *nma_wired_dialog_get_connection (GtkWidget *dialog);
diff --git a/src/wireless-dialog.c b/src/wireless-dialog.c
index ee9cb0a..16bfaff 100644
--- a/src/wireless-dialog.c
+++ b/src/wireless-dialog.c
@@ -1411,9 +1411,9 @@ nma_wireless_dialog_init (NMAWirelessDialog *self)
NMAWirelessDialogPrivate *priv = NMA_WIRELESS_DIALOG_GET_PRIVATE (self);
GError *error = NULL;
- priv->builder = gtk_builder_new();
+ priv->builder = gtk_builder_new ();
- if (!gtk_builder_add_from_file (priv->builder, UIDIR "/applet.ui", &error)) {
+ if (!gtk_builder_add_from_file (priv->builder, UIDIR "/wifi.ui", &error)) {
g_warning ("Couldn't load builder file: %s", error->message);
g_error_free (error);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]