[network-manager-applet: 11/13] bluetooth: rename bling spinner to avoid GObject type conflicts



commit b5eb351a12aeea64d67da30ffe48c526d9ec4435
Author: Dan Williams <dcbw redhat com>
Date:   Thu Feb 18 10:30:49 2010 -0800

    bluetooth: rename bling spinner to avoid GObject type conflicts
    
    If another gnome-bluetooth plugin (or gnome-bluetooth itself) used the
    bling spinner without renaming it, we'd conflict and lose.

 src/gnome-bluetooth/Makefile.am                    |    8 +-
 src/gnome-bluetooth/bling-spinner.h                |   58 ----------
 src/gnome-bluetooth/network-manager-applet.c       |   10 +-
 .../{bling-spinner.c => nma-bling-spinner.c}       |  110 ++++++++++----------
 src/gnome-bluetooth/nma-bling-spinner.h            |   58 ++++++++++
 5 files changed, 122 insertions(+), 122 deletions(-)
---
diff --git a/src/gnome-bluetooth/Makefile.am b/src/gnome-bluetooth/Makefile.am
index f430c2f..a60d33e 100644
--- a/src/gnome-bluetooth/Makefile.am
+++ b/src/gnome-bluetooth/Makefile.am
@@ -16,8 +16,8 @@ plugin_LTLIBRARIES = libnma.la
 
 libnma_la_SOURCES = \
 	network-manager-applet.c \
-	bling-spinner.c \
-	bling-spinner.h
+	nma-bling-spinner.c \
+	nma-bling-spinner.h
 
 libnma_la_LDFLAGS = -module -avoid-version
 
@@ -28,5 +28,5 @@ endif
 
 EXTRA_DIST = \
 	network-manager-applet.c \
-	bling-spinner.c \
-	bling-spinner.h
+	nma-bling-spinner.c \
+	nma-bling-spinner.h
diff --git a/src/gnome-bluetooth/network-manager-applet.c b/src/gnome-bluetooth/network-manager-applet.c
index 2f97408..2ca8fdd 100644
--- a/src/gnome-bluetooth/network-manager-applet.c
+++ b/src/gnome-bluetooth/network-manager-applet.c
@@ -47,7 +47,7 @@
 #include <dbus/dbus-glib.h>
 
 #include "nma-marshal.h"
-#include "bling-spinner.h"
+#include "nma-bling-spinner.h"
 #include "mobile-wizard.h"
 
 #define DBUS_TYPE_G_MAP_OF_VARIANT (dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE))
@@ -302,7 +302,7 @@ dun_cleanup (PluginInfo *info, const char *message, gboolean uncheck)
 	}
 
 	if (info->spinner) {
-		bling_spinner_stop (BLING_SPINNER (info->spinner));
+		nma_bling_spinner_stop (NMA_BLING_SPINNER (info->spinner));
 		gtk_widget_hide (info->spinner);
 	}
 	gtk_label_set_text (GTK_LABEL (info->label), message);
@@ -717,10 +717,10 @@ dun_start (PluginInfo *info)
 
 	/* Start the spinner */
 	if (!info->spinner) {
-		info->spinner = bling_spinner_new ();
+		info->spinner = nma_bling_spinner_new ();
 		gtk_box_pack_start (GTK_BOX (info->hbox), info->spinner, FALSE, FALSE, 6);
 	}
-	bling_spinner_start (BLING_SPINNER (info->spinner));
+	nma_bling_spinner_start (NMA_BLING_SPINNER (info->spinner));
 	gtk_widget_show_all (info->hbox);
 
 	gtk_widget_set_sensitive (info->dun_button, FALSE);
@@ -880,7 +880,7 @@ plugin_info_destroy (gpointer data)
 	if (info->dun_connection)
 		g_object_unref (info->dun_connection);
 	if (info->spinner)
-		bling_spinner_stop (BLING_SPINNER (info->spinner));
+		nma_bling_spinner_stop (NMA_BLING_SPINNER (info->spinner));
 	g_object_unref (info->settings);
 	g_object_unref (info->btmodel);
 	g_object_unref (info->btclient);
diff --git a/src/gnome-bluetooth/bling-spinner.c b/src/gnome-bluetooth/nma-bling-spinner.c
similarity index 63%
rename from src/gnome-bluetooth/bling-spinner.c
rename to src/gnome-bluetooth/nma-bling-spinner.c
index 7269188..5522046 100644
--- a/src/gnome-bluetooth/bling-spinner.c
+++ b/src/gnome-bluetooth/nma-bling-spinner.c
@@ -30,11 +30,11 @@
 #include <gtk/gtk.h>
 #include <math.h>
 
-#include "bling-spinner.h"
+#include "nma-bling-spinner.h"
 
-#define BLING_SPINNER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), BLING_TYPE_SPINNER, BlingSpinnerPrivate))
+#define NMA_BLING_SPINNER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), NMA_TYPE_BLING_SPINNER, NmaBlingSpinnerPrivate))
 
-G_DEFINE_TYPE (BlingSpinner, bling_spinner, GTK_TYPE_DRAWING_AREA);
+G_DEFINE_TYPE (NmaBlingSpinner, nma_bling_spinner, GTK_TYPE_DRAWING_AREA);
 
 enum
 {
@@ -43,7 +43,7 @@ enum
 };
 
 /* STRUCTS & ENUMS */
-struct _BlingSpinnerPrivate
+struct _NmaBlingSpinnerPrivate
 {
 	/* state */
 	guint current;
@@ -54,12 +54,12 @@ struct _BlingSpinnerPrivate
 };
 
 /* FORWARDS */
-static void bling_spinner_class_init(BlingSpinnerClass *klass);
-static void bling_spinner_init(BlingSpinner *spinner);
-static void bling_spinner_finalize (GObject *gobject);
-static void bling_spinner_set_property(GObject *gobject, guint prop_id, const GValue *value, GParamSpec *pspec);
-static gboolean bling_spinner_expose(GtkWidget *widget, GdkEventExpose *event);
-static void bling_spinner_screen_changed (GtkWidget* widget, GdkScreen* old_screen);
+static void nma_bling_spinner_class_init(NmaBlingSpinnerClass *klass);
+static void nma_bling_spinner_init(NmaBlingSpinner *spinner);
+static void nma_bling_spinner_finalize (GObject *gobject);
+static void nma_bling_spinner_set_property(GObject *gobject, guint prop_id, const GValue *value, GParamSpec *pspec);
+static gboolean nma_bling_spinner_expose(GtkWidget *widget, GdkEventExpose *event);
+static void nma_bling_spinner_screen_changed (GtkWidget* widget, GdkScreen* old_screen);
 
 static GtkDrawingAreaClass *parent_class;
 
@@ -73,9 +73,9 @@ draw (GtkWidget *widget, cairo_t *cr)
 	int i;
 	int width, height;
 
-	BlingSpinnerPrivate *priv;
+	NmaBlingSpinnerPrivate *priv;
 
-	priv = BLING_SPINNER_GET_PRIVATE (widget);
+	priv = NMA_BLING_SPINNER_GET_PRIVATE (widget);
 
 	cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
 
@@ -121,7 +121,7 @@ draw (GtkWidget *widget, cairo_t *cr)
 
 /*	GOBJECT INIT CODE */
 static void
-bling_spinner_class_init(BlingSpinnerClass *klass)
+nma_bling_spinner_class_init(NmaBlingSpinnerClass *klass)
 {
 	GObjectClass *gobject_class;
 	GtkWidgetClass *widget_class;
@@ -129,13 +129,13 @@ bling_spinner_class_init(BlingSpinnerClass *klass)
 	parent_class = g_type_class_peek_parent(klass);
 
 	gobject_class = G_OBJECT_CLASS(klass);
-	g_type_class_add_private (gobject_class, sizeof (BlingSpinnerPrivate));
-	gobject_class->set_property = bling_spinner_set_property;
-	gobject_class->finalize = bling_spinner_finalize;
+	g_type_class_add_private (gobject_class, sizeof (NmaBlingSpinnerPrivate));
+	gobject_class->set_property = nma_bling_spinner_set_property;
+	gobject_class->finalize = nma_bling_spinner_finalize;
 
 	widget_class = GTK_WIDGET_CLASS(klass);
-	widget_class->expose_event = bling_spinner_expose;
-	widget_class->screen_changed = bling_spinner_screen_changed;
+	widget_class->expose_event = nma_bling_spinner_expose;
+	widget_class->screen_changed = nma_bling_spinner_screen_changed;
 
 	g_object_class_install_property(gobject_class, PROP_NUM_LINES,
 		g_param_spec_uint("lines", "Num Lines",
@@ -146,11 +146,11 @@ bling_spinner_class_init(BlingSpinnerClass *klass)
 }
 
 static void
-bling_spinner_init (BlingSpinner *spinner)
+nma_bling_spinner_init (NmaBlingSpinner *spinner)
 {
-	BlingSpinnerPrivate *priv;
+	NmaBlingSpinnerPrivate *priv;
 
-	priv = BLING_SPINNER_GET_PRIVATE (spinner);
+	priv = NMA_BLING_SPINNER_GET_PRIVATE (spinner);
 	priv->current = 0;
 	priv->timeout = 0;
 
@@ -158,7 +158,7 @@ bling_spinner_init (BlingSpinner *spinner)
 }
 
 static gboolean
-bling_spinner_expose (GtkWidget *widget, GdkEventExpose *event)
+nma_bling_spinner_expose (GtkWidget *widget, GdkEventExpose *event)
 {
 	cairo_t *cr;
 
@@ -183,13 +183,13 @@ bling_spinner_expose (GtkWidget *widget, GdkEventExpose *event)
 }
 
 static void
-bling_spinner_screen_changed (GtkWidget* widget, GdkScreen* old_screen)
+nma_bling_spinner_screen_changed (GtkWidget* widget, GdkScreen* old_screen)
 {
-	BlingSpinner *spinner;
+	NmaBlingSpinner *spinner;
 	GdkScreen* new_screen;
 	GdkColormap* colormap;
 
-	spinner = BLING_SPINNER(widget);
+	spinner = NMA_BLING_SPINNER(widget);
 
 	new_screen = gtk_widget_get_screen (widget);
 	colormap = gdk_screen_get_rgba_colormap (new_screen);
@@ -201,13 +201,13 @@ bling_spinner_screen_changed (GtkWidget* widget, GdkScreen* old_screen)
 }
 
 static gboolean
-bling_spinner_timeout (gpointer data)
+nma_bling_spinner_timeout (gpointer data)
 {
-	BlingSpinner *spinner;
-	BlingSpinnerPrivate *priv;
+	NmaBlingSpinner *spinner;
+	NmaBlingSpinnerPrivate *priv;
 
-	spinner = BLING_SPINNER (data);
-	priv = BLING_SPINNER_GET_PRIVATE (spinner);
+	spinner = NMA_BLING_SPINNER (data);
+	priv = NMA_BLING_SPINNER_GET_PRIVATE (spinner);
 
 	if (priv->current + 1 >= priv->lines) {
 		priv->current = 0;
@@ -221,14 +221,14 @@ bling_spinner_timeout (gpointer data)
 }
 
 static void
-bling_spinner_set_property(GObject *gobject, guint prop_id,
+nma_bling_spinner_set_property(GObject *gobject, guint prop_id,
 					const GValue *value, GParamSpec *pspec)
 {
-	BlingSpinner *spinner;
-	BlingSpinnerPrivate *priv;
+	NmaBlingSpinner *spinner;
+	NmaBlingSpinnerPrivate *priv;
 
-	spinner = BLING_SPINNER(gobject);
-	priv = BLING_SPINNER_GET_PRIVATE (spinner);
+	spinner = NMA_BLING_SPINNER(gobject);
+	priv = NMA_BLING_SPINNER_GET_PRIVATE (spinner);
 
 	switch (prop_id)
 	{
@@ -242,13 +242,13 @@ bling_spinner_set_property(GObject *gobject, guint prop_id,
 }
 
 static void
-bling_spinner_finalize (GObject *gobject)
+nma_bling_spinner_finalize (GObject *gobject)
 {
-	BlingSpinner *spinner;
-	BlingSpinnerPrivate *priv;
+	NmaBlingSpinner *spinner;
+	NmaBlingSpinnerPrivate *priv;
 
-	spinner = BLING_SPINNER(gobject);
-	priv = BLING_SPINNER_GET_PRIVATE (spinner);
+	spinner = NMA_BLING_SPINNER(gobject);
+	priv = NMA_BLING_SPINNER_GET_PRIVATE (spinner);
 
 	if (priv->timeout != 0) {
 		g_source_remove (priv->timeout);
@@ -257,49 +257,49 @@ bling_spinner_finalize (GObject *gobject)
 }
 
 /**
- * bling_spinner_new
+ * nma_bling_spinner_new
  *
  * Returns a default spinner. Not yet started.
  *
- * Returns: a new #BlingSpinner
+ * Returns: a new #NmaBlingSpinner
  */
 GtkWidget *
-bling_spinner_new (void)
+nma_bling_spinner_new (void)
 {
-	return g_object_new (BLING_TYPE_SPINNER, NULL);
+	return g_object_new (NMA_TYPE_BLING_SPINNER, NULL);
 }
 
 /**
- * bling_spinner_start
+ * nma_bling_spinner_start
  *
  * Starts the animation
  */
 void
-bling_spinner_start (BlingSpinner *spinner)
+nma_bling_spinner_start (NmaBlingSpinner *spinner)
 {
-	BlingSpinnerPrivate *priv;
+	NmaBlingSpinnerPrivate *priv;
 
-	g_return_if_fail (BLING_IS_SPINNER (spinner));
+	g_return_if_fail (NMA_IS_BLING_SPINNER (spinner));
 
-	priv = BLING_SPINNER_GET_PRIVATE (spinner);
+	priv = NMA_BLING_SPINNER_GET_PRIVATE (spinner);
 	if (priv->timeout != 0)
 		return;
-	priv->timeout = g_timeout_add (80, bling_spinner_timeout, spinner);
+	priv->timeout = g_timeout_add (80, nma_bling_spinner_timeout, spinner);
 }
 
 /**
- * bling_spinner_stop
+ * nma_bling_spinner_stop
  *
  * Stops the animation
  */
 void
-bling_spinner_stop (BlingSpinner *spinner)
+nma_bling_spinner_stop (NmaBlingSpinner *spinner)
 {
-	BlingSpinnerPrivate *priv;
+	NmaBlingSpinnerPrivate *priv;
 
-	g_return_if_fail (BLING_IS_SPINNER (spinner));
+	g_return_if_fail (NMA_IS_BLING_SPINNER (spinner));
 
-	priv = BLING_SPINNER_GET_PRIVATE (spinner);
+	priv = NMA_BLING_SPINNER_GET_PRIVATE (spinner);
 	if (priv->timeout == 0)
 		return;
 	g_source_remove (priv->timeout);
diff --git a/src/gnome-bluetooth/nma-bling-spinner.h b/src/gnome-bluetooth/nma-bling-spinner.h
new file mode 100644
index 0000000..a828699
--- /dev/null
+++ b/src/gnome-bluetooth/nma-bling-spinner.h
@@ -0,0 +1,58 @@
+/* @Copyright (C) 2007 John Stowers, Neil Jagdish Patel.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA  02111-1307, USA.
+ */
+
+
+#ifndef _NMA_BLING_SPINNER_H_
+#define _NMA_BLING_SPINNER_H_
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define NMA_TYPE_BLING_SPINNER           (nma_bling_spinner_get_type ())
+#define NMA_BLING_SPINNER(obj)           (G_TYPE_CHECK_INSTANCE_CAST ((obj), NMA_TYPE_BLING_SPINNER, NmaBlingSpinner))
+#define NMA_BLING_SPINNER_CLASS(obj)     (G_TYPE_CHECK_CLASS_CAST ((obj), NMA_BLING_SPINNER,  NmaBlingSpinnerClass))
+#define NMA_IS_BLING_SPINNER(obj)        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NMA_TYPE_BLING_SPINNER))
+#define NMA_IS_BLING_SPINNER_CLASS(obj)  (G_TYPE_CHECK_CLASS_TYPE ((obj), NMA_TYPE_BLING_SPINNER))
+#define NMA_BLING_SPINNER_GET_CLASS      (G_TYPE_INSTANCE_GET_CLASS ((obj), NMA_TYPE_BLING_SPINNER, NmaBlingSpinnerClass))
+
+typedef struct _NmaBlingSpinner      NmaBlingSpinner;
+typedef struct _NmaBlingSpinnerClass NmaBlingSpinnerClass;
+typedef struct _NmaBlingSpinnerPrivate  NmaBlingSpinnerPrivate;
+
+struct _NmaBlingSpinner
+{
+	GtkDrawingArea parent;
+};
+
+struct _NmaBlingSpinnerClass
+{
+	GtkDrawingAreaClass parent_class;
+	NmaBlingSpinnerPrivate *priv;
+};
+
+GType nma_bling_spinner_get_type (void);
+
+GtkWidget * nma_bling_spinner_new (void);
+
+void nma_bling_spinner_start (NmaBlingSpinner *spinner);
+void nma_bling_spinner_stop  (NmaBlingSpinner *spinner);
+
+G_END_DECLS
+
+#endif



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]