[seahorse-plugins] Bug 590247 - Migrate from libglade to GtkBuilder
- From: Adam Schreiber <sadam src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [seahorse-plugins] Bug 590247 - Migrate from libglade to GtkBuilder
- Date: Thu, 26 Nov 2009 22:43:22 +0000 (UTC)
commit c426b19843a0ca28e838e0d6b8428db287f1a0c2
Author: Adam Schreiber <sadam gnome org>
Date: Wed Aug 19 20:18:04 2009 -0400
Bug 590247 - Migrate from libglade to GtkBuilder
agent/Makefile.am | 6 +-
agent/seahorse-agent-cache.glade | 226 --------
agent/seahorse-agent-cache.xml | 156 ++++++
agent/seahorse-agent-status.c | 60 ++--
libseahorse/Makefile.am | 14 +-
libseahorse/seahorse-gconf.h | 2 +
libseahorse/seahorse-multi-encrypt.glade | 340 ------------
libseahorse/seahorse-multi-encrypt.xml | 236 +++++++++
libseahorse/seahorse-notify.glade | 99 ----
libseahorse/seahorse-notify.xml | 79 +++
libseahorse/seahorse-prefs.c | 13 +-
libseahorse/seahorse-prefs.glade | 600 ----------------------
libseahorse/seahorse-prefs.xml | 398 ++++++++++++++
libseahorse/seahorse-progress.c | 40 +-
libseahorse/seahorse-progress.glade | 189 -------
libseahorse/seahorse-progress.xml | 128 +++++
libseahorse/seahorse-widget.c | 347 +++++--------
libseahorse/seahorse-widget.h | 50 +-
plugins/applet/Makefile.am | 15 +-
plugins/applet/seahorse-applet-preferences.glade | 216 --------
plugins/applet/seahorse-applet-preferences.xml | 159 ++++++
plugins/applet/seahorse-applet.c | 11 +-
plugins/nautilus/seahorse-pgp-preferences.c | 15 +-
plugins/nautilus/seahorse-tool-files.c | 20 +-
24 files changed, 1412 insertions(+), 2007 deletions(-)
---
diff --git a/agent/Makefile.am b/agent/Makefile.am
index 419dbdf..f527827 100644
--- a/agent/Makefile.am
+++ b/agent/Makefile.am
@@ -1,4 +1,4 @@
-gladedir = $(datadir)/seahorse-plugins/glade/
+uidir = $(datadir)/seahorse-plugins/ui/
localedir = $(datadir)/locale
pixmapsdir = $(datadir)/pixmaps/
@@ -23,8 +23,8 @@ seahorse_agent_LDADD = \
$(top_builddir)/libseahorse/libseahorse.a \
$(SEAHORSE_LIBS)
-glade_DATA = \
- seahorse-agent-cache.glade
+ui_DATA = \
+ seahorse-agent-cache.xml
man_MANS = seahorse-agent.1
diff --git a/agent/seahorse-agent-cache.xml b/agent/seahorse-agent-cache.xml
new file mode 100644
index 0000000..3bb1cfc
--- /dev/null
+++ b/agent/seahorse-agent-cache.xml
@@ -0,0 +1,156 @@
+<?xml version="1.0"?>
+<interface>
+ <requires lib="gtk+" version="2.16"/>
+ <!-- interface-naming-policy toplevel-contextual -->
+ <object class="GtkDialog" id="agent-cache">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Cached Encryption Keys</property>
+ <property name="window_position">center</property>
+ <property name="default_width">380</property>
+ <property name="default_height">250</property>
+ <property name="type_hint">normal</property>
+ <property name="skip_taskbar_hint">True</property>
+ <property name="has_separator">False</property>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <child>
+ <object class="GtkTreeView" id="key_list">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="border_width">3</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox2">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="insecure_label">
+ <property name="can_focus">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes"><b>Warning</b>: Your system is not configured to cache passphrases in secure memory.</property>
+ <property name="use_markup">True</property>
+ <property name="wrap">True</property>
+ <property name="selectable">True</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="pack_type">end</property>
+ <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="clear_button">
+ <property name="label">gtk-clear</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>
+ <signal name="clicked" handler="clear_clicked"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="close_button">
+ <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>
+ <accelerator key="Escape" signal="clicked"/>
+ <signal name="clicked" handler="close_clicked"/>
+ </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="-5">clear_button</action-widget>
+ <action-widget response="-5">close_button</action-widget>
+ </action-widgets>
+ </object>
+ <object class="GtkMenu" id="context-menu">
+ <child>
+ <object class="GtkImageMenuItem" id="clear_cache">
+ <property name="label">_Clear Cache</property>
+ <property name="visible">True</property>
+ <property name="use_underline">True</property>
+ <property name="use_stock">True</property>
+ <signal name="activate" handler="on_clear_cache_activate"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="show_window">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Show Window</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="on_show_window_activate"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkSeparatorMenuItem" id="separator1">
+ <property name="visible">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkImageMenuItem" id="cache_settings">
+ <property name="label">Cache _Preferences</property>
+ <property name="visible">True</property>
+ <property name="use_underline">True</property>
+ <property name="use_stock">True</property>
+ <signal name="activate" handler="on_settings_activate"/>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/agent/seahorse-agent-status.c b/agent/seahorse-agent-status.c
index 4069b5e..5411658 100644
--- a/agent/seahorse-agent-status.c
+++ b/agent/seahorse-agent-status.c
@@ -59,7 +59,7 @@ enum {
};
/* Called to close status window */
-void
+G_MODULE_EXPORT void
window_destroy ()
{
if (g_window) {
@@ -69,7 +69,7 @@ window_destroy ()
}
/* When window close clicked we close window */
-static int
+G_MODULE_EXPORT static int
delete_event (GtkWidget *widget, GdkEvent *event, gpointer data)
{
window_destroy ();
@@ -77,14 +77,14 @@ delete_event (GtkWidget *widget, GdkEvent *event, gpointer data)
}
/* When close button clicked */
-static void
+G_MODULE_EXPORT static void
close_clicked (GtkButton *button, SeahorseWidget *swidget)
{
window_destroy ();
}
/* Clear button, clear cache and close */
-static void
+G_MODULE_EXPORT static void
clear_clicked (GtkButton *button, SeahorseWidget *swidget)
{
seahorse_agent_cache_clearall ();
@@ -124,7 +124,7 @@ window_update_keys ()
GtkTreeView *tree;
g_return_if_fail (g_window != NULL);
- tree = GTK_TREE_VIEW (glade_xml_get_widget (g_window->xml, "key_list"));
+ tree = GTK_TREE_VIEW (seahorse_widget_get_widget (g_window, "key_list"));
g_return_if_fail (tree != NULL);
store = GTK_TREE_STORE (gtk_tree_view_get_model (tree));
@@ -162,20 +162,21 @@ window_show ()
GtkWidget *w;
if (g_window) {
- w = glade_xml_get_widget (g_window->xml, g_window->name);
+ w = GTK_WIDGET (seahorse_widget_get_widget (g_window, g_window->name));
gtk_window_present (GTK_WINDOW (w));
return;
}
g_window = seahorse_widget_new ("agent-cache", NULL);
- w = glade_xml_get_widget (g_window->xml, g_window->name);
+ w = GTK_WIDGET (seahorse_widget_get_widget (g_window, g_window->name));
g_signal_connect (G_OBJECT (w), "delete_event", G_CALLBACK (delete_event), NULL);
- glade_xml_signal_connect_data (g_window->xml, "close_clicked",
- G_CALLBACK (close_clicked), g_window);
- glade_xml_signal_connect_data (g_window->xml, "clear_clicked",
- G_CALLBACK (clear_clicked), g_window);
+ w = GTK_WIDGET (seahorse_widget_get_widget (g_window, "close_button"));
+ g_signal_connect (G_OBJECT (w), "clicked", G_CALLBACK (close_clicked), g_window);
+
+ w = GTK_WIDGET (seahorse_widget_get_widget (g_window, "clear_button"));
+ g_signal_connect (G_OBJECT (w), "clicked", G_CALLBACK (clear_clicked), g_window);
window_update_keys ();
}
@@ -224,7 +225,7 @@ on_settings_activate (GtkWidget *item, gpointer data)
}
/* Called when icon clicked */
-static void
+G_MODULE_EXPORT static void
tray_activate (GtkStatusIcon *icon, void *data)
{
if (g_window)
@@ -234,28 +235,27 @@ tray_activate (GtkStatusIcon *icon, void *data)
}
/* Called when icon clicked */
-static void
+G_MODULE_EXPORT static void
tray_popup_menu (GtkStatusIcon *icon, guint button, guint32 timestamp, void *data)
{
- GtkWidget *menu;
- GladeXML *xml;
-
- xml = glade_xml_new (SEAHORSE_GLADEDIR "seahorse-agent-cache.glade",
- "context-menu", NULL);
- menu = glade_xml_get_widget (xml, "context-menu");
- glade_xml_signal_connect_data (xml, "on_clear_cache_activate",
- G_CALLBACK (on_clear_cache_activate), NULL);
- glade_xml_signal_connect_data (xml, "on_show_window_activate",
- G_CALLBACK (on_show_window_activate), NULL);
- glade_xml_signal_connect_data (xml, "on_settings_activate",
- G_CALLBACK (on_settings_activate), NULL);
-
- gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
+ GtkWidget *w;
+
+ w = GTK_WIDGET (seahorse_widget_get_widget (g_window, "clear_cache"));
+ g_object_connect (G_OBJECT (w), "activate", G_CALLBACK (on_clear_cache_activate), NULL);
+
+ w = GTK_WIDGET (seahorse_widget_get_widget (g_window, "show_window"));
+ g_object_connect (G_OBJECT (w), "activate", G_CALLBACK (on_show_window_activate), NULL);
+
+ w = GTK_WIDGET (seahorse_widget_get_widget (g_window, "cache_settings"));
+ g_object_connect (G_OBJECT (w), "activate", G_CALLBACK (on_settings_activate), NULL);
+
+ w = GTK_WIDGET (seahorse_widget_get_widget (g_window, "context-menu"));
+
+ gtk_menu_popup (GTK_MENU (w), NULL, NULL,
gtk_status_icon_position_menu, icon, button, timestamp);
+
if (button == 0)
- gtk_menu_shell_select_first (GTK_MENU_SHELL (menu), FALSE);
-
- g_object_unref (xml);
+ gtk_menu_shell_select_first (GTK_MENU_SHELL (w), FALSE);
}
/* Remove tray icon */
diff --git a/libseahorse/Makefile.am b/libseahorse/Makefile.am
index 2c3af01..a7badc3 100644
--- a/libseahorse/Makefile.am
+++ b/libseahorse/Makefile.am
@@ -1,5 +1,5 @@
-gladedir = $(datadir)/seahorse-plugins/glade/
+uidir = $(datadir)/seahorse-plugins/ui/
localedir = $(datadir)/locale
pixmapsdir = $(datadir)/pixmaps/seahorse-plugins/
seahorselibexecbindir = $(libdir)/seahorse-plugins/
@@ -9,7 +9,7 @@ INCLUDES = -I$(top_builddir) \
-I$(top_srcdir)/libcryptui \
$(SEAHORSE_CFLAGS) \
-DDATA_DIR=\""$(datadir)"\" \
- -DSEAHORSE_GLADEDIR=\""$(gladedir)"\" \
+ -DSEAHORSE_UIDIR=\""$(uidir)"\" \
-DLOCALEDIR=\"$(localedir)\" \
-DPIXMAPSDIR=\""$(pixmapsdir)"\" \
-DEXECDIR=\""$(seahorselibexecbindir)"\" \
@@ -56,11 +56,11 @@ seahorse-marshal.c: seahorse-marshal.list $(GLIB_GENMARSHAL)
echo "#include \"seahorse-marshal.h\"" > $@ && \
$(GLIB_GENMARSHAL) $< --body --prefix=seahorse_marshal >> $@
-glade_DATA = \
- seahorse-notify.glade \
- seahorse-prefs.glade \
- seahorse-progress.glade \
- seahorse-multi-encrypt.glade
+ui_DATA = \
+ seahorse-notify.xml \
+ seahorse-prefs.xml \
+ seahorse-progress.xml \
+ seahorse-multi-encrypt.xml
EXTRA_DIST = $(glade_DATA) \
seahorse-marshal.list
diff --git a/libseahorse/seahorse-gconf.h b/libseahorse/seahorse-gconf.h
index 8ffb89c..a5c17ba 100644
--- a/libseahorse/seahorse-gconf.h
+++ b/libseahorse/seahorse-gconf.h
@@ -50,6 +50,8 @@
#define KEYSHARING_KEY SEAHORSE_SCHEMAS "/sharing/sharing_enabled"
+#define WINDOW_SIZE SEAHORSE_SCHEMAS "/windows/"
+
void seahorse_gconf_disconnect ();
void seahorse_gconf_set_boolean (const char *key,
diff --git a/libseahorse/seahorse-multi-encrypt.xml b/libseahorse/seahorse-multi-encrypt.xml
new file mode 100644
index 0000000..b3a8036
--- /dev/null
+++ b/libseahorse/seahorse-multi-encrypt.xml
@@ -0,0 +1,236 @@
+<?xml version="1.0"?>
+<interface>
+ <requires lib="gtk+" version="2.16"/>
+ <!-- interface-naming-policy toplevel-contextual -->
+ <object class="GtkDialog" id="multi-encrypt">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes">Encrypt Multiple Files</property>
+ <property name="window_position">center</property>
+ <property name="type_hint">normal</property>
+ <property name="has_separator">False</property>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox2">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkVBox" id="vbox3">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="message">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>You have selected multiple files or folders</b></property>
+ <property name="use_markup">True</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkTable" id="local-options">
+ <property name="n_rows">3</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <object class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <property name="spacing">10</property>
+ <child>
+ <object class="GtkEntry" id="package-name">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property name="activates_default">True</property>
+ <property name="text" translatable="yes">encrypted-package</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="package-extension">
+ <property name="visible">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">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label9">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="do-separate">
+ <property name="label" translatable="yes">Encrypt each file separately</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </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"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="do-package">
+ <property name="label" translatable="yes">Encrypt packed together in a package</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">do-separate</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"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label6">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">Packaging:</property>
+ </object>
+ <packing>
+ <property name="x_options">GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label7">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Package Name:</property>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="remote-options">
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">Because the files are located remotely, each file will be encrypted separately.</property>
+ <property name="wrap">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area2">
+ <property name="visible">True</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="helpbutton1">
+ <property name="label">gtk-help</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="cancelbutton1">
+ <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">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="okbutton1">
+ <property name="label">gtk-ok</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">2</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="-11">helpbutton1</action-widget>
+ <action-widget response="-6">cancelbutton1</action-widget>
+ <action-widget response="-5">okbutton1</action-widget>
+ </action-widgets>
+ </object>
+</interface>
diff --git a/libseahorse/seahorse-notify.xml b/libseahorse/seahorse-notify.xml
new file mode 100644
index 0000000..c2e807b
--- /dev/null
+++ b/libseahorse/seahorse-notify.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0"?>
+<interface>
+ <requires lib="gtk+" version="2.16"/>
+ <!-- interface-naming-policy toplevel-contextual -->
+ <object class="GtkDialog" id="notify">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes">Notification Messages</property>
+ <property name="type_hint">dialog</property>
+ <property name="has_separator">False</property>
+ <signal name="delete_event" handler="delete_event"/>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow1">
+ <property name="width_request">400</property>
+ <property name="height_request">190</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="border_width">5</property>
+ <property name="hscrollbar_policy">never</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkViewport" id="viewport1">
+ <property name="visible">True</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkVBox" id="message-area">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ </child>
+ </object>
+ </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="closebutton1">
+ <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_stock">True</property>
+ <signal name="clicked" handler="closed"/>
+ </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/libseahorse/seahorse-prefs.c b/libseahorse/seahorse-prefs.c
index 5751207..eab846d 100644
--- a/libseahorse/seahorse-prefs.c
+++ b/libseahorse/seahorse-prefs.c
@@ -33,6 +33,7 @@
#include "seahorse-gconf.h"
#include "seahorse-gtkstock.h"
#include "seahorse-secure-entry.h"
+#include "seahorse-widget.h"
/* From seahorse-prefs-cache.c */
void seahorse_prefs_cache (SeahorseWidget *widget);
@@ -89,10 +90,10 @@ seahorse_prefs_new (GtkWindow *parent)
swidget = seahorse_widget_new ("prefs", parent);
- widget = glade_xml_get_widget (swidget->xml, "encrypt-self");
+ widget = GTK_WIDGET (seahorse_widget_get_widget (swidget, "encrypt-self"));
seahorse_check_button_gconf_attach (GTK_CHECK_BUTTON (widget), ENCRYPTSELF_KEY);
- widget = glade_xml_get_widget (swidget->xml, "signer-select");
+ widget = GTK_WIDGET (seahorse_widget_get_widget (swidget, "signer-select"));
g_return_val_if_fail (widget != NULL, NULL);
/* The Sign combo */
@@ -113,7 +114,7 @@ seahorse_prefs_new (GtkWindow *parent)
#ifdef WITH_AGENT
seahorse_prefs_cache (swidget);
#else
- widget = glade_xml_get_widget (swidget->xml, "cache-tab");
+ widget = GTK_WIDGET (seahorse_widget_get_widget (swidget, "cache-tab"));
g_return_val_if_fail (GTK_IS_WIDGET (widget), swidget);
seahorse_prefs_remove_tab (swidget, widget);
#endif
@@ -132,7 +133,7 @@ void
seahorse_prefs_add_tab (SeahorseWidget *swidget, GtkWidget *label, GtkWidget *tab)
{
GtkWidget *widget;
- widget = glade_xml_get_widget (swidget->xml, "notebook");
+ widget = GTK_WIDGET (seahorse_widget_get_widget (swidget, "notebook"));
gtk_widget_show (label);
gtk_notebook_prepend_page (GTK_NOTEBOOK (widget), tab, label);
}
@@ -145,7 +146,7 @@ seahorse_prefs_select_tab (SeahorseWidget *swidget, GtkWidget *tab)
g_return_if_fail (GTK_IS_WIDGET (tab));
- tabs = glade_xml_get_widget (swidget->xml, "notebook");
+ tabs = GTK_WIDGET (seahorse_widget_get_widget (swidget, "notebook"));
g_return_if_fail (GTK_IS_NOTEBOOK (tabs));
pos = gtk_notebook_page_num (GTK_NOTEBOOK (tabs), tab);
@@ -161,7 +162,7 @@ seahorse_prefs_remove_tab (SeahorseWidget *swidget, GtkWidget *tab)
g_return_if_fail (GTK_IS_WIDGET (tab));
- tabs = glade_xml_get_widget (swidget->xml, "notebook");
+ tabs = GTK_WIDGET (seahorse_widget_get_widget (swidget, "notebook"));
g_return_if_fail (GTK_IS_NOTEBOOK (tabs));
pos = gtk_notebook_page_num (GTK_NOTEBOOK (tabs), tab);
diff --git a/libseahorse/seahorse-prefs.xml b/libseahorse/seahorse-prefs.xml
new file mode 100644
index 0000000..47ef0b6
--- /dev/null
+++ b/libseahorse/seahorse-prefs.xml
@@ -0,0 +1,398 @@
+<?xml version="1.0"?>
+<interface>
+ <requires lib="gtk+" version="2.16"/>
+ <!-- interface-naming-policy toplevel-contextual -->
+ <object class="GtkDialog" id="prefs">
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes">Encryption and Keyrings</property>
+ <property name="type_hint">dialog</property>
+ <property name="has_separator">False</property>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="mainbox">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkNotebook" id="notebook">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="border_width">5</property>
+ <child>
+ <object class="GtkVBox" id="encryption-tab">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <child>
+ <object class="GtkVBox" id="vbox10">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label19">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>Default Key</b></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="GtkAlignment" id="alignment3">
+ <property name="visible">True</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkVBox" id="vbox27">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <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="label10">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Default key:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">signer-select</property>
+ </object>
+ <packing>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label20">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><i>This key is used to sign messages when no other key is chosen</i></property>
+ <property name="use_markup">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"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="signer-select">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ </packing>
+ </child>
+ <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="GtkCheckButton" id="encrypt-self">
+ <property name="label" translatable="yes">When _encrypting, always include myself as a recipient</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </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="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Encryption</property>
+ </object>
+ <packing>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="cache-tab">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="spacing">18</property>
+ <child>
+ <object class="GtkVBox" id="vbox26">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label15">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>Remember PGP Passphrases</b></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="GtkAlignment" id="pgp-message">
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkLabel" id="label18">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><i>A supported PGP passphrase caching agent is not running.</i></property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkAlignment" id="pgp-area">
+ <property name="visible">True</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkVBox" id="vbox12">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkRadioButton" id="no-cache">
+ <property name="label" translatable="yes">_Never remember passphrases</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox9">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkRadioButton" id="session-cache">
+ <property name="label" translatable="yes">_Remember passphrases for</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">no-cache</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="ttl">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="adjustment">adjustment1</property>
+ <property name="climb_rate">1</property>
+ <property name="numeric">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">minutes</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="keyring-cache">
+ <property name="label" translatable="yes">_Always remember passphrases whenever logged in</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">no-cache</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="authorize">
+ <property name="label" translatable="yes">As_k me before using a cached passphrase</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="display_status">
+ <property name="label" translatable="yes">Show _icon in status area when passphrases are in memory</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="position">4</property>
+ </packing>
+ </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">0</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label2">
+ <property name="label" translatable="yes">PGP Passphrases</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ <property name="tab_fill">False</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="helpbutton1">
+ <property name="label">gtk-help</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="closebutton1">
+ <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="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="-11">helpbutton1</action-widget>
+ <action-widget response="-7">closebutton1</action-widget>
+ </action-widgets>
+ </object>
+ <object class="GtkAction" id="action1"/>
+ <object class="GtkAdjustment" id="adjustment1">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ <property name="page_size">10</property>
+ </object>
+</interface>
diff --git a/libseahorse/seahorse-progress.c b/libseahorse/seahorse-progress.c
index e6e31d7..8a98f53 100644
--- a/libseahorse/seahorse-progress.c
+++ b/libseahorse/seahorse-progress.c
@@ -114,11 +114,13 @@ operation_done (SeahorseOperation *operation, SeahorseWidget *swidget)
if (err) {
operation_progress (operation, err->message, 0.0, swidget);
g_error_free (err);
- return;
}
+ } else {
+ operation_progress (operation, "", 0.0, swidget);
}
- operation_progress (operation, "", 0.0, swidget);
+ g_signal_handlers_disconnect_by_func (swidget, disconnect_progress, operation);
+ g_object_set_data (G_OBJECT (swidget), "operation", NULL);
}
static void
@@ -126,7 +128,6 @@ disconnect_progress (SeahorseWidget *widget, SeahorseOperation *op)
{
g_signal_handlers_disconnect_by_func (op, operation_progress, widget);
g_signal_handlers_disconnect_by_func (op, operation_done, widget);
- g_signal_handlers_disconnect_by_func (widget, disconnect_progress, op);
}
void
@@ -146,9 +147,14 @@ seahorse_progress_status_set_operation (SeahorseWidget *swidget,
prev = SEAHORSE_OPERATION (g_object_get_data (G_OBJECT (swidget), "operation"));
if (prev) {
+
+ /* If it's the same operation, just ignore */
+ if (prev == operation)
+ return;
/* If the previous one was a multi operation, just piggy back this one in */
if (SEAHORSE_IS_MULTI_OPERATION (prev)) {
+ g_object_ref (operation);
seahorse_multi_operation_take (SEAHORSE_MULTI_OPERATION (prev), operation);
return;
}
@@ -157,6 +163,7 @@ seahorse_progress_status_set_operation (SeahorseWidget *swidget,
disconnect_progress (swidget, prev);
}
+ g_object_ref (operation);
g_object_set_data_full (G_OBJECT (swidget), "operation", operation,
(GDestroyNotify)g_object_unref);
g_signal_connect (swidget, "destroy",
@@ -190,13 +197,13 @@ progress_operation_update (SeahorseOperation *operation, const gchar *message,
GtkWidget *w;
const gchar *t;
- w = glade_xml_get_widget (swidget->xml, "operation-details");
+ w = GTK_WIDGET (seahorse_widget_get_widget (swidget, "operation-details"));
g_return_if_fail (w != NULL);
t = seahorse_operation_get_message (operation);
gtk_label_set_text (GTK_LABEL (w), t ? t : "");
- progress = GTK_PROGRESS_BAR (glade_xml_get_widget (swidget->xml, "operation-bar"));
+ progress = GTK_PROGRESS_BAR (seahorse_widget_get_widget (swidget, "operation-bar"));
g_return_if_fail (w != NULL);
if (fract >= 0.0) {
@@ -207,8 +214,8 @@ progress_operation_update (SeahorseOperation *operation, const gchar *message,
}
}
-static void
-progress_operation_cancel (GtkButton *button, SeahorseOperation *operation)
+G_MODULE_EXPORT void
+on_progress_operation_cancel (GtkButton *button, SeahorseOperation *operation)
{
if (seahorse_operation_is_running (operation))
seahorse_operation_cancel (operation);
@@ -225,7 +232,7 @@ progress_delete_event (GtkWidget *widget, GdkEvent *event,
SeahorseOperation *operation)
{
/* When window close we simulate a cancel */
- progress_operation_cancel (NULL, operation);
+ on_progress_operation_cancel (NULL, operation);
/* Allow window to close regardless of outcome */
return TRUE;
@@ -263,18 +270,21 @@ progress_show (SeahorseOperation *operation)
/* Release our reference on the operation when this window is destroyed */
g_object_set_data_full (G_OBJECT (swidget), "operation", operation,
(GDestroyNotify)g_object_unref);
-
+
+ w = GTK_WIDGET (seahorse_widget_get_widget (swidget, swidget->name));
+ gtk_window_move (GTK_WINDOW (w), 10, 10);
+
/* Setup the title */
title = (const gchar*)g_object_get_data (G_OBJECT (operation), "progress-title");
if (title) {
/* The window title */
- w = glade_xml_get_widget (swidget->xml, swidget->name);
+ w = GTK_WIDGET (seahorse_widget_get_widget (swidget, swidget->name));
g_return_val_if_fail (w != NULL, FALSE);
gtk_window_set_title (GTK_WINDOW (w), title);
/* The main message title */
- w = glade_xml_get_widget (swidget->xml, "operation-title");
+ w = GTK_WIDGET (seahorse_widget_get_widget (swidget, "operation-title"));
g_return_val_if_fail (w != NULL, FALSE);
t = g_strdup_printf ("<b>%s</b>", title);
gtk_label_set_markup (GTK_LABEL (w), t);
@@ -288,13 +298,11 @@ progress_show (SeahorseOperation *operation)
G_CALLBACK (progress_operation_update), swidget);
/* Cancel events */
- glade_xml_signal_connect_data (swidget->xml, "cancel_clicked",
- G_CALLBACK (progress_operation_cancel), operation);
- g_signal_connect (seahorse_widget_get_top (swidget), "delete_event",
+ g_signal_connect (seahorse_widget_get_toplevel (swidget), "delete_event",
G_CALLBACK (progress_delete_event), operation);
/* Done and cleanup */
- w = glade_xml_get_widget (swidget->xml, swidget->name);
+ w = GTK_WIDGET (seahorse_widget_get_widget (swidget, swidget->name));
g_signal_connect (w, "destroy", G_CALLBACK (progress_destroy), operation);
g_signal_connect (operation, "done", G_CALLBACK (progress_operation_done), swidget);
@@ -312,7 +320,7 @@ seahorse_progress_show (SeahorseOperation *operation, const gchar *title,
/* Show the progress, after one second */
if (delayed)
- g_timeout_add (1000, (GSourceFunc)progress_show, operation);
+ g_timeout_add_seconds (1, (GSourceFunc)progress_show, operation);
/* Right away */
else
diff --git a/libseahorse/seahorse-progress.xml b/libseahorse/seahorse-progress.xml
new file mode 100644
index 0000000..365b858
--- /dev/null
+++ b/libseahorse/seahorse-progress.xml
@@ -0,0 +1,128 @@
+<?xml version="1.0"?>
+<interface>
+ <requires lib="gtk+" version="2.16"/>
+ <!-- interface-naming-policy toplevel-contextual -->
+ <object class="GtkDialog" id="progress">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes">Progress Title</property>
+ <property name="window_position">center-on-parent</property>
+ <property name="default_width">400</property>
+ <property name="type_hint">dialog</property>
+ <property name="has_separator">False</property>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="stock">gtk-dialog-authentication</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="vbox2">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="operation-title">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label"><b>Progress Message</b></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="operation-details">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label">Progress Status</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkProgressBar" id="operation-bar">
+ <property name="visible">True</property>
+ <property name="pulse_step">0.10000000149</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="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">
+ <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>
+ <signal name="clicked" handler="cancel_clicked"/>
+ </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="-6">cancel</action-widget>
+ </action-widgets>
+ </object>
+</interface>
diff --git a/libseahorse/seahorse-widget.c b/libseahorse/seahorse-widget.c
index 4588434..b15d53e 100644
--- a/libseahorse/seahorse-widget.c
+++ b/libseahorse/seahorse-widget.c
@@ -20,18 +20,14 @@
* Boston, MA 02111-1307, USA.
*/
-#include "config.h"
+#include <config.h>
#include <string.h>
-#include <gtk/gtk.h>
-#include <gio/gio.h>
-
#include <glib/gi18n.h>
-#include <glade/glade.h>
-#include <glade/glade-build.h>
#include "seahorse-widget.h"
+#include "seahorse-gconf.h"
#include "seahorse-gtkstock.h"
#define STATUS "status"
@@ -55,17 +51,21 @@ static void object_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
+
+static GObject* seahorse_widget_constructor (GType type,
+ guint n_props,
+ GObjectConstructParam* props);
/* signal functions */
-static void widget_closed (GtkWidget *widget,
- SeahorseWidget *swidget);
+G_MODULE_EXPORT void on_widget_closed (GtkWidget *widget,
+ SeahorseWidget *swidget);
-static void widget_help (GtkWidget *widget,
- SeahorseWidget *swidget);
+G_MODULE_EXPORT void on_widget_help (GtkWidget *widget,
+ SeahorseWidget *swidget);
-static gboolean widget_delete_event (GtkWidget *widget,
- GdkEvent *event,
- SeahorseWidget *swidget);
+G_MODULE_EXPORT gboolean on_widget_delete_event (GtkWidget *widget,
+ GdkEvent *event,
+ SeahorseWidget *swidget);
static GtkObjectClass *parent_class = NULL;
@@ -99,12 +99,13 @@ class_init (SeahorseWidgetClass *klass)
parent_class = g_type_class_peek_parent (klass);
gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->constructor = seahorse_widget_constructor;
gobject_class->finalize = object_finalize;
gobject_class->set_property = object_set_property;
gobject_class->get_property = object_get_property;
g_object_class_install_property (gobject_class, PROP_NAME,
- g_param_spec_string ("name", "Widget name", "Name of glade file and main widget",
+ g_param_spec_string ("name", "Widget name", "Name of gtkbuilder file and main widget",
NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
}
@@ -114,6 +115,38 @@ object_init (SeahorseWidget *swidget)
}
+static GObject*
+seahorse_widget_constructor (GType type, guint n_props, GObjectConstructParam* props)
+{
+ SeahorseWidget *swidget;
+ GObject *obj;
+
+ GtkWindow *window;
+ gint width, height;
+ gchar *widthkey, *heightkey;
+
+ obj = G_OBJECT_CLASS (parent_class)->constructor (type, n_props, props);
+ swidget = SEAHORSE_WIDGET (obj);
+
+ /* Load window size for windows that aren't dialogs */
+ window = GTK_WINDOW (seahorse_widget_get_toplevel (swidget));
+ if (!GTK_IS_DIALOG (window)) {
+ widthkey = g_strdup_printf ("%s%s%s", WINDOW_SIZE, swidget->name, "_width");
+ width = seahorse_gconf_get_integer (widthkey);
+
+ heightkey = g_strdup_printf ("%s%s%s", WINDOW_SIZE, swidget->name, "_height");
+ height = seahorse_gconf_get_integer (heightkey);
+
+ if (width > 0 && height > 0)
+ gtk_window_resize (window, width, height);
+
+ g_free (widthkey);
+ g_free (heightkey);
+ }
+
+ return obj;
+}
+
/* Disconnects callbacks, destroys main window widget,
* and frees the xml definition and any other data */
static void
@@ -132,11 +165,11 @@ object_finalize (GObject *gobject)
}
}
- if (glade_xml_get_widget (swidget->xml, swidget->name))
- gtk_widget_destroy (glade_xml_get_widget (swidget->xml, swidget->name));
+ if (seahorse_widget_get_widget (swidget, swidget->name))
+ gtk_widget_destroy (GTK_WIDGET (seahorse_widget_get_widget (swidget, swidget->name)));
- g_object_unref (swidget->xml);
- swidget->xml = NULL;
+ g_object_unref (swidget->gtkbuilder);
+ swidget->gtkbuilder = NULL;
g_free (swidget->name);
@@ -153,28 +186,24 @@ object_set_property (GObject *object, guint prop_id, const GValue *value, GParam
swidget = SEAHORSE_WIDGET (object);
switch (prop_id) {
- /* Loads xml definition from name, connects common callbacks */
+ /* Loads gtkbuilder xml definition from name, connects common callbacks */
case PROP_NAME:
g_return_if_fail (swidget->name == NULL);
swidget->name = g_value_dup_string (value);
- path = g_strdup_printf ("%sseahorse-%s.glade",
- SEAHORSE_GLADEDIR, swidget->name);
- swidget->xml = glade_xml_new (path, swidget->name, NULL);
+ path = g_strdup_printf ("%sseahorse-%s.xml",
+ SEAHORSE_UIDIR, swidget->name);
+ swidget->gtkbuilder = gtk_builder_new ();
+ gtk_builder_add_from_file (swidget->gtkbuilder, path, NULL);
g_free (path);
- g_return_if_fail (swidget->xml != NULL);
+ g_return_if_fail (swidget->gtkbuilder != NULL);
- glade_xml_signal_connect_data (swidget->xml, "closed",
- G_CALLBACK (widget_closed), swidget);
- glade_xml_signal_connect_data (swidget->xml, "delete_event",
- G_CALLBACK (widget_delete_event), swidget);
- glade_xml_signal_connect_data (swidget->xml, "help",
- G_CALLBACK (widget_help), swidget);
+ gtk_builder_connect_signals (swidget->gtkbuilder, swidget);
- w = glade_xml_get_widget (swidget->xml, swidget->name);
- glade_xml_set_toplevel (swidget->xml, GTK_WINDOW (w));
- glade_xml_ensure_accel (swidget->xml);
+ w = GTK_WIDGET (seahorse_widget_get_widget (swidget, swidget->name));
+ GTK_WIDGET_SET_FLAGS (GTK_WINDOW (w), GTK_TOPLEVEL);
+ /*TODO: glade_xml_ensure_accel (swidget->gtkbuilder);*/
- gtk_window_set_icon_name (GTK_WINDOW (w), "seahorse-preferences");
+ gtk_window_set_icon_name (GTK_WINDOW (w), "seahorse");
break;
}
}
@@ -194,30 +223,30 @@ object_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *
}
}
-static void
-widget_help (GtkWidget *widget, SeahorseWidget *swidget)
+G_MODULE_EXPORT void
+on_widget_help (GtkWidget *widget, SeahorseWidget *swidget)
{
seahorse_widget_show_help (swidget);
}
/* Destroys widget */
-static void
-widget_closed (GtkWidget *widget, SeahorseWidget *swidget)
+G_MODULE_EXPORT void
+on_widget_closed (GtkWidget *widget, SeahorseWidget *swidget)
{
seahorse_widget_destroy (swidget);
}
/* Closed widget */
-static gboolean
-widget_delete_event (GtkWidget *widget, GdkEvent *event, SeahorseWidget *swidget)
+G_MODULE_EXPORT gboolean
+on_widget_delete_event (GtkWidget *widget, GdkEvent *event, SeahorseWidget *swidget)
{
- widget_closed (widget, swidget);
+ on_widget_closed (widget, swidget);
return FALSE; /* propogate event */
}
/**
* seahorse_widget_new:
- * @name: Name of widget, filename part of glade file, and name of main window
+ * @name: Name of widget, filename part of gtkbuilder file, and name of main window
* @parent: GtkWindow to make the parent of the new swidget
*
* Creates a new #SeahorseWidget.
@@ -233,7 +262,7 @@ seahorse_widget_new (const gchar *name, GtkWindow *parent)
/* If widget already exists, present */
if (swidget != NULL) {
- gtk_window_present (GTK_WINDOW (glade_xml_get_widget (swidget->xml, swidget->name)));
+ gtk_window_present (GTK_WINDOW (seahorse_widget_get_widget (swidget, swidget->name)));
return NULL;
}
@@ -244,7 +273,7 @@ seahorse_widget_new (const gchar *name, GtkWindow *parent)
g_hash_table_insert (widgets, g_strdup (name), swidget);
if (parent != NULL) {
- window = GTK_WINDOW (glade_xml_get_widget (swidget->xml, swidget->name));
+ window = GTK_WINDOW (seahorse_widget_get_widget (swidget, swidget->name));
gtk_window_set_transient_for (window, parent);
}
@@ -258,7 +287,7 @@ seahorse_widget_new (const gchar *name, GtkWindow *parent)
/**
* seahorse_widget_new_allow_multiple:
- * @name: Name of widget, filename part of glade file, and name of main window
+ * @name: Name of widget, filename part of gtkbuilder file, and name of main window
* @parent: GtkWindow to make the parent of the new swidget
*
* Creates a new #SeahorseWidget without checking if it already exists.
@@ -272,9 +301,11 @@ seahorse_widget_new_allow_multiple (const gchar *name, GtkWindow *parent)
SeahorseWidget *swidget = g_object_new (SEAHORSE_TYPE_WIDGET, "name", name, NULL);
if (parent != NULL) {
- window = GTK_WINDOW (glade_xml_get_widget (swidget->xml, swidget->name));
+ window = GTK_WINDOW (seahorse_widget_get_widget (swidget, swidget->name));
gtk_window_set_transient_for (window, parent);
}
+
+ gtk_builder_connect_signals (swidget->gtkbuilder, NULL);
/* We don't care about this floating business */
g_object_ref (GTK_OBJECT (swidget));
@@ -302,9 +333,9 @@ seahorse_widget_find (const gchar *name)
void
seahorse_widget_show_help (SeahorseWidget *swidget)
{
+ GError *error = NULL;
gchar *document = NULL;
- GError *err = NULL;
- gboolean error;
+ GtkWidget *dialog = NULL;
if (g_str_equal (swidget->name, "key-manager") ||
g_str_equal (swidget->name, "keyserver-results")) {
@@ -313,26 +344,29 @@ seahorse_widget_show_help (SeahorseWidget *swidget)
document = g_strdup_printf ("ghelp:" PACKAGE "?%s", swidget->name);
}
- error = g_app_info_launch_default_for_uri (document, NULL, &err);
- g_free (document);
-
- if (error != TRUE) {
- GtkWidget *dialog;
-
- dialog = gtk_message_dialog_new (GTK_WINDOW (seahorse_widget_get_top (swidget)), GTK_DIALOG_MODAL,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
- _("Could not display help: %s"),
- err->message);
- g_error_free (err);
-
- g_signal_connect (G_OBJECT (dialog), "response",
- G_CALLBACK (gtk_widget_destroy), NULL);
+ if (!g_app_info_launch_default_for_uri (document, NULL, &error)) {
+ dialog = gtk_message_dialog_new (GTK_WINDOW (seahorse_widget_get_toplevel (swidget)),
+ GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
+ _("Could not display help: %s"), error->message);
+ g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (gtk_widget_destroy), NULL);
gtk_widget_show (dialog);
}
+
+ g_free (document);
+
+ if (error)
+ g_error_free (error);
+}
+
+const gchar*
+seahorse_widget_get_name (SeahorseWidget *swidget)
+{
+ g_return_val_if_fail (SEAHORSE_IS_WIDGET (swidget), NULL);
+ return swidget->name;
}
/**
- * seahorse_widget_get_top
+ * seahorse_widget_get_toplevel
* @swidget: The seahorse widget
*
* Return the top level widget in this seahorse widget
@@ -340,9 +374,9 @@ seahorse_widget_show_help (SeahorseWidget *swidget)
* Returns: The top level widget
**/
GtkWidget*
-seahorse_widget_get_top (SeahorseWidget *swidget)
+seahorse_widget_get_toplevel (SeahorseWidget *swidget)
{
- GtkWidget *widget = glade_xml_get_widget (swidget->xml, swidget->name);
+ GtkWidget *widget = GTK_WIDGET (seahorse_widget_get_widget (swidget, swidget->name));
g_return_val_if_fail (widget != NULL, NULL);
return widget;
}
@@ -350,8 +384,9 @@ seahorse_widget_get_top (SeahorseWidget *swidget)
GtkWidget*
seahorse_widget_get_widget (SeahorseWidget *swidget, const char *identifier)
{
- GtkWidget *widget = glade_xml_get_widget (swidget->xml, identifier);
- g_return_val_if_fail (widget != NULL, NULL);
+ GtkWidget *widget = GTK_WIDGET (gtk_builder_get_object (swidget->gtkbuilder, identifier));
+ if (widget == NULL)
+ g_warning ("could not find widget %s for seahorse-%s.xml", identifier, swidget->name);
return widget;
}
@@ -359,17 +394,14 @@ seahorse_widget_get_widget (SeahorseWidget *swidget, const char *identifier)
* seahorse_widget_show:
* @swidget: #SeahorseWidget to show
*
- * Show the toplevel widget in the glade file.
+ * Show the toplevel widget in the gtkbuilder file.
**/
void
seahorse_widget_show (SeahorseWidget *swidget)
{
GtkWidget *widget;
- if (swidget->ui)
- gtk_ui_manager_ensure_update (swidget->ui);
-
- widget = glade_xml_get_widget (swidget->xml, swidget->name);
+ widget = GTK_WIDGET (seahorse_widget_get_widget (swidget, swidget->name));
g_return_if_fail (widget != NULL);
gtk_widget_show (widget);
}
@@ -378,7 +410,7 @@ void
seahorse_widget_set_visible (SeahorseWidget *swidget, const char *identifier,
gboolean visible)
{
- GtkWidget *widget = glade_xml_get_widget (swidget->xml, identifier);
+ GtkWidget *widget = GTK_WIDGET (seahorse_widget_get_widget (swidget, identifier));
g_return_if_fail (widget != NULL);
if (visible)
@@ -391,7 +423,7 @@ void
seahorse_widget_set_sensitive (SeahorseWidget *swidget, const char *identifier,
gboolean sensitive)
{
- GtkWidget *widget = glade_xml_get_widget (swidget->xml, identifier);
+ GtkWidget *widget = GTK_WIDGET (seahorse_widget_get_widget (swidget, identifier));
g_return_if_fail (widget != NULL);
gtk_widget_set_sensitive (widget, sensitive);
}
@@ -405,163 +437,32 @@ seahorse_widget_set_sensitive (SeahorseWidget *swidget, const char *identifier,
void
seahorse_widget_destroy (SeahorseWidget *swidget)
{
- g_return_if_fail (swidget != NULL && SEAHORSE_IS_WIDGET (swidget));
- if (!swidget->destroying) {
- swidget->destroying = TRUE;
- g_object_unref (swidget);
- }
-}
-
-/* UI MANAGER CODE ---------------------------------------------------------- */
-
-static void
-ui_add_widget (GtkUIManager *ui, GtkWidget *widget, SeahorseWidget *swidget)
-{
- GtkWidget *holder;
- const gchar *name;
-
- /* We automatically add menus and toolbars */
- if (GTK_IS_MENU_BAR (widget))
- name = "menu-placeholder";
- else
- name = "toolbar-placeholder";
-
- if (name != NULL) {
- /* Find the appropriate position in the glade file */
- holder = glade_xml_get_widget (swidget->xml, name);
- if (holder != NULL)
- gtk_container_add (GTK_CONTAINER (holder), widget);
- else
- g_warning ("no place holder found for: %s", name);
- }
-}
+ GtkWidget *widget;
+ gchar *widthkey, *heightkey;
+ gint width, height;
-static void
-ui_load (SeahorseWidget *swidget)
-{
- GtkWidget *w;
- GError *err = NULL;
- gchar *path;
+ g_return_if_fail (swidget != NULL && SEAHORSE_IS_WIDGET (swidget));
+ widget = seahorse_widget_get_toplevel (swidget);
- if (!swidget->ui) {
-
- /* Load the menu/toolbar description file */
- swidget->ui = gtk_ui_manager_new ();
- path = g_strdup_printf ("%sseahorse-%s.ui", SEAHORSE_GLADEDIR, swidget->name);
- gtk_ui_manager_add_ui_from_file (swidget->ui, path, &err);
- g_free (path);
-
- if (err) {
- g_warning ("couldn't load ui description for '%s': %s", swidget->name, err->message);
- g_error_free (err);
- return;
- }
-
- /* The widgets get added in an idle loop later */
- g_signal_connect (swidget->ui, "add-widget", G_CALLBACK (ui_add_widget), swidget);
-
- /* Attach accelerators to the window */
- w = glade_xml_get_widget (swidget->xml, swidget->name);
- if (GTK_IS_WINDOW (w))
- gtk_window_add_accel_group (GTK_WINDOW (w), gtk_ui_manager_get_accel_group (swidget->ui));
- }
-}
+ /* Don't save window size for dialogs */
+ if (!GTK_IS_DIALOG (widget)) {
-static void
-cleanup_actions (GtkActionGroup *group)
-{
- GList *actions, *l;
+ /* Save window size */
+ gtk_window_get_size (GTK_WINDOW (widget), &width, &height);
- #define ELIPSIS "..."
- #define ELIPSIS_LEN 3
+ widthkey = g_strdup_printf ("%s%s%s", WINDOW_SIZE, swidget->name, "_width");
+ seahorse_gconf_set_integer (widthkey, width);
- actions = gtk_action_group_list_actions (group);
+ heightkey = g_strdup_printf ("%s%s%s", WINDOW_SIZE, swidget->name, "_height");
+ seahorse_gconf_set_integer (heightkey, height);
- for (l = actions; l; l = g_list_next (l)) {
- GtkAction *action = GTK_ACTION (l->data);
- gchar *label;
- guint len;
-
- /* Remove the ellipsis from the end of action labels if present */
- g_object_get (action, "short-label", &label, NULL);
- if (label) {
- len = strlen (label);
- if (strcmp (ELIPSIS, label + (len - ELIPSIS_LEN)) == 0) {
- label[len - ELIPSIS_LEN] = 0;
- g_object_set (action, "short-label", label, NULL);
- }
- g_free (label);
- }
+ g_free (widthkey);
+ g_free (heightkey);
}
-
- g_list_free (actions);
-}
-
-/**
- * seahorse_widget_get_ui_widget
- * @swidget: The #SeahorseWidget.
- * @path: The path to the widget. See gtk_ui_manager_get_widget
- *
- * Returns a piece of generated UI. Note this doesn't look in the glade
- * file but rather looks in the GtkUIManager UI. If no UI has been loaded
- * then one will be loaded. The UI file has the same name as the glade file
- * but with a 'ui' extension.
- */
-GtkWidget*
-seahorse_widget_get_ui_widget (SeahorseWidget *swidget, const gchar *path)
-{
- g_return_val_if_fail (SEAHORSE_IS_WIDGET (swidget), NULL);
-
- ui_load (swidget);
- g_return_val_if_fail (swidget->ui, NULL);
-
- return gtk_ui_manager_get_widget (swidget->ui, path);
-}
-
-/**
- * seahorse_widget_add_actions
- * @swidget: The #SeahorseWidget.
- * @actions: A #GtkActionGroup to add to the UI.
- *
- * Adds a GtkActionGroup to this widget's GtkUIManager UI. If no UI
- * has been loaded then one will be loaded. The UI file has the same
- * name as the glade file but with a 'ui' extension.
- */
-void
-seahorse_widget_add_actions (SeahorseWidget *swidget, GtkActionGroup *actions)
-{
- g_return_if_fail (SEAHORSE_IS_WIDGET (swidget));
-
- ui_load (swidget);
- g_return_if_fail (swidget->ui);
-
- cleanup_actions (actions);
- gtk_ui_manager_insert_action_group (swidget->ui, actions, -1);
-}
-
-/**
- * seahorse_widget_find_actions
- * @swidget: The #SeahorseWidget.
- * @name: The name of the action group.
- *
- * Find an #GtkActionGroup previously added to this widget.
- *
- * Returns: The action group.
- */
-GtkActionGroup*
-seahorse_widget_find_actions (SeahorseWidget *swidget, const gchar *name)
-{
- GList *l;
-
- g_return_val_if_fail (SEAHORSE_IS_WIDGET (swidget), NULL);
-
- if (!swidget->ui)
- return NULL;
- for (l = gtk_ui_manager_get_action_groups (swidget->ui); l; l = g_list_next (l)) {
- if (g_str_equal (gtk_action_group_get_name (GTK_ACTION_GROUP (l->data)), name))
- return GTK_ACTION_GROUP (l->data);
+ /* Destroy Widget */
+ if (!swidget->destroying) {
+ swidget->destroying = TRUE;
+ g_object_unref (swidget);
}
-
- return NULL;
}
diff --git a/libseahorse/seahorse-widget.h b/libseahorse/seahorse-widget.h
index becc06a..b5929c1 100644
--- a/libseahorse/seahorse-widget.h
+++ b/libseahorse/seahorse-widget.h
@@ -19,27 +19,12 @@
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*/
-
-/**
- * SeahorseWidget: A window created from a glade file.
- *
- * - All SeahorseWidget objects are destroyed when the SeahorseContext
- * goes bye-bye.
- * - Implements fun GtkUIManager stuff.
- *
- * Signals:
- * destroy: The window was destroyed.
- *
- * Properties:
- * name: (gchar*) The name of the glade file to load.
- */
#ifndef __SEAHORSE_WIDGET_H__
#define __SEAHORSE_WIDGET_H__
#include <glib.h>
#include <gtk/gtk.h>
-#include <glade/glade-xml.h>
#define SEAHORSE_TYPE_WIDGET (seahorse_widget_get_type ())
#define SEAHORSE_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_WIDGET, SeahorseWidget))
@@ -51,15 +36,33 @@
typedef struct _SeahorseWidget SeahorseWidget;
typedef struct _SeahorseWidgetClass SeahorseWidgetClass;
+/**
+ * SeahorseWidget:
+ * @parent: The parent #GtkObject
+ * @gtkbuilder: The #GtkBuilder object for the #SeahorseWidget
+ * @name: The name of the gtkbuilder file
+ *
+ * A window created from a gtkbuilder file.
+ *
+ * - All SeahorseWidget objects are destroyed when the SeahorseContext
+ * goes bye-bye.
+ * - Implements fun GtkUIManager stuff.
+ *
+ * Signals:
+ * destroy: The window was destroyed.
+ *
+ * Properties:
+ * name: (gchar*) The name of the gtkbuilder file to load.
+ */
+
struct _SeahorseWidget {
GtkObject parent;
/*< public >*/
- GladeXML *xml;
+ GtkBuilder *gtkbuilder;
gchar *name;
/*< private >*/
- GtkUIManager *ui;
gboolean destroying;
};
@@ -77,7 +80,9 @@ SeahorseWidget* seahorse_widget_new_allow_multiple (const gchar *name,
SeahorseWidget* seahorse_widget_find (const gchar *name);
-GtkWidget* seahorse_widget_get_top (SeahorseWidget *swidget);
+const gchar* seahorse_widget_get_name (SeahorseWidget *swidget);
+
+GtkWidget* seahorse_widget_get_toplevel (SeahorseWidget *swidget);
GtkWidget* seahorse_widget_get_widget (SeahorseWidget *swidget,
const char *identifier);
@@ -96,13 +101,4 @@ void seahorse_widget_set_sensitive (SeahorseWidget *swidget,
void seahorse_widget_destroy (SeahorseWidget *swidget);
-GtkWidget* seahorse_widget_get_ui_widget (SeahorseWidget *swidget,
- const gchar *path);
-
-void seahorse_widget_add_actions (SeahorseWidget *swidget,
- GtkActionGroup *actions);
-
-GtkActionGroup* seahorse_widget_find_actions (SeahorseWidget *swidget,
- const gchar *name);
-
#endif /* __SEAHORSE_WIDGET_H__ */
diff --git a/plugins/applet/Makefile.am b/plugins/applet/Makefile.am
index 8378b29..d486104 100644
--- a/plugins/applet/Makefile.am
+++ b/plugins/applet/Makefile.am
@@ -1,6 +1,6 @@
-uidir = $(datadir)/gnome-2.0/ui
-gladedir = $(datadir)/seahorse-plugins/glade/
+appletdir = $(datadir)/gnome-2.0/ui
+uidir = $(datadir)/seahorse-plugins/ui/
localedir = $(datadir)/locale
SUBDIRS = docs
@@ -14,9 +14,10 @@ INCLUDES = \
-I$(top_srcdir)/libseahorse \
$(SEAHORSE_CFLAGS) \
-DGNOMELOCALEDIR=\"$(localedir)\" \
- -DUIDIR=\"$(uidir)\" \
+ -DUIDIR=\"$(appletdir)\" \
-DDATADIR=\""$(datadir)"\" \
-DLIBDIR=\""$(libdir)"\" \
+ -DSEAHORSE_UIDIR=\""$(uidir)"\" \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
-DPREFIX=\""$(prefix)"\" \
-DLIBCRYPTUI_API_SUBJECT_TO_CHANGE
@@ -43,15 +44,15 @@ $(server_in_files): $(server_in_files:.server.in=.server.in.in)
CLEANFILES = $(server_in_files) $(server_DATA) $(schemas_DATA) *.gladep* *.bak
-ui_DATA = \
+applet_DATA = \
GNOME_SeahorseApplet.xml
@INTLTOOL_SERVER_RULE@
-glade_DATA = \
+ui_DATA = \
seahorse-applet-preferences.glade
EXTRA_DIST = \
GNOME_SeahorseApplet.server.in.in \
- $(glade_DATA) \
- $(ui_DATA)
+ $(ui_DATA) \
+ $(applet_DATA)
diff --git a/plugins/applet/seahorse-applet-preferences.xml b/plugins/applet/seahorse-applet-preferences.xml
new file mode 100644
index 0000000..ec644b4
--- /dev/null
+++ b/plugins/applet/seahorse-applet-preferences.xml
@@ -0,0 +1,159 @@
+<?xml version="1.0"?>
+<interface>
+ <requires lib="gtk+" version="2.16"/>
+ <!-- interface-naming-policy toplevel-contextual -->
+ <object class="GtkDialog" id="applet-preferences">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes">Clipboard Encryption Preferences</property>
+ <property name="resizable">False</property>
+ <property name="type_hint">dialog</property>
+ <property name="has_separator">False</property>
+ <signal name="delete_event" handler="delete_event"/>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkVBox" id="vbox2">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <property name="spacing">18</property>
+ <child>
+ <object class="GtkCheckButton" id="show-clipboard-state">
+ <property name="label" translatable="yes">_Show clipboard state in panel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</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="vbox3">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>Display clipboard contents after:</b></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="GtkAlignment" id="alignment2">
+ <property name="visible">True</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkVBox" id="vbox4">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCheckButton" id="display-encrypted-clipboard">
+ <property name="label" translatable="yes">_Encrypting or signing the clipboard</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="display-decrypted-clipboard">
+ <property name="label" translatable="yes">_Decrypting the clipboard</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="display-verified-clipboard">
+ <property name="label" translatable="yes">_Verifying the clipboard</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <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>
+ </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="ok">
+ <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_stock">True</property>
+ <signal name="clicked" handler="closed"/>
+ </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">ok</action-widget>
+ </action-widgets>
+ </object>
+</interface>
diff --git a/plugins/applet/seahorse-applet.c b/plugins/applet/seahorse-applet.c
index e2c8e18..e2bf616 100644
--- a/plugins/applet/seahorse-applet.c
+++ b/plugins/applet/seahorse-applet.c
@@ -24,6 +24,7 @@
#include <string.h>
#include <stdlib.h>
+#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <panel-applet.h>
@@ -674,7 +675,7 @@ properties_cb (BonoboUIComponent *uic, SeahorseApplet *sapplet, const char *verb
swidget = seahorse_widget_new ("applet-preferences", NULL);
- widget = glade_xml_get_widget (swidget->xml, swidget->name);
+ widget = GTK_WIDGET (seahorse_widget_get_widget (swidget, swidget->name));
pixbuf = gtk_widget_render_icon (widget,
ICON_CLIPBOARD_DEFAULT,
@@ -689,19 +690,19 @@ properties_cb (BonoboUIComponent *uic, SeahorseApplet *sapplet, const char *verb
if (!swidget)
return;
- widget = glade_xml_get_widget (swidget->xml, "show-clipboard-state");
+ widget = GTK_WIDGET (seahorse_widget_get_widget (swidget, "show-clipboard-state"));
if (widget && GTK_IS_CHECK_BUTTON (widget))
seahorse_check_button_gconf_attach (GTK_CHECK_BUTTON (widget), SHOW_CLIPBOARD_STATE_KEY);
- widget = glade_xml_get_widget (swidget->xml, "display-encrypted-clipboard");
+ widget = GTK_WIDGET (seahorse_widget_get_widget (swidget, "display-encrypted-clipboard"));
if (widget && GTK_IS_CHECK_BUTTON (widget))
seahorse_check_button_gconf_attach (GTK_CHECK_BUTTON (widget), DISPLAY_CLIPBOARD_ENC_KEY);
- widget = glade_xml_get_widget (swidget->xml, "display-decrypted-clipboard");
+ widget = GTK_WIDGET (seahorse_widget_get_widget (swidget, "display-decrypted-clipboard"));
if (widget && GTK_IS_CHECK_BUTTON (widget))
seahorse_check_button_gconf_attach (GTK_CHECK_BUTTON (widget), DISPLAY_CLIPBOARD_DEC_KEY);
- widget = glade_xml_get_widget (swidget->xml, "display-verified-clipboard");
+ widget = GTK_WIDGET (seahorse_widget_get_widget (swidget, "display-verified-clipboard"));
if (widget && GTK_IS_CHECK_BUTTON (widget))
seahorse_check_button_gconf_attach (GTK_CHECK_BUTTON (widget), DISPLAY_CLIPBOARD_VER_KEY);
diff --git a/plugins/nautilus/seahorse-pgp-preferences.c b/plugins/nautilus/seahorse-pgp-preferences.c
index fa3bc5b..9b9b076 100644
--- a/plugins/nautilus/seahorse-pgp-preferences.c
+++ b/plugins/nautilus/seahorse-pgp-preferences.c
@@ -41,12 +41,18 @@ static const GOptionEntry options[] = {
{ NULL }
};
-static void
+G_MODULE_EXPORT static void
destroyed (GtkObject *object, gpointer data)
{
exit (0);
}
+G_MODULE_EXPORT static void
+help_clicked (GtkObject *object, SeahorseWidget *swidget)
+{
+ seahorse_widget_show_help (swidget);
+}
+
int
main (int argc, char **argv)
{
@@ -71,12 +77,15 @@ main (int argc, char **argv)
seahorse_gtkstock_init();
swidget = seahorse_prefs_new (NULL);
- g_signal_connect (seahorse_widget_get_top (swidget), "destroy",
+ g_signal_connect (seahorse_widget_get_toplevel (swidget), "destroy",
+ G_CALLBACK (destroyed), NULL);
+ g_signal_connect (seahorse_widget_get_widget (swidget, "closebutton1"), "clicked",
G_CALLBACK (destroyed), NULL);
+ g_signal_connect (seahorse_widget_get_widget (swidget, "helpbutton1"), "clicked", G_CALLBACK (help_clicked), swidget);
#ifdef WITH_AGENT
if (show_cache) {
- GtkWidget *tab = glade_xml_get_widget (swidget->xml, "cache-tab");
+ GtkWidget *tab = GTK_WIDGET (seahorse_widget_get_widget (swidget, "cache-tab"));
seahorse_prefs_select_tab (swidget, tab);
}
#endif
diff --git a/plugins/nautilus/seahorse-tool-files.c b/plugins/nautilus/seahorse-tool-files.c
index 7fee662..b0f6045 100644
--- a/plugins/nautilus/seahorse-tool-files.c
+++ b/plugins/nautilus/seahorse-tool-files.c
@@ -387,16 +387,16 @@ prepare_dialog (FilesCtx *ctx, guint nfolders, guint nfiles, GFileInfo *info, gc
/* The main 'selected' message */
msg = make_message (nfolders, nfiles);
- w = glade_xml_get_widget (swidget->xml, "message");
+ w = GTK_WIDGET (seahorse_widget_get_widget (swidget, "message"));
gtk_label_set_markup (GTK_LABEL(w), msg);
g_free (msg);
/* Setup the remote or local messages */
- w = glade_xml_get_widget (swidget->xml,
- ctx->remote ? "remote-options" : "local-options");
+ w = GTK_WIDGET (seahorse_widget_get_widget (swidget,
+ ctx->remote ? "remote-options" : "local-options"));
gtk_widget_show (w);
- tog = glade_xml_get_widget (swidget->xml, "do-separate");
+ tog = GTK_WIDGET (seahorse_widget_get_widget (swidget, "do-separate"));
if (ctx->remote) {
/* Always use the seperate option */
@@ -408,14 +408,14 @@ prepare_dialog (FilesCtx *ctx, guint nfolders, guint nfiles, GFileInfo *info, gc
sep = seahorse_gconf_get_boolean (MULTI_SEPERATE_KEY);
/* Setup the package */
- w = glade_xml_get_widget (swidget->xml, "package-name");
+ w = GTK_WIDGET (seahorse_widget_get_widget (swidget, "package-name"));
display = g_strdup (g_file_info_get_display_name (info));
pkg = seahorse_util_uri_split_last (display);
gtk_entry_set_text (GTK_ENTRY (w), pkg);
g_free (display);
/* Setup the URI combo box */
- combo = glade_xml_get_widget (swidget->xml, "package-extension");
+ combo = GTK_WIDGET (seahorse_widget_get_widget (swidget, "package-extension"));
store = GTK_TREE_MODEL (gtk_list_store_new (1, G_TYPE_STRING));
gtk_combo_box_set_model (GTK_COMBO_BOX (combo), store);
g_object_unref (store);
@@ -462,17 +462,17 @@ get_results (SeahorseWidget *swidget)
GtkWidget *w;
gboolean sep;
- w = glade_xml_get_widget (swidget->xml, "do-separate");
+ w = GTK_WIDGET (seahorse_widget_get_widget (swidget, "do-separate"));
sep = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w));
seahorse_gconf_set_boolean (MULTI_SEPERATE_KEY, sep);
/* no packaging */
if(!sep) {
- w = glade_xml_get_widget (swidget->xml, "package-name");
+ w = GTK_WIDGET (seahorse_widget_get_widget (swidget, "package-name"));
name = gtk_entry_get_text (GTK_ENTRY (w));
- w = glade_xml_get_widget (swidget->xml, "package-extension");
+ w = GTK_WIDGET (seahorse_widget_get_widget (swidget, "package-extension"));
ext = gtk_combo_box_get_active_text (GTK_COMBO_BOX (w));
@@ -543,7 +543,7 @@ step_process_multiple (FilesCtx *ctx, const gchar **orig_uris, GError **err)
g_free (ext);
- dlg = seahorse_widget_get_top (swidget);
+ dlg = seahorse_widget_get_toplevel (swidget);
/* Inhibit popping up of progress dialog */
seahorse_tool_progress_block (TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]