gobjectification: f9a727c1: clean up a bunch of stuff i forgot to do...
grim at pidgin.im
grim at pidgin.im
Sat Jul 18 23:15:35 EDT 2009
-----------------------------------------------------------------
Revision: f9a727c10e726be45a8a202b05bf7934ed486849
Ancestor: 6ef28fad42d71923606b110f399a4bdd88221354
Author: grim at pidgin.im
Date: 2009-07-19T03:10:01
Branch: im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/f9a727c10e726be45a8a202b05bf7934ed486849
Modified files:
libpurple/gsignal.c libpurple/gsignal.h
ChangeLog:
clean up a bunch of stuff i forgot to do before i did the initial commit of the purple_g_signal stuff
-------------- next part --------------
============================================================
--- libpurple/gsignal.c 96cc23863125f2364ae658336cf9340ab905e126
+++ libpurple/gsignal.c 9b55225c2bcb6eb0e85992a8070a599c5a4d15e3
@@ -1,5 +1,30 @@
-#include "signals.h"
+/* purple
+ *
+ * Purple 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 "gsignal.h"
+#include "debug.h"
+
+/******************************************************************************
+ * Structs
+ *****************************************************************************/
struct _PurpleGSignalHandle {
guint signal_id;
gulong hook_id;
@@ -14,6 +39,9 @@ typedef struct {
GType return_type;
} PurpleGSignalData;
+/******************************************************************************
+ * Helpers
+ *****************************************************************************/
static gboolean
purple_g_signal_emission_hook(GSignalInvocationHint *hint, guint n_params,
const GValue *pvalues, gpointer data)
@@ -51,8 +79,14 @@ purple_g_signal_emission_hook(GSignalInv
return TRUE;
}
+/******************************************************************************
+ * PurpleGSignal API
+ *****************************************************************************/
PurpleGSignalHandle *
-purple_g_signal_connect(GType t, const gchar *n, GCallback cb, gpointer d) {
+purple_g_signal_connect_flags(GType type, const gchar *name,
+ GConnectFlags flags,
+ GCallback callback, gpointer data)
+{
PurpleGSignalData *sd = NULL;
PurpleGSignalHandle *handle = NULL;
GQuark detail = 0;
@@ -61,13 +95,32 @@ purple_g_signal_connect(GType t, const g
gulong hook_id = 0;
gpointer *klass = NULL;
- klass = g_type_class_ref(t);
+ klass = g_type_class_ref(type);
- if(!g_signal_parse_name(n, t, &signal_id, &detail, TRUE))
- return 0;
+ if(!g_signal_parse_name(name, type, &signal_id, &detail, TRUE)) {
+ purple_debug_warning("gsignal",
+ "Failed to find information for signal '%s' on "
+ "type '%s'!\n",
+ name, g_type_name(type));
+
+ g_type_class_unref(klass);
+
+ return NULL;
+ }
+
g_signal_query(signal_id, &query);
+ if(query.signal_id == 0) {
+ purple_debug_warning("gsignal",
+ "Failed to query signal '%s' on type '%s'!\n",
+ name, g_type_name(type));
+
+ g_type_class_unref(klass);
+
+ return NULL;
+ }
+
sd = g_new(PurpleGSignalData, 1);
sd->callback = cb;
sd->user_data = d;
============================================================
--- libpurple/gsignal.h bffe40692db65b026f99bb6791987e351fdc98e8
+++ libpurple/gsignal.h e65d69276bbdbf67507309854ede93ada94b131d
@@ -1,3 +1,23 @@
+/* purple
+ *
+ * Purple 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 PURPLE_SIGNALS_H
#define PURPLE_SIGNALS_H
@@ -10,7 +30,10 @@ G_BEGIN_DECLS
G_BEGIN_DECLS
-PurpleGSignalHandle *purple_g_signal_connect(GType t, const gchar *n, GCallback cb, gpointer d);
+#define purple_g_signal_connect(type, name, callback, data) \
+ (purple_g_signal_connect_flags((type), (name), 0, (callback), (data))
+
+PurpleGSignalHandle *purple_g_signal_connect_flags(GType type, const gchar *name, GConnectFlags flags, GCallback callback, gpointer data);
void purple_g_signal_disconnect(PurpleGSignalHandle *handle);
GType purple_g_signal_handle_get_gtype(void);
More information about the Commits
mailing list