diff options
author | Carlos Soriano <csoriano@gnome.org> | 2016-08-29 18:24:05 +0200 |
---|---|---|
committer | Carlos Soriano <csoriano@gnome.org> | 2016-08-29 18:37:10 +0200 |
commit | 52d960542b4d5fdf2bd06735d0dbf7934cf2ec12 (patch) | |
tree | 5e000d5ed40b52b003c02b597e51ae0b87ff22ac /libnautilus-extension | |
parent | 4cafccd82859a4ee0bdfad3e31a310f2d94c0485 (diff) | |
download | nautilus-52d960542b4d5fdf2bd06735d0dbf7934cf2ec12.tar.gz |
general: run uncrustify
And make the style of Nautilus the same for all files.
Hopefully we can fix all the style issues we can find in the next days,
so expect a little of movement on this.
https://bugzilla.gnome.org/show_bug.cgi?id=770564
Diffstat (limited to 'libnautilus-extension')
-rw-r--r-- | libnautilus-extension/nautilus-column-provider.c | 58 | ||||
-rw-r--r-- | libnautilus-extension/nautilus-column.c | 404 | ||||
-rw-r--r-- | libnautilus-extension/nautilus-extension-types.c | 56 | ||||
-rw-r--r-- | libnautilus-extension/nautilus-file-info.c | 268 | ||||
-rw-r--r-- | libnautilus-extension/nautilus-info-provider.c | 138 | ||||
-rw-r--r-- | libnautilus-extension/nautilus-location-widget-provider.c | 63 | ||||
-rw-r--r-- | libnautilus-extension/nautilus-menu-item.c | 505 | ||||
-rw-r--r-- | libnautilus-extension/nautilus-menu-provider.c | 125 | ||||
-rw-r--r-- | libnautilus-extension/nautilus-menu.c | 77 | ||||
-rw-r--r-- | libnautilus-extension/nautilus-property-page-provider.c | 60 | ||||
-rw-r--r-- | libnautilus-extension/nautilus-property-page.c | 340 |
11 files changed, 1122 insertions, 972 deletions
diff --git a/libnautilus-extension/nautilus-column-provider.c b/libnautilus-extension/nautilus-column-provider.c index 7732592da..22519a635 100644 --- a/libnautilus-extension/nautilus-column-provider.c +++ b/libnautilus-extension/nautilus-column-provider.c @@ -1,5 +1,5 @@ /* - * nautilus-column-provider.c - Interface for Nautilus extensions + * nautilus-column-provider.c - Interface for Nautilus extensions * that provide column specifications. * * Copyright (C) 2003 Novell, Inc. @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU Library General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. - * + * * Author: Dave Camp <dave@ximian.com> * */ @@ -41,31 +41,33 @@ nautilus_column_provider_base_init (gpointer g_class) { } -GType +GType nautilus_column_provider_get_type (void) { - static GType type = 0; + static GType type = 0; + + if (!type) + { + const GTypeInfo info = + { + sizeof (NautilusColumnProviderIface), + nautilus_column_provider_base_init, + NULL, + NULL, + NULL, + NULL, + 0, + 0, + NULL + }; - if (!type) { - const GTypeInfo info = { - sizeof (NautilusColumnProviderIface), - nautilus_column_provider_base_init, - NULL, - NULL, - NULL, - NULL, - 0, - 0, - NULL - }; - - type = g_type_register_static (G_TYPE_INTERFACE, - "NautilusColumnProvider", - &info, 0); - g_type_interface_add_prerequisite (type, G_TYPE_OBJECT); - } + type = g_type_register_static (G_TYPE_INTERFACE, + "NautilusColumnProvider", + &info, 0); + g_type_interface_add_prerequisite (type, G_TYPE_OBJECT); + } - return type; + return type; } /** @@ -77,11 +79,9 @@ nautilus_column_provider_get_type (void) GList * nautilus_column_provider_get_columns (NautilusColumnProvider *provider) { - g_return_val_if_fail (NAUTILUS_IS_COLUMN_PROVIDER (provider), NULL); - g_return_val_if_fail (NAUTILUS_COLUMN_PROVIDER_GET_IFACE (provider)->get_columns != NULL, NULL); + g_return_val_if_fail (NAUTILUS_IS_COLUMN_PROVIDER (provider), NULL); + g_return_val_if_fail (NAUTILUS_COLUMN_PROVIDER_GET_IFACE (provider)->get_columns != NULL, NULL); - return NAUTILUS_COLUMN_PROVIDER_GET_IFACE (provider)->get_columns - (provider); + return NAUTILUS_COLUMN_PROVIDER_GET_IFACE (provider)->get_columns + (provider); } - - diff --git a/libnautilus-extension/nautilus-column.c b/libnautilus-extension/nautilus-column.c index 29e6149cd..fdf83204c 100644 --- a/libnautilus-extension/nautilus-column.c +++ b/libnautilus-extension/nautilus-column.c @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU Library General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. - * + * * Author: Dave Camp <dave@ximian.com> * */ @@ -26,25 +26,27 @@ #include <gtk/gtk.h> #include "nautilus-column.h" -enum { - PROP_0, - PROP_NAME, - PROP_ATTRIBUTE, - PROP_ATTRIBUTE_Q, - PROP_LABEL, - PROP_DESCRIPTION, - PROP_XALIGN, - PROP_DEFAULT_SORT_ORDER, - LAST_PROP +enum +{ + PROP_0, + PROP_NAME, + PROP_ATTRIBUTE, + PROP_ATTRIBUTE_Q, + PROP_LABEL, + PROP_DESCRIPTION, + PROP_XALIGN, + PROP_DEFAULT_SORT_ORDER, + LAST_PROP }; -struct _NautilusColumnDetails { - char *name; - GQuark attribute; - char *label; - char *description; - float xalign; - GtkSortType default_sort_order; +struct _NautilusColumnDetails +{ + char *name; + GQuark attribute; + char *label; + char *description; + float xalign; + GtkSortType default_sort_order; }; G_DEFINE_TYPE (NautilusColumn, nautilus_column, G_TYPE_OBJECT); @@ -75,192 +77,236 @@ G_DEFINE_TYPE (NautilusColumn, nautilus_column, G_TYPE_OBJECT); */ NautilusColumn * nautilus_column_new (const char *name, - const char *attribute, - const char *label, - const char *description) + const char *attribute, + const char *label, + const char *description) { - NautilusColumn *column; - - g_return_val_if_fail (name != NULL, NULL); - g_return_val_if_fail (attribute != NULL, NULL); - g_return_val_if_fail (label != NULL, NULL); - g_return_val_if_fail (description != NULL, NULL); - - column = g_object_new (NAUTILUS_TYPE_COLUMN, - "name", name, - "attribute", attribute, - "label", label, - "description", description, - NULL); - - return column; + NautilusColumn *column; + + g_return_val_if_fail (name != NULL, NULL); + g_return_val_if_fail (attribute != NULL, NULL); + g_return_val_if_fail (label != NULL, NULL); + g_return_val_if_fail (description != NULL, NULL); + + column = g_object_new (NAUTILUS_TYPE_COLUMN, + "name", name, + "attribute", attribute, + "label", label, + "description", description, + NULL); + + return column; } static void -nautilus_column_get_property (GObject *object, - guint param_id, - GValue *value, - GParamSpec *pspec) +nautilus_column_get_property (GObject *object, + guint param_id, + GValue *value, + GParamSpec *pspec) { - NautilusColumn *column; - - column = NAUTILUS_COLUMN (object); - - switch (param_id) { - case PROP_NAME : - g_value_set_string (value, column->details->name); - break; - case PROP_ATTRIBUTE : - g_value_set_string (value, g_quark_to_string (column->details->attribute)); - break; - case PROP_ATTRIBUTE_Q : - g_value_set_uint (value, column->details->attribute); - break; - case PROP_LABEL : - g_value_set_string (value, column->details->label); - break; - case PROP_DESCRIPTION : - g_value_set_string (value, column->details->description); - break; - case PROP_XALIGN : - g_value_set_float (value, column->details->xalign); - break; - case PROP_DEFAULT_SORT_ORDER : - g_value_set_enum (value, column->details->default_sort_order); - break; - default : - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); - break; - } + NautilusColumn *column; + + column = NAUTILUS_COLUMN (object); + + switch (param_id) + { + case PROP_NAME: + { + g_value_set_string (value, column->details->name); + } + break; + + case PROP_ATTRIBUTE: + { + g_value_set_string (value, g_quark_to_string (column->details->attribute)); + } + break; + + case PROP_ATTRIBUTE_Q: + { + g_value_set_uint (value, column->details->attribute); + } + break; + + case PROP_LABEL: + { + g_value_set_string (value, column->details->label); + } + break; + + case PROP_DESCRIPTION: + { + g_value_set_string (value, column->details->description); + } + break; + + case PROP_XALIGN: + { + g_value_set_float (value, column->details->xalign); + } + break; + + case PROP_DEFAULT_SORT_ORDER: + { + g_value_set_enum (value, column->details->default_sort_order); + } + break; + + default: + { + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); + } + break; + } } static void -nautilus_column_set_property (GObject *object, - guint param_id, - const GValue *value, - GParamSpec *pspec) +nautilus_column_set_property (GObject *object, + guint param_id, + const GValue *value, + GParamSpec *pspec) { - NautilusColumn *column; - - column = NAUTILUS_COLUMN (object); - - switch (param_id) { - case PROP_NAME : - g_free (column->details->name); - column->details->name = g_strdup (g_value_get_string (value)); - g_object_notify (object, "name"); - break; - case PROP_ATTRIBUTE : - column->details->attribute = g_quark_from_string (g_value_get_string (value)); - g_object_notify (object, "attribute"); - g_object_notify (object, "attribute_q"); - break; - case PROP_LABEL : - g_free (column->details->label); - column->details->label = g_strdup (g_value_get_string (value)); - g_object_notify (object, "label"); - break; - case PROP_DESCRIPTION : - g_free (column->details->description); - column->details->description = g_strdup (g_value_get_string (value)); - g_object_notify (object, "description"); - break; - case PROP_XALIGN : - column->details->xalign = g_value_get_float (value); - g_object_notify (object, "xalign"); - break; - case PROP_DEFAULT_SORT_ORDER : - column->details->default_sort_order = g_value_get_enum (value); - g_object_notify (object, "default-sort-order"); - break; - default : - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); - break; - } + NautilusColumn *column; + + column = NAUTILUS_COLUMN (object); + + switch (param_id) + { + case PROP_NAME: + { + g_free (column->details->name); + column->details->name = g_strdup (g_value_get_string (value)); + g_object_notify (object, "name"); + } + break; + + case PROP_ATTRIBUTE: + { + column->details->attribute = g_quark_from_string (g_value_get_string (value)); + g_object_notify (object, "attribute"); + g_object_notify (object, "attribute_q"); + } + break; + + case PROP_LABEL: + { + g_free (column->details->label); + column->details->label = g_strdup (g_value_get_string (value)); + g_object_notify (object, "label"); + } + break; + + case PROP_DESCRIPTION: + { + g_free (column->details->description); + column->details->description = g_strdup (g_value_get_string (value)); + g_object_notify (object, "description"); + } + break; + + case PROP_XALIGN: + { + column->details->xalign = g_value_get_float (value); + g_object_notify (object, "xalign"); + } + break; + + case PROP_DEFAULT_SORT_ORDER: + { + column->details->default_sort_order = g_value_get_enum (value); + g_object_notify (object, "default-sort-order"); + } + break; + + default: + { + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); + } + break; + } } static void nautilus_column_finalize (GObject *object) { - NautilusColumn *column; - - column = NAUTILUS_COLUMN (object); + NautilusColumn *column; + + column = NAUTILUS_COLUMN (object); - g_free (column->details->name); - g_free (column->details->label); - g_free (column->details->description); + g_free (column->details->name); + g_free (column->details->label); + g_free (column->details->description); - g_free (column->details); + g_free (column->details); - G_OBJECT_CLASS (nautilus_column_parent_class)->finalize (object); + G_OBJECT_CLASS (nautilus_column_parent_class)->finalize (object); } static void nautilus_column_init (NautilusColumn *column) { - column->details = g_new0 (NautilusColumnDetails, 1); - column->details->xalign = 0.0; + column->details = g_new0 (NautilusColumnDetails, 1); + column->details->xalign = 0.0; } static void nautilus_column_class_init (NautilusColumnClass *class) { - G_OBJECT_CLASS (class)->finalize = nautilus_column_finalize; - G_OBJECT_CLASS (class)->get_property = nautilus_column_get_property; - G_OBJECT_CLASS (class)->set_property = nautilus_column_set_property; - - g_object_class_install_property (G_OBJECT_CLASS (class), - PROP_NAME, - g_param_spec_string ("name", - "Name", - "Name of the column", - NULL, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE | G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (class), - PROP_ATTRIBUTE, - g_param_spec_string ("attribute", - "Attribute", - "The attribute name to display", - NULL, - G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (class), - PROP_ATTRIBUTE_Q, - g_param_spec_uint ("attribute_q", - "Attribute quark", - "The attribute name to display, in quark form", - 0, G_MAXUINT, 0, - G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (class), - PROP_LABEL, - g_param_spec_string ("label", - "Label", - "Label to display in the column", - NULL, - G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (class), - PROP_DESCRIPTION, - g_param_spec_string ("description", - "Description", - "A user-visible description of the column", - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property (G_OBJECT_CLASS (class), - PROP_XALIGN, - g_param_spec_float ("xalign", - "xalign", - "The x-alignment of the column", - 0.0, - 1.0, - 0.0, - G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (class), - PROP_DEFAULT_SORT_ORDER, - g_param_spec_enum ("default-sort-order", - "Default sort order", - "Default sort order", - GTK_TYPE_SORT_TYPE, - GTK_SORT_ASCENDING, - G_PARAM_READWRITE)); -} + G_OBJECT_CLASS (class)->finalize = nautilus_column_finalize; + G_OBJECT_CLASS (class)->get_property = nautilus_column_get_property; + G_OBJECT_CLASS (class)->set_property = nautilus_column_set_property; + + g_object_class_install_property (G_OBJECT_CLASS (class), + PROP_NAME, + g_param_spec_string ("name", + "Name", + "Name of the column", + NULL, + G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE | G_PARAM_READABLE)); + g_object_class_install_property (G_OBJECT_CLASS (class), + PROP_ATTRIBUTE, + g_param_spec_string ("attribute", + "Attribute", + "The attribute name to display", + NULL, + G_PARAM_READWRITE)); + g_object_class_install_property (G_OBJECT_CLASS (class), + PROP_ATTRIBUTE_Q, + g_param_spec_uint ("attribute_q", + "Attribute quark", + "The attribute name to display, in quark form", + 0, G_MAXUINT, 0, + G_PARAM_READABLE)); + g_object_class_install_property (G_OBJECT_CLASS (class), + PROP_LABEL, + g_param_spec_string ("label", + "Label", + "Label to display in the column", + NULL, + G_PARAM_READWRITE)); + g_object_class_install_property (G_OBJECT_CLASS (class), + PROP_DESCRIPTION, + g_param_spec_string ("description", + "Description", + "A user-visible description of the column", + NULL, + G_PARAM_READWRITE)); + g_object_class_install_property (G_OBJECT_CLASS (class), + PROP_XALIGN, + g_param_spec_float ("xalign", + "xalign", + "The x-alignment of the column", + 0.0, + 1.0, + 0.0, + G_PARAM_READWRITE)); + g_object_class_install_property (G_OBJECT_CLASS (class), + PROP_DEFAULT_SORT_ORDER, + g_param_spec_enum ("default-sort-order", + "Default sort order", + "Default sort order", + GTK_TYPE_SORT_TYPE, + GTK_SORT_ASCENDING, + G_PARAM_READWRITE)); +} diff --git a/libnautilus-extension/nautilus-extension-types.c b/libnautilus-extension/nautilus-extension-types.c index 31f3ec8ea..f61d5db11 100644 --- a/libnautilus-extension/nautilus-extension-types.c +++ b/libnautilus-extension/nautilus-extension-types.c @@ -1,6 +1,6 @@ /* * nautilus-extension-types.c - Type definitions for Nautilus extensions - * + * * Copyright (C) 2003 Novell, Inc. * * This library is free software; you can redistribute it and/or @@ -17,7 +17,7 @@ * License along with this library; if not, see <http://www.gnu.org/licenses/>. * * Author: Dave Camp <dave@ximian.com> - * + * */ #include <config.h> @@ -27,30 +27,32 @@ GType nautilus_operation_result_get_type (void) { - static GType type = 0; - if (type == 0) { - static const GEnumValue values[] = { - { - NAUTILUS_OPERATION_COMPLETE, - "NAUTILUS_OPERATION_COMPLETE", - "complete", - }, - { - NAUTILUS_OPERATION_FAILED, - "NAUTILUS_OPERATION_FAILED", - "failed", - }, - { - NAUTILUS_OPERATION_IN_PROGRESS, - "NAUTILUS_OPERATION_IN_PROGRESS", - "in_progress", - }, - { 0, NULL, NULL } - }; - - type = g_enum_register_static ("NautilusOperationResult", - values); - } + static GType type = 0; + if (type == 0) + { + static const GEnumValue values[] = + { + { + NAUTILUS_OPERATION_COMPLETE, + "NAUTILUS_OPERATION_COMPLETE", + "complete", +}, + { + NAUTILUS_OPERATION_FAILED, + "NAUTILUS_OPERATION_FAILED", + "failed", +}, + { + NAUTILUS_OPERATION_IN_PROGRESS, + "NAUTILUS_OPERATION_IN_PROGRESS", + "in_progress", +}, + { 0, NULL, NULL } + }; + + type = g_enum_register_static ("NautilusOperationResult", + values); + } - return type; + return type; } diff --git a/libnautilus-extension/nautilus-file-info.c b/libnautilus-extension/nautilus-file-info.c index 329d5e5cb..2f2a46b93 100644 --- a/libnautilus-extension/nautilus-file-info.c +++ b/libnautilus-extension/nautilus-file-info.c @@ -1,5 +1,5 @@ /* - * nautilus-file-info.c - Information about a file + * nautilus-file-info.c - Information about a file * * Copyright (C) 2003 Novell, Inc. * @@ -22,7 +22,7 @@ #include "nautilus-file-info.h" #include "nautilus-extension-private.h" -NautilusFileInfo *(*nautilus_file_info_getter) (GFile *location, gboolean create); +NautilusFileInfo *(*nautilus_file_info_getter)(GFile * location, gboolean create); /** * SECTION:nautilus-file-info @@ -44,15 +44,16 @@ NautilusFileInfo *(*nautilus_file_info_getter) (GFile *location, gboolean create GList * nautilus_file_info_list_copy (GList *files) { - GList *ret; - GList *l; - - ret = g_list_copy (files); - for (l = ret; l != NULL; l = l->next) { - g_object_ref (G_OBJECT (l->data)); - } - - return ret; + GList *ret; + GList *l; + + ret = g_list_copy (files); + for (l = ret; l != NULL; l = l->next) + { + g_object_ref (G_OBJECT (l->data)); + } + + return ret; } /** @@ -61,16 +62,17 @@ nautilus_file_info_list_copy (GList *files) * #nautilus_file_info_list_copy * */ -void +void nautilus_file_info_list_free (GList *files) { - GList *l; - - for (l = files; l != NULL; l = l->next) { - g_object_unref (G_OBJECT (l->data)); - } - - g_list_free (files); + GList *l; + + for (l = files; l != NULL; l = l->next) + { + g_object_unref (G_OBJECT (l->data)); + } + + g_list_free (files); } static void @@ -78,58 +80,60 @@ nautilus_file_info_base_init (gpointer g_class) { } -GType +GType nautilus_file_info_get_type (void) { - static GType type = 0; - - if (!type) { - const GTypeInfo info = { - sizeof (NautilusFileInfoIface), - nautilus_file_info_base_init, - NULL, - NULL, - NULL, - NULL, - 0, - 0, - NULL - }; - - type = g_type_register_static (G_TYPE_INTERFACE, - "NautilusFileInfo", - &info, 0); - g_type_interface_add_prerequisite (type, G_TYPE_OBJECT); - } - - return type; + static GType type = 0; + + if (!type) + { + const GTypeInfo info = + { + sizeof (NautilusFileInfoIface), + nautilus_file_info_base_init, + NULL, + NULL, + NULL, + NULL, + 0, + 0, + NULL + }; + + type = g_type_register_static (G_TYPE_INTERFACE, + "NautilusFileInfo", + &info, 0); + g_type_interface_add_prerequisite (type, G_TYPE_OBJECT); + } + + return type; } gboolean nautilus_file_info_is_gone (NautilusFileInfo *file) { - g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), FALSE); - g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->is_gone != NULL, FALSE); - - return NAUTILUS_FILE_INFO_GET_IFACE (file)->is_gone (file); + g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), FALSE); + g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->is_gone != NULL, FALSE); + + return NAUTILUS_FILE_INFO_GET_IFACE (file)->is_gone (file); } GFileType nautilus_file_info_get_file_type (NautilusFileInfo *file) { - g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), G_FILE_TYPE_UNKNOWN); - g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->get_file_type != NULL, G_FILE_TYPE_UNKNOWN); + g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), G_FILE_TYPE_UNKNOWN); + g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->get_file_type != NULL, G_FILE_TYPE_UNKNOWN); - return NAUTILUS_FILE_INFO_GET_IFACE (file)->get_file_type (file); + return NAUTILUS_FILE_INFO_GET_IFACE (file)->get_file_type (file); } char * nautilus_file_info_get_name (NautilusFileInfo *file) { - g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), NULL); - g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->get_name != NULL, NULL); + g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), NULL); + g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->get_name != NULL, NULL); - return NAUTILUS_FILE_INFO_GET_IFACE (file)->get_name (file); + return NAUTILUS_FILE_INFO_GET_IFACE (file)->get_name (file); } /** @@ -141,177 +145,177 @@ nautilus_file_info_get_name (NautilusFileInfo *file) GFile * nautilus_file_info_get_location (NautilusFileInfo *file) { - g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), NULL); - g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->get_location != NULL, NULL); + g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), NULL); + g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->get_location != NULL, NULL); - return NAUTILUS_FILE_INFO_GET_IFACE (file)->get_location (file); + return NAUTILUS_FILE_INFO_GET_IFACE (file)->get_location (file); } char * nautilus_file_info_get_uri (NautilusFileInfo *file) { - g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), NULL); - g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->get_uri != NULL, NULL); + g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), NULL); + g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->get_uri != NULL, NULL); - return NAUTILUS_FILE_INFO_GET_IFACE (file)->get_uri (file); + return NAUTILUS_FILE_INFO_GET_IFACE (file)->get_uri (file); } char * nautilus_file_info_get_activation_uri (NautilusFileInfo *file) { - g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), NULL); - g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->get_activation_uri != NULL, NULL); + g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), NULL); + g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->get_activation_uri != NULL, NULL); - return NAUTILUS_FILE_INFO_GET_IFACE (file)->get_activation_uri (file); + return NAUTILUS_FILE_INFO_GET_IFACE (file)->get_activation_uri (file); } /** * nautilus_file_info_get_parent_location: * @file: a #NautilusFileInfo * - * Returns: (allow-none) (transfer full): a #GFile for the parent location of @file, + * Returns: (allow-none) (transfer full): a #GFile for the parent location of @file, * or %NULL if @file has no parent */ GFile * nautilus_file_info_get_parent_location (NautilusFileInfo *file) { - g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), NULL); - g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->get_parent_location != NULL, NULL); + g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), NULL); + g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->get_parent_location != NULL, NULL); - return NAUTILUS_FILE_INFO_GET_IFACE (file)->get_parent_location (file); + return NAUTILUS_FILE_INFO_GET_IFACE (file)->get_parent_location (file); } char * nautilus_file_info_get_parent_uri (NautilusFileInfo *file) { - g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), NULL); - g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->get_parent_uri != NULL, NULL); + g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), NULL); + g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->get_parent_uri != NULL, NULL); - return NAUTILUS_FILE_INFO_GET_IFACE (file)->get_parent_uri (file); + return NAUTILUS_FILE_INFO_GET_IFACE (file)->get_parent_uri (file); } /** * nautilus_file_info_get_parent_info: * @file: a #NautilusFileInfo * - * Returns: (allow-none) (transfer full): a #NautilusFileInfo for the parent of @file, + * Returns: (allow-none) (transfer full): a #NautilusFileInfo for the parent of @file, * or %NULL if @file has no parent */ NautilusFileInfo * nautilus_file_info_get_parent_info (NautilusFileInfo *file) { - g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), NULL); - g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->get_parent_info != NULL, NULL); + g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), NULL); + g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->get_parent_info != NULL, NULL); - return NAUTILUS_FILE_INFO_GET_IFACE (file)->get_parent_info (file); + return NAUTILUS_FILE_INFO_GET_IFACE (file)->get_parent_info (file); } /** * nautilus_file_info_get_mount: * @file: a #NautilusFileInfo * - * Returns: (allow-none) (transfer full): a #GMount for the mount of @file, + * Returns: (allow-none) (transfer full): a #GMount for the mount of @file, * or %NULL if @file has no mount */ GMount * nautilus_file_info_get_mount (NautilusFileInfo *file) { - g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), NULL); - g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->get_mount != NULL, NULL); - - return NAUTILUS_FILE_INFO_GET_IFACE (file)->get_mount (file); + g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), NULL); + g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->get_mount != NULL, NULL); + + return NAUTILUS_FILE_INFO_GET_IFACE (file)->get_mount (file); } char * nautilus_file_info_get_uri_scheme (NautilusFileInfo *file) { - g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), NULL); - g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->get_uri_scheme != NULL, NULL); + g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), NULL); + g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->get_uri_scheme != NULL, NULL); - return NAUTILUS_FILE_INFO_GET_IFACE (file)->get_uri_scheme (file); + return NAUTILUS_FILE_INFO_GET_IFACE (file)->get_uri_scheme (file); } char * nautilus_file_info_get_mime_type (NautilusFileInfo *file) { - g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), NULL); - g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->get_mime_type != NULL, NULL); + g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), NULL); + g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->get_mime_type != NULL, NULL); - return NAUTILUS_FILE_INFO_GET_IFACE (file)->get_mime_type (file); + return NAUTILUS_FILE_INFO_GET_IFACE (file)->get_mime_type (file); } gboolean nautilus_file_info_is_mime_type (NautilusFileInfo *file, - const char *mime_type) + const char *mime_type) { - g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), FALSE); - g_return_val_if_fail (mime_type != NULL, FALSE); - g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->is_mime_type != NULL, FALSE); + g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), FALSE); + g_return_val_if_fail (mime_type != NULL, FALSE); + g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->is_mime_type != NULL, FALSE); - return NAUTILUS_FILE_INFO_GET_IFACE (file)->is_mime_type (file, - mime_type); + return NAUTILUS_FILE_INFO_GET_IFACE (file)->is_mime_type (file, + mime_type); } gboolean nautilus_file_info_is_directory (NautilusFileInfo *file) { - g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), FALSE); - g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->is_directory != NULL, FALSE); + g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), FALSE); + g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->is_directory != NULL, FALSE); - return NAUTILUS_FILE_INFO_GET_IFACE (file)->is_directory (file); + return NAUTILUS_FILE_INFO_GET_IFACE (file)->is_directory (file); } gboolean nautilus_file_info_can_write (NautilusFileInfo *file) { - g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), FALSE); - g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->can_write != NULL, FALSE); + g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), FALSE); + g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->can_write != NULL, FALSE); - return NAUTILUS_FILE_INFO_GET_IFACE (file)->can_write (file); + return NAUTILUS_FILE_INFO_GET_IFACE (file)->can_write (file); } void nautilus_file_info_add_emblem (NautilusFileInfo *file, - const char *emblem_name) + const char *emblem_name) { - g_return_if_fail (NAUTILUS_IS_FILE_INFO (file)); - g_return_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->add_emblem != NULL); + g_return_if_fail (NAUTILUS_IS_FILE_INFO (file)); + g_return_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->add_emblem != NULL); - NAUTILUS_FILE_INFO_GET_IFACE (file)->add_emblem (file, emblem_name); + NAUTILUS_FILE_INFO_GET_IFACE (file)->add_emblem (file, emblem_name); } char * nautilus_file_info_get_string_attribute (NautilusFileInfo *file, - const char *attribute_name) + const char *attribute_name) { - g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), NULL); - g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->get_string_attribute != NULL, NULL); - g_return_val_if_fail (attribute_name != NULL, NULL); + g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), NULL); + g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->get_string_attribute != NULL, NULL); + g_return_val_if_fail (attribute_name != NULL, NULL); - return NAUTILUS_FILE_INFO_GET_IFACE (file)->get_string_attribute - (file, attribute_name); + return NAUTILUS_FILE_INFO_GET_IFACE (file)->get_string_attribute + (file, attribute_name); } void nautilus_file_info_add_string_attribute (NautilusFileInfo *file, - const char *attribute_name, - const char *value) + const char *attribute_name, + const char *value) { - g_return_if_fail (NAUTILUS_IS_FILE_INFO (file)); - g_return_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->add_string_attribute != NULL); - g_return_if_fail (attribute_name != NULL); - g_return_if_fail (value != NULL); - - NAUTILUS_FILE_INFO_GET_IFACE (file)->add_string_attribute - (file, attribute_name, value); + g_return_if_fail (NAUTILUS_IS_FILE_INFO (file)); + g_return_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->add_string_attribute != NULL); + g_return_if_fail (attribute_name != NULL); + g_return_if_fail (value != NULL); + + NAUTILUS_FILE_INFO_GET_IFACE (file)->add_string_attribute + (file, attribute_name, value); } void nautilus_file_info_invalidate_extension_info (NautilusFileInfo *file) { - g_return_if_fail (NAUTILUS_IS_FILE_INFO (file)); - g_return_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->invalidate_extension_info != NULL); - - NAUTILUS_FILE_INFO_GET_IFACE (file)->invalidate_extension_info (file); + g_return_if_fail (NAUTILUS_IS_FILE_INFO (file)); + g_return_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->invalidate_extension_info != NULL); + + NAUTILUS_FILE_INFO_GET_IFACE (file)->invalidate_extension_info (file); } /** @@ -323,7 +327,7 @@ nautilus_file_info_invalidate_extension_info (NautilusFileInfo *file) NautilusFileInfo * nautilus_file_info_lookup (GFile *location) { - return nautilus_file_info_getter (location, FALSE); + return nautilus_file_info_getter (location, FALSE); } /** @@ -335,7 +339,7 @@ nautilus_file_info_lookup (GFile *location) NautilusFileInfo * nautilus_file_info_create (GFile *location) { - return nautilus_file_info_getter (location, TRUE); + return nautilus_file_info_getter (location, TRUE); } /** @@ -347,14 +351,14 @@ nautilus_file_info_create (GFile *location) NautilusFileInfo * nautilus_file_info_lookup_for_uri (const char *uri) { - GFile *location; - NautilusFile *file; + GFile *location; + NautilusFile *file; - location = g_file_new_for_uri (uri); - file = nautilus_file_info_lookup (location); - g_object_unref (location); + location = g_file_new_for_uri (uri); + file = nautilus_file_info_lookup (location); + g_object_unref (location); - return file; + return file; } /** @@ -366,12 +370,12 @@ nautilus_file_info_lookup_for_uri (const char *uri) NautilusFileInfo * nautilus_file_info_create_for_uri (const char *uri) { - GFile *location; - NautilusFile *file; + GFile *location; + NautilusFile *file; - location = g_file_new_for_uri (uri); - file = nautilus_file_info_create (location); - g_object_unref (location); + location = g_file_new_for_uri (uri); + file = nautilus_file_info_create (location); + g_object_unref (location); - return file; + return file; } diff --git a/libnautilus-extension/nautilus-info-provider.c b/libnautilus-extension/nautilus-info-provider.c index b2cbbbac0..359bf8e24 100644 --- a/libnautilus-extension/nautilus-info-provider.c +++ b/libnautilus-extension/nautilus-info-provider.c @@ -1,5 +1,5 @@ /* - * nautilus-info-provider.c - Interface for Nautilus extensions that + * nautilus-info-provider.c - Interface for Nautilus extensions that * provide info about files. * * Copyright (C) 2003 Novell, Inc. @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU Library General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. - * + * * Author: Dave Camp <dave@ximian.com> * */ @@ -43,89 +43,89 @@ nautilus_info_provider_base_init (gpointer g_class) { } -GType +GType nautilus_info_provider_get_type (void) { - static GType type = 0; - - if (!type) { - const GTypeInfo info = { - sizeof (NautilusInfoProviderIface), - nautilus_info_provider_base_init, - NULL, - NULL, - NULL, - NULL, - 0, - 0, - NULL - }; - - type = g_type_register_static (G_TYPE_INTERFACE, - "NautilusInfoProvider", - &info, 0); - g_type_interface_add_prerequisite (type, G_TYPE_OBJECT); - } - - return type; + static GType type = 0; + + if (!type) + { + const GTypeInfo info = + { + sizeof (NautilusInfoProviderIface), + nautilus_info_provider_base_init, + NULL, + NULL, + NULL, + NULL, + 0, + 0, + NULL + }; + + type = g_type_register_static (G_TYPE_INTERFACE, + "NautilusInfoProvider", + &info, 0); + g_type_interface_add_prerequisite (type, G_TYPE_OBJECT); + } + + return type; } -NautilusOperationResult -nautilus_info_provider_update_file_info (NautilusInfoProvider *provider, - NautilusFileInfo *file, - GClosure *update_complete, - NautilusOperationHandle **handle) +NautilusOperationResult +nautilus_info_provider_update_file_info (NautilusInfoProvider *provider, + NautilusFileInfo *file, + GClosure *update_complete, + NautilusOperationHandle **handle) { - g_return_val_if_fail (NAUTILUS_IS_INFO_PROVIDER (provider), - NAUTILUS_OPERATION_FAILED); - g_return_val_if_fail (NAUTILUS_INFO_PROVIDER_GET_IFACE (provider)->update_file_info != NULL, - NAUTILUS_OPERATION_FAILED); - g_return_val_if_fail (update_complete != NULL, - NAUTILUS_OPERATION_FAILED); - g_return_val_if_fail (handle != NULL, NAUTILUS_OPERATION_FAILED); - - return NAUTILUS_INFO_PROVIDER_GET_IFACE (provider)->update_file_info - (provider, file, update_complete, handle); + g_return_val_if_fail (NAUTILUS_IS_INFO_PROVIDER (provider), + NAUTILUS_OPERATION_FAILED); + g_return_val_if_fail (NAUTILUS_INFO_PROVIDER_GET_IFACE (provider)->update_file_info != NULL, + NAUTILUS_OPERATION_FAILED); + g_return_val_if_fail (update_complete != NULL, + NAUTILUS_OPERATION_FAILED); + g_return_val_if_fail (handle != NULL, NAUTILUS_OPERATION_FAILED); + + return NAUTILUS_INFO_PROVIDER_GET_IFACE (provider)->update_file_info + (provider, file, update_complete, handle); } void -nautilus_info_provider_cancel_update (NautilusInfoProvider *provider, - NautilusOperationHandle *handle) +nautilus_info_provider_cancel_update (NautilusInfoProvider *provider, + NautilusOperationHandle *handle) { - g_return_if_fail (NAUTILUS_IS_INFO_PROVIDER (provider)); - g_return_if_fail (NAUTILUS_INFO_PROVIDER_GET_IFACE (provider)->cancel_update != NULL); - g_return_if_fail (NAUTILUS_INFO_PROVIDER_GET_IFACE (provider)->cancel_update != NULL); - g_return_if_fail (handle != NULL); + g_return_if_fail (NAUTILUS_IS_INFO_PROVIDER (provider)); + g_return_if_fail (NAUTILUS_INFO_PROVIDER_GET_IFACE (provider)->cancel_update != NULL); + g_return_if_fail (NAUTILUS_INFO_PROVIDER_GET_IFACE (provider)->cancel_update != NULL); + g_return_if_fail (handle != NULL); - NAUTILUS_INFO_PROVIDER_GET_IFACE (provider)->cancel_update (provider, - handle); + NAUTILUS_INFO_PROVIDER_GET_IFACE (provider)->cancel_update (provider, + handle); } void -nautilus_info_provider_update_complete_invoke (GClosure *update_complete, - NautilusInfoProvider *provider, - NautilusOperationHandle *handle, - NautilusOperationResult result) +nautilus_info_provider_update_complete_invoke (GClosure *update_complete, + NautilusInfoProvider *provider, + NautilusOperationHandle *handle, + NautilusOperationResult result) { - GValue args[3] = { { 0, } }; - GValue return_val = { 0, }; - - g_return_if_fail (update_complete != NULL); - g_return_if_fail (NAUTILUS_IS_INFO_PROVIDER (provider)); + GValue args[3] = { { 0, } }; + GValue return_val = { 0, }; - g_value_init (&args[0], NAUTILUS_TYPE_INFO_PROVIDER); - g_value_init (&args[1], G_TYPE_POINTER); - g_value_init (&args[2], NAUTILUS_TYPE_OPERATION_RESULT); + g_return_if_fail (update_complete != NULL); + g_return_if_fail (NAUTILUS_IS_INFO_PROVIDER (provider)); - g_value_set_object (&args[0], provider); - g_value_set_pointer (&args[1], handle); - g_value_set_enum (&args[2], result); + g_value_init (&args[0], NAUTILUS_TYPE_INFO_PROVIDER); + g_value_init (&args[1], G_TYPE_POINTER); + g_value_init (&args[2], NAUTILUS_TYPE_OPERATION_RESULT); - g_closure_invoke (update_complete, &return_val, 3, args, NULL); + g_value_set_object (&args[0], provider); + g_value_set_pointer (&args[1], handle); + g_value_set_enum (&args[2], result); - g_value_unset (&args[0]); - g_value_unset (&args[1]); - g_value_unset (&args[2]); -} + g_closure_invoke (update_complete, &return_val, 3, args, NULL); - + g_value_unset (&args[0]); + g_value_unset (&args[1]); + g_value_unset (&args[2]); +} diff --git a/libnautilus-extension/nautilus-location-widget-provider.c b/libnautilus-extension/nautilus-location-widget-provider.c index 12d28ddeb..a2e2af008 100644 --- a/libnautilus-extension/nautilus-location-widget-provider.c +++ b/libnautilus-extension/nautilus-location-widget-provider.c @@ -1,6 +1,6 @@ /* * nautilus-location-widget-provider.c - Interface for Nautilus - extensions that provide extra widgets for a location + * extensions that provide extra widgets for a location * * Copyright (C) 2005 Red Hat, Inc. * @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU Library General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. - * + * * Author: Alexander Larsson <alexl@redhat.com> * */ @@ -41,31 +41,33 @@ nautilus_location_widget_provider_base_init (gpointer g_class) { } -GType +GType nautilus_location_widget_provider_get_type (void) { - static GType type = 0; + static GType type = 0; + + if (!type) + { + const GTypeInfo info = + { + sizeof (NautilusLocationWidgetProviderIface), + nautilus_location_widget_provider_base_init, + NULL, + NULL, + NULL, + NULL, + 0, + 0, + NULL + }; - if (!type) { - const GTypeInfo info = { - sizeof (NautilusLocationWidgetProviderIface), - nautilus_location_widget_provider_base_init, - NULL, - NULL, - NULL, - NULL, - 0, - 0, - NULL - }; - - type = g_type_register_static (G_TYPE_INTERFACE, - "NautilusLocationWidgetProvider", - &info, 0); - g_type_interface_add_prerequisite (type, G_TYPE_OBJECT); - } + type = g_type_register_static (G_TYPE_INTERFACE, + "NautilusLocationWidgetProvider", + &info, 0); + g_type_interface_add_prerequisite (type, G_TYPE_OBJECT); + } - return type; + return type; } /** @@ -77,13 +79,12 @@ nautilus_location_widget_provider_get_type (void) * Returns: (transfer none): the location widget for @provider at @uri */ GtkWidget * -nautilus_location_widget_provider_get_widget (NautilusLocationWidgetProvider *provider, - const char *uri, - GtkWidget *window) +nautilus_location_widget_provider_get_widget (NautilusLocationWidgetProvider *provider, + const char *uri, + GtkWidget *window) { - g_return_val_if_fail (NAUTILUS_IS_LOCATION_WIDGET_PROVIDER (provider), NULL); + g_return_val_if_fail (NAUTILUS_IS_LOCATION_WIDGET_PROVIDER (provider), NULL); - return NAUTILUS_LOCATION_WIDGET_PROVIDER_GET_IFACE (provider)->get_widget - (provider, uri, window); - -} + return NAUTILUS_LOCATION_WIDGET_PROVIDER_GET_IFACE (provider)->get_widget + (provider, uri, window); +} diff --git a/libnautilus-extension/nautilus-menu-item.c b/libnautilus-extension/nautilus-menu-item.c index ee582dcde..068188a6b 100644 --- a/libnautilus-extension/nautilus-menu-item.c +++ b/libnautilus-extension/nautilus-menu-item.c @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU Library General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. - * + * * Author: Dave Camp <dave@ximian.com> * */ @@ -25,31 +25,34 @@ #include <glib/gi18n-lib.h> #include "nautilus-menu.h" -enum { - ACTIVATE, - LAST_SIGNAL +enum +{ + ACTIVATE, + LAST_SIGNAL }; -enum { - PROP_0, - PROP_NAME, - PROP_LABEL, - PROP_TIP, - PROP_ICON, - PROP_SENSITIVE, - PROP_PRIORITY, - PROP_MENU, - LAST_PROP +enum +{ + PROP_0, + PROP_NAME, + PROP_LABEL, + PROP_TIP, + PROP_ICON, + PROP_SENSITIVE, + PROP_PRIORITY, + PROP_MENU, + LAST_PROP }; -struct _NautilusMenuItemDetails { - char *name; - char *label; - char *tip; - char *icon; - NautilusMenu *menu; - gboolean sensitive; - gboolean priority; +struct _NautilusMenuItemDetails +{ + char *name; + char *label; + char *tip; + char *icon; + NautilusMenu *menu; + gboolean sensitive; + gboolean priority; }; static guint signals[LAST_SIGNAL]; @@ -83,24 +86,24 @@ static GObjectClass *parent_class = NULL; */ NautilusMenuItem * nautilus_menu_item_new (const char *name, - const char *label, - const char *tip, - const char *icon) + const char *label, + const char *tip, + const char *icon) { - NautilusMenuItem *item; + NautilusMenuItem *item; - g_return_val_if_fail (name != NULL, NULL); - g_return_val_if_fail (label != NULL, NULL); - g_return_val_if_fail (tip != NULL, NULL); + g_return_val_if_fail (name != NULL, NULL); + g_return_val_if_fail (label != NULL, NULL); + g_return_val_if_fail (tip != NULL, NULL); - item = g_object_new (NAUTILUS_TYPE_MENU_ITEM, - "name", name, - "label", label, - "tip", tip, - "icon", icon, - NULL); + item = g_object_new (NAUTILUS_TYPE_MENU_ITEM, + "name", name, + "label", label, + "tip", tip, + "icon", icon, + NULL); - return item; + return item; } /** @@ -112,7 +115,7 @@ nautilus_menu_item_new (const char *name, void nautilus_menu_item_activate (NautilusMenuItem *item) { - g_signal_emit (item, signals[ACTIVATE], 0); + g_signal_emit (item, signals[ACTIVATE], 0); } /** @@ -123,224 +126,276 @@ nautilus_menu_item_activate (NautilusMenuItem *item) * Attachs a menu to the given #NautilusMenuItem. */ void -nautilus_menu_item_set_submenu (NautilusMenuItem *item, NautilusMenu *menu) +nautilus_menu_item_set_submenu (NautilusMenuItem *item, + NautilusMenu *menu) { - g_object_set (item, "menu", menu, NULL); + g_object_set (item, "menu", menu, NULL); } static void -nautilus_menu_item_get_property (GObject *object, - guint param_id, - GValue *value, - GParamSpec *pspec) +nautilus_menu_item_get_property (GObject *object, + guint param_id, + GValue *value, + GParamSpec *pspec) { - NautilusMenuItem *item; - - item = NAUTILUS_MENU_ITEM (object); - - switch (param_id) { - case PROP_NAME : - g_value_set_string (value, item->details->name); - break; - case PROP_LABEL : - g_value_set_string (value, item->details->label); - break; - case PROP_TIP : - g_value_set_string (value, item->details->tip); - break; - case PROP_ICON : - g_value_set_string (value, item->details->icon); - break; - case PROP_SENSITIVE : - g_value_set_boolean (value, item->details->sensitive); - break; - case PROP_PRIORITY : - g_value_set_boolean (value, item->details->priority); - break; - case PROP_MENU : - g_value_set_object (value, item->details->menu); - break; - default : - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); - break; - } + NautilusMenuItem *item; + + item = NAUTILUS_MENU_ITEM (object); + + switch (param_id) + { + case PROP_NAME: + { + g_value_set_string (value, item->details->name); + } + break; + + case PROP_LABEL: + { + g_value_set_string (value, item->details->label); + } + break; + + case PROP_TIP: + { + g_value_set_string (value, item->details->tip); + } + break; + + case PROP_ICON: + { + g_value_set_string (value, item->details->icon); + } + break; + + case PROP_SENSITIVE: + { + g_value_set_boolean (value, item->details->sensitive); + } + break; + + case PROP_PRIORITY: + { + g_value_set_boolean (value, item->details->priority); + } + break; + + case PROP_MENU: + { + g_value_set_object (value, item->details->menu); + } + break; + + default: + { + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); + } + break; + } } static void -nautilus_menu_item_set_property (GObject *object, - guint param_id, - const GValue *value, - GParamSpec *pspec) +nautilus_menu_item_set_property (GObject *object, + guint param_id, + const GValue *value, + GParamSpec *pspec) { - NautilusMenuItem *item; - - item = NAUTILUS_MENU_ITEM (object); - - switch (param_id) { - case PROP_NAME : - g_free (item->details->name); - item->details->name = g_strdup (g_value_get_string (value)); - g_object_notify (object, "name"); - break; - case PROP_LABEL : - g_free (item->details->label); - item->details->label = g_strdup (g_value_get_string (value)); - g_object_notify (object, "label"); - break; - case PROP_TIP : - g_free (item->details->tip); - item->details->tip = g_strdup (g_value_get_string (value)); - g_object_notify (object, "tip"); - break; - case PROP_ICON : - g_free (item->details->icon); - item->details->icon = g_strdup (g_value_get_string (value)); - g_object_notify (object, "icon"); - break; - case PROP_SENSITIVE : - item->details->sensitive = g_value_get_boolean (value); - g_object_notify (object, "sensitive"); - break; - case PROP_PRIORITY : - item->details->priority = g_value_get_boolean (value); - g_object_notify (object, "priority"); - break; - case PROP_MENU : - if (item->details->menu) { - g_object_unref (item->details->menu); - } - item->details->menu = g_object_ref (g_value_get_object (value)); - g_object_notify (object, "menu"); - break; - default : - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); - break; - } + NautilusMenuItem *item; + + item = NAUTILUS_MENU_ITEM (object); + + switch (param_id) + { + case PROP_NAME: + { + g_free (item->details->name); + item->details->name = g_strdup (g_value_get_string (value)); + g_object_notify (object, "name"); + } + break; + + case PROP_LABEL: + { + g_free (item->details->label); + item->details->label = g_strdup (g_value_get_string (value)); + g_object_notify (object, "label"); + } + break; + + case PROP_TIP: + { + g_free (item->details->tip); + item->details->tip = g_strdup (g_value_get_string (value)); + g_object_notify (object, "tip"); + } + break; + + case PROP_ICON: + { + g_free (item->details->icon); + item->details->icon = g_strdup (g_value_get_string (value)); + g_object_notify (object, "icon"); + } + break; + + case PROP_SENSITIVE: + { + item->details->sensitive = g_value_get_boolean (value); + g_object_notify (object, "sensitive"); + } + break; + + case PROP_PRIORITY: + { + item->details->priority = g_value_get_boolean (value); + g_object_notify (object, "priority"); + } + break; + + case PROP_MENU: + { + if (item->details->menu) + { + g_object_unref (item->details->menu); + } + item->details->menu = g_object_ref (g_value_get_object (value)); + g_object_notify (object, "menu"); + } + break; + + default: + { + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); + } + break; + } } static void nautilus_menu_item_finalize (GObject *object) { - NautilusMenuItem *item; + NautilusMenuItem *item; - item = NAUTILUS_MENU_ITEM (object); + item = NAUTILUS_MENU_ITEM (object); - g_free (item->details->name); - g_free (item->details->label); - g_free (item->details->tip); - g_free (item->details->icon); - if (item->details->menu) { - g_object_unref (item->details->menu); - } + g_free (item->details->name); + g_free (item->details->label); + g_free (item->details->tip); + g_free (item->details->icon); + if (item->details->menu) + { + g_object_unref (item->details->menu); + } - g_free (item->details); + g_free (item->details); - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (parent_class)->finalize (object); } static void nautilus_menu_item_instance_init (NautilusMenuItem *item) { - item->details = g_new0 (NautilusMenuItemDetails, 1); - item->details->sensitive = TRUE; - item->details->menu = NULL; + item->details = g_new0 (NautilusMenuItemDetails, 1); + item->details->sensitive = TRUE; + item->details->menu = NULL; } static void nautilus_menu_item_class_init (NautilusMenuItemClass *class) { - parent_class = g_type_class_peek_parent (class); - - G_OBJECT_CLASS (class)->finalize = nautilus_menu_item_finalize; - G_OBJECT_CLASS (class)->get_property = nautilus_menu_item_get_property; - G_OBJECT_CLASS (class)->set_property = nautilus_menu_item_set_property; - - signals[ACTIVATE] = - g_signal_new ("activate", - G_TYPE_FROM_CLASS (class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (NautilusMenuItemClass, - activate), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - g_object_class_install_property (G_OBJECT_CLASS (class), - PROP_NAME, - g_param_spec_string ("name", - "Name", - "Name of the item", - NULL, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE | G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (class), - PROP_LABEL, - g_param_spec_string ("label", - "Label", - "Label to display to the user", - NULL, - G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (class), - PROP_TIP, - g_param_spec_string ("tip", - "Tip", - "Tooltip for the menu item", - NULL, - G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (class), - PROP_ICON, - g_param_spec_string ("icon", - "Icon", - "Name of the icon to display in the menu item", - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property (G_OBJECT_CLASS (class), - PROP_SENSITIVE, - g_param_spec_boolean ("sensitive", - "Sensitive", - "Whether the menu item is sensitive", - TRUE, - G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (class), - PROP_PRIORITY, - g_param_spec_boolean ("priority", - "Priority", - "Show priority text in toolbars", - TRUE, - G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (class), - PROP_MENU, - g_param_spec_object ("menu", - "Menu", - "The menu belonging to this item. May be null.", - NAUTILUS_TYPE_MENU, - G_PARAM_READWRITE)); + parent_class = g_type_class_peek_parent (class); + + G_OBJECT_CLASS (class)->finalize = nautilus_menu_item_finalize; + G_OBJECT_CLASS (class)->get_property = nautilus_menu_item_get_property; + G_OBJECT_CLASS (class)->set_property = nautilus_menu_item_set_property; + + signals[ACTIVATE] = + g_signal_new ("activate", + G_TYPE_FROM_CLASS (class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (NautilusMenuItemClass, + activate), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + g_object_class_install_property (G_OBJECT_CLASS (class), + PROP_NAME, + g_param_spec_string ("name", + "Name", + "Name of the item", + NULL, + G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE | G_PARAM_READABLE)); + g_object_class_install_property (G_OBJECT_CLASS (class), + PROP_LABEL, + g_param_spec_string ("label", + "Label", + "Label to display to the user", + NULL, + G_PARAM_READWRITE)); + g_object_class_install_property (G_OBJECT_CLASS (class), + PROP_TIP, + g_param_spec_string ("tip", + "Tip", + "Tooltip for the menu item", + NULL, + G_PARAM_READWRITE)); + g_object_class_install_property (G_OBJECT_CLASS (class), + PROP_ICON, + g_param_spec_string ("icon", + "Icon", + "Name of the icon to display in the menu item", + NULL, + G_PARAM_READWRITE)); + + g_object_class_install_property (G_OBJECT_CLASS (class), + PROP_SENSITIVE, + g_param_spec_boolean ("sensitive", + "Sensitive", + "Whether the menu item is sensitive", + TRUE, + G_PARAM_READWRITE)); + g_object_class_install_property (G_OBJECT_CLASS (class), + PROP_PRIORITY, + g_param_spec_boolean ("priority", + "Priority", + "Show priority text in toolbars", + TRUE, + G_PARAM_READWRITE)); + g_object_class_install_property (G_OBJECT_CLASS (class), + PROP_MENU, + g_param_spec_object ("menu", + "Menu", + "The menu belonging to this item. May be null.", + NAUTILUS_TYPE_MENU, + G_PARAM_READWRITE)); } -GType +GType nautilus_menu_item_get_type (void) { - static GType type = 0; - - if (!type) { - const GTypeInfo info = { - sizeof (NautilusMenuItemClass), - NULL, - NULL, - (GClassInitFunc)nautilus_menu_item_class_init, - NULL, - NULL, - sizeof (NautilusMenuItem), - 0, - (GInstanceInitFunc)nautilus_menu_item_instance_init - }; - - type = g_type_register_static - (G_TYPE_OBJECT, - "NautilusMenuItem", - &info, 0); - } - - return type; -} + static GType type = 0; + if (!type) + { + const GTypeInfo info = + { + sizeof (NautilusMenuItemClass), + NULL, + NULL, + (GClassInitFunc) nautilus_menu_item_class_init, + NULL, + NULL, + sizeof (NautilusMenuItem), + 0, + (GInstanceInitFunc) nautilus_menu_item_instance_init + }; + + type = g_type_register_static + (G_TYPE_OBJECT, + "NautilusMenuItem", + &info, 0); + } + + return type; +} diff --git a/libnautilus-extension/nautilus-menu-provider.c b/libnautilus-extension/nautilus-menu-provider.c index 0fb709469..05eb28a67 100644 --- a/libnautilus-extension/nautilus-menu-provider.c +++ b/libnautilus-extension/nautilus-menu-provider.c @@ -1,5 +1,5 @@ /* - * nautilus-property-page-provider.c - Interface for Nautilus extensions + * nautilus-property-page-provider.c - Interface for Nautilus extensions * that provide context menu items * for files. * @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU Library General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. - * + * * Author: Dave Camp <dave@ximian.com> * */ @@ -40,47 +40,49 @@ static void nautilus_menu_provider_base_init (gpointer g_class) { - static gboolean initialized = FALSE; + static gboolean initialized = FALSE; - if (!initialized) - { - /* This signal should be emited each time the extension modify the list of menu items */ - g_signal_new ("items-updated", - NAUTILUS_TYPE_MENU_PROVIDER, - G_SIGNAL_RUN_LAST, - 0, - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - initialized = TRUE; - } + if (!initialized) + { + /* This signal should be emited each time the extension modify the list of menu items */ + g_signal_new ("items-updated", + NAUTILUS_TYPE_MENU_PROVIDER, + G_SIGNAL_RUN_LAST, + 0, + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + initialized = TRUE; + } } -GType +GType nautilus_menu_provider_get_type (void) { - static GType type = 0; + static GType type = 0; + + if (!type) + { + const GTypeInfo info = + { + sizeof (NautilusMenuProviderIface), + nautilus_menu_provider_base_init, + NULL, + NULL, + NULL, + NULL, + 0, + 0, + NULL + }; - if (!type) { - const GTypeInfo info = { - sizeof (NautilusMenuProviderIface), - nautilus_menu_provider_base_init, - NULL, - NULL, - NULL, - NULL, - 0, - 0, - NULL - }; - - type = g_type_register_static (G_TYPE_INTERFACE, - "NautilusMenuProvider", - &info, 0); - g_type_interface_add_prerequisite (type, G_TYPE_OBJECT); - } + type = g_type_register_static (G_TYPE_INTERFACE, + "NautilusMenuProvider", + &info, 0); + g_type_interface_add_prerequisite (type, G_TYPE_OBJECT); + } - return type; + return type; } /** @@ -93,17 +95,20 @@ nautilus_menu_provider_get_type (void) */ GList * nautilus_menu_provider_get_file_items (NautilusMenuProvider *provider, - GtkWidget *window, - GList *files) + GtkWidget *window, + GList *files) { - g_return_val_if_fail (NAUTILUS_IS_MENU_PROVIDER (provider), NULL); + g_return_val_if_fail (NAUTILUS_IS_MENU_PROVIDER (provider), NULL); - if (NAUTILUS_MENU_PROVIDER_GET_IFACE (provider)->get_file_items) { - return NAUTILUS_MENU_PROVIDER_GET_IFACE (provider)->get_file_items - (provider, window, files); - } else { - return NULL; - } + if (NAUTILUS_MENU_PROVIDER_GET_IFACE (provider)->get_file_items) + { + return NAUTILUS_MENU_PROVIDER_GET_IFACE (provider)->get_file_items + (provider, window, files); + } + else + { + return NULL; + } } /** @@ -116,26 +121,28 @@ nautilus_menu_provider_get_file_items (NautilusMenuProvider *provider, */ GList * nautilus_menu_provider_get_background_items (NautilusMenuProvider *provider, - GtkWidget *window, - NautilusFileInfo *current_folder) + GtkWidget *window, + NautilusFileInfo *current_folder) { - g_return_val_if_fail (NAUTILUS_IS_MENU_PROVIDER (provider), NULL); - g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (current_folder), NULL); + g_return_val_if_fail (NAUTILUS_IS_MENU_PROVIDER (provider), NULL); + g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (current_folder), NULL); - if (NAUTILUS_MENU_PROVIDER_GET_IFACE (provider)->get_background_items) { - return NAUTILUS_MENU_PROVIDER_GET_IFACE (provider)->get_background_items - (provider, window, current_folder); - } else { - return NULL; - } + if (NAUTILUS_MENU_PROVIDER_GET_IFACE (provider)->get_background_items) + { + return NAUTILUS_MENU_PROVIDER_GET_IFACE (provider)->get_background_items + (provider, window, current_folder); + } + else + { + return NULL; + } } /* This function emit a signal to inform nautilus that its item list has changed */ void -nautilus_menu_provider_emit_items_updated_signal (NautilusMenuProvider* provider) +nautilus_menu_provider_emit_items_updated_signal (NautilusMenuProvider *provider) { - g_return_if_fail (NAUTILUS_IS_MENU_PROVIDER (provider)); + g_return_if_fail (NAUTILUS_IS_MENU_PROVIDER (provider)); - g_signal_emit_by_name (provider, "items-updated"); + g_signal_emit_by_name (provider, "items-updated"); } - diff --git a/libnautilus-extension/nautilus-menu.c b/libnautilus-extension/nautilus-menu.c index ee7b2b2a8..fcc2ecc4c 100644 --- a/libnautilus-extension/nautilus-menu.c +++ b/libnautilus-extension/nautilus-menu.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU Library General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. - * + * * Author: Raffaele Sandrini <rasa@gmx.ch> * */ @@ -40,17 +40,19 @@ #define NAUTILUS_MENU_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NAUTILUS_TYPE_MENU, NautilusMenuPrivate)) G_DEFINE_TYPE (NautilusMenu, nautilus_menu, G_TYPE_OBJECT); -struct _NautilusMenuPrivate { - GList *item_list; +struct _NautilusMenuPrivate +{ + GList *item_list; }; void -nautilus_menu_append_item (NautilusMenu *menu, NautilusMenuItem *item) +nautilus_menu_append_item (NautilusMenu *menu, + NautilusMenuItem *item) { - g_return_if_fail (menu != NULL); - g_return_if_fail (item != NULL); - - menu->priv->item_list = g_list_append (menu->priv->item_list, g_object_ref (item)); + g_return_if_fail (menu != NULL); + g_return_if_fail (item != NULL); + + menu->priv->item_list = g_list_append (menu->priv->item_list, g_object_ref (item)); } /** @@ -62,14 +64,14 @@ nautilus_menu_append_item (NautilusMenu *menu, NautilusMenuItem *item) GList * nautilus_menu_get_items (NautilusMenu *menu) { - GList *item_list; - - g_return_val_if_fail (menu != NULL, NULL); - - item_list = g_list_copy (menu->priv->item_list); - g_list_foreach (item_list, (GFunc)g_object_ref, NULL); - - return item_list; + GList *item_list; + + g_return_val_if_fail (menu != NULL, NULL); + + item_list = g_list_copy (menu->priv->item_list); + g_list_foreach (item_list, (GFunc) g_object_ref, NULL); + + return item_list; } /** @@ -80,10 +82,10 @@ nautilus_menu_get_items (NautilusMenu *menu) void nautilus_menu_item_list_free (GList *item_list) { - g_return_if_fail (item_list != NULL); - - g_list_foreach (item_list, (GFunc)g_object_unref, NULL); - g_list_free (item_list); + g_return_if_fail (item_list != NULL); + + g_list_foreach (item_list, (GFunc) g_object_unref, NULL); + g_list_free (item_list); } /* Type initialization */ @@ -91,31 +93,32 @@ nautilus_menu_item_list_free (GList *item_list) static void nautilus_menu_finalize (GObject *object) { - NautilusMenu *menu = NAUTILUS_MENU (object); + NautilusMenu *menu = NAUTILUS_MENU (object); - if (menu->priv->item_list) { - g_list_free (menu->priv->item_list); - } + if (menu->priv->item_list) + { + g_list_free (menu->priv->item_list); + } - G_OBJECT_CLASS (nautilus_menu_parent_class)->finalize (object); + G_OBJECT_CLASS (nautilus_menu_parent_class)->finalize (object); } static void nautilus_menu_init (NautilusMenu *menu) { - menu->priv = NAUTILUS_MENU_GET_PRIVATE (menu); + menu->priv = NAUTILUS_MENU_GET_PRIVATE (menu); - menu->priv->item_list = NULL; + menu->priv->item_list = NULL; } static void nautilus_menu_class_init (NautilusMenuClass *klass) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - g_type_class_add_private (klass, sizeof (NautilusMenuPrivate)); - - object_class->finalize = nautilus_menu_finalize; + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + g_type_class_add_private (klass, sizeof (NautilusMenuPrivate)); + + object_class->finalize = nautilus_menu_finalize; } /* public constructors */ @@ -123,9 +126,9 @@ nautilus_menu_class_init (NautilusMenuClass *klass) NautilusMenu * nautilus_menu_new (void) { - NautilusMenu *obj; - - obj = NAUTILUS_MENU (g_object_new (NAUTILUS_TYPE_MENU, NULL)); - - return obj; + NautilusMenu *obj; + + obj = NAUTILUS_MENU (g_object_new (NAUTILUS_TYPE_MENU, NULL)); + + return obj; } diff --git a/libnautilus-extension/nautilus-property-page-provider.c b/libnautilus-extension/nautilus-property-page-provider.c index 04a7f1f0f..7a7a13cf0 100644 --- a/libnautilus-extension/nautilus-property-page-provider.c +++ b/libnautilus-extension/nautilus-property-page-provider.c @@ -1,6 +1,6 @@ /* * nautilus-property-page-provider.c - Interface for Nautilus extensions - * that provide property pages for + * that provide property pages for * files. * * Copyright (C) 2003 Novell, Inc. @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU Library General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. - * + * * Author: Dave Camp <dave@ximian.com> * */ @@ -42,31 +42,33 @@ nautilus_property_page_provider_base_init (gpointer g_class) { } -GType +GType nautilus_property_page_provider_get_type (void) { - static GType type = 0; + static GType type = 0; + + if (!type) + { + const GTypeInfo info = + { + sizeof (NautilusPropertyPageProviderIface), + nautilus_property_page_provider_base_init, + NULL, + NULL, + NULL, + NULL, + 0, + 0, + NULL + }; - if (!type) { - const GTypeInfo info = { - sizeof (NautilusPropertyPageProviderIface), - nautilus_property_page_provider_base_init, - NULL, - NULL, - NULL, - NULL, - 0, - 0, - NULL - }; - - type = g_type_register_static (G_TYPE_INTERFACE, - "NautilusPropertyPageProvider", - &info, 0); - g_type_interface_add_prerequisite (type, G_TYPE_OBJECT); - } + type = g_type_register_static (G_TYPE_INTERFACE, + "NautilusPropertyPageProvider", + &info, 0); + g_type_interface_add_prerequisite (type, G_TYPE_OBJECT); + } - return type; + return type; } /** @@ -84,13 +86,11 @@ nautilus_property_page_provider_get_type (void) */ GList * nautilus_property_page_provider_get_pages (NautilusPropertyPageProvider *provider, - GList *files) + GList *files) { - g_return_val_if_fail (NAUTILUS_IS_PROPERTY_PAGE_PROVIDER (provider), NULL); - g_return_val_if_fail (NAUTILUS_PROPERTY_PAGE_PROVIDER_GET_IFACE (provider)->get_pages != NULL, NULL); + g_return_val_if_fail (NAUTILUS_IS_PROPERTY_PAGE_PROVIDER (provider), NULL); + g_return_val_if_fail (NAUTILUS_PROPERTY_PAGE_PROVIDER_GET_IFACE (provider)->get_pages != NULL, NULL); - return NAUTILUS_PROPERTY_PAGE_PROVIDER_GET_IFACE (provider)->get_pages - (provider, files); + return NAUTILUS_PROPERTY_PAGE_PROVIDER_GET_IFACE (provider)->get_pages + (provider, files); } - - diff --git a/libnautilus-extension/nautilus-property-page.c b/libnautilus-extension/nautilus-property-page.c index 545f2999f..a1c9d3a87 100644 --- a/libnautilus-extension/nautilus-property-page.c +++ b/libnautilus-extension/nautilus-property-page.c @@ -1,5 +1,5 @@ /* - * nautilus-property-page.h - Property pages exported by + * nautilus-property-page.h - Property pages exported by * NautilusPropertyProvider objects. * * Copyright (C) 2003 Novell, Inc. @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU Library General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. - * + * * Author: Dave Camp <dave@ximian.com> * */ @@ -26,18 +26,20 @@ #include <glib/gi18n-lib.h> -enum { - PROP_0, - PROP_NAME, - PROP_LABEL, - PROP_PAGE, - LAST_PROP +enum +{ + PROP_0, + PROP_NAME, + PROP_LABEL, + PROP_PAGE, + LAST_PROP }; -struct _NautilusPropertyPageDetails { - char *name; - GtkWidget *label; - GtkWidget *page; +struct _NautilusPropertyPageDetails +{ + char *name; + GtkWidget *label; + GtkWidget *page; }; static GObjectClass *parent_class = NULL; @@ -67,182 +69,212 @@ static GObjectClass *parent_class = NULL; */ NautilusPropertyPage * nautilus_property_page_new (const char *name, - GtkWidget *label, - GtkWidget *page_widget) + GtkWidget *label, + GtkWidget *page_widget) { - NautilusPropertyPage *page; - - g_return_val_if_fail (name != NULL, NULL); - g_return_val_if_fail (label != NULL && GTK_IS_WIDGET (label), NULL); - g_return_val_if_fail (page_widget != NULL && GTK_IS_WIDGET (page_widget), - NULL); - - page = g_object_new (NAUTILUS_TYPE_PROPERTY_PAGE, - "name", name, - "label", label, - "page", page_widget, - NULL); - - return page; + NautilusPropertyPage *page; + + g_return_val_if_fail (name != NULL, NULL); + g_return_val_if_fail (label != NULL && GTK_IS_WIDGET (label), NULL); + g_return_val_if_fail (page_widget != NULL && GTK_IS_WIDGET (page_widget), + NULL); + + page = g_object_new (NAUTILUS_TYPE_PROPERTY_PAGE, + "name", name, + "label", label, + "page", page_widget, + NULL); + + return page; } static void -nautilus_property_page_get_property (GObject *object, - guint param_id, - GValue *value, - GParamSpec *pspec) +nautilus_property_page_get_property (GObject *object, + guint param_id, + GValue *value, + GParamSpec *pspec) { - NautilusPropertyPage *page; - - page = NAUTILUS_PROPERTY_PAGE (object); - - switch (param_id) { - case PROP_NAME : - g_value_set_string (value, page->details->name); - break; - case PROP_LABEL : - g_value_set_object (value, page->details->label); - break; - case PROP_PAGE : - g_value_set_object (value, page->details->page); - break; - default : - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); - break; - } + NautilusPropertyPage *page; + + page = NAUTILUS_PROPERTY_PAGE (object); + + switch (param_id) + { + case PROP_NAME: + { + g_value_set_string (value, page->details->name); + } + break; + + case PROP_LABEL: + { + g_value_set_object (value, page->details->label); + } + break; + + case PROP_PAGE: + { + g_value_set_object (value, page->details->page); + } + break; + + default: + { + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); + } + break; + } } static void -nautilus_property_page_set_property (GObject *object, - guint param_id, - const GValue *value, - GParamSpec *pspec) +nautilus_property_page_set_property (GObject *object, + guint param_id, + const GValue *value, + GParamSpec *pspec) { - NautilusPropertyPage *page; - - page = NAUTILUS_PROPERTY_PAGE (object); - - switch (param_id) { - case PROP_NAME : - g_free (page->details->name); - page->details->name = g_strdup (g_value_get_string (value)); - g_object_notify (object, "name"); - break; - case PROP_LABEL : - if (page->details->label) { - g_object_unref (page->details->label); - } - - page->details->label = g_object_ref (g_value_get_object (value)); - g_object_notify (object, "label"); - break; - case PROP_PAGE : - if (page->details->page) { - g_object_unref (page->details->page); - } - - page->details->page = g_object_ref (g_value_get_object (value)); - g_object_notify (object, "page"); - break; - default : - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); - break; - } + NautilusPropertyPage *page; + + page = NAUTILUS_PROPERTY_PAGE (object); + + switch (param_id) + { + case PROP_NAME: + { + g_free (page->details->name); + page->details->name = g_strdup (g_value_get_string (value)); + g_object_notify (object, "name"); + } + break; + + case PROP_LABEL: + { + if (page->details->label) + { + g_object_unref (page->details->label); + } + + page->details->label = g_object_ref (g_value_get_object (value)); + g_object_notify (object, "label"); + } + break; + + case PROP_PAGE: + { + if (page->details->page) + { + g_object_unref (page->details->page); + } + + page->details->page = g_object_ref (g_value_get_object (value)); + g_object_notify (object, "page"); + } + break; + + default: + { + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); + } + break; + } } static void nautilus_property_page_dispose (GObject *object) { - NautilusPropertyPage *page; - - page = NAUTILUS_PROPERTY_PAGE (object); - - if (page->details->label) { - g_object_unref (page->details->label); - page->details->label = NULL; - } - if (page->details->page) { - g_object_unref (page->details->page); - page->details->page = NULL; - } + NautilusPropertyPage *page; + + page = NAUTILUS_PROPERTY_PAGE (object); + + if (page->details->label) + { + g_object_unref (page->details->label); + page->details->label = NULL; + } + if (page->details->page) + { + g_object_unref (page->details->page); + page->details->page = NULL; + } } static void nautilus_property_page_finalize (GObject *object) { - NautilusPropertyPage *page; - - page = NAUTILUS_PROPERTY_PAGE (object); + NautilusPropertyPage *page; - g_free (page->details->name); + page = NAUTILUS_PROPERTY_PAGE (object); - g_free (page->details); + g_free (page->details->name); - G_OBJECT_CLASS (parent_class)->finalize (object); + g_free (page->details); + + G_OBJECT_CLASS (parent_class)->finalize (object); } static void nautilus_property_page_instance_init (NautilusPropertyPage *page) { - page->details = g_new0 (NautilusPropertyPageDetails, 1); + page->details = g_new0 (NautilusPropertyPageDetails, 1); } static void nautilus_property_page_class_init (NautilusPropertyPageClass *class) { - parent_class = g_type_class_peek_parent (class); - - G_OBJECT_CLASS (class)->finalize = nautilus_property_page_finalize; - G_OBJECT_CLASS (class)->dispose = nautilus_property_page_dispose; - G_OBJECT_CLASS (class)->get_property = nautilus_property_page_get_property; - G_OBJECT_CLASS (class)->set_property = nautilus_property_page_set_property; - - g_object_class_install_property (G_OBJECT_CLASS (class), - PROP_NAME, - g_param_spec_string ("name", - "Name", - "Name of the page", - NULL, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE | G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (class), - PROP_LABEL, - g_param_spec_object ("label", - "Label", - "Label widget to display in the notebook tab", - GTK_TYPE_WIDGET, - G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (class), - PROP_PAGE, - g_param_spec_object ("page", - "Page", - "Widget for the property page", - GTK_TYPE_WIDGET, - G_PARAM_READWRITE)); + parent_class = g_type_class_peek_parent (class); + + G_OBJECT_CLASS (class)->finalize = nautilus_property_page_finalize; + G_OBJECT_CLASS (class)->dispose = nautilus_property_page_dispose; + G_OBJECT_CLASS (class)->get_property = nautilus_property_page_get_property; + G_OBJECT_CLASS (class)->set_property = nautilus_property_page_set_property; + + g_object_class_install_property (G_OBJECT_CLASS (class), + PROP_NAME, + g_param_spec_string ("name", + "Name", + "Name of the page", + NULL, + G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE | G_PARAM_READABLE)); + g_object_class_install_property (G_OBJECT_CLASS (class), + PROP_LABEL, + g_param_spec_object ("label", + "Label", + "Label widget to display in the notebook tab", + GTK_TYPE_WIDGET, + G_PARAM_READWRITE)); + g_object_class_install_property (G_OBJECT_CLASS (class), + PROP_PAGE, + g_param_spec_object ("page", + "Page", + "Widget for the property page", + GTK_TYPE_WIDGET, + G_PARAM_READWRITE)); } -GType +GType nautilus_property_page_get_type (void) { - static GType type = 0; - - if (!type) { - const GTypeInfo info = { - sizeof (NautilusPropertyPageClass), - NULL, - NULL, - (GClassInitFunc)nautilus_property_page_class_init, - NULL, - NULL, - sizeof (NautilusPropertyPage), - 0, - (GInstanceInitFunc)nautilus_property_page_instance_init - }; - - type = g_type_register_static - (G_TYPE_OBJECT, - "NautilusPropertyPage", - &info, 0); - } - - return type; + static GType type = 0; + + if (!type) + { + const GTypeInfo info = + { + sizeof (NautilusPropertyPageClass), + NULL, + NULL, + (GClassInitFunc) nautilus_property_page_class_init, + NULL, + NULL, + sizeof (NautilusPropertyPage), + 0, + (GInstanceInitFunc) nautilus_property_page_instance_init + }; + + type = g_type_register_static + (G_TYPE_OBJECT, + "NautilusPropertyPage", + &info, 0); + } + + return type; } |