[seahorse] common: Migrate seahorse_icons_xxx to vala



commit 3811d500b651be923f5310caf02291f1e7ac4e60
Author: Stef Walter <stefw gnome org>
Date:   Wed Jun 19 14:47:32 2013 +0200

    common: Migrate seahorse_icons_xxx to vala
    
    Also start a simple config.vapi for declarations that come from
    config.h or compiler defines

 common/Makefile.am                    |    5 +++
 common/config.vapi                    |    5 +++
 common/icons.vala                     |   46 +++++++++++++++++++++++++++++++
 gkr/seahorse-gkr-item-properties.c    |    2 +-
 gkr/seahorse-gkr-item.c               |    1 -
 gkr/seahorse-gkr-keyring-properties.c |    2 +-
 libseahorse/Makefile.am               |    1 -
 libseahorse/seahorse-application.c    |    2 +-
 libseahorse/seahorse-icons.c          |   48 ---------------------------------
 libseahorse/seahorse-icons.h          |   47 --------------------------------
 libseahorse/seahorse-prefs.c          |    1 -
 libseahorse/seahorse-widget.c         |    2 +-
 pgp/seahorse-gpgme-generate.c         |    1 -
 pgp/seahorse-gpgme-key.c              |    1 -
 pgp/seahorse-gpgme-sign.c             |    2 +-
 pgp/seahorse-pgp-key-properties.c     |    1 -
 pgp/seahorse-pgp-key.c                |    1 -
 ssh/seahorse-ssh-generate.c           |    1 -
 ssh/seahorse-ssh-key-properties.c     |    2 +-
 ssh/seahorse-ssh-key.c                |    1 -
 ssh/seahorse-ssh-upload.c             |    2 +-
 21 files changed, 63 insertions(+), 111 deletions(-)
---
diff --git a/common/Makefile.am b/common/Makefile.am
index 576bbed..5beeb17 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -2,6 +2,7 @@ NULL =
 
 INCLUDES = -I$(top_builddir) \
        -I$(top_srcdir) \
+       -DPKGDATADIR=\""$(pkgdatadir)/"\" \
        $(SEAHORSE_CFLAGS)
 
 noinst_LTLIBRARIES = libcommon.la
@@ -13,6 +14,7 @@ libcommon_la_SOURCES = \
        deleter.vala \
        exportable.vala \
        exporter.vala \
+       icons.vala \
        place.vala \
        registry.vala \
        viewable.vala \
@@ -24,6 +26,8 @@ AM_VALAFLAGS = \
        --header=seahorse-internal.h \
        --pkg gtk+-3.0 \
        --pkg gcr-3 \
+       --pkg config \
+       --vapidir=$(srcdir) \
        --vapi=common.vapi \
        $(NULL)
 
@@ -45,6 +49,7 @@ EXTRA_DIST = \
        seahorse-common.h \
        seahorse-internal.h \
        common.vapi \
+       config.vapi \
        $(NULL)
 
 DISTCLEANFILES = \
diff --git a/common/config.vapi b/common/config.vapi
new file mode 100644
index 0000000..1e2ed4c
--- /dev/null
+++ b/common/config.vapi
@@ -0,0 +1,5 @@
+[CCode (prefix = "", lower_case_cprefix = "", cheader_filename = "config.h")]
+namespace Config
+{
+       public const string PKGDATADIR;
+}
diff --git a/common/icons.vala b/common/icons.vala
new file mode 100644
index 0000000..d4d3284
--- /dev/null
+++ b/common/icons.vala
@@ -0,0 +1,46 @@
+/*
+ * Seahorse
+ *
+ * Copyright (C) 2011 Collabora Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Author: Stef Walter <stefw collabora co uk>
+ */
+
+namespace Seahorse {
+       public const string ICON_KEY = "seahorse-key";
+       public const string ICON_SECRET = "seahorse-key-personal";
+       public const string ICON_KEY_SSH = "seahorse-key-ssh";
+       public const string ICON_PERSON = "seahorse-person";
+       public const string ICON_SIGN = "seahorse-sign";
+       public const string ICON_SIGN_OK = "seahorse-sign-ok";
+       public const string ICON_SIGN_BAD = "seahorse-sign-bad";
+       public const string ICON_SIGN_UNKNOWN = "seahorse-sign-unknown";
+       public const string ICON_WEBBROWSER = "web-browser";
+       public const string ICON_FOLDER = "folder";
+       public bool _icons_inited = false;
+
+       public static void icons_init() {
+               if (_icons_inited)
+                       return;
+               _icons_inited = true;
+
+               var path = GLib.Path.build_filename(Config.PKGDATADIR, "icons");
+               Gtk.IconTheme.get_default().append_search_path (path);
+               Gtk.Window.set_default_icon_name ("seahorse");
+       }
+}
diff --git a/gkr/seahorse-gkr-item-properties.c b/gkr/seahorse-gkr-item-properties.c
index 8adfee2..9ee8f95 100644
--- a/gkr/seahorse-gkr-item-properties.c
+++ b/gkr/seahorse-gkr-item-properties.c
@@ -29,7 +29,7 @@
 #include "seahorse-gkr-item.h"
 
 #include "seahorse-bind.h"
-#include "seahorse-icons.h"
+#include "seahorse-common.h"
 #include "seahorse-object.h"
 #include "seahorse-object-widget.h"
 #include "seahorse-progress.h"
diff --git a/gkr/seahorse-gkr-item.c b/gkr/seahorse-gkr-item.c
index 0230b64..3c6d798 100644
--- a/gkr/seahorse-gkr-item.c
+++ b/gkr/seahorse-gkr-item.c
@@ -35,7 +35,6 @@
 #include "seahorse-gkr-keyring.h"
 
 #include "seahorse-common.h"
-#include "seahorse-icons.h"
 #include "seahorse-util.h"
 
 #define GENERIC_SECRET "org.freedesktop.Secret.Generic"
diff --git a/gkr/seahorse-gkr-keyring-properties.c b/gkr/seahorse-gkr-keyring-properties.c
index 1ff79dd..d290e51 100644
--- a/gkr/seahorse-gkr-keyring-properties.c
+++ b/gkr/seahorse-gkr-keyring-properties.c
@@ -26,7 +26,7 @@
 #include <glib/gi18n.h>
 
 #include "seahorse-bind.h"
-#include "seahorse-icons.h"
+#include "seahorse-common.h"
 #include "seahorse-object.h"
 #include "seahorse-object-widget.h"
 #include "seahorse-util.h"
diff --git a/libseahorse/Makefile.am b/libseahorse/Makefile.am
index 5edabf3..0b943bf 100644
--- a/libseahorse/Makefile.am
+++ b/libseahorse/Makefile.am
@@ -50,7 +50,6 @@ libseahorse_la_SOURCES = \
        seahorse-catalog.c seahorse-catalog.h \
        seahorse-collection.c seahorse-collection.h \
        seahorse-debug.c seahorse-debug.h \
-       seahorse-icons.c seahorse-icons.h \
        seahorse-interaction.c seahorse-interaction.h \
        seahorse-key-manager-store.c seahorse-key-manager-store.h \
        seahorse-lockable.c seahorse-lockable.h \
diff --git a/libseahorse/seahorse-application.c b/libseahorse/seahorse-application.c
index a36a81e..6100f11 100644
--- a/libseahorse/seahorse-application.c
+++ b/libseahorse/seahorse-application.c
@@ -25,7 +25,7 @@
 #include "config.h"
 
 #include "seahorse-application.h"
-#include "seahorse-icons.h"
+#include "seahorse-common.h"
 
 #include "pgp/seahorse-pgp.h"
 #include "ssh/seahorse-ssh.h"
diff --git a/libseahorse/seahorse-prefs.c b/libseahorse/seahorse-prefs.c
index d98dc61..587819f 100644
--- a/libseahorse/seahorse-prefs.c
+++ b/libseahorse/seahorse-prefs.c
@@ -24,7 +24,6 @@
 
 #include "seahorse-application.h"
 #include "seahorse-common.h"
-#include "seahorse-icons.h"
 #include "seahorse-keyserver-control.h"
 #include "seahorse-prefs.h"
 #include "seahorse-servers.h"
diff --git a/libseahorse/seahorse-widget.c b/libseahorse/seahorse-widget.c
index c887004..1fbaa12 100644
--- a/libseahorse/seahorse-widget.c
+++ b/libseahorse/seahorse-widget.c
@@ -26,7 +26,7 @@
 
 #include <glib/gi18n.h>
 
-#include "seahorse-icons.h"
+#include "seahorse-common.h"
 #include "seahorse-widget.h"
 
 /**
diff --git a/pgp/seahorse-gpgme-generate.c b/pgp/seahorse-gpgme-generate.c
index f7cb203..ab65c96 100644
--- a/pgp/seahorse-gpgme-generate.c
+++ b/pgp/seahorse-gpgme-generate.c
@@ -31,7 +31,6 @@
 
 #include "seahorse-action.h"
 #include "seahorse-common.h"
-#include "seahorse-icons.h"
 #include "seahorse-passphrase.h"
 #include "seahorse-progress.h"
 #include "seahorse-util.h"
diff --git a/pgp/seahorse-gpgme-key.c b/pgp/seahorse-gpgme-key.c
index 67d1902..4764162 100644
--- a/pgp/seahorse-gpgme-key.c
+++ b/pgp/seahorse-gpgme-key.c
@@ -34,7 +34,6 @@
 #include "seahorse-pgp-key.h"
 
 #include "seahorse-common.h"
-#include "seahorse-icons.h"
 #include "seahorse-predicate.h"
 #include "seahorse-object-list.h"
 #include "seahorse-util.h"
diff --git a/pgp/seahorse-gpgme-sign.c b/pgp/seahorse-gpgme-sign.c
index e54ac03..83ad3fd 100644
--- a/pgp/seahorse-gpgme-sign.c
+++ b/pgp/seahorse-gpgme-sign.c
@@ -23,7 +23,7 @@
 #include "config.h"
 
 #include "seahorse-combo-keys.h"
-#include "seahorse-icons.h"
+#include "seahorse-common.h"
 #include "seahorse-object-widget.h"
 #include "seahorse-util.h"
 
diff --git a/pgp/seahorse-pgp-key-properties.c b/pgp/seahorse-pgp-key-properties.c
index d5a301f..8c28486 100644
--- a/pgp/seahorse-pgp-key-properties.c
+++ b/pgp/seahorse-pgp-key-properties.c
@@ -32,7 +32,6 @@
 
 #include "seahorse-bind.h"
 #include "seahorse-common.h"
-#include "seahorse-icons.h"
 #include "seahorse-object.h"
 #include "seahorse-object-model.h"
 #include "seahorse-object-widget.h"
diff --git a/pgp/seahorse-pgp-key.c b/pgp/seahorse-pgp-key.c
index 550f0bf..0f3478e 100644
--- a/pgp/seahorse-pgp-key.c
+++ b/pgp/seahorse-pgp-key.c
@@ -27,7 +27,6 @@
 #include "seahorse-pgp-subkey.h"
 
 #include "seahorse-common.h"
-#include "seahorse-icons.h"
 #include "seahorse-object-list.h"
 #include "seahorse-util.h"
 
diff --git a/ssh/seahorse-ssh-generate.c b/ssh/seahorse-ssh-generate.c
index 6f9cb38..a3c4840 100644
--- a/ssh/seahorse-ssh-generate.c
+++ b/ssh/seahorse-ssh-generate.c
@@ -34,7 +34,6 @@
 
 #include "seahorse-action.h"
 #include "seahorse-common.h"
-#include "seahorse-icons.h"
 #include "seahorse-progress.h"
 #include "seahorse-util.h"
 #include "seahorse-widget.h"
diff --git a/ssh/seahorse-ssh-key-properties.c b/ssh/seahorse-ssh-key-properties.c
index 08cf3e8..2dfecc5 100644
--- a/ssh/seahorse-ssh-key-properties.c
+++ b/ssh/seahorse-ssh-key-properties.c
@@ -27,7 +27,7 @@
 #include "seahorse-ssh-operation.h"
 
 #include "seahorse-bind.h"
-#include "seahorse-icons.h"
+#include "seahorse-common.h"
 #include "seahorse-object.h"
 #include "seahorse-object-widget.h"
 #include "seahorse-util.h"
diff --git a/ssh/seahorse-ssh-key.c b/ssh/seahorse-ssh-key.c
index a353013..e32c2e3 100644
--- a/ssh/seahorse-ssh-key.c
+++ b/ssh/seahorse-ssh-key.c
@@ -31,7 +31,6 @@
 #include "seahorse-ssh-source.h"
 
 #include "seahorse-common.h"
-#include "seahorse-icons.h"
 #include "seahorse-validity.h"
 
 #include <gcr/gcr.h>
diff --git a/ssh/seahorse-ssh-upload.c b/ssh/seahorse-ssh-upload.c
index 53b0aa1..d6fd41d 100644
--- a/ssh/seahorse-ssh-upload.c
+++ b/ssh/seahorse-ssh-upload.c
@@ -26,7 +26,7 @@
 
 #include <glib/gi18n.h>
 
-#include "seahorse-icons.h"
+#include "seahorse-common.h"
 #include "seahorse-widget.h"
 #include "seahorse-util.h"
 #include "seahorse-progress.h"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]