soc.2008.themes: f81d3858: Fixed purple sound loader class init fun...
ffdragon at soc.pidgin.im
ffdragon at soc.pidgin.im
Sat Jun 21 02:00:59 EDT 2008
-----------------------------------------------------------------
Revision: f81d3858f10a98eb117b79b4a96ba721f529ad57
Ancestor: 5d9f09ec4361138eeabe95a926a0b16bf2fb9adb
Author: ffdragon at soc.pidgin.im
Date: 2008-06-21T05:55:58
Branch: im.pidgin.soc.2008.themes
URL: http://d.pidgin.im/viewmtn/revision/info/f81d3858f10a98eb117b79b4a96ba721f529ad57
Modified files:
libpurple/core.c libpurple/sound-loader.c
libpurple/sound-loader.h libpurple/theme-loader.c
libpurple/theme-manager.c pidgin/gtkprefs.c
ChangeLog:
Fixed purple sound loader class init function (bug on startup) and added shell sound theme selector
-------------- next part --------------
============================================================
--- libpurple/core.c 0086adbca66e71ab77f59508b10b2c54c03a69c0
+++ libpurple/core.c dc66294968e929eb4b1942c33e7b672f894f75e5
@@ -45,10 +45,12 @@
#include "signals.h"
#include "smiley.h"
#include "sound.h"
+#include "sound-loader.h"
#include "sslconn.h"
#include "status.h"
#include "stun.h"
#include "util.h"
+#include "theme-manager.h"
#ifdef HAVE_DBUS
# ifndef DBUS_API_SUBJECT_TO_CHANGE
@@ -147,6 +149,7 @@ purple_core_init(const char *ui)
/* Accounts use status, buddy icons and connection signals, so
* initialize these before accounts
*/
+ purple_theme_manager_init(g_object_new(PURPLE_TYPE_SOUND_THEME_LOADER, NULL), NULL);
purple_status_init();
purple_buddy_icons_init();
purple_connections_init();
@@ -169,7 +172,7 @@ purple_core_init(const char *ui)
purple_xfers_init();
purple_idle_init();
purple_smileys_init();
-
+
/*
* Call this early on to try to auto-detect our IP address and
* hopefully save some time later.
@@ -178,6 +181,7 @@ purple_core_init(const char *ui)
if (ops != NULL && ops->ui_init != NULL)
ops->ui_init();
+
return TRUE;
}
@@ -213,6 +217,7 @@ purple_core_quit(void)
purple_status_uninit();
purple_prefs_uninit();
purple_sound_uninit();
+ purple_theme_manager_uninit();
purple_xfers_uninit();
purple_proxy_uninit();
purple_dnsquery_uninit();
============================================================
--- libpurple/sound-loader.c 746a88c2500eb0f406b936d28c56caabeff5ccda
+++ libpurple/sound-loader.c 75d580be025723cd5017937265f90547bf42b855
@@ -22,6 +22,7 @@
*/
#include "sound-loader.h"
+#include "sound-theme.h"
#include "util.h"
#include "xmlnode.h"
@@ -102,9 +103,9 @@ purple_sound_theme_loader_class_init (Pu
static void
purple_sound_theme_loader_class_init (PurpleSoundThemeLoaderClass *klass)
{
- parent_class = g_type_class_peek_parent (klass);
-
- parent_class->purple_theme_loader_build = purple_sound_loader_build;
+ PurpleThemeLoaderClass *loader_klass = PURPLE_THEME_LOADER_CLASS(klass);
+
+ loader_klass->purple_theme_loader_build = purple_sound_loader_build;
}
============================================================
--- libpurple/sound-loader.h 907d14695cf14fc3c060e9ecb8b82c04c9c843ae
+++ libpurple/sound-loader.h 54ab92c16d2fd65a2a9ba021500bd1587e4177a2
@@ -29,7 +29,6 @@
#include <glib.h>
#include <glib-object.h>
#include "theme-loader.h"
-#include "sound-theme.h"
/**
* A purple sound theme loader. extends PurpleThemeLoader (theme-loader.h)
@@ -40,9 +39,9 @@ typedef struct _PurpleSoundThemeLoaderCl
typedef struct _PurpleSoundThemeLoader PurpleSoundThemeLoader;
typedef struct _PurpleSoundThemeLoaderClass PurpleSoundThemeLoaderClass;
-#define PURPLE_TYPE_SOUND_THEME_LOADER (purple_sound_theme_loader_get_type ())
-#define PURPLE_SOUND_THEME_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PURPLE_TYPE_SOUND_THEME_LOADER, PurpleSoundThemeLoader))
-#define PURPLE_SOUND_THEME_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PURPLE_TYPE_SOUND_THEME_LOADER, PurpleSoundThemeLoaderClass))
+#define PURPLE_TYPE_SOUND_THEME_LOADER (purple_sound_theme_loader_get_type ())
+#define PURPLE_SOUND_THEME_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PURPLE_TYPE_SOUND_THEME_LOADER, PurpleSoundThemeLoader))
+#define PURPLE_SOUND_THEME_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PURPLE_TYPE_SOUND_THEME_LOADER, PurpleSoundThemeLoaderClass))
#define PURPLE_IS_SOUND_THEME_LOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PURPLE_TYPE_SOUND_THEME_LOADER))
#define PURPLE_IS_SOUND_THEME_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PURPLE_TYPE_SOUND_THEME_LOADER))
#define PURPLE_SOUND_THEME_LOADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PURPLE_TYPE_SOUND_THEME_LOADER, PurpleSoundThemeLoaderClass))
============================================================
--- libpurple/theme-loader.c 22cf2051719b704078e840e0e0b5c76642036479
+++ libpurple/theme-loader.c ad0bd55a5ba654124c30adbe62d673d1776d8088
@@ -90,7 +90,7 @@ purple_theme_loader_finalize(GObject *ob
{
PurpleThemeLoader *loader = PURPLE_THEME_LOADER(obj);
PurpleThemeLoaderPrivate *priv = PURPLE_THEME_LOADER_GET_PRIVATE(loader);
-
+
g_free(priv->type);
parent_class->finalize (obj);
@@ -101,13 +101,13 @@ purple_theme_loader_class_init (PurpleTh
{
GObjectClass *obj_class = G_OBJECT_CLASS(klass);
GParamSpec *pspec;
-
+
parent_class = g_type_class_peek_parent (klass);
obj_class->get_property = purple_theme_loader_get_property;
obj_class->set_property = purple_theme_loader_set_property;
obj_class->finalize = purple_theme_loader_finalize;
-
+
/* TYPE STRING (read only) */
pspec = g_param_spec_string(PROP_TYPE_S, "Type",
"The string represtenting the type of the theme",
============================================================
--- libpurple/theme-manager.c 5e43d00214b233fa5f7f3cdf1f073b459afec280
+++ libpurple/theme-manager.c a1391bda4f10ed883af0d0294270c10fcf2ce289
@@ -28,7 +28,7 @@
* Globals
*****************************************************************************/
-static GHashTable *theme_table;
+static GHashTable *theme_table = NULL;
/*****************************************************************************
* GObject Stuff
@@ -147,7 +147,7 @@ purple_theme_manager_init (PurpleThemeLo
va_list args;
PurpleThemeLoader *loader;
- g_return_if_fail(theme_table != NULL);
+ /*g_return_if_fail(theme_table != NULL);*/
theme_table = g_hash_table_new_full (g_str_hash,
g_str_equal,
@@ -160,7 +160,7 @@ purple_theme_manager_init (PurpleThemeLo
va_end(args);
/* TODO: add themes properly */
- purple_theme_manager_build_dir(NULL);
+ purple_theme_manager_build_dir("/usr/share/themes");
}
void
@@ -171,7 +171,7 @@ purple_theme_manager_refresh()
NULL);
/* TODO: this also needs to be fixed the same as new */
- purple_theme_manager_build_dir(NULL);
+ purple_theme_manager_build_dir("/usr/share/themes");
}
@@ -189,14 +189,12 @@ purple_theme_manager_register_type(Purpl
g_return_if_fail(PURPLE_IS_THEME_LOADER(loader));
- type = purple_theme_loader_get_type_string(loader);
+ type = g_strdup(purple_theme_loader_get_type_string(loader));
g_return_if_fail(type);
/* if something is already there do nothing */
if (! g_hash_table_lookup (theme_table, type))
g_hash_table_insert(theme_table, type, loader);
-
- g_free(type);
}
void
============================================================
--- pidgin/gtkprefs.c 8c2ed56087f9959d97b13d6ad5242001cb5256ac
+++ pidgin/gtkprefs.c e57374abd5d039e2db3d92708e23305d176340cf
@@ -69,6 +69,8 @@ static GtkTreeRowReference *previous_smi
static int notebook_page = 0;
static GtkTreeRowReference *previous_smiley_row = NULL;
+static GtkListStore *sound_themes;
+
/*
* PROTOTYPES
*/
@@ -1832,7 +1834,7 @@ sound_page(void)
sound_page(void)
{
GtkWidget *ret;
- GtkWidget *vbox, *sw, *button;
+ GtkWidget *vbox, *sw, *button, *combo_box;
GtkSizeGroup *sg;
GtkTreeIter iter;
GtkWidget *event_view;
@@ -1845,6 +1847,8 @@ sound_page(void)
int j;
const char *file;
char *pref;
+ GtkCellRenderer *cell_rend;
+ GdkPixbuf *pixbuf;
#ifndef _WIN32
GtkWidget *dd;
GtkWidget *entry;
@@ -1922,7 +1926,6 @@ sound_page(void)
purple_prefs_connect_callback(prefs, PIDGIN_PREFS_ROOT "/sound/method",
sound_changed2_cb, vbox);
#endif
-
vbox = pidgin_make_frame(ret, _("Sound Events"));
/* The following is an ugly hack to make the frame expand so the
@@ -1934,6 +1937,26 @@ sound_page(void)
gtk_box_set_child_packing(GTK_BOX(vbox->parent->parent->parent),
vbox->parent->parent, TRUE, TRUE, 0, GTK_PACK_START);
+ /* SOUND THEMES */
+ sound_themes = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+
+ combo_box = gtk_combo_box_new_with_model (GTK_TREE_MODEL (sound_themes));
+ gtk_box_pack_start (GTK_BOX (vbox), combo_box, FALSE, FALSE, 0);
+
+ cell_rend = gtk_cell_renderer_pixbuf_new ();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), cell_rend, FALSE);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), cell_rend, "pixbuf", 0, NULL);
+
+ cell_rend = gtk_cell_renderer_text_new ();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), cell_rend, FALSE);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), cell_rend, "text", 1, NULL);
+
+ pixbuf = gdk_pixbuf_new_from_file (NULL, NULL);
+ gtk_list_store_append (sound_themes, &iter);
+ gtk_list_store_set (sound_themes, &iter, 0, pixbuf, 1, _("(Default)"), -1);
+ gdk_pixbuf_unref (pixbuf);
+
+ /* SOUND SELECTION */
sw = gtk_scrolled_window_new(NULL,NULL);
gtk_widget_set_size_request(sw, -1, 100);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
More information about the Commits
mailing list