[seahorse] prefs: Don't show preferences when no preferences are available
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seahorse] prefs: Don't show preferences when no preferences are available
- Date: Mon, 4 Mar 2013 19:55:23 +0000 (UTC)
commit 8ca95133cfe701a74227f7487a5c6052beb7a608
Author: Stef Walter <stefw gnome org>
Date: Tue Feb 26 10:14:27 2013 +0100
prefs: Don't show preferences when no preferences are available
If seahorse is built without GnuPG support (not recommended, but
possible) then there are currently no preferences available.
Hide the Preferences menu item in these cases, so it doesn't show
a confusing empty window.
In addition fix some assertions and cleanup some unused code
related to this.
https://bugzilla.gnome.org/show_bug.cgi?id=694678
libseahorse/Makefile.am | 1 -
libseahorse/seahorse-catalog.c | 7 +++-
libseahorse/seahorse-key-manager-store.c | 2 +-
libseahorse/seahorse-preferences.c | 44 ----------------------
libseahorse/seahorse-preferences.h | 36 ------------------
libseahorse/seahorse-prefs.c | 58 ++++++++++++++++++++++++++++--
libseahorse/seahorse-prefs.h | 5 +++
src/seahorse-key-manager.c | 1 -
8 files changed, 66 insertions(+), 88 deletions(-)
---
diff --git a/libseahorse/Makefile.am b/libseahorse/Makefile.am
index 06e8629..a90e81b 100644
--- a/libseahorse/Makefile.am
+++ b/libseahorse/Makefile.am
@@ -54,7 +54,6 @@ libseahorse_la_SOURCES = \
seahorse-place.c seahorse-place.h \
seahorse-predicate.c seahorse-predicate.h \
seahorse-prefs.c seahorse-prefs.h \
- seahorse-preferences.c seahorse-preferences.h \
seahorse-progress.c seahorse-progress.h \
seahorse-registry.c seahorse-registry.h \
seahorse-servers.c seahorse-servers.h \
diff --git a/libseahorse/seahorse-catalog.c b/libseahorse/seahorse-catalog.c
index 38fcfaf..df00dc3 100644
--- a/libseahorse/seahorse-catalog.c
+++ b/libseahorse/seahorse-catalog.c
@@ -29,7 +29,7 @@
#include "seahorse-deletable.h"
#include "seahorse-exportable.h"
#include "seahorse-object.h"
-#include "seahorse-preferences.h"
+#include "seahorse-prefs.h"
#include "seahorse-progress.h"
#include "seahorse-registry.h"
#include "seahorse-util.h"
@@ -70,7 +70,7 @@ on_app_preferences (GtkAction* action,
gpointer user_data)
{
SeahorseCatalog *self = SEAHORSE_CATALOG (user_data);
- seahorse_preferences_show (seahorse_catalog_get_window (self), NULL);
+ seahorse_prefs_show (seahorse_catalog_get_window (self), NULL);
}
static void
@@ -393,6 +393,7 @@ seahorse_catalog_constructed (GObject *obj)
const gchar *name;
gchar *path;
GtkActionGroup *actions;
+ GtkAction *action;
G_OBJECT_CLASS (seahorse_catalog_parent_class)->constructed (obj);
@@ -414,6 +415,8 @@ seahorse_catalog_constructed (GObject *obj)
actions = gtk_action_group_new ("main");
gtk_action_group_set_translation_domain (actions, GETTEXT_PACKAGE);
gtk_action_group_add_actions (actions, UI_ENTRIES, G_N_ELEMENTS (UI_ENTRIES), self);
+ action = gtk_action_group_get_action (actions, "app-preferences");
+ gtk_action_set_visible (action, seahorse_prefs_available ());
self->pv->edit_delete = gtk_action_group_get_action (actions, "edit-delete");
g_object_ref (self->pv->edit_delete);
self->pv->properties_object = gtk_action_group_get_action (actions, "properties-object");
diff --git a/libseahorse/seahorse-key-manager-store.c b/libseahorse/seahorse-key-manager-store.c
index 0781768..b6fdcd5 100644
--- a/libseahorse/seahorse-key-manager-store.c
+++ b/libseahorse/seahorse-key-manager-store.c
@@ -28,7 +28,7 @@
#include "seahorse-util.h"
#include "seahorse-key-manager-store.h"
-#include "seahorse-preferences.h"
+#include "seahorse-prefs.h"
#include "seahorse-validity.h"
#include <string.h>
diff --git a/libseahorse/seahorse-prefs.c b/libseahorse/seahorse-prefs.c
index 14a5a57..2b8daa2 100644
--- a/libseahorse/seahorse-prefs.c
+++ b/libseahorse/seahorse-prefs.c
@@ -31,15 +31,15 @@
#include "seahorse-util.h"
#include "seahorse-widget.h"
-/* From seahorse-prefs-cache.c */
-void seahorse_prefs_cache (SeahorseWidget *widget);
-
+G_MODULE_EXPORT
void on_prefs_keyserver_add_clicked (GtkButton *button,
gpointer user_data);
+G_MODULE_EXPORT
void on_prefs_keyserver_remove_clicked (GtkWidget *button,
gpointer user_data);
+G_MODULE_EXPORT
void on_prefs_add_keyserver_uri_changed (GtkWidget *button,
gpointer user_data);
@@ -419,10 +419,62 @@ setup_keyservers (SeahorseWidget *swidget)
widget, "active", G_SETTINGS_BIND_DEFAULT);
}
+#else
+
+void
+on_prefs_keyserver_add_clicked (GtkButton *button,
+ gpointer user_data)
+{
+
+}
+
+void
+on_prefs_keyserver_remove_clicked (GtkWidget *button,
+ gpointer user_data)
+{
+
+}
+
+void
+on_prefs_add_keyserver_uri_changed (GtkWidget *button,
+ gpointer user_data)
+{
+
+}
+
#endif /* WITH_KEYSERVER */
/* -------------------------------------------------------------------------- */
+gboolean
+seahorse_prefs_available (void)
+{
+#ifdef WITH_KEYSERVER
+ return TRUE;
+#else
+ return FALSE;
+#endif
+}
+
+/**
+ * seahorse_preferences_show:
+ * @tabid: The id of the tab to show
+ *
+ * Creates a new or shows the current preferences dialog.
+ **/
+void
+seahorse_prefs_show (GtkWindow *parent, const gchar *tabid)
+{
+ SeahorseWidget *swidget = seahorse_prefs_new (parent);
+ GtkWidget *tab;
+
+ if (tabid) {
+ tab = seahorse_widget_get_widget (swidget, tabid);
+ g_return_if_fail (tab);
+ seahorse_prefs_select_tab (swidget, tab);
+ }
+}
+
/**
* seahorse_prefs_new:
* @parent: The #GtkWindow to set as the preferences dialog's parent
diff --git a/libseahorse/seahorse-prefs.h b/libseahorse/seahorse-prefs.h
index 5d7b785..62f4911 100644
--- a/libseahorse/seahorse-prefs.h
+++ b/libseahorse/seahorse-prefs.h
@@ -28,6 +28,11 @@
#include "seahorse-widget.h"
+gboolean seahorse_prefs_available (void);
+
+void seahorse_prefs_show (GtkWindow *parent,
+ const gchar *tabid);
+
SeahorseWidget * seahorse_prefs_new (GtkWindow *parent);
void seahorse_prefs_add_tab (SeahorseWidget *swidget,
diff --git a/src/seahorse-key-manager.c b/src/seahorse-key-manager.c
index 7495109..5641851 100644
--- a/src/seahorse-key-manager.c
+++ b/src/seahorse-key-manager.c
@@ -26,7 +26,6 @@
#include "seahorse-import-dialog.h"
#include "seahorse-key-manager.h"
#include "seahorse-key-manager-store.h"
-#include "seahorse-preferences.h"
#include "seahorse-sidebar.h"
#include "seahorse-collection.h"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]