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. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5857 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
9fa8cd8bf9
commit
83527f798c
@ -4,6 +4,9 @@
|
|||||||
Remove support of size being -1 in document_open_file_list().
|
Remove support of size being -1 in document_open_file_list().
|
||||||
* src/utils.c src/utils.h:
|
* src/utils.c src/utils.h:
|
||||||
Remove support of size being -1 in utils_get_line_endings().
|
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>
|
2011-06-16 Colomban Wendling <colomban(at)geany(dot)org>
|
||||||
|
@ -566,14 +566,13 @@ lookup_widget(GtkWidget *widget, const gchar *widget_name)
|
|||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
get_widget(GtkWidget *owner, StashWidgetID widget_id)
|
get_widget(GtkWidget *owner, StashWidgetID widget_id)
|
||||||
{
|
{
|
||||||
GtkWidget *widget = widget_id;
|
GtkWidget *widget;
|
||||||
|
|
||||||
if (owner)
|
if (owner)
|
||||||
{
|
widget = lookup_widget(owner, (const gchar *)widget_id);
|
||||||
const gchar *widget_name = widget_id;
|
else
|
||||||
|
widget = (GtkWidget *)widget_id;
|
||||||
|
|
||||||
widget = lookup_widget(owner, widget_name);
|
|
||||||
}
|
|
||||||
if (!GTK_IS_WIDGET(widget))
|
if (!GTK_IS_WIDGET(widget))
|
||||||
{
|
{
|
||||||
g_warning("Unknown widget in %s()!", G_STRFUNC);
|
g_warning("Unknown widget in %s()!", G_STRFUNC);
|
||||||
|
@ -30,7 +30,7 @@ typedef struct StashGroup StashGroup;
|
|||||||
|
|
||||||
/** Can be @c GtkWidget* or @c gchar* depending on whether the @a owner argument is used for
|
/** Can be @c GtkWidget* or @c gchar* depending on whether the @a owner argument is used for
|
||||||
* stash_group_display() and stash_group_update(). */
|
* stash_group_display() and stash_group_update(). */
|
||||||
typedef gpointer StashWidgetID;
|
typedef gconstpointer StashWidgetID;
|
||||||
|
|
||||||
|
|
||||||
StashGroup *stash_group_new(const gchar *name);
|
StashGroup *stash_group_new(const gchar *name);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user