SF.net SVN: geany:[5857] trunk

colombanw at users.sourceforge.net colombanw at xxxxx
Fri Jun 17 22:53:01 UTC 2011


Revision: 5857
          http://geany.svn.sourceforge.net/geany/?rev=5857&view=rev
Author:   colombanw
Date:     2011-06-17 22:53:01 +0000 (Fri, 17 Jun 2011)

Log Message:
-----------
Make StashWidgetID map to gconstpointer rather than gpointer

This allows to use constant strings (e.g. string literals) as the
widget ID without triggering tons of compiler warnings.  In cases
widgets or non-constant strings are used, this just don't change
anything, since anyway we don't really need the widget pointer not
to be constant.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/stash.c
    trunk/src/stash.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2011-06-17 22:52:43 UTC (rev 5856)
+++ trunk/ChangeLog	2011-06-17 22:53:01 UTC (rev 5857)
@@ -4,6 +4,9 @@
    Remove support of size being -1 in document_open_file_list().
  * src/utils.c src/utils.h:
    Remove support of size being -1 in utils_get_line_endings().
+ * src/stash.c, src/stash.h:
+   Make StashWidgetID map to gconstpointer, allowing use of const
+   strings as the widget key.
 
 
 2011-06-16  Colomban Wendling  <colomban(at)geany(dot)org>

Modified: trunk/src/stash.c
===================================================================
--- trunk/src/stash.c	2011-06-17 22:52:43 UTC (rev 5856)
+++ trunk/src/stash.c	2011-06-17 22:53:01 UTC (rev 5857)
@@ -566,14 +566,13 @@
 static GtkWidget *
 get_widget(GtkWidget *owner, StashWidgetID widget_id)
 {
-	GtkWidget *widget = widget_id;
+	GtkWidget *widget;
 
 	if (owner)
-	{
-		const gchar *widget_name = widget_id;
+		widget = lookup_widget(owner, (const gchar *)widget_id);
+	else
+		widget = (GtkWidget *)widget_id;
 
-		widget = lookup_widget(owner, widget_name);
-	}
 	if (!GTK_IS_WIDGET(widget))
 	{
 		g_warning("Unknown widget in %s()!", G_STRFUNC);

Modified: trunk/src/stash.h
===================================================================
--- trunk/src/stash.h	2011-06-17 22:52:43 UTC (rev 5856)
+++ trunk/src/stash.h	2011-06-17 22:53:01 UTC (rev 5857)
@@ -30,7 +30,7 @@
 
 /** Can be @c GtkWidget* or @c gchar* depending on whether the @a owner argument is used for
  * stash_group_display() and stash_group_update(). */
-typedef gpointer StashWidgetID;
+typedef gconstpointer StashWidgetID;
 
 
 StashGroup *stash_group_new(const gchar *name);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list