soc.2008.themes: 6c289f85: Clean up status icon themes a bit
ffdragon at soc.pidgin.im
ffdragon at soc.pidgin.im
Fri Aug 8 16:50:44 EDT 2008
-----------------------------------------------------------------
Revision: 6c289f85149fad2d73cb2247f2bdefb761e81daf
Ancestor: d8168b447d994f505cf343765502175dccd1ffcc
Author: ffdragon at soc.pidgin.im
Date: 2008-08-08T20:47:15
Branch: im.pidgin.soc.2008.themes
URL: http://d.pidgin.im/viewmtn/revision/info/6c289f85149fad2d73cb2247f2bdefb761e81daf
Added files:
pidgin/gtkstatus-icon-theme.c pidgin/gtkstatus-icon-theme.h
Modified files:
pidgin/Makefile.am pidgin/gtkblist.c pidgin/gtkicon-loader.c
pidgin/gtkicon-theme.c pidgin/gtkprefs.c
pidgin/pidginstock.c pidgin/pidginstock.h
ChangeLog:
Clean up status icon themes a bit
-------------- next part --------------
============================================================
--- pidgin/gtkstatus-icon-theme.c a61ee9435a41ff239ef646c52d79bc6b71900032
+++ pidgin/gtkstatus-icon-theme.c a61ee9435a41ff239ef646c52d79bc6b71900032
@@ -0,0 +1,78 @@
+/*
+ * Status Icon Themes for Pidgin
+ *
+ * Pidgin is the legal property of its developers, whose names are too numerous
+ * to list here. Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
+ *
+ */
+
+#include "gtkstatus-icon-theme.h"
+
+/******************************************************************************
+ * Structs
+ *****************************************************************************/
+/******************************************************************************
+ * Globals
+ *****************************************************************************/
+static GObjectClass *parent_class = NULL;
+/******************************************************************************
+ * Enums
+ *****************************************************************************/
+/******************************************************************************
+ * GObject Stuff
+ *****************************************************************************/
+
+static void
+pidgin_status_icon_theme_finalize (GObject *obj)
+{
+ parent_class->finalize (obj);
+}
+
+static void
+pidgin_status_icon_theme_class_init (PidginStatusIconThemeClass *klass)
+{
+ GObjectClass *obj_class = G_OBJECT_CLASS(klass);
+
+ parent_class = g_type_class_peek_parent(klass);
+
+ obj_class->finalize = pidgin_status_icon_theme_finalize;
+}
+
+GType
+pidgin_status_icon_theme_get_type (void)
+{
+ static GType type = 0;
+ if (type == 0) {
+ static const GTypeInfo info = {
+ sizeof (PidginStatusIconThemeClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc)pidgin_status_icon_theme_class_init, /* class_init */
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (PidginStatusIconTheme),
+ 0, /* n_preallocs */
+ NULL,
+ NULL, /* value table */
+ };
+ type = g_type_register_static (PIDGIN_TYPE_ICON_THEME,
+ "PidginStatusIconTheme",
+ &info, 0);
+ }
+ return type;
+}
============================================================
--- pidgin/gtkstatus-icon-theme.h 2d24016fdbdef9e970cf9e015aee242e635efcd3
+++ pidgin/gtkstatus-icon-theme.h 2d24016fdbdef9e970cf9e015aee242e635efcd3
@@ -0,0 +1,71 @@
+/**
+ * @file status_icon-theme.h Pidgin Icon Theme Class API
+ */
+
+/* pidgin
+ *
+ * Pidgin is the legal property of its developers, whose names are too numerous
+ * to list here. Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
+ */
+
+#ifndef _PIDGIN_STATUS_ICON_THEME_H_
+#define _PIDGIN_STATUS_ICON_THEME_H_
+
+#include <glib-object.h>
+#include "gtkicon-theme.h"
+
+/**
+ * extends PidginIconTheme (gtkicon-theme.h)
+ * A pidgin status icon theme.
+ * This object represents a Pidgin status icon theme.
+ *
+ * PidginStatusIconTheme is a PidginIconTheme Object.
+ */
+typedef struct _PidginStatusIconTheme PidginStatusIconTheme;
+typedef struct _PidginStatusIconThemeClass PidginStatusIconThemeClass;
+
+#define PIDGIN_TYPE_STATUS_ICON_THEME (pidgin_status_icon_theme_get_type ())
+#define PIDGIN_STATUS_ICON_THEME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIDGIN_TYPE_STATUS_ICON_THEME, PidginStatusIconTheme))
+#define PIDGIN_STATUS_ICON_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PIDGIN_TYPE_STATUS_ICON_THEME, PidginStatusIconThemeClass))
+#define PIDGIN_IS_STATUS_ICON_THEME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIDGIN_TYPE_STATUS_ICON_THEME))
+#define PIDGIN_IS_STATUS_ICON_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIDGIN_TYPE_STATUS_ICON_THEME))
+#define PIDGIN_STATUS_ICON_THEME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PIDGIN_TYPE_STATUS_ICON_THEME, PidginStatusIconThemeClass))
+
+struct _PidginStatusIconTheme
+{
+ PidginIconTheme parent;
+};
+
+struct _PidginStatusIconThemeClass
+{
+ PidginIconThemeClass parent_class;
+};
+
+/**************************************************************************/
+/** @name Pidgin Status Icon Theme API */
+/**************************************************************************/
+G_BEGIN_DECLS
+
+/**
+ * GObject foo.
+ * @internal.
+ */
+GType pidgin_status_icon_theme_get_type(void);
+
+G_END_DECLS
+#endif /* _PIDGIN_STATUS_ICON_THEME_H_ */
============================================================
--- pidgin/Makefile.am ff43bc48b7ddbd4b1a55412de5770780ea31cbfa
+++ pidgin/Makefile.am 8d7e4df7a601d63a26a89f1a4d8bd5c48b7ad692
@@ -120,6 +120,7 @@ pidgin_SOURCES = \
gtksourceiter.c \
gtksourceundomanager.c \
gtksourceview-marshal.c \
+ gtkstatus-icon-theme.c \
gtkstatusbox.c \
gtkthemes.c \
gtkutils.c \
@@ -177,6 +178,7 @@ pidgin_headers = \
gtksourceiter.h \
gtksourceundomanager.h \
gtksourceview-marshal.h \
+ gtkstatus-icon-theme.h \
gtkstatusbox.h \
pidginstock.h \
gtkthemes.h \
============================================================
--- pidgin/gtkblist.c a1df26bb48d176211c4e3cf7adcf133c6983ba52
+++ pidgin/gtkblist.c c7fd5d2294dc377cfed2880dcd4c4e341f8c56cb
@@ -5386,7 +5386,7 @@ static void pidgin_blist_show(PurpleBudd
priv->current_theme = PIDGIN_BLIST_THEME(purple_theme_manager_find_theme(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/blist/theme"), "blist"));
- pidgin_stock_load_status_icon_theme(PIDGIN_ICON_THEME(purple_theme_manager_find_theme(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/icon/status/theme"), "status_icon")));
+ pidgin_stock_load_status_icon_theme(PIDGIN_STATUS_ICON_THEME(purple_theme_manager_find_theme(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/icon/status/theme"), "status-icon")));
gtkblist->empty_avatar = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 32, 32);
gdk_pixbuf_fill(gtkblist->empty_avatar, 0x00000000);
============================================================
--- pidgin/gtkicon-loader.c 54d2b08186673d5e4294e2a54e7833cfec5ec740
+++ pidgin/gtkicon-loader.c 467d4e308410152e74438f2f8e5904303f894c86
@@ -22,7 +22,7 @@
*/
#include "gtkicon-loader.h"
-#include "gtkicon-theme.h"
+#include "gtkstatus-icon-theme.h"
#include "xmlnode.h"
@@ -54,7 +54,7 @@ pidgin_icon_loader_build(const gchar *di
/* Build the xml tree */
filename_full = g_build_filename(dir, filename, NULL);
- root_node = xmlnode_from_file(dir, filename, "icon themes", "icon-loader");
+ root_node = xmlnode_from_file(dir, filename, "status icon themes", "icon-loader");
g_return_val_if_fail(root_node != NULL, NULL);
/* Parse the tree */
@@ -62,8 +62,8 @@ pidgin_icon_loader_build(const gchar *di
data = xmlnode_get_data(sub_node);
if (xmlnode_get_attrib(root_node, "name") != NULL) {
- theme = g_object_new(PIDGIN_TYPE_ICON_THEME,
- "type", "icon",
+ theme = g_object_new(PIDGIN_TYPE_STATUS_ICON_THEME,
+ "type", "status-icon",
"name", xmlnode_get_attrib(root_node, "name"),
"author", xmlnode_get_attrib(root_node, "author"),
"image", xmlnode_get_attrib(root_node, "image"),
============================================================
--- pidgin/gtkicon-theme.c 54ff9a328ef322e4012e559d6566649bca9d9e37
+++ pidgin/gtkicon-theme.c 9c720dba52aae6fa984d624671a886c519d37323
@@ -44,42 +44,9 @@ static GObjectClass *parent_class = NULL
static GObjectClass *parent_class = NULL;
-static const GtkStockItem stock_icons[] =
-{
- { PIDGIN_STOCK_TRAY_AVAILABLE, "", 0, 0, NULL },
- { PIDGIN_STOCK_TRAY_INVISIBLE, "", 0, 0, NULL },
- { PIDGIN_STOCK_TRAY_AWAY, "", 0, 0, NULL },
- { PIDGIN_STOCK_TRAY_BUSY, "", 0, 0, NULL },
- { PIDGIN_STOCK_TRAY_XA, "", 0, 0, NULL },
- { PIDGIN_STOCK_TRAY_OFFLINE, "", 0, 0, NULL },
- { PIDGIN_STOCK_TRAY_CONNECT, "", 0, 0, NULL },
- { PIDGIN_STOCK_TRAY_PENDING, "", 0, 0, NULL },
- { PIDGIN_STOCK_TRAY_EMAIL, "", 0, 0, NULL },
-
- { PIDGIN_STOCK_STATUS_AVAILABLE, "", 0, 0, NULL },
- { PIDGIN_STOCK_STATUS_AVAILABLE_I, "", 0, 0, NULL },
- { PIDGIN_STOCK_STATUS_AWAY, "", 0, 0, NULL },
- { PIDGIN_STOCK_STATUS_AWAY_I, "", 0, 0, NULL },
- { PIDGIN_STOCK_STATUS_BUSY, "", 0, 0, NULL },
- { PIDGIN_STOCK_STATUS_BUSY_I, "", 0, 0, NULL },
- { PIDGIN_STOCK_STATUS_CHAT, "", 0, 0, NULL },
- { PIDGIN_STOCK_STATUS_INVISIBLE, "", 0, 0, NULL },
- { PIDGIN_STOCK_STATUS_XA, "", 0, 0, NULL },
- { PIDGIN_STOCK_STATUS_XA_I, "", 0, 0, NULL },
- { PIDGIN_STOCK_STATUS_LOGIN, "", 0, 0, NULL },
- { PIDGIN_STOCK_STATUS_LOGOUT, "", 0, 0, NULL },
- { PIDGIN_STOCK_STATUS_OFFLINE, "", 0, 0, NULL },
- { PIDGIN_STOCK_STATUS_OFFLINE_I, "", 0, 0, NULL },
- { PIDGIN_STOCK_STATUS_PERSON, "", 0, 0, NULL },
- { PIDGIN_STOCK_STATUS_MESSAGE, "", 0, 0, NULL }
-};
-
-
-
/******************************************************************************
* Enums
*****************************************************************************/
-
/******************************************************************************
* GObject Stuff
*****************************************************************************/
@@ -141,7 +108,7 @@ pidgin_icon_theme_get_type (void)
};
type = g_type_register_static (PURPLE_TYPE_THEME,
"PidginIconTheme",
- &info, 0 /*G_TYPE_FLAG_ABSTRACT*/);
+ &info, G_TYPE_FLAG_ABSTRACT);
}
return type;
}
============================================================
--- pidgin/gtkprefs.c e86f9e1b38be7271b749fa8ec6446a97f0ff2eaa
+++ pidgin/gtkprefs.c 40762a60c43cd6dc073bc846869ad5c31fd8d5a4
@@ -44,12 +44,12 @@
#include "gtkconv.h"
#include "gtkdebug.h"
#include "gtkdialogs.h"
-#include "gtkicon-theme.h"
#include "gtkimhtml.h"
#include "gtkimhtmltoolbar.h"
#include "gtkprefs.h"
#include "gtksavedstatuses.h"
#include "gtksound.h"
+#include "gtkstatus-icon-theme.h"
#include "gtkthemes.h"
#include "gtkutils.h"
#include "pidginstock.h"
@@ -614,13 +614,13 @@ prefs_themes_sort(PurpleTheme *theme)
g_free(image_full);
} else pixbuf = NULL;
- gtk_list_store_append (prefs_sound_themes, &iter);
- gtk_list_store_set (prefs_sound_themes, &iter, 0, pixbuf, 2, purple_theme_get_name(theme), -1);
+ gtk_list_store_append(prefs_sound_themes, &iter);
+ gtk_list_store_set(prefs_sound_themes, &iter, 0, pixbuf, 2, purple_theme_get_name(theme), -1);
if (pixbuf != NULL)
gdk_pixbuf_unref(pixbuf);
- } else if (PIDGIN_IS_BLIST_THEME(theme) || PIDGIN_IS_ICON_THEME(theme)){
+ } else if (PIDGIN_IS_BLIST_THEME(theme) || PIDGIN_IS_STATUS_ICON_THEME(theme)){
GtkListStore *store;
if (PIDGIN_IS_BLIST_THEME(theme))
@@ -640,8 +640,8 @@ prefs_themes_sort(PurpleTheme *theme)
markup = g_strdup_printf("<b>%s</b>%s%s\n<span foreground='dim grey'>%s</span>", name, author != NULL ? " - " : "",
author != NULL ? author : "", description != NULL ? description : "");
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, pixbuf, 1, markup, 2, name, -1);
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter, 0, pixbuf, 1, markup, 2, name, -1);
g_free(markup);
if (pixbuf != NULL)
@@ -1152,14 +1152,14 @@ prefs_set_status_icon_theme_cb(GtkComboB
static void
prefs_set_status_icon_theme_cb(GtkComboBox *combo_box, gpointer user_data)
{
- PidginIconTheme *theme;
+ PidginStatusIconTheme *theme;
GtkTreeIter iter;
gchar *name = NULL;
g_return_if_fail(gtk_combo_box_get_active_iter(combo_box, &iter));
gtk_tree_model_get(GTK_TREE_MODEL(prefs_status_icon_themes), &iter, 2, &name, -1);
- theme = PIDGIN_ICON_THEME(purple_theme_manager_find_theme(name, "icon"));
+ theme = PIDGIN_STATUS_ICON_THEME(purple_theme_manager_find_theme(name, "status-icon"));
g_free(name);
pidgin_stock_load_status_icon_theme(theme);
@@ -1189,7 +1189,7 @@ interface_page(void)
g_signal_connect(G_OBJECT(combo_box), "changed", (GCallback)prefs_set_blist_theme_cb, NULL);
/* Status Icon Themes */
- combo_box = prefs_build_theme_combo_box(prefs_status_icon_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/icon/theme"));
+ combo_box = prefs_build_theme_combo_box(prefs_status_icon_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/icon/status/theme"));
gtk_box_pack_start(GTK_BOX (vbox), combo_box, FALSE, FALSE, 0);
g_signal_connect(G_OBJECT(combo_box), "changed", (GCallback)prefs_set_status_icon_theme_cb, NULL);
============================================================
--- pidgin/pidginstock.c e1fb7a49af845cf8488b13b1f5493e10c10ad9f0
+++ pidgin/pidginstock.c 4822b4bbb8c5a30399bb9e329c1fb10d03c609ff
@@ -263,7 +263,7 @@ static gchar *
}
static gchar *
-find_icon_file(PidginIconTheme *theme, const gchar *size, SizedStockIcon sized_icon, gboolean rtl)
+find_icon_file(PidginStatusIconTheme *theme, const gchar *size, SizedStockIcon sized_icon, gboolean rtl)
{
const gchar *file, *dir;
gchar *file_full = NULL;
@@ -288,7 +288,7 @@ static void
}
static void
-add_sized_icon(GtkIconSet *iconset, GtkIconSize sizeid, PidginIconTheme *theme,
+add_sized_icon(GtkIconSet *iconset, GtkIconSize sizeid, PidginStatusIconTheme *theme,
const char *size, SizedStockIcon sized_icon, gboolean translucent)
{
char *filename;
@@ -348,7 +348,7 @@ void
*****************************************************************************/
void
-pidgin_stock_load_status_icon_theme(PidginIconTheme *theme)
+pidgin_stock_load_status_icon_theme(PidginStatusIconTheme *theme)
{
GtkIconFactory *icon_factory;
gint i;
@@ -356,7 +356,11 @@ pidgin_stock_load_status_icon_theme(Pidg
GtkIconSet *translucent = NULL;
GtkWidget *win;
- g_return_if_fail(stock_initted);
+ if (theme != NULL)
+ purple_prefs_set_string(PIDGIN_PREFS_ROOT "/icon/status/theme",
+ purple_theme_get_name(PURPLE_THEME(theme)));
+ else purple_prefs_set_string(PIDGIN_PREFS_ROOT "/icon/status/theme", "");
+
icon_factory = gtk_icon_factory_new();
@@ -411,7 +415,7 @@ pidgin_stock_init(void)
stock_initted = TRUE;
/* Setup the theme */
- purple_theme_manager_register_type(g_object_new(PIDGIN_TYPE_ICON_THEME_LOADER, "type", "icon", NULL));
+ purple_theme_manager_register_type(g_object_new(PIDGIN_TYPE_ICON_THEME_LOADER, "type", "status-icon", NULL));
purple_prefs_add_none(PIDGIN_PREFS_ROOT "/icon/status");
purple_prefs_add_string(PIDGIN_PREFS_ROOT "/icon/status/theme", "");
============================================================
--- pidgin/pidginstock.h 799616aee16a049ac52471c8001a9b717b870a82
+++ pidgin/pidginstock.h 7d692e5cea815f02bdbbbea6fe0387b945ea7f93
@@ -24,7 +24,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
#include <gtk/gtkstock.h>
-#include "gtkicon-theme.h"
+#include "gtkstatus-icon-theme.h"
#ifndef _PIDGIN_STOCK_H_
#define _PIDGIN_STOCK_H_
@@ -161,7 +161,7 @@
*
* @param theme the theme to load, or null to load all the default icons
*/
-void pidgin_stock_load_status_icon_theme(PidginIconTheme *theme);
+void pidgin_stock_load_status_icon_theme(PidginStatusIconTheme *theme);
/**
* Sets up the purple stock repository.
More information about the Commits
mailing list