[gtksourceview/gtksourcecompletion] Changed API from const GdkPixbuf to GdkPixbuf and implemented defaults for proposal interface functi
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: svn-commits-list gnome org
- Subject: [gtksourceview/gtksourcecompletion] Changed API from const GdkPixbuf to GdkPixbuf and implemented defaults for proposal interface functi
- Date: Sat, 18 Apr 2009 08:40:59 -0400 (EDT)
commit cd124775fcca088a20fe2d4d3c85acd25905636f
Author: Jesse van den Kieboom <jesse icecrew nl>
Date: Sat Apr 18 14:38:40 2009 +0200
Changed API from const GdkPixbuf to GdkPixbuf and implemented defaults for proposal interface functions
Returning const GdkPixbuf was giving some problems in bindings, and it did not seem too important/useful to return a const (the docs should describe it's not a reference and should not be unreffed).
---
gtksourceview/gtksourcecompletionproposal.c | 44 ++++++++++----------------
gtksourceview/gtksourcecompletionproposal.h | 4 +-
gtksourceview/gtksourcecompletionprovider.c | 4 +-
gtksourceview/gtksourcecompletionprovider.h | 4 +-
4 files changed, 23 insertions(+), 33 deletions(-)
diff --git a/gtksourceview/gtksourcecompletionproposal.c b/gtksourceview/gtksourcecompletionproposal.c
index 2ae0df8..8e5d3cc 100644
--- a/gtksourceview/gtksourcecompletionproposal.c
+++ b/gtksourceview/gtksourcecompletionproposal.c
@@ -50,12 +50,26 @@ gtk_source_completion_proposal_get_label_default (GtkSourceCompletionProposal *p
g_return_val_if_reached (NULL);
}
+static GdkPixbuf *
+gtk_source_completion_proposal_get_icon_default (GtkSourceCompletionProposal *proposal)
+{
+ return NULL;
+}
+
+static const gchar *
+gtk_source_completion_proposal_get_info_default (GtkSourceCompletionProposal *proposal)
+{
+ return NULL;
+}
+
static void
gtk_source_completion_proposal_init (GtkSourceCompletionProposalIface *iface)
{
static gboolean initialized = FALSE;
iface->get_label = gtk_source_completion_proposal_get_label_default;
+ iface->get_icon = gtk_source_completion_proposal_get_icon_default;
+ iface->get_info = gtk_source_completion_proposal_get_info_default;
if (!initialized)
{
@@ -128,23 +142,11 @@ gtk_source_completion_proposal_get_label (GtkSourceCompletionProposal *proposal)
*
* Returns: The icon of @proposal
*/
-const GdkPixbuf *
+GdkPixbuf *
gtk_source_completion_proposal_get_icon (GtkSourceCompletionProposal *proposal)
{
- GtkSourceCompletionProposalIface *iface;
-
g_return_val_if_fail (GTK_IS_SOURCE_COMPLETION_PROPOSAL (proposal), NULL);
-
- iface = GTK_SOURCE_COMPLETION_PROPOSAL_GET_INTERFACE (proposal);
-
- if (iface->get_icon)
- {
- return iface->get_icon (proposal);
- }
- else
- {
- return NULL;
- }
+ return GTK_SOURCE_COMPLETION_PROPOSAL_GET_INTERFACE (proposal)->get_icon (proposal);
}
/**
@@ -161,20 +163,8 @@ gtk_source_completion_proposal_get_icon (GtkSourceCompletionProposal *proposal)
const gchar *
gtk_source_completion_proposal_get_info (GtkSourceCompletionProposal *proposal)
{
- GtkSourceCompletionProposalIface *iface;
-
g_return_val_if_fail (GTK_IS_SOURCE_COMPLETION_PROPOSAL (proposal), NULL);
-
- iface = GTK_SOURCE_COMPLETION_PROPOSAL_GET_INTERFACE (proposal);
-
- if (iface->get_info)
- {
- return iface->get_info (proposal);
- }
- else
- {
- return NULL;
- }
+ return GTK_SOURCE_COMPLETION_PROPOSAL_GET_INTERFACE (proposal)->get_info (proposal);
}
/**
diff --git a/gtksourceview/gtksourcecompletionproposal.h b/gtksourceview/gtksourcecompletionproposal.h
index cbc8567..34aa4a5 100644
--- a/gtksourceview/gtksourcecompletionproposal.h
+++ b/gtksourceview/gtksourcecompletionproposal.h
@@ -48,7 +48,7 @@ struct _GtkSourceCompletionProposalIface
/* Interface functions */
const gchar *(*get_label) (GtkSourceCompletionProposal *proposal);
- const GdkPixbuf *(*get_icon) (GtkSourceCompletionProposal *proposal);
+ GdkPixbuf *(*get_icon) (GtkSourceCompletionProposal *proposal);
const gchar *(*get_info) (GtkSourceCompletionProposal *proposal);
};
@@ -56,7 +56,7 @@ struct _GtkSourceCompletionProposalIface
GType gtk_source_completion_proposal_get_type (void) G_GNUC_CONST;
const gchar *gtk_source_completion_proposal_get_label (GtkSourceCompletionProposal *proposal);
-const GdkPixbuf *gtk_source_completion_proposal_get_icon (GtkSourceCompletionProposal *proposal);
+GdkPixbuf *gtk_source_completion_proposal_get_icon (GtkSourceCompletionProposal *proposal);
const gchar *gtk_source_completion_proposal_get_info (GtkSourceCompletionProposal *proposal);
gboolean gtk_source_completion_proposal_activate (GtkSourceCompletionProposal *proposal,
diff --git a/gtksourceview/gtksourcecompletionprovider.c b/gtksourceview/gtksourcecompletionprovider.c
index c902388..8494b10 100644
--- a/gtksourceview/gtksourcecompletionprovider.c
+++ b/gtksourceview/gtksourcecompletionprovider.c
@@ -40,7 +40,7 @@ gtk_source_completion_provider_get_name_default (GtkSourceCompletionProvider *pr
g_return_val_if_reached (NULL);
}
-static const GdkPixbuf *
+static GdkPixbuf *
gtk_source_completion_provider_get_icon_default (GtkSourceCompletionProvider *provider)
{
return NULL;
@@ -163,7 +163,7 @@ gtk_source_completion_provider_get_name (GtkSourceCompletionProvider *provider)
*
* Returns: The icon to be used for the provider, or %NULL
*/
-const GdkPixbuf *
+GdkPixbuf *
gtk_source_completion_provider_get_icon (GtkSourceCompletionProvider *provider)
{
g_return_val_if_fail (GTK_IS_SOURCE_COMPLETION_PROVIDER (provider), NULL);
diff --git a/gtksourceview/gtksourcecompletionprovider.h b/gtksourceview/gtksourcecompletionprovider.h
index 039f8df..614d4f3 100644
--- a/gtksourceview/gtksourcecompletionprovider.h
+++ b/gtksourceview/gtksourcecompletionprovider.h
@@ -45,7 +45,7 @@ struct _GtkSourceCompletionProviderIface
GTypeInterface g_iface;
const gchar *(*get_name) (GtkSourceCompletionProvider *provider);
- const GdkPixbuf *(*get_icon) (GtkSourceCompletionProvider *provider);
+ GdkPixbuf *(*get_icon) (GtkSourceCompletionProvider *provider);
GList *(*get_proposals) (GtkSourceCompletionProvider *provider);
gboolean (*filter_proposal) (GtkSourceCompletionProvider *provider,
GtkSourceCompletionProposal *proposal,
@@ -66,7 +66,7 @@ GType gtk_source_completion_provider_get_type (void);
const gchar *gtk_source_completion_provider_get_name (GtkSourceCompletionProvider *provider);
-const GdkPixbuf *gtk_source_completion_provider_get_icon (GtkSourceCompletionProvider *provider);
+GdkPixbuf *gtk_source_completion_provider_get_icon (GtkSourceCompletionProvider *provider);
GList *gtk_source_completion_provider_get_proposals (GtkSourceCompletionProvider *provider);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]