summaryrefslogtreecommitdiff
path: root/thunarx
diff options
context:
space:
mode:
authorBenedikt Meurer <benny@xfce.org>2006-03-24 14:46:35 +0000
committerBenedikt Meurer <benny@xfce.org>2006-03-24 14:46:35 +0000
commit3291a47e988c8074aa1d7dfa54a98f7ab8930175 (patch)
treeae95130d0f5c1c38d55f51602a6b0933ac84218b /thunarx
parentf15ff94d884c7666c275dc8a64a5d9aea8c376c9 (diff)
downloadthunar-3291a47e988c8074aa1d7dfa54a98f7ab8930175.tar.gz
2006-03-24 Benedikt Meurer <benny@xfce.org>
* plugins/thunar-sbr/thunar-sbr-case-renamer.h, plugins/thunar-sbr/thunar-sbr-insert-renamer.h, plugins/thunar-sbr/thunar-sbr-remove-renamer.h, plugins/thunar-sbr/thunar-sbr-replace-renamer.h: Fix typos. * docs/reference/thunarx/tmpl/thunarx-file-info.sgml, thunarx/thunarx-file-info.c: Register the "changed" and "renamed" signals right after the type is registered. This way gtk-doc will properly display the signals (gtk-doc doesn't invoke base_init() for interfaces). Bug #1418. * docs/reference/thunarx/tmpl/thunarx-property-page-provider.sgml, docs/reference/thunarx/tmpl/thunarx-property-page.sgml, thunarx/thunarx-property-page-provider.c: Properly document ThunarxPropertyPage and ThunarxPropertyPageProvider. Bug #1456. (Old svn revision: 20531)
Diffstat (limited to 'thunarx')
-rw-r--r--thunarx/thunarx-file-info.c31
-rw-r--r--thunarx/thunarx-property-page-provider.c24
2 files changed, 31 insertions, 24 deletions
diff --git a/thunarx/thunarx-file-info.c b/thunarx/thunarx-file-info.c
index 5c555797..d4340f4f 100644
--- a/thunarx/thunarx-file-info.c
+++ b/thunarx/thunarx-file-info.c
@@ -38,10 +38,6 @@ enum
-static void thunarx_file_info_base_init (gpointer klass);
-
-
-
static guint file_info_signals[LAST_SIGNAL];
@@ -56,7 +52,7 @@ thunarx_file_info_get_type (void)
static const GTypeInfo info =
{
sizeof (ThunarxFileInfoIface),
- (GBaseInitFunc) thunarx_file_info_base_init,
+ NULL,
NULL,
NULL,
NULL,
@@ -67,22 +63,12 @@ thunarx_file_info_get_type (void)
NULL,
};
+ /* register the interface type */
type = g_type_register_static (G_TYPE_INTERFACE, I_("ThunarxFileInfo"), &info, 0);
- g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
- }
-
- return type;
-}
+ /* implementations must inherit GObject */
+ g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
-
-static void
-thunarx_file_info_base_init (gpointer klass)
-{
- static gboolean initialized = FALSE;
-
- if (G_UNLIKELY (!initialized))
- {
/**
* ThunarxFileInfo::changed:
* @file_info : a #ThunarxFileInfo.
@@ -96,7 +82,7 @@ thunarx_file_info_base_init (gpointer klass)
**/
file_info_signals[CHANGED] =
g_signal_new (I_("changed"),
- G_TYPE_FROM_CLASS (klass),
+ type,
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (ThunarxFileInfoIface, changed),
NULL, NULL,
@@ -116,16 +102,15 @@ thunarx_file_info_base_init (gpointer klass)
**/
file_info_signals[RENAMED] =
g_signal_new (I_("renamed"),
- G_TYPE_FROM_CLASS (klass),
+ type,
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (ThunarxFileInfoIface, renamed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
-
- /* yep, we're initialized now */
- initialized = TRUE;
}
+
+ return type;
}
diff --git a/thunarx/thunarx-property-page-provider.c b/thunarx/thunarx-property-page-provider.c
index d45f3caf..0cb9fd87 100644
--- a/thunarx/thunarx-property-page-provider.c
+++ b/thunarx/thunarx-property-page-provider.c
@@ -1,6 +1,6 @@
/* $Id$ */
/*-
- * Copyright (c) 2005 Benedikt Meurer <benny@xfce.org>
+ * Copyright (c) 2005-2006 Benedikt Meurer <benny@xfce.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -66,6 +66,28 @@ thunarx_property_page_provider_get_type (void)
*
* Returns the list of #ThunarxPropertyPage<!---->s that @provider has to offer for @files.
*
+ * Extensions that implement this interface, must first check whether they support all the
+ * #ThunarxFileInfo<!---->s in the list of @files. Most extensions will probably only support
+ * #ThunarxPropertyPage<!---->s for exactly one file of a certain type. For example an MP3-Tag
+ * editor property page will most probably support only a single audio file, and so the method
+ * would be implemented like this
+ * <informalexample><programlisting>
+ * GList*
+ * tag_provider_get_pages (ThunarxPropertyPageProvider *property_page_provider,
+ * GList *files)
+ * {
+ * if (g_list_length (files) != 1)
+ * return NULL;
+ * else if (!thunarx_file_info_has_mime_type (files->data, "audio/mp3"))
+ * return NULL;
+ * else
+ * return g_list_append (NULL, tag_page_new (files->data));
+ * }
+ * </programlisting></informalexample>
+ * where tag_page_new() allocates a new #TagPage instance for a #ThunarxFileInfo object
+ * passed to it. See the description of the #ThunarxPropertyPage class for additional
+ * information about the #TagPage example class.
+ *
* As a special note, this method automatically takes a reference on the
* @provider for every #ThunarxPropertyPage object returned from the real implementation
* of this method in @provider. This is to make sure that the extension stays