Commit 446ddc17 authored by Adam Schreiber's avatar Adam Schreiber

libseahorse/seahorse-key-store.h

* daemon/seahorse-daemon.c:
* daemon/seahorse-sharing.c:
* libseahorse/Makefile.am:
* libseahorse/seahorse-gtkstock.c:
* libseahorse/seahorse-gtkstock.h:
* libseahorse/seahorse-key-store.c:
* libseahorse/seahorse-key-store.h
* libseahorse/seahorse-widget.c:
* pixmaps/Makefile.am:
* src/main.c:
* src/seahorse-key-manager.c: Made our icons themeable
parent 484d886d
2005-08-13 Adam Schreiber <sadam@clemson.edu>
* daemon/seahorse-daemon.c:
* daemon/seahorse-sharing.c:
* libseahorse/Makefile.am:
* libseahorse/seahorse-gtkstock.c:
* libseahorse/seahorse-gtkstock.h:
* libseahorse/seahorse-key-store.c:
* libseahorse/seahorse-key-store.h
* libseahorse/seahorse-widget.c:
* pixmaps/Makefile.am:
* src/main.c:
* src/seahorse-key-manager.c: Made our icons themeable
2005-08-13 Nate Nielsen <nielsen@memberwebs.com>
* libseahorse/seahorse-pgp-source.c: Fix some gpgme_ctx_t leakage.
......
......@@ -34,6 +34,7 @@
#include "config.h"
#include "seahorse-daemon.h"
#include "seahorse-gtkstock.h"
#ifdef WITH_AGENT
#include "seahorse-agent.h"
......@@ -230,6 +231,9 @@ int main(int argc, char* argv[])
/* We log to the syslog */
prepare_logging ();
/* Insert Icons into Stock */
seahorse_gtk_stock_init();
/* Initialize the various daemon components */
#ifdef WITH_DBUS
seahorse_dbus_server_init ();
......
......@@ -21,6 +21,7 @@
#include <gnome.h>
#include <howl.h>
#include "seahorse-gtkstock.h"
/* Workaround broken howl installing config.h */
#undef PACKAGE
......@@ -219,7 +220,8 @@ show_tray ()
tray_icon = egg_tray_icon_new ("seahorse-daemon-sharing");
box = gtk_event_box_new ();
image = gtk_image_new_from_file (PIXMAPSDIR "seahorse-share-keys.png");
image = gtk_image_new_from_stock (SEAHORSE_STOCK_SHARE_KEYS, (GtkIconSize)-1);
//image = gtk_image_new_from_file (PIXMAPSDIR "seahorse-share-keys.png");
gtk_container_add (GTK_CONTAINER (box), image);
gtk_container_add (GTK_CONTAINER (tray_icon), box);
......
......@@ -70,6 +70,7 @@ libseahorse_internal_la_SOURCES = \
seahorse-gconf.c seahorse-gconf.h \
seahorse-dns-sd.c seahorse-dns-sd.h \
eggtrayicon.c eggtrayicon.h \
seahorse-gtkstock.c seahorse-gtkstock.h \
$(BUILT_SOURCES) \
$(AGENT_SRCS) \
$(KEYSERVER_SRCS) \
......
/**
* @file seahorse-gtkstock.c GTK+ Stock resources
*
* Seahorse
*
* Gaim is the legal property of its developers, whose names are too numerous
* to list here. Please refer to the COPYRIGHT file distributed with the gaim
* source distribution.
*
* Also (c) 2005 Adam Schreiber <sadam@clemson.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 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 General Public License for more details.
*
* You should have received a copy of the GNU 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
*
*/
#include <gtk/gtk.h>
#include "seahorse-gtkstock.h"
static struct StockIcon
{
const char *name;
const char *dir;
const char *filename;
} const stock_icons[] =
{
{ SEAHORSE_STOCK_KEY, "seahorse", "seahorse-key.png" },
{ SEAHORSE_STOCK_PERSON, "seahorse", "seahorse-person.png" },
{ SEAHORSE_STOCK_SEAHORSE, NULL, "seahorse.png" },
{ SEAHORSE_STOCK_SECRET, "seahorse", "seahorse-secret.png" },
{ SEAHORSE_STOCK_SHARE_KEYS, "seahorse", "seahorse-share-keys.png" }
};
static gchar *
find_file(const char *dir, const char *base)
{
char *filename;
if (base == NULL)
return NULL;
if (dir == NULL)
filename = g_build_filename(DATA_DIR, "pixmaps", base, NULL);
else
{
filename = g_build_filename(DATA_DIR, "pixmaps", dir,
base, NULL);
}
if (!g_file_test(filename, G_FILE_TEST_EXISTS))
{
g_critical("Unable to load stock pixmap %s\n", base);
g_free(filename);
return NULL;
}
return filename;
}
void
seahorse_gtk_stock_init(void)
{
static gboolean stock_initted = FALSE;
GtkIconFactory *icon_factory;
int i;
GtkWidget *win;
if (stock_initted)
return;
stock_initted = TRUE;
/* Setup the icon factory. */
icon_factory = gtk_icon_factory_new();
gtk_icon_factory_add_default(icon_factory);
/* Er, yeah, a hack, but it works. :) */
win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_realize(win);
for (i = 0; i < G_N_ELEMENTS(stock_icons); i++)
{
GdkPixbuf *pixbuf;
GtkIconSet *iconset;
gchar *filename;
filename = find_file(stock_icons[i].dir, stock_icons[i].filename);
if (filename == NULL)
continue;
pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
g_free(filename);
iconset = gtk_icon_set_new_from_pixbuf(pixbuf);
g_object_unref(G_OBJECT(pixbuf));
gtk_icon_factory_add(icon_factory, stock_icons[i].name, iconset);
gtk_icon_set_unref(iconset);
}
gtk_widget_destroy(win);
g_object_unref(G_OBJECT(icon_factory));
}
/**
* @file gtkstock.h GTK+ Stock resources
*
* seahorse
*
* Gaim is the legal property of its developers, whose names are too numerous
* to list here. Please refer to the COPYRIGHT file distributed with the gaim
* source distribution.
*
* Also (c) 2005 Adam Schreiber <sadam@clemson.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 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 General Public License for more details.
*
* You should have received a copy of the GNU 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
*/
#ifndef _SEAHORSE_STOCK_H_
#define _SEAHORSE_STOCK_H_
/**************************************************************************/
/** @name Stock images */
/**************************************************************************/
/*@{*/
#define SEAHORSE_STOCK_KEY "seahorse-key"
#define SEAHORSE_STOCK_PERSON "seahorse-person"
#define SEAHORSE_STOCK_SEAHORSE "seahorse"
#define SEAHORSE_STOCK_SECRET "seahorse-secret"
#define SEAHORSE_STOCK_SHARE_KEYS "seahorse-share-keys"
/*@}*/
/**
* Sets up the gaim stock repository.
*/
void seahorse_gtk_stock_init(void);
#endif /* _SEAHORSE_STOCK_H_ */
......@@ -23,6 +23,7 @@
#include "seahorse-key-store.h"
#include "seahorse-gconf.h"
#include "seahorse-gtkstock.h"
enum {
PROP_0,
......@@ -386,7 +387,7 @@ seahorse_key_store_set (SeahorseKeyStore *skstore, SeahorseKey *skey,
gtk_tree_store_set (GTK_TREE_STORE (skstore), iter,
KEY_STORE_CHECK, FALSE,
KEY_STORE_PAIR, uid == 0 ? sec : FALSE,
KEY_STORE_NOTPAIR, uid == 0 ? !sec : FALSE,
KEY_STORE_STOCK_ID, (uid == 0 && sec) ? SEAHORSE_STOCK_SECRET : SEAHORSE_STOCK_KEY,
KEY_STORE_NAME, userid,
KEY_STORE_KEYID, seahorse_key_get_keyid (skey),
KEY_STORE_UID, uid, -1);
......@@ -755,32 +756,12 @@ seahorse_key_store_init (SeahorseKeyStore *skstore, GtkTreeView *view)
/* When using key pair icons, we add an icon column */
if (SEAHORSE_KEY_STORE_GET_CLASS (skstore)->use_icon) {
GtkCellRenderer *secretPixbufRenderer = NULL, *keyPixbufRenderer = NULL;
GdkPixbuf *secret_pixbuf = NULL, *key_pixbuf;
secret_pixbuf = gdk_pixbuf_new_from_file(PIXMAPSDIR "seahorse-secret.png", NULL);
secretPixbufRenderer = gtk_cell_renderer_pixbuf_new();
g_object_set(secretPixbufRenderer,
"pixbuf", GDK_PIXBUF(secret_pixbuf),
NULL);
key_pixbuf = gdk_pixbuf_new_from_file(PIXMAPSDIR "seahorse-key.png", NULL);
keyPixbufRenderer = gtk_cell_renderer_pixbuf_new();
g_object_set(keyPixbufRenderer,
"pixbuf", GDK_PIXBUF(key_pixbuf),
NULL);
GtkCellRenderer *keyPixbufRenderer = NULL;
col = gtk_tree_view_column_new_with_attributes ("", secretPixbufRenderer,
"visible", KEY_STORE_PAIR,
col = gtk_tree_view_column_new_with_attributes ("", keyPixbufRenderer,
"stock-id", KEY_STORE_STOCK_ID,
NULL);
gtk_tree_view_column_pack_end(col,
keyPixbufRenderer,
FALSE);
gtk_tree_view_column_add_attribute(col, keyPixbufRenderer,
"visible",
KEY_STORE_NOTPAIR);
gtk_tree_view_column_set_resizable (col, FALSE);
gtk_tree_view_append_column (view, col);
......
......@@ -110,7 +110,7 @@ enum {
KEY_STORE_DATA,
KEY_STORE_CHECK,
KEY_STORE_PAIR,
KEY_STORE_NOTPAIR,
KEY_STORE_STOCK_ID,
KEY_STORE_NAME,
KEY_STORE_KEYID,
KEY_STORE_UID,
......@@ -136,7 +136,7 @@ enum {
G_TYPE_POINTER, \
G_TYPE_BOOLEAN, \
G_TYPE_BOOLEAN, \
G_TYPE_BOOLEAN, \
G_TYPE_STRING, \
G_TYPE_STRING, \
G_TYPE_STRING, \
G_TYPE_INT
......
......@@ -26,6 +26,7 @@
#include "seahorse-widget.h"
#include "config.h"
#include "seahorse-gtkstock.h"
#define STATUS "status"
......@@ -153,6 +154,7 @@ object_set_property (GObject *object, guint prop_id, const GValue *value, GParam
{
SeahorseWidget *swidget;
GtkWidget *w;
GdkPixbuf *pixbuf = NULL;
char *path;
swidget = SEAHORSE_WIDGET (object);
......@@ -178,8 +180,13 @@ object_set_property (GObject *object, guint prop_id, const GValue *value, GParam
w = glade_xml_get_widget (swidget->xml, swidget->name);
glade_xml_set_toplevel (swidget->xml, GTK_WINDOW (w));
glade_xml_ensure_accel (swidget->xml);
gtk_window_set_icon (GTK_WINDOW (w), gdk_pixbuf_new_from_file (PIXMAPSDIR "seahorse.png", NULL));
pixbuf = gtk_widget_render_icon (w,
SEAHORSE_STOCK_SEAHORSE,
(GtkIconSize)-1,
NULL);
gtk_window_set_icon (GTK_WINDOW (w), gdk_pixbuf_copy(pixbuf));
g_object_unref(pixbuf);
break;
default:
......
INCLUDES = -DDATA_DIR=\""$(datadir)"\"
appicon_DATA = seahorse.png \
seahorse-secret.png \
pixmap_DATA = seahorse.png
appicon_DATA = seahorse-secret.png \
seahorse-key.png \
seahorse-share-keys.png
seahorse-share-keys.png \
seahorse-person.png
appicondir = $(datadir)/pixmaps
pixmapdir = $(datadir)/pixmaps/
appicondir = $(datadir)/pixmaps/seahorse
EXTRA_DIST = $(appicon_DATA) \
EXTRA_DIST = $(pixmap_DATA) \
$(appicon_DATA) \
seahorse-shared-keys.xcf
......@@ -33,6 +33,7 @@
#include "seahorse-libdialogs.h"
#include "seahorse-pgp-source.h"
#include "seahorse-pgp-key.h"
#include "seahorse-gtkstock.h"
typedef enum _CmdLineMode {
MODE_NONE,
......@@ -436,7 +437,10 @@ main (int argc, char **argv)
g_log_set_always_fatal (G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL |
G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL);
#endif
/* Insert Icons into Stock */
seahorse_gtk_stock_init();
/* Make the default SeahorseContext */
seahorse_context_new (TRUE);
op = seahorse_context_load_local_keys (SCTX_APP());
......
......@@ -40,6 +40,7 @@
#include "seahorse-op.h"
#include "seahorse-gpg-options.h"
#include "seahorse-gconf.h"
#include "seahorse-gtkstock.h"
/* The various tabs */
enum KeyManagerTabs {
......@@ -432,6 +433,7 @@ about_activate (GtkWidget *widget, SeahorseWidget *swidget)
{
static GtkWidget *about = NULL;
GdkPixbuf *pixbuf = NULL;
GtkWidget *tempwidget = gtk_image_new();
gchar *authors[] = {
"Jacob Perkins <jap1@users.sourceforge.net>",
......@@ -458,7 +460,12 @@ about_activate (GtkWidget *widget, SeahorseWidget *swidget)
return;
}
pixbuf = gdk_pixbuf_new_from_file (PIXMAPSDIR "seahorse.png", NULL);
pixbuf = gtk_widget_render_icon (tempwidget,
SEAHORSE_STOCK_SEAHORSE,
(GtkIconSize)-1,
NULL);
gtk_widget_destroy(tempwidget);
if (pixbuf != NULL) {
GdkPixbuf *temp_pixbuf = NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment