summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 348be30)
raw | patch | inline | side by side (parent: 348be30)
author | mental <mental@users.sourceforge.net> | |
Tue, 25 Jul 2006 22:17:56 +0000 (22:17 +0000) | ||
committer | mental <mental@users.sourceforge.net> | |
Tue, 25 Jul 2006 22:17:56 +0000 (22:17 +0000) |
ChangeLog | patch | blob | history | |
src/widgets/gradient-vector.cpp | patch | blob | history | |
src/widgets/gradient-vector.h | patch | blob | history |
diff --git a/ChangeLog b/ChangeLog
index 45dce9f09e85df7c3a6e08c61b845e02ab53d63b..6cd34087e1d7c3b66b9def04b965175c757a9a10 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
+2006-07-25 MenTaLguY <mental@rydia.net>
+
+ * src/widgets/gradient-vector.cpp, src/widgets/gradient-vector.h:
+
+ switch to sigc++ SPObject signals for SPGradientVectorSelector
+
2006-07-25 MenTaLguY <mental@rydia.net>
* autogen.sh, configure.ac, debian/control, tools-version.sh:
index be1adcfe03d5f8c204c66a1ca6a9a8c89a09c733..83336895041c8f21b8db7b51f6218266d8db4fe4 100644 (file)
#include "svg/css-ostringstream.h"
#include "sp-stop.h"
+#include <sigc++/functors/ptr_fun.h>
+#include <sigc++/adaptors/bind.h>
+
enum {
VECTOR_SET,
LAST_SIGNAL
static void sp_gradient_vector_selector_init (SPGradientVectorSelector *gvs);
static void sp_gradient_vector_selector_destroy (GtkObject *object);
-static void sp_gvs_gradient_release (SPGradient *gr, SPGradientVectorSelector *gvs);
+static void sp_gvs_gradient_release (SPObject *obj, SPGradientVectorSelector *gvs);
static void sp_gvs_defs_release (SPObject *defs, SPGradientVectorSelector *gvs);
static void sp_gvs_defs_modified (SPObject *defs, guint flags, SPGradientVectorSelector *gvs);
gvs->doc = NULL;
gvs->gr = NULL;
+ new (&gvs->gradient_release_connection) sigc::connection();
+ new (&gvs->defs_release_connection) sigc::connection();
+ new (&gvs->defs_modified_connection) sigc::connection();
+
gvs->menu = gtk_option_menu_new ();
gtk_widget_show (gvs->menu);
gtk_box_pack_start (GTK_BOX (gvs), gvs->menu, TRUE, TRUE, 0);
gvs = SP_GRADIENT_VECTOR_SELECTOR (object);
if (gvs->gr) {
- sp_signal_disconnect_by_data (gvs->gr, gvs);
+ gvs->gradient_release_connection.disconnect();
gvs->gr = NULL;
}
if (gvs->doc) {
- sp_signal_disconnect_by_data (SP_DOCUMENT_DEFS (gvs->doc), gvs);
+ gvs->defs_release_connection.disconnect();
+ gvs->defs_modified_connection.disconnect();
gvs->doc = NULL;
}
+ gvs->gradient_release_connection.~connection();
+ gvs->defs_release_connection.~connection();
+ gvs->defs_modified_connection.~connection();
+
if (((GtkObjectClass *) (parent_class))->destroy)
(* ((GtkObjectClass *) (parent_class))->destroy) (object);
}
@@ -168,21 +180,21 @@ sp_gradient_vector_selector_set_gradient (SPGradientVectorSelector *gvs, SPDocum
if (doc != gvs->doc) {
/* Disconnect signals */
if (gvs->gr) {
- sp_signal_disconnect_by_data (gvs->gr, gvs);
- g_signal_handlers_disconnect_matched (G_OBJECT(gvs->gr), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, gvs);
+ gvs->gradient_release_connection.disconnect();
gvs->gr = NULL;
}
if (gvs->doc) {
- sp_signal_disconnect_by_data (SP_DOCUMENT_DEFS (gvs->doc), gvs);
+ gvs->defs_release_connection.disconnect();
+ gvs->defs_modified_connection.disconnect();
gvs->doc = NULL;
}
/* Connect signals */
if (doc) {
- g_signal_connect (G_OBJECT (SP_DOCUMENT_DEFS (doc)), "release", G_CALLBACK (sp_gvs_defs_release), gvs);
- g_signal_connect (G_OBJECT (SP_DOCUMENT_DEFS (doc)), "modified", G_CALLBACK (sp_gvs_defs_modified), gvs);
+ gvs->defs_release_connection = SP_DOCUMENT_DEFS(doc)->connectRelease(sigc::bind<1>(sigc::ptr_fun(&sp_gvs_defs_release), gvs));
+ gvs->defs_modified_connection = SP_DOCUMENT_DEFS(doc)->connectModified(sigc::bind<2>(sigc::ptr_fun(&sp_gvs_defs_modified), gvs));
}
if (gr) {
- g_signal_connect (G_OBJECT (gr), "release", G_CALLBACK (sp_gvs_gradient_release), gvs);
+ gvs->gradient_release_connection = gr->connectRelease(sigc::bind<1>(sigc::ptr_fun(&sp_gvs_gradient_release), gvs));
}
gvs->doc = doc;
gvs->gr = gr;
/* fixme: Really we would want to use _set_vector */
/* Detach old */
if (gvs->gr) {
- sp_signal_disconnect_by_data (gvs->gr, gvs);
+ gvs->gradient_release_connection.disconnect();
gvs->gr = NULL;
}
/* Attach new */
if (norm) {
- g_signal_connect (G_OBJECT (norm), "release", G_CALLBACK (sp_gvs_gradient_release), gvs);
- /* fixme: Connect 'modified'? (Lauris) */
- /* fixme: I think we do not need it (Lauris) */
+ gvs->gradient_release_connection = norm->connectRelease(sigc::bind<1>(sigc::ptr_fun(&sp_gvs_gradient_release), gvs));
gvs->gr = norm;
}
}
static void
-sp_gvs_gradient_release (SPGradient *gr, SPGradientVectorSelector *gvs)
+sp_gvs_gradient_release (SPObject *obj, SPGradientVectorSelector *gvs)
{
/* Disconnect gradient */
if (gvs->gr) {
- sp_signal_disconnect_by_data (gvs->gr, gvs);
+ gvs->gradient_release_connection.disconnect();
gvs->gr = NULL;
}
sp_gvs_defs_release (SPObject *defs, SPGradientVectorSelector *gvs)
{
gvs->doc = NULL;
+
+ gvs->defs_release_connection.disconnect();
+ gvs->defs_modified_connection.disconnect();
+
/* Disconnect gradient as well */
if (gvs->gr) {
- sp_signal_disconnect_by_data (gvs->gr, gvs);
+ gvs->gradient_release_connection.disconnect();
gvs->gr = NULL;
}
index 9d754b8a02e21de4400eec8bfbb4e887076bfb03..be3ed62eb38ac6c0976217822418a044758d82f1 100644 (file)
#include <glib.h>
-
+#include <sigc++/connection.h>
#include <gtk/gtkvbox.h>
#include "../forward.h"
/* Vector menu */
GtkWidget *menu;
+
+ sigc::connection gradient_release_connection;
+ sigc::connection defs_release_connection;
+ sigc::connection defs_modified_connection;
};
struct SPGradientVectorSelectorClass {