From 55311a41fe9ddb782f2f633174c3fa67c79a397b Mon Sep 17 00:00:00 2001 From: Benedikt Meurer <benny@xfce.org> Date: Tue, 22 Nov 2005 20:40:14 +0000 Subject: [PATCH] 2005-11-22 Benedikt Meurer <benny@xfce.org> * thunar-vfs/*.{c,h}, thunar/*.c, thunarx/*.c: Avoid duplicating static strings if possible. * thunar-vfs/thunar-vfs-scandir.c(thunar_vfs_scandir_collect): Ignore EACCES and EPERM on subdirectories with recursive scanning. * thunar-vfs/thunar-vfs-info.h(ThunarVfsInfo): Compress "type", "mode" and "flags" to reduce memory overhead. (Old svn revision: 18929) --- ChangeLog | 9 ++++ thunar-vfs/thunar-vfs-info.c | 2 +- thunar-vfs/thunar-vfs-info.h | 6 +-- thunar-vfs/thunar-vfs-interactive-job.c | 41 ++++++++++++--- thunar-vfs/thunar-vfs-job.c | 8 +-- thunar-vfs/thunar-vfs-link-job.c | 2 +- thunar-vfs/thunar-vfs-listdir-job.c | 7 ++- thunar-vfs/thunar-vfs-mime-application.c | 2 +- thunar-vfs/thunar-vfs-mime-cache.c | 4 +- thunar-vfs/thunar-vfs-mime-database.c | 34 +++++++++++- thunar-vfs/thunar-vfs-mime-info.c | 2 +- thunar-vfs/thunar-vfs-mime-legacy.c | 5 +- thunar-vfs/thunar-vfs-mime-provider.c | 7 ++- thunar-vfs/thunar-vfs-mime-provider.h | 2 +- thunar-vfs/thunar-vfs-mkdir-job.c | 2 +- thunar-vfs/thunar-vfs-monitor.c | 34 +++++++++++- thunar-vfs/thunar-vfs-path.c | 2 +- thunar-vfs/thunar-vfs-scandir.c | 7 ++- thunar-vfs/thunar-vfs-thumb-jpeg.c | 2 + thunar-vfs/thunar-vfs-thumb.c | 34 +++++++++++- thunar-vfs/thunar-vfs-transfer-job.c | 40 +++++++++++++- thunar-vfs/thunar-vfs-unlink-job.c | 6 ++- thunar-vfs/thunar-vfs-user.c | 4 +- thunar-vfs/thunar-vfs-volume.c | 7 +-- thunar/thunar-application.c | 34 +++++++++++- thunar/thunar-chooser-dialog.c | 34 +++++++++++- thunar/thunar-chooser-model.c | 34 +++++++++++- thunar/thunar-clipboard-manager.c | 39 ++++++++++++-- thunar/thunar-create-dialog.c | 34 +++++++++++- thunar/thunar-details-view.c | 34 +++++++++++- thunar/thunar-dnd.c | 4 +- thunar/thunar-emblem-chooser.c | 40 ++++++++++++-- thunar/thunar-favourites-model.c | 56 +++++++++++++++++--- thunar/thunar-favourites-pane.c | 56 +++++++++++++++++--- thunar/thunar-favourites-view.c | 44 +++++++++++++--- thunar/thunar-file.c | 9 ++-- thunar/thunar-folder.c | 41 ++++++++++++--- thunar/thunar-history.c | 46 ++++++++++++++-- thunar/thunar-icon-factory.c | 37 +++++++++++-- thunar/thunar-icon-renderer.c | 34 +++++++++++- thunar/thunar-icon-view.c | 34 +++++++++++- thunar/thunar-launcher.c | 35 +++++++++++-- thunar/thunar-list-model.c | 67 ++++++++++++++++++++---- thunar/thunar-location-bar.c | 5 +- thunar/thunar-location-buttons.c | 56 +++++++++++++++++--- thunar/thunar-location-dialog.c | 33 +++++++++--- thunar/thunar-location-entry.c | 56 +++++++++++++++++--- thunar/thunar-metafile.c | 34 +++++++++++- thunar/thunar-navigator.c | 6 +-- thunar/thunar-open-with-action.c | 43 ++++++++++++--- thunar/thunar-path-entry.c | 62 ++++++++++++++++------ thunar/thunar-preferences-dialog.c | 34 +++++++++++- thunar/thunar-preferences.c | 34 +++++++++++- thunar/thunar-progress-dialog.c | 34 +++++++++++- thunar/thunar-properties-dialog.c | 34 +++++++++++- thunar/thunar-side-pane.c | 5 +- thunar/thunar-standard-view.c | 9 ++-- thunar/thunar-statusbar.c | 41 ++++++++++++--- thunar/thunar-text-renderer.c | 41 ++++++++++++--- thunar/thunar-thumbnail-generator.c | 34 +++++++++++- thunar/thunar-view.c | 5 +- thunar/thunar-window.c | 36 ++++++++++++- thunarx/Makefile.am | 1 + thunarx/thunarx-file-info.c | 4 +- thunarx/thunarx-menu-provider.c | 3 +- thunarx/thunarx-private.h | 40 ++++++++++++++ thunarx/thunarx-property-page-provider.c | 3 +- thunarx/thunarx-property-page.c | 35 ++++++++++++- thunarx/thunarx-provider-factory.c | 35 ++++++++++++- thunarx/thunarx-provider-module.c | 3 +- thunarx/thunarx-provider-plugin.c | 3 +- 71 files changed, 1505 insertions(+), 205 deletions(-) create mode 100644 thunarx/thunarx-private.h diff --git a/ChangeLog b/ChangeLog index 91c34d4aa..dee3033ab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2005-11-22 Benedikt Meurer <benny@xfce.org> + + * thunar-vfs/*.{c,h}, thunar/*.c, thunarx/*.c: Avoid duplicating static + strings if possible. + * thunar-vfs/thunar-vfs-scandir.c(thunar_vfs_scandir_collect): Ignore + EACCES and EPERM on subdirectories with recursive scanning. + * thunar-vfs/thunar-vfs-info.h(ThunarVfsInfo): Compress "type", "mode" + and "flags" to reduce memory overhead. + 2005-11-22 Benedikt Meurer <benny@xfce.org> * configure.in.in: Add fr and pt_BR to gettext linguas, which were diff --git a/thunar-vfs/thunar-vfs-info.c b/thunar-vfs/thunar-vfs-info.c index 0a25c48f1..fbc707faa 100644 --- a/thunar-vfs/thunar-vfs-info.c +++ b/thunar-vfs/thunar-vfs-info.c @@ -85,7 +85,7 @@ thunar_vfs_info_get_type (void) if (G_UNLIKELY (type == G_TYPE_INVALID)) { - type = g_boxed_type_register_static ("ThunarVfsInfo", + type = g_boxed_type_register_static (I_("ThunarVfsInfo"), (GBoxedCopyFunc) thunar_vfs_info_ref, (GBoxedFreeFunc) thunar_vfs_info_unref); } diff --git a/thunar-vfs/thunar-vfs-info.h b/thunar-vfs/thunar-vfs-info.h index c1ce4fbdc..1146c1fb1 100644 --- a/thunar-vfs/thunar-vfs-info.h +++ b/thunar-vfs/thunar-vfs-info.h @@ -42,13 +42,13 @@ typedef struct _ThunarVfsInfo ThunarVfsInfo; struct _ThunarVfsInfo { /* File type */ - ThunarVfsFileType type; + ThunarVfsFileType type : 8; /* File permissions and special mode flags */ - ThunarVfsFileMode mode; + ThunarVfsFileMode mode : 12; /* File flags */ - ThunarVfsFileFlags flags; + ThunarVfsFileFlags flags : 12; /* Owner's user id */ ThunarVfsUserId uid; diff --git a/thunar-vfs/thunar-vfs-interactive-job.c b/thunar-vfs/thunar-vfs-interactive-job.c index 55a4b3f18..ab6069c33 100644 --- a/thunar-vfs/thunar-vfs-interactive-job.c +++ b/thunar-vfs/thunar-vfs-interactive-job.c @@ -56,11 +56,37 @@ static ThunarVfsInteractiveJobResponse thunar_vfs_interactive_job_ask (Th -static guint interactive_signals[LAST_SIGNAL]; +static GObjectClass *thunar_vfs_interactive_job_parent_class; +static guint interactive_signals[LAST_SIGNAL]; -G_DEFINE_ABSTRACT_TYPE (ThunarVfsInteractiveJob, thunar_vfs_interactive_job, THUNAR_VFS_TYPE_JOB); +GType +thunar_vfs_interactive_job_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarVfsInteractiveJobClass), + NULL, + NULL, + (GClassInitFunc) thunar_vfs_interactive_job_class_init, + NULL, + NULL, + sizeof (ThunarVfsInteractiveJob), + 0, + (GInstanceInitFunc) thunar_vfs_interactive_job_init, + NULL, + }; + + type = g_type_register_static (THUNAR_VFS_TYPE_JOB, I_("ThunarVfsInteractiveJob"), &info, G_TYPE_FLAG_ABSTRACT); + } + + return type; +} @@ -81,6 +107,9 @@ thunar_vfs_interactive_job_class_init (ThunarVfsInteractiveJobClass *klass) { GObjectClass *gobject_class; + /* determine the parent type class */ + thunar_vfs_interactive_job_parent_class = g_type_class_peek_parent (klass); + gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = thunar_vfs_interactive_job_finalize; @@ -97,7 +126,7 @@ thunar_vfs_interactive_job_class_init (ThunarVfsInteractiveJobClass *klass) * Return value: the selected choice. **/ interactive_signals[ASK] = - g_signal_new ("ask", + g_signal_new (I_("ask"), G_TYPE_FROM_CLASS (klass), G_SIGNAL_NO_HOOKS | G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (ThunarVfsInteractiveJobClass, ask), @@ -118,7 +147,7 @@ thunar_vfs_interactive_job_class_init (ThunarVfsInteractiveJobClass *klass) * the application on creation of the @job. **/ interactive_signals[NEW_FILES] = - g_signal_new ("new-files", + g_signal_new (I_("new-files"), G_TYPE_FROM_CLASS (klass), G_SIGNAL_NO_HOOKS, 0, NULL, NULL, g_cclosure_marshal_VOID__POINTER, @@ -138,7 +167,7 @@ thunar_vfs_interactive_job_class_init (ThunarVfsInteractiveJobClass *klass) * box. **/ interactive_signals[INFO_MESSAGE] = - g_signal_new ("info-message", + g_signal_new (I_("info-message"), G_TYPE_FROM_CLASS (klass), G_SIGNAL_NO_HOOKS, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, @@ -153,7 +182,7 @@ thunar_vfs_interactive_job_class_init (ThunarVfsInteractiveJobClass *klass) * of the overall progress. **/ interactive_signals[PERCENT] = - g_signal_new ("percent", + g_signal_new (I_("percent"), G_TYPE_FROM_CLASS (klass), G_SIGNAL_NO_HOOKS, 0, NULL, NULL, g_cclosure_marshal_VOID__DOUBLE, diff --git a/thunar-vfs/thunar-vfs-job.c b/thunar-vfs/thunar-vfs-job.c index 5125c42b1..dd5dfc9ba 100644 --- a/thunar-vfs/thunar-vfs-job.c +++ b/thunar-vfs/thunar-vfs-job.c @@ -36,7 +36,7 @@ #include <thunar-vfs/thunar-vfs-alias.h> -#include <gdk/gdk.h> +#include <exo/exo.h> @@ -113,7 +113,7 @@ thunar_vfs_job_get_type (void) NULL, }; - type = g_type_register_static (G_TYPE_OBJECT, "ThunarVfsJob", &info, G_TYPE_FLAG_ABSTRACT); + type = g_type_register_static (G_TYPE_OBJECT, I_("ThunarVfsJob"), &info, G_TYPE_FLAG_ABSTRACT); } return type; @@ -144,7 +144,7 @@ thunar_vfs_job_class_init (ThunarVfsJobClass *klass) * @job. **/ job_signals[ERROR] = - g_signal_new ("error", + g_signal_new (I_("error"), G_TYPE_FROM_CLASS (klass), G_SIGNAL_NO_HOOKS, 0, NULL, NULL, g_cclosure_marshal_VOID__POINTER, @@ -160,7 +160,7 @@ thunar_vfs_job_class_init (ThunarVfsJobClass *klass) * user. **/ job_signals[FINISHED] = - g_signal_new ("finished", + g_signal_new (I_("finished"), G_TYPE_FROM_CLASS (klass), G_SIGNAL_NO_HOOKS, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, diff --git a/thunar-vfs/thunar-vfs-link-job.c b/thunar-vfs/thunar-vfs-link-job.c index 66f7962a6..e329ec075 100644 --- a/thunar-vfs/thunar-vfs-link-job.c +++ b/thunar-vfs/thunar-vfs-link-job.c @@ -89,7 +89,7 @@ thunar_vfs_link_job_get_type (void) }; type = g_type_register_static (THUNAR_VFS_TYPE_INTERACTIVE_JOB, - "ThunarVfsLinkJob", &info, 0); + I_("ThunarVfsLinkJob"), &info, 0); } return type; diff --git a/thunar-vfs/thunar-vfs-listdir-job.c b/thunar-vfs/thunar-vfs-listdir-job.c index f7606d1dc..15390dd29 100644 --- a/thunar-vfs/thunar-vfs-listdir-job.c +++ b/thunar-vfs/thunar-vfs-listdir-job.c @@ -102,7 +102,7 @@ thunar_vfs_listdir_job_get_type (void) }; type = g_type_register_static (THUNAR_VFS_TYPE_JOB, - "ThunarVfsListdirJob", + I_("ThunarVfsListdirJob"), &info, 0); } @@ -134,7 +134,7 @@ thunar_vfs_listdir_job_class_init (ThunarVfsJobClass *klass) * to be never emitted with an @infos parameter of %NULL. **/ listdir_signals[INFOS_READY] = - g_signal_new ("infos-ready", + g_signal_new (I_("infos-ready"), G_TYPE_FROM_CLASS (klass), G_SIGNAL_NO_HOOKS, 0, NULL, NULL, g_cclosure_marshal_VOID__POINTER, @@ -349,3 +349,6 @@ thunar_vfs_listdir_job_new (ThunarVfsPath *folder_path) } + +#define __THUNAR_VFS_LISTDIR_JOB_C__ +#include <thunar-vfs/thunar-vfs-aliasdef.c> diff --git a/thunar-vfs/thunar-vfs-mime-application.c b/thunar-vfs/thunar-vfs-mime-application.c index 71e6ecf48..7df9d5764 100644 --- a/thunar-vfs/thunar-vfs-mime-application.c +++ b/thunar-vfs/thunar-vfs-mime-application.c @@ -67,7 +67,7 @@ thunar_vfs_mime_application_get_type (void) if (G_UNLIKELY (type == G_TYPE_INVALID)) { - type = g_boxed_type_register_static ("ThunarVfsMimeApplication", + type = g_boxed_type_register_static (I_("ThunarVfsMimeApplication"), (GBoxedCopyFunc) thunar_vfs_mime_application_ref, (GBoxedFreeFunc) thunar_vfs_mime_application_unref); } diff --git a/thunar-vfs/thunar-vfs-mime-cache.c b/thunar-vfs/thunar-vfs-mime-cache.c index 6e5f573ba..59a142938 100644 --- a/thunar-vfs/thunar-vfs-mime-cache.c +++ b/thunar-vfs/thunar-vfs-mime-cache.c @@ -52,6 +52,7 @@ #endif #include <thunar-vfs/thunar-vfs-mime-cache.h> +#include <thunar-vfs/thunar-vfs-alias.h> #if GLIB_CHECK_VERSION(2,6,0) #include <glib/gstdio.h> @@ -134,7 +135,8 @@ thunar_vfs_mime_cache_get_type (void) }; type = g_type_register_static (THUNAR_VFS_TYPE_MIME_PROVIDER, - "ThunarVfsMimeCache", &info, 0); + I_("ThunarVfsMimeCache"), + &info, 0); } return type; diff --git a/thunar-vfs/thunar-vfs-mime-database.c b/thunar-vfs/thunar-vfs-mime-database.c index 1a16eb07d..7697f39b2 100644 --- a/thunar-vfs/thunar-vfs-mime-database.c +++ b/thunar-vfs/thunar-vfs-mime-database.c @@ -170,7 +170,36 @@ struct _ThunarVfsMimeProviderData -G_DEFINE_TYPE (ThunarVfsMimeDatabase, thunar_vfs_mime_database, G_TYPE_OBJECT); +static GObjectClass *thunar_vfs_mime_database_parent_class; + + + +GType +thunar_vfs_mime_database_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarVfsMimeDatabaseClass), + NULL, + NULL, + (GClassInitFunc) thunar_vfs_mime_database_class_init, + NULL, + NULL, + sizeof (ThunarVfsMimeDatabase), + 0, + (GInstanceInitFunc) thunar_vfs_mime_database_init, + NULL, + }; + + type = g_type_register_static (G_TYPE_OBJECT, I_("ThunarVfsMimeDatabase"), &info, 0); + } + + return type; +} @@ -179,6 +208,9 @@ thunar_vfs_mime_database_class_init (ThunarVfsMimeDatabaseClass *klass) { GObjectClass *gobject_class; + /* determine the parent type class */ + thunar_vfs_mime_database_parent_class = g_type_class_peek_parent (klass); + gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = thunar_vfs_mime_database_finalize; } diff --git a/thunar-vfs/thunar-vfs-mime-info.c b/thunar-vfs/thunar-vfs-mime-info.c index 62eb3b45f..4c1de3723 100644 --- a/thunar-vfs/thunar-vfs-mime-info.c +++ b/thunar-vfs/thunar-vfs-mime-info.c @@ -96,7 +96,7 @@ thunar_vfs_mime_info_get_type (void) if (G_UNLIKELY (type == G_TYPE_INVALID)) { - type = g_boxed_type_register_static ("ThunarVfsMimeInfo", + type = g_boxed_type_register_static (I_("ThunarVfsMimeInfo"), (GBoxedCopyFunc) thunar_vfs_mime_info_ref, (GBoxedFreeFunc) thunar_vfs_mime_info_unref); } diff --git a/thunar-vfs/thunar-vfs-mime-legacy.c b/thunar-vfs/thunar-vfs-mime-legacy.c index 9099c7e7e..d35436a4c 100644 --- a/thunar-vfs/thunar-vfs-mime-legacy.c +++ b/thunar-vfs/thunar-vfs-mime-legacy.c @@ -37,6 +37,7 @@ #endif #include <thunar-vfs/thunar-vfs-mime-legacy.h> +#include <thunar-vfs/thunar-vfs-alias.h> @@ -144,7 +145,7 @@ thunar_vfs_mime_legacy_get_type (void) }; type = g_type_register_static (THUNAR_VFS_TYPE_MIME_PROVIDER, - "ThunarVfsMimeLegacy", &info, 0); + I_("ThunarVfsMimeLegacy"), &info, 0); } return type; @@ -641,3 +642,5 @@ thunar_vfs_mime_legacy_new (const gchar *directory) +#define __THUNAR_VFS_MIME_LEGACY_C__ +#include <thunar-vfs/thunar-vfs-aliasdef.c> diff --git a/thunar-vfs/thunar-vfs-mime-provider.c b/thunar-vfs/thunar-vfs-mime-provider.c index e1b4b8a3a..96d431af1 100644 --- a/thunar-vfs/thunar-vfs-mime-provider.c +++ b/thunar-vfs/thunar-vfs-mime-provider.c @@ -23,6 +23,7 @@ #endif #include <thunar-vfs/thunar-vfs-mime-provider.h> +#include <thunar-vfs/thunar-vfs-alias.h> @@ -47,9 +48,13 @@ thunar_vfs_mime_provider_get_type (void) NULL, }; - type = g_type_register_static (G_TYPE_OBJECT, "ThunarVfsMimeProvider", &info, G_TYPE_FLAG_ABSTRACT); + type = g_type_register_static (G_TYPE_OBJECT, I_("ThunarVfsMimeProvider"), &info, G_TYPE_FLAG_ABSTRACT); } return type; } + + +#define __THUNAR_VFS_MIME_PROVIDER_C__ +#include <thunar-vfs/thunar-vfs-aliasdef.c> diff --git a/thunar-vfs/thunar-vfs-mime-provider.h b/thunar-vfs/thunar-vfs-mime-provider.h index bc609567f..9f8c0d5d2 100644 --- a/thunar-vfs/thunar-vfs-mime-provider.h +++ b/thunar-vfs/thunar-vfs-mime-provider.h @@ -21,7 +21,7 @@ #ifndef __THUNAR_VFS_MIME_PROVIDER_H__ #define __THUNAR_VFS_MIME_PROVIDER_H__ -#include <glib-object.h> +#include <exo/exo.h> G_BEGIN_DECLS; diff --git a/thunar-vfs/thunar-vfs-mkdir-job.c b/thunar-vfs/thunar-vfs-mkdir-job.c index 1e5812b20..ecc7bf4b7 100644 --- a/thunar-vfs/thunar-vfs-mkdir-job.c +++ b/thunar-vfs/thunar-vfs-mkdir-job.c @@ -86,7 +86,7 @@ thunar_vfs_mkdir_job_get_type (void) }; type = g_type_register_static (THUNAR_VFS_TYPE_INTERACTIVE_JOB, - "ThunarVfsMkdirJob", &info, 0); + I_("ThunarVfsMkdirJob"), &info, 0); } return type; diff --git a/thunar-vfs/thunar-vfs-monitor.c b/thunar-vfs/thunar-vfs-monitor.c index 8ef86d0e1..ab106b458 100644 --- a/thunar-vfs/thunar-vfs-monitor.c +++ b/thunar-vfs/thunar-vfs-monitor.c @@ -128,7 +128,36 @@ struct _ThunarVfsMonitorNotification -G_DEFINE_TYPE (ThunarVfsMonitor, thunar_vfs_monitor, G_TYPE_OBJECT); +static GObjectClass *thunar_vfs_monitor_parent_class; + + + +GType +thunar_vfs_monitor_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarVfsMonitorClass), + NULL, + NULL, + (GClassInitFunc) thunar_vfs_monitor_class_init, + NULL, + NULL, + sizeof (ThunarVfsMonitor), + 0, + (GInstanceInitFunc) thunar_vfs_monitor_init, + NULL, + }; + + type = g_type_register_static (G_TYPE_OBJECT, I_("ThunarVfsMonitor"), &info, 0); + } + + return type; +} @@ -137,6 +166,9 @@ thunar_vfs_monitor_class_init (ThunarVfsMonitorClass *klass) { GObjectClass *gobject_class; + /* determine the parent type class */ + thunar_vfs_monitor_parent_class = g_type_class_peek_parent (klass); + gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = thunar_vfs_monitor_finalize; } diff --git a/thunar-vfs/thunar-vfs-path.c b/thunar-vfs/thunar-vfs-path.c index 7c0fc6d7d..0799a4a2f 100644 --- a/thunar-vfs/thunar-vfs-path.c +++ b/thunar-vfs/thunar-vfs-path.c @@ -177,7 +177,7 @@ thunar_vfs_path_get_type (void) if (G_UNLIKELY (type == G_TYPE_INVALID)) { - type = g_boxed_type_register_static ("ThunarVfsPath", + type = g_boxed_type_register_static (I_("ThunarVfsPath"), (GBoxedCopyFunc) thunar_vfs_path_ref, (GBoxedFreeFunc) thunar_vfs_path_unref); } diff --git a/thunar-vfs/thunar-vfs-scandir.c b/thunar-vfs/thunar-vfs-scandir.c index aaa1a6b71..5c5dadb0c 100644 --- a/thunar-vfs/thunar-vfs-scandir.c +++ b/thunar-vfs/thunar-vfs-scandir.c @@ -58,6 +58,7 @@ #endif #include <thunar-vfs/thunar-vfs-scandir.h> +#include <thunar-vfs/thunar-vfs-alias.h> @@ -369,7 +370,7 @@ thunar_vfs_scandir_collect (ThunarVfsScandirHandle *handle, if (G_UNLIKELY (!succeed)) { /* we can ignore certain errors here */ - if (errno == EMLINK || errno == ENOTDIR || errno == ENOENT) + if (errno == EACCES || errno == EMLINK || errno == ENOTDIR || errno == ENOENT || errno == EPERM) succeed = TRUE; } } @@ -426,3 +427,7 @@ thunar_vfs_scandir (ThunarVfsPath *path, return handle.path_list; } + + +#define __THUNAR_VFS_SCANDIR_C__ +#include <thunar-vfs/thunar-vfs-aliasdef.c> diff --git a/thunar-vfs/thunar-vfs-thumb-jpeg.c b/thunar-vfs/thunar-vfs-thumb-jpeg.c index 62888906a..210e05983 100644 --- a/thunar-vfs/thunar-vfs-thumb-jpeg.c +++ b/thunar-vfs/thunar-vfs-thumb-jpeg.c @@ -335,3 +335,5 @@ error: +#define __THUNAR_VFS_THUMB_JPEG_C__ +#include <thunar-vfs/thunar-vfs-aliasdef.c> diff --git a/thunar-vfs/thunar-vfs-thumb.c b/thunar-vfs/thunar-vfs-thumb.c index b03ef8b2d..0e23de6f8 100644 --- a/thunar-vfs/thunar-vfs-thumb.c +++ b/thunar-vfs/thunar-vfs-thumb.c @@ -118,7 +118,36 @@ struct _ThunarVfsThumbFactory -G_DEFINE_TYPE (ThunarVfsThumbFactory, thunar_vfs_thumb_factory, G_TYPE_OBJECT); +static GObjectClass *thunar_vfs_thumb_factory_parent_class; + + + +GType +thunar_vfs_thumb_factory_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarVfsThumbFactoryClass), + NULL, + NULL, + (GClassInitFunc) thunar_vfs_thumb_factory_class_init, + NULL, + NULL, + sizeof (ThunarVfsThumbFactory), + 0, + (GInstanceInitFunc) thunar_vfs_thumb_factory_init, + NULL, + }; + + type = g_type_register_static (G_TYPE_OBJECT, I_("ThunarVfsThumbFactory"), &info, 0); + } + + return type; +} @@ -127,6 +156,9 @@ thunar_vfs_thumb_factory_class_init (ThunarVfsThumbFactoryClass *klass) { GObjectClass *gobject_class; + /* determine the parent type class */ + thunar_vfs_thumb_factory_parent_class = g_type_class_peek_parent (klass); + gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = thunar_vfs_thumb_factory_finalize; gobject_class->get_property = thunar_vfs_thumb_factory_get_property; diff --git a/thunar-vfs/thunar-vfs-transfer-job.c b/thunar-vfs/thunar-vfs-transfer-job.c index b5fac46a1..938b30206 100644 --- a/thunar-vfs/thunar-vfs-transfer-job.c +++ b/thunar-vfs/thunar-vfs-transfer-job.c @@ -148,7 +148,38 @@ struct _ThunarVfsTransferPair -G_DEFINE_TYPE (ThunarVfsTransferJob, thunar_vfs_transfer_job, THUNAR_VFS_TYPE_INTERACTIVE_JOB); +static GObjectClass *thunar_vfs_transfer_job_parent_class; + + + +GType +thunar_vfs_transfer_job_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarVfsTransferJobClass), + NULL, + NULL, + (GClassInitFunc) thunar_vfs_transfer_job_class_init, + NULL, + NULL, + sizeof (ThunarVfsTransferJob), + 0, + (GInstanceInitFunc) thunar_vfs_transfer_job_init, + NULL, + }; + + type = g_type_register_static (THUNAR_VFS_TYPE_INTERACTIVE_JOB, + I_("ThunarVfsTransferJob"), + &info, 0); + } + + return type; +} @@ -158,6 +189,9 @@ thunar_vfs_transfer_job_class_init (ThunarVfsTransferJobClass *klass) ThunarVfsJobClass *thunarvfs_job_class; GObjectClass *gobject_class; + /* determine the parent type class */ + thunar_vfs_transfer_job_parent_class = g_type_class_peek_parent (klass); + gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = thunar_vfs_transfer_job_finalize; @@ -860,3 +894,7 @@ failure: return NULL; } + + +#define __THUNAR_VFS_TRANSFER_JOB_C__ +#include <thunar-vfs/thunar-vfs-aliasdef.c> diff --git a/thunar-vfs/thunar-vfs-unlink-job.c b/thunar-vfs/thunar-vfs-unlink-job.c index 54f8020b8..b84a02a9c 100644 --- a/thunar-vfs/thunar-vfs-unlink-job.c +++ b/thunar-vfs/thunar-vfs-unlink-job.c @@ -109,7 +109,8 @@ thunar_vfs_unlink_job_get_type (void) }; type = g_type_register_static (THUNAR_VFS_TYPE_INTERACTIVE_JOB, - "ThunarVfsUnlinkJob", &info, 0); + I_("ThunarVfsUnlinkJob"), + &info, 0); } return type; @@ -292,3 +293,6 @@ thunar_vfs_unlink_job_new (GList *path_list, } + +#define __THUNAR_VFS_UNLINK_JOB_C__ +#include <thunar-vfs/thunar-vfs-aliasdef.c> diff --git a/thunar-vfs/thunar-vfs-user.c b/thunar-vfs/thunar-vfs-user.c index 51f5dc3ab..84d708a76 100644 --- a/thunar-vfs/thunar-vfs-user.c +++ b/thunar-vfs/thunar-vfs-user.c @@ -102,7 +102,7 @@ thunar_vfs_group_get_type (void) NULL, }; - type = g_type_register_static (G_TYPE_OBJECT, "ThunarVfsGroup", &info, 0); + type = g_type_register_static (G_TYPE_OBJECT, I_("ThunarVfsGroup"), &info, 0); } return type; @@ -251,7 +251,7 @@ thunar_vfs_user_get_type (void) NULL, }; - type = g_type_register_static (G_TYPE_OBJECT, "ThunarVfsUser", &info, 0); + type = g_type_register_static (G_TYPE_OBJECT, I_("ThunarVfsUser"), &info, 0); } return type; diff --git a/thunar-vfs/thunar-vfs-volume.c b/thunar-vfs/thunar-vfs-volume.c index 8180791ba..320c607f6 100644 --- a/thunar-vfs/thunar-vfs-volume.c +++ b/thunar-vfs/thunar-vfs-volume.c @@ -67,10 +67,7 @@ thunar_vfs_volume_get_type (void) NULL, }; - type = g_type_register_static (G_TYPE_INTERFACE, - "ThunarVfsVolume", - &info, 0); - + type = g_type_register_static (G_TYPE_INTERFACE, I_("ThunarVfsVolume"), &info, 0); g_type_interface_add_prerequisite (type, G_TYPE_OBJECT); } @@ -93,7 +90,7 @@ thunar_vfs_volume_base_init (gpointer klass) * Emitted whenever the state of @volume changed. **/ volume_signals[THUNAR_VFS_VOLUME_CHANGED] = - g_signal_new ("changed", + g_signal_new (I_("changed"), G_TYPE_FROM_INTERFACE (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (ThunarVfsVolumeIface, changed), diff --git a/thunar/thunar-application.c b/thunar/thunar-application.c index ca7ef1963..23c7a4e9d 100644 --- a/thunar/thunar-application.c +++ b/thunar/thunar-application.c @@ -79,7 +79,36 @@ struct _ThunarApplication -G_DEFINE_TYPE (ThunarApplication, thunar_application, G_TYPE_OBJECT); +static GObjectClass *thunar_application_parent_class; + + + +GType +thunar_application_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarApplicationClass), + NULL, + NULL, + (GClassInitFunc) thunar_application_class_init, + NULL, + NULL, + sizeof (ThunarApplication), + 0, + (GInstanceInitFunc) thunar_application_init, + NULL, + }; + + type = g_type_register_static (G_TYPE_OBJECT, I_("ThunarApplication"), &info, 0); + } + + return type; +} @@ -88,6 +117,9 @@ thunar_application_class_init (ThunarApplicationClass *klass) { GObjectClass *gobject_class; + /* determine the parent type class */ + thunar_application_parent_class = g_type_class_peek_parent (klass); + gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = thunar_application_finalize; } diff --git a/thunar/thunar-chooser-dialog.c b/thunar/thunar-chooser-dialog.c index 91f49d495..d52048e4b 100644 --- a/thunar/thunar-chooser-dialog.c +++ b/thunar/thunar-chooser-dialog.c @@ -104,7 +104,36 @@ struct _ThunarChooserDialog -G_DEFINE_TYPE (ThunarChooserDialog, thunar_chooser_dialog, GTK_TYPE_DIALOG); +static GObjectClass *thunar_chooser_dialog_parent_class; + + + +GType +thunar_chooser_dialog_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarChooserDialogClass), + NULL, + NULL, + (GClassInitFunc) thunar_chooser_dialog_class_init, + NULL, + NULL, + sizeof (ThunarChooserDialog), + 0, + (GInstanceInitFunc) thunar_chooser_dialog_init, + NULL, + }; + + type = g_type_register_static (GTK_TYPE_DIALOG, I_("ThunarChooserDialog"), &info, 0); + } + + return type; +} @@ -115,6 +144,9 @@ thunar_chooser_dialog_class_init (ThunarChooserDialogClass *klass) GtkWidgetClass *gtkwidget_class; GObjectClass *gobject_class; + /* determine the parent type class */ + thunar_chooser_dialog_parent_class = g_type_class_peek_parent (klass); + gobject_class = G_OBJECT_CLASS (klass); gobject_class->dispose = thunar_chooser_dialog_dispose; gobject_class->get_property = thunar_chooser_dialog_get_property; diff --git a/thunar/thunar-chooser-model.c b/thunar/thunar-chooser-model.c index 599c3db89..92b2157d1 100644 --- a/thunar/thunar-chooser-model.c +++ b/thunar/thunar-chooser-model.c @@ -90,7 +90,36 @@ struct _ThunarChooserModel -G_DEFINE_TYPE (ThunarChooserModel, thunar_chooser_model, GTK_TYPE_TREE_STORE); +static GObjectClass *thunar_chooser_model_parent_class; + + + +GType +thunar_chooser_model_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarChooserModelClass), + NULL, + NULL, + (GClassInitFunc) thunar_chooser_model_class_init, + NULL, + NULL, + sizeof (ThunarChooserModel), + 0, + (GInstanceInitFunc) thunar_chooser_model_init, + NULL, + }; + + type = g_type_register_static (GTK_TYPE_TREE_STORE, I_("ThunarChooserModel"), &info, 0); + } + + return type; +} @@ -99,6 +128,9 @@ thunar_chooser_model_class_init (ThunarChooserModelClass *klass) { GObjectClass *gobject_class; + /* determine the parent type class */ + thunar_chooser_model_parent_class = g_type_class_peek_parent (klass); + gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = thunar_chooser_model_finalize; gobject_class->get_property = thunar_chooser_model_get_property; diff --git a/thunar/thunar-clipboard-manager.c b/thunar/thunar-clipboard-manager.c index bc2b8206a..4112cae85 100644 --- a/thunar/thunar-clipboard-manager.c +++ b/thunar/thunar-clipboard-manager.c @@ -55,6 +55,7 @@ enum static void thunar_clipboard_manager_class_init (ThunarClipboardManagerClass *klass); +static void thunar_clipboard_manager_init (ThunarClipboardManager *manager); static void thunar_clipboard_manager_finalize (GObject *object); static void thunar_clipboard_manager_get_property (GObject *object, guint prop_id, @@ -118,12 +119,38 @@ static const GtkTargetEntry clipboard_targets[] = { "UTF8_STRING", 0, TARGET_UTF8_STRING } }; -static GQuark thunar_clipboard_manager_quark = 0; -static guint manager_signals[LAST_SIGNAL]; +static GObjectClass *thunar_clipboard_manager_parent_class; +static GQuark thunar_clipboard_manager_quark = 0; +static guint manager_signals[LAST_SIGNAL]; -G_DEFINE_TYPE (ThunarClipboardManager, thunar_clipboard_manager, G_TYPE_OBJECT); +GType +thunar_clipboard_manager_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarClipboardManagerClass), + NULL, + NULL, + (GClassInitFunc) thunar_clipboard_manager_class_init, + NULL, + NULL, + sizeof (ThunarClipboardManager), + 0, + (GInstanceInitFunc) thunar_clipboard_manager_init, + NULL, + }; + + type = g_type_register_static (G_TYPE_OBJECT, I_("ThunarClipboardManager"), &info, 0); + } + + return type; +} @@ -132,6 +159,9 @@ thunar_clipboard_manager_class_init (ThunarClipboardManagerClass *klass) { GObjectClass *gobject_class; + /* determine the parent type class */ + thunar_clipboard_manager_parent_class = g_type_class_peek_parent (klass); + gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = thunar_clipboard_manager_finalize; gobject_class->get_property = thunar_clipboard_manager_get_property; @@ -159,7 +189,7 @@ thunar_clipboard_manager_class_init (ThunarClipboardManagerClass *klass) * clipboard associated with @manager changes. **/ manager_signals[CHANGED] = - g_signal_new ("changed", + g_signal_new (I_("changed"), G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (ThunarClipboardManagerClass, changed), @@ -173,7 +203,6 @@ thunar_clipboard_manager_class_init (ThunarClipboardManagerClass *klass) static void thunar_clipboard_manager_init (ThunarClipboardManager *manager) { - manager->can_paste = FALSE; manager->x_special_gnome_copied_files = gdk_atom_intern ("x-special/gnome-copied-files", FALSE); } diff --git a/thunar/thunar-create-dialog.c b/thunar/thunar-create-dialog.c index 44d3b6062..129b8553c 100644 --- a/thunar/thunar-create-dialog.c +++ b/thunar/thunar-create-dialog.c @@ -71,7 +71,36 @@ struct _ThunarCreateDialog -G_DEFINE_TYPE (ThunarCreateDialog, thunar_create_dialog, GTK_TYPE_DIALOG); +static GObjectClass *thunar_create_dialog_parent_class; + + + +GType +thunar_create_dialog_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarCreateDialogClass), + NULL, + NULL, + (GClassInitFunc) thunar_create_dialog_class_init, + NULL, + NULL, + sizeof (ThunarCreateDialog), + 0, + (GInstanceInitFunc) thunar_create_dialog_init, + NULL, + }; + + type = g_type_register_static (GTK_TYPE_DIALOG, I_("ThunarCreateDialog"), &info, 0); + } + + return type; +} @@ -81,6 +110,9 @@ thunar_create_dialog_class_init (ThunarCreateDialogClass *klass) GtkWidgetClass *gtkwidget_class; GObjectClass *gobject_class; + /* determine the parent type class */ + thunar_create_dialog_parent_class = g_type_class_peek_parent (klass); + gobject_class = G_OBJECT_CLASS (klass); gobject_class->dispose = thunar_create_dialog_dispose; gobject_class->get_property = thunar_create_dialog_get_property; diff --git a/thunar/thunar-details-view.c b/thunar/thunar-details-view.c index e3f02f0e4..9bf7e168d 100644 --- a/thunar/thunar-details-view.c +++ b/thunar/thunar-details-view.c @@ -73,7 +73,36 @@ struct _ThunarDetailsView -G_DEFINE_TYPE (ThunarDetailsView, thunar_details_view, THUNAR_TYPE_STANDARD_VIEW); +static GObjectClass *thunar_details_view_parent_class; + + + +GType +thunar_details_view_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarDetailsViewClass), + NULL, + NULL, + (GClassInitFunc) thunar_details_view_class_init, + NULL, + NULL, + sizeof (ThunarDetailsView), + 0, + (GInstanceInitFunc) thunar_details_view_init, + NULL, + }; + + type = g_type_register_static (THUNAR_TYPE_STANDARD_VIEW, I_("ThunarDetailsView"), &info, 0); + } + + return type; +} @@ -83,6 +112,9 @@ thunar_details_view_class_init (ThunarDetailsViewClass *klass) ThunarStandardViewClass *thunarstandard_view_class; GtkWidgetClass *gtkwidget_class; + /* determine the parent type class */ + thunar_details_view_parent_class = g_type_class_peek_parent (klass); + gtkwidget_class = GTK_WIDGET_CLASS (klass); gtkwidget_class->get_accessible = thunar_details_view_get_accessible; diff --git a/thunar/thunar-dnd.c b/thunar/thunar-dnd.c index 46ce1bb52..858d92e66 100644 --- a/thunar/thunar-dnd.c +++ b/thunar/thunar-dnd.c @@ -31,7 +31,7 @@ static void action_selected (GtkWidget *item, GdkDragAction *action) { - *action = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (item), "action")); + *action = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (item), I_("action"))); } @@ -84,7 +84,7 @@ thunar_dnd_ask (GtkWidget *widget, if (G_LIKELY ((actions & action_items[n]) != 0)) { item = gtk_image_menu_item_new_with_mnemonic (_(action_names[n])); - g_object_set_data (G_OBJECT (item), "action", GUINT_TO_POINTER (action_items[n])); + g_object_set_data (G_OBJECT (item), I_("action"), GUINT_TO_POINTER (action_items[n])); g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (action_selected), &action); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show (item); diff --git a/thunar/thunar-emblem-chooser.c b/thunar/thunar-emblem-chooser.c index 3fb7326fa..c0447540d 100644 --- a/thunar/thunar-emblem-chooser.c +++ b/thunar/thunar-emblem-chooser.c @@ -84,7 +84,36 @@ struct _ThunarEmblemChooser -G_DEFINE_TYPE (ThunarEmblemChooser, thunar_emblem_chooser, GTK_TYPE_SCROLLED_WINDOW); +static GObjectClass *thunar_emblem_chooser_parent_class; + + + +GType +thunar_emblem_chooser_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarEmblemChooserClass), + NULL, + NULL, + (GClassInitFunc) thunar_emblem_chooser_class_init, + NULL, + NULL, + sizeof (ThunarEmblemChooser), + 0, + (GInstanceInitFunc) thunar_emblem_chooser_init, + NULL, + }; + + type = g_type_register_static (GTK_TYPE_SCROLLED_WINDOW, I_("ThunarEmblemChooser"), &info, 0); + } + + return type; +} @@ -94,6 +123,9 @@ thunar_emblem_chooser_class_init (ThunarEmblemChooserClass *klass) GtkWidgetClass *gtkwidget_class; GObjectClass *gobject_class; + /* determine the parent type class */ + thunar_emblem_chooser_parent_class = g_type_class_peek_parent (klass); + gobject_class = G_OBJECT_CLASS (klass); gobject_class->dispose = thunar_emblem_chooser_dispose; gobject_class->finalize = thunar_emblem_chooser_finalize; @@ -279,7 +311,7 @@ thunar_emblem_chooser_button_toggled (GtkToggleButton *button, for (lp = children; lp != NULL; lp = lp->next) if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (lp->data))) { - emblem_name = g_object_get_data (G_OBJECT (lp->data), "thunar-emblem"); + emblem_name = g_object_get_data (G_OBJECT (lp->data), I_("thunar-emblem")); emblem_names = g_list_append (emblem_names, g_strdup (emblem_name)); } g_list_free (children); @@ -317,7 +349,7 @@ thunar_emblem_chooser_file_changed (ThunarFile *file, children = gtk_container_get_children (GTK_CONTAINER (chooser->table)); for (lp = children; lp != NULL; lp = lp->next) { - emblem_name = g_object_get_data (G_OBJECT (lp->data), "thunar-emblem"); + emblem_name = g_object_get_data (G_OBJECT (lp->data), I_("thunar-emblem")); if (g_list_find_custom (emblem_names, emblem_name, (GCompareFunc) strcmp) != NULL) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (lp->data), TRUE); else @@ -419,7 +451,7 @@ thunar_emblem_chooser_create_button (ThunarEmblemChooser *chooser, /* allocate the button */ button = gtk_check_button_new (); GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_FOCUS); - g_object_set_data_full (G_OBJECT (button), "thunar-emblem", g_strdup (emblem), g_free); + g_object_set_data_full (G_OBJECT (button), I_("thunar-emblem"), g_strdup (emblem), g_free); g_signal_connect (G_OBJECT (button), "toggled", G_CALLBACK (thunar_emblem_chooser_button_toggled), chooser); /* allocate the box */ diff --git a/thunar/thunar-favourites-model.c b/thunar/thunar-favourites-model.c index 2ab65b097..99bf892c2 100644 --- a/thunar/thunar-favourites-model.c +++ b/thunar/thunar-favourites-model.c @@ -143,13 +143,52 @@ struct _ThunarFavourite -G_DEFINE_TYPE_WITH_CODE (ThunarFavouritesModel, - thunar_favourites_model, - G_TYPE_OBJECT, - G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_MODEL, - thunar_favourites_model_tree_model_init) - G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_DRAG_SOURCE, - thunar_favourites_model_drag_source_init)); +static GObjectClass *thunar_favourites_model_parent_class; + + + +GType +thunar_favourites_model_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarFavouritesModelClass), + NULL, + NULL, + (GClassInitFunc) thunar_favourites_model_class_init, + NULL, + NULL, + sizeof (ThunarFavouritesModel), + 0, + (GInstanceInitFunc) thunar_favourites_model_init, + NULL, + }; + + static const GInterfaceInfo tree_model_info = + { + (GInterfaceInitFunc) thunar_favourites_model_tree_model_init, + NULL, + NULL, + }; + + static const GInterfaceInfo drag_source_info = + { + (GInterfaceInitFunc) thunar_favourites_model_drag_source_init, + NULL, + NULL, + }; + + type = g_type_register_static (G_TYPE_OBJECT, I_("ThunarFavouritesModel"), &info, 0); + g_type_add_interface_static (type, GTK_TYPE_TREE_MODEL, &tree_model_info); + g_type_add_interface_static (type, GTK_TYPE_TREE_DRAG_SOURCE, &drag_source_info); + } + + return type; +} @@ -158,6 +197,9 @@ thunar_favourites_model_class_init (ThunarFavouritesModelClass *klass) { GObjectClass *gobject_class; + /* determine the parent type class */ + thunar_favourites_model_parent_class = g_type_class_peek_parent (klass); + gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = thunar_favourites_model_finalize; } diff --git a/thunar/thunar-favourites-pane.c b/thunar/thunar-favourites-pane.c index 9e9989bbf..1b68e4d3a 100644 --- a/thunar/thunar-favourites-pane.c +++ b/thunar/thunar-favourites-pane.c @@ -68,13 +68,52 @@ struct _ThunarFavouritesPane -G_DEFINE_TYPE_WITH_CODE (ThunarFavouritesPane, - thunar_favourites_pane, - GTK_TYPE_SCROLLED_WINDOW, - G_IMPLEMENT_INTERFACE (THUNAR_TYPE_NAVIGATOR, - thunar_favourites_pane_navigator_init) - G_IMPLEMENT_INTERFACE (THUNAR_TYPE_SIDE_PANE, - thunar_favourites_pane_side_pane_init)); +static GObjectClass *thunar_favourites_pane_parent_class; + + + +GType +thunar_favourites_pane_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarFavouritesPaneClass), + NULL, + NULL, + (GClassInitFunc) thunar_favourites_pane_class_init, + NULL, + NULL, + sizeof (ThunarFavouritesPane), + 0, + (GInstanceInitFunc) thunar_favourites_pane_init, + NULL, + }; + + static const GInterfaceInfo navigator_info = + { + (GInterfaceInitFunc) thunar_favourites_pane_navigator_init, + NULL, + NULL, + }; + + static const GInterfaceInfo side_pane_info = + { + (GInterfaceInitFunc) thunar_favourites_pane_side_pane_init, + NULL, + NULL, + }; + + type = g_type_register_static (GTK_TYPE_SCROLLED_WINDOW, I_("ThunarFavouritesPane"), &info, 0); + g_type_add_interface_static (type, THUNAR_TYPE_NAVIGATOR, &navigator_info); + g_type_add_interface_static (type, THUNAR_TYPE_SIDE_PANE, &side_pane_info); + } + + return type; +} @@ -83,6 +122,9 @@ thunar_favourites_pane_class_init (ThunarFavouritesPaneClass *klass) { GObjectClass *gobject_class; + /* determine the parent type class */ + thunar_favourites_pane_parent_class = g_type_class_peek_parent (klass); + gobject_class = G_OBJECT_CLASS (klass); gobject_class->dispose = thunar_favourites_pane_dispose; gobject_class->get_property = thunar_favourites_pane_get_property; diff --git a/thunar/thunar-favourites-view.c b/thunar/thunar-favourites-view.c index a9f38b659..7e3d2310b 100644 --- a/thunar/thunar-favourites-view.c +++ b/thunar/thunar-favourites-view.c @@ -125,7 +125,36 @@ static const GtkTargetEntry drop_targets[] = { -G_DEFINE_TYPE (ThunarFavouritesView, thunar_favourites_view, GTK_TYPE_TREE_VIEW); +static GObjectClass *thunar_favourites_view_parent_class; + + + +GType +thunar_favourites_view_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarFavouritesViewClass), + NULL, + NULL, + (GClassInitFunc) thunar_favourites_view_class_init, + NULL, + NULL, + sizeof (ThunarFavouritesView), + 0, + (GInstanceInitFunc) thunar_favourites_view_init, + NULL, + }; + + type = g_type_register_static (GTK_TYPE_TREE_VIEW, I_("ThunarFavouritesView"), &info, 0); + } + + return type; +} @@ -135,6 +164,9 @@ thunar_favourites_view_class_init (ThunarFavouritesViewClass *klass) GtkTreeViewClass *gtktree_view_class; GtkWidgetClass *gtkwidget_class; + /* determine the parent type class */ + thunar_favourites_view_parent_class = g_type_class_peek_parent (klass); + gtkwidget_class = GTK_WIDGET_CLASS (klass); gtkwidget_class->button_press_event = thunar_favourites_view_button_press_event; gtkwidget_class->drag_data_received = thunar_favourites_view_drag_data_received; @@ -150,7 +182,7 @@ thunar_favourites_view_class_init (ThunarFavouritesViewClass *klass) * Invoked whenever a favourite is activated by the user. **/ view_signals[FAVOURITE_ACTIVATED] = - g_signal_new ("favourite-activated", + g_signal_new (I_("favourite-activated"), G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (ThunarFavouritesViewClass, favourite_activated), @@ -290,7 +322,7 @@ thunar_favourites_view_button_press_event (GtkWidget *widget, /* append the remove menu item */ item = gtk_image_menu_item_new_with_mnemonic (_("_Remove Favourite")); - g_object_set_data_full (G_OBJECT (item), "thunar-favourites-row", + g_object_set_data_full (G_OBJECT (item), I_("thunar-favourites-row"), gtk_tree_row_reference_new (model, path), (GDestroyNotify) gtk_tree_row_reference_free); g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (thunar_favourites_view_remove_activated), widget); @@ -305,7 +337,7 @@ thunar_favourites_view_button_press_event (GtkWidget *widget, /* append the rename menu item */ item = gtk_image_menu_item_new_with_mnemonic (_("Re_name Favourite")); - g_object_set_data_full (G_OBJECT (item), "thunar-favourites-row", + g_object_set_data_full (G_OBJECT (item), I_("thunar-favourites-row"), gtk_tree_row_reference_new (model, path), (GDestroyNotify) gtk_tree_row_reference_free); g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (thunar_favourites_view_rename_activated), widget); @@ -481,7 +513,7 @@ thunar_favourites_view_remove_activated (GtkWidget *item, GtkTreeModel *model; GtkTreePath *path; - row = g_object_get_data (G_OBJECT (item), "thunar-favourites-row"); + row = g_object_get_data (G_OBJECT (item), I_("thunar-favourites-row")); path = gtk_tree_row_reference_get_path (row); if (G_LIKELY (path != NULL)) { @@ -503,7 +535,7 @@ thunar_favourites_view_rename_activated (GtkWidget *item, GtkTreePath *path; GList *renderers; - row = g_object_get_data (G_OBJECT (item), "thunar-favourites-row"); + row = g_object_get_data (G_OBJECT (item), I_("thunar-favourites-row")); path = gtk_tree_row_reference_get_path (row); if (G_LIKELY (path != NULL)) { diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c index d7dd46a0e..d54efb467 100644 --- a/thunar/thunar-file.c +++ b/thunar/thunar-file.c @@ -133,8 +133,7 @@ thunar_file_get_type (void) NULL, }; - type = g_type_register_static (G_TYPE_OBJECT, "ThunarFile", &info, 0); - + type = g_type_register_static (G_TYPE_OBJECT, I_("ThunarFile"), &info, 0); g_type_add_interface_static (type, THUNARX_TYPE_FILE_INFO, &file_info_info); } @@ -213,7 +212,7 @@ thunar_file_class_init (ThunarFileClass *klass) * Emitted whenever the system notices a change to @file. **/ file_signals[CHANGED] = - g_signal_new ("changed", + g_signal_new (I_("changed"), G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (ThunarFileClass, changed), @@ -229,7 +228,7 @@ thunar_file_class_init (ThunarFileClass *klass) * was destroyed. **/ file_signals[DESTROY] = - g_signal_new ("destroy", + g_signal_new (I_("destroy"), G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_CLEANUP | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS, G_STRUCT_OFFSET (ThunarFileClass, destroy), @@ -246,7 +245,7 @@ thunar_file_class_init (ThunarFileClass *klass) * reregister it's VFS directory monitor. **/ file_signals[RENAMED] = - g_signal_new ("renamed", + g_signal_new (I_("renamed"), G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (ThunarFileClass, renamed), diff --git a/thunar/thunar-folder.c b/thunar/thunar-folder.c index c7b0368cc..fa9055fba 100644 --- a/thunar/thunar-folder.c +++ b/thunar/thunar-folder.c @@ -104,12 +104,38 @@ struct _ThunarFolder -static guint folder_signals[LAST_SIGNAL]; -static GQuark thunar_folder_quark; +static GObjectClass *thunar_folder_parent_class; +static guint folder_signals[LAST_SIGNAL]; +static GQuark thunar_folder_quark; -G_DEFINE_TYPE (ThunarFolder, thunar_folder, GTK_TYPE_OBJECT); +GType +thunar_folder_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarFolderClass), + NULL, + NULL, + (GClassInitFunc) thunar_folder_class_init, + NULL, + NULL, + sizeof (ThunarFolder), + 0, + (GInstanceInitFunc) thunar_folder_init, + NULL, + }; + + type = g_type_register_static (GTK_TYPE_OBJECT, I_("ThunarFolder"), &info, 0); + } + + return type; +} @@ -118,6 +144,9 @@ thunar_folder_class_init (ThunarFolderClass *klass) { GObjectClass *gobject_class; + /* determine the parent type class */ + thunar_folder_parent_class = g_type_class_peek_parent (klass); + gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = thunar_folder_finalize; gobject_class->get_property = thunar_folder_get_property; @@ -145,7 +174,7 @@ thunar_folder_class_init (ThunarFolderClass *klass) * load the directory content because of an error. **/ folder_signals[ERROR] = - g_signal_new ("error", + g_signal_new (I_("error"), G_TYPE_FROM_CLASS (gobject_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (ThunarFolderClass, error), @@ -160,7 +189,7 @@ thunar_folder_class_init (ThunarFolderClass *klass) * been added to a particular folder. **/ folder_signals[FILES_ADDED] = - g_signal_new ("files-added", + g_signal_new (I_("files-added"), G_TYPE_FROM_CLASS (gobject_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (ThunarFolderClass, files_added), @@ -177,7 +206,7 @@ thunar_folder_class_init (ThunarFolderClass *klass) * the reload of folders, which take longer to load. **/ folder_signals[FILES_REMOVED] = - g_signal_new ("files-removed", + g_signal_new (I_("files-removed"), G_TYPE_FROM_CLASS (gobject_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (ThunarFolderClass, files_removed), diff --git a/thunar/thunar-history.c b/thunar/thunar-history.c index 29d4c1486..146139689 100644 --- a/thunar/thunar-history.c +++ b/thunar/thunar-history.c @@ -81,11 +81,44 @@ struct _ThunarHistory -G_DEFINE_TYPE_WITH_CODE (ThunarHistory, - thunar_history, - G_TYPE_OBJECT, - G_IMPLEMENT_INTERFACE (THUNAR_TYPE_NAVIGATOR, - thunar_history_navigator_init)); +static GObjectClass *thunar_history_parent_class; + + + +GType +thunar_history_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarHistoryClass), + NULL, + NULL, + (GClassInitFunc) thunar_history_class_init, + NULL, + NULL, + sizeof (ThunarHistory), + 0, + (GInstanceInitFunc) thunar_history_init, + NULL, + }; + + static const GInterfaceInfo navigator_info = + { + (GInterfaceInitFunc) thunar_history_navigator_init, + NULL, + NULL, + }; + + type = g_type_register_static (G_TYPE_OBJECT, I_("ThunarHistory"), &info, 0); + g_type_add_interface_static (type, THUNAR_TYPE_NAVIGATOR, &navigator_info); + } + + return type; +} @@ -94,6 +127,9 @@ thunar_history_class_init (ThunarHistoryClass *klass) { GObjectClass *gobject_class; + /* determine the parent type class */ + thunar_history_parent_class = g_type_class_peek_parent (klass); + gobject_class = G_OBJECT_CLASS (klass); gobject_class->dispose = thunar_history_dispose; gobject_class->finalize = thunar_history_finalize; diff --git a/thunar/thunar-icon-factory.c b/thunar/thunar-icon-factory.c index 56c7b99fa..226cb8c36 100644 --- a/thunar/thunar-icon-factory.c +++ b/thunar/thunar-icon-factory.c @@ -32,8 +32,6 @@ #include <string.h> #endif -#include <exo/exo.h> - #include <thunar/thunar-fallback-icon.h> #include <thunar/thunar-gdk-pixbuf-extensions.h> #include <thunar/thunar-icon-factory.h> @@ -128,12 +126,38 @@ struct _ThunarIconKey -static GQuark thunar_icon_factory_quark = 0; -static GQuark thunar_file_thumb_path_quark = 0; +static GObjectClass *thunar_icon_factory_parent_class = NULL; +static GQuark thunar_icon_factory_quark = 0; +static GQuark thunar_file_thumb_path_quark = 0; -G_DEFINE_TYPE (ThunarIconFactory, thunar_icon_factory, G_TYPE_OBJECT); +GType +thunar_icon_factory_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarIconFactoryClass), + NULL, + NULL, + (GClassInitFunc) thunar_icon_factory_class_init, + NULL, + NULL, + sizeof (ThunarIconFactory), + 0, + (GInstanceInitFunc) thunar_icon_factory_init, + NULL, + }; + + type = g_type_register_static (G_TYPE_OBJECT, I_("ThunarIconFactory"), &info, 0); + } + + return type; +} @@ -142,6 +166,9 @@ thunar_icon_factory_class_init (ThunarIconFactoryClass *klass) { GObjectClass *gobject_class; + /* determine the parent type class */ + thunar_icon_factory_parent_class = g_type_class_peek_parent (klass); + /* setup the thunar-file-thumb-path quark */ thunar_file_thumb_path_quark = g_quark_from_static_string ("thunar-file-thumb-path"); diff --git a/thunar/thunar-icon-renderer.c b/thunar/thunar-icon-renderer.c index b48a9bb46..e749e7367 100644 --- a/thunar/thunar-icon-renderer.c +++ b/thunar/thunar-icon-renderer.c @@ -85,7 +85,36 @@ struct _ThunarIconRenderer -G_DEFINE_TYPE (ThunarIconRenderer, thunar_icon_renderer, GTK_TYPE_CELL_RENDERER); +static GObjectClass *thunar_icon_renderer_parent_class; + + + +GType +thunar_icon_renderer_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarIconRendererClass), + NULL, + NULL, + (GClassInitFunc) thunar_icon_renderer_class_init, + NULL, + NULL, + sizeof (ThunarIconRenderer), + 0, + (GInstanceInitFunc) thunar_icon_renderer_init, + NULL, + }; + + type = g_type_register_static (GTK_TYPE_CELL_RENDERER, I_("ThunarIconRenderer"), &info, 0); + } + + return type; +} @@ -95,6 +124,9 @@ thunar_icon_renderer_class_init (ThunarIconRendererClass *klass) GtkCellRendererClass *gtkcell_renderer_class; GObjectClass *gobject_class; + /* determine the parent type class */ + thunar_icon_renderer_parent_class = g_type_class_peek_parent (klass); + gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = thunar_icon_renderer_finalize; gobject_class->get_property = thunar_icon_renderer_get_property; diff --git a/thunar/thunar-icon-view.c b/thunar/thunar-icon-view.c index 488b31e62..453d000ba 100644 --- a/thunar/thunar-icon-view.c +++ b/thunar/thunar-icon-view.c @@ -140,7 +140,36 @@ static const GtkRadioActionEntry order_action_entries[] = -G_DEFINE_TYPE (ThunarIconView, thunar_icon_view, THUNAR_TYPE_STANDARD_VIEW); +static GObjectClass *thunar_icon_view_parent_class; + + + +GType +thunar_icon_view_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarIconViewClass), + NULL, + NULL, + (GClassInitFunc) thunar_icon_view_class_init, + NULL, + NULL, + sizeof (ThunarIconView), + 0, + (GInstanceInitFunc) thunar_icon_view_init, + NULL, + }; + + type = g_type_register_static (THUNAR_TYPE_STANDARD_VIEW, I_("ThunarIconView"), &info, 0); + } + + return type; +} @@ -151,6 +180,9 @@ thunar_icon_view_class_init (ThunarIconViewClass *klass) GtkWidgetClass *gtkwidget_class; GObjectClass *gobject_class; + /* determine the parent type class */ + thunar_icon_view_parent_class = g_type_class_peek_parent (klass); + gobject_class = G_OBJECT_CLASS (klass); gobject_class->set_property = thunar_icon_view_set_property; diff --git a/thunar/thunar-launcher.c b/thunar/thunar-launcher.c index 1adf59d44..bb1b2db3c 100644 --- a/thunar/thunar-launcher.c +++ b/thunar/thunar-launcher.c @@ -103,11 +103,37 @@ struct _ThunarLauncher -static guint launcher_signals[LAST_SIGNAL]; +static GObjectClass *thunar_launcher_parent_class; +static guint launcher_signals[LAST_SIGNAL]; -G_DEFINE_TYPE (ThunarLauncher, thunar_launcher, G_TYPE_OBJECT); +GType +thunar_launcher_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarLauncherClass), + NULL, + NULL, + (GClassInitFunc) thunar_launcher_class_init, + NULL, + NULL, + sizeof (ThunarLauncher), + 0, + (GInstanceInitFunc) thunar_launcher_init, + NULL, + }; + + type = g_type_register_static (G_TYPE_OBJECT, I_("ThunarLauncher"), &info, 0); + } + + return type; +} @@ -116,6 +142,9 @@ thunar_launcher_class_init (ThunarLauncherClass *klass) { GObjectClass *gobject_class; + /* determine the parent type class */ + thunar_launcher_parent_class = g_type_class_peek_parent (klass); + gobject_class = G_OBJECT_CLASS (klass); gobject_class->dispose = thunar_launcher_dispose; gobject_class->finalize = thunar_launcher_finalize; @@ -171,7 +200,7 @@ thunar_launcher_class_init (ThunarLauncherClass *klass) * based on the @launcher in the current window (if possible). **/ launcher_signals[OPEN_DIRECTORY] = - g_signal_new ("open-directory", + g_signal_new (I_("open-directory"), G_TYPE_FROM_CLASS (gobject_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (ThunarLauncherClass, open_directory), diff --git a/thunar/thunar-list-model.c b/thunar/thunar-list-model.c index b21135270..1d1d3a522 100644 --- a/thunar/thunar-list-model.c +++ b/thunar/thunar-list-model.c @@ -220,19 +220,61 @@ struct _SortTuple -static guint list_model_signals[LAST_SIGNAL]; +static GObjectClass *thunar_list_model_parent_class; +static guint list_model_signals[LAST_SIGNAL]; -G_DEFINE_TYPE_WITH_CODE (ThunarListModel, - thunar_list_model, - G_TYPE_OBJECT, - G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_MODEL, - thunar_list_model_tree_model_init) - G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_DRAG_DEST, - thunar_list_model_drag_dest_init) - G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_SORTABLE, - thunar_list_model_sortable_init)); +GType +thunar_list_model_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarListModelClass), + NULL, + NULL, + (GClassInitFunc) thunar_list_model_class_init, + NULL, + NULL, + sizeof (ThunarListModel), + 0, + (GInstanceInitFunc) thunar_list_model_init, + NULL, + }; + + static const GInterfaceInfo tree_model_info = + { + (GInterfaceInitFunc) thunar_list_model_tree_model_init, + NULL, + NULL, + }; + + static const GInterfaceInfo drag_dest_info = + { + (GInterfaceInitFunc) thunar_list_model_drag_dest_init, + NULL, + NULL, + }; + + static const GInterfaceInfo sortable_info = + { + (GInterfaceInitFunc) thunar_list_model_sortable_init, + NULL, + NULL, + }; + + type = g_type_register_static (G_TYPE_OBJECT, I_("ThunarListModel"), &info, 0); + g_type_add_interface_static (type, GTK_TYPE_TREE_MODEL, &tree_model_info); + g_type_add_interface_static (type, GTK_TYPE_TREE_DRAG_DEST, &drag_dest_info); + g_type_add_interface_static (type, GTK_TYPE_TREE_SORTABLE, &sortable_info); + } + + return type; +} @@ -241,6 +283,9 @@ thunar_list_model_class_init (ThunarListModelClass *klass) { GObjectClass *gobject_class; + /* determine the parent type class */ + thunar_list_model_parent_class = g_type_class_peek_parent (klass); + gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = thunar_list_model_finalize; gobject_class->dispose = thunar_list_model_dispose; @@ -308,7 +353,7 @@ thunar_list_model_class_init (ThunarListModelClass *klass) * @store content. **/ list_model_signals[ERROR] = - g_signal_new ("error", + g_signal_new (I_("error"), G_TYPE_FROM_CLASS (gobject_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (ThunarListModelClass, error), diff --git a/thunar/thunar-location-bar.c b/thunar/thunar-location-bar.c index a2b602fea..c7b4a7ffc 100644 --- a/thunar/thunar-location-bar.c +++ b/thunar/thunar-location-bar.c @@ -45,10 +45,7 @@ thunar_location_bar_get_type (void) NULL, }; - type = g_type_register_static (G_TYPE_INTERFACE, - "ThunarLocationBar", - &info, 0); - + type = g_type_register_static (G_TYPE_INTERFACE, I_("ThunarLocationBar"), &info, 0); g_type_interface_add_prerequisite (type, THUNAR_TYPE_NAVIGATOR); } diff --git a/thunar/thunar-location-buttons.c b/thunar/thunar-location-buttons.c index c1979d6d8..79a566519 100644 --- a/thunar/thunar-location-buttons.c +++ b/thunar/thunar-location-buttons.c @@ -162,13 +162,52 @@ static const GtkTargetEntry drag_targets[] = -G_DEFINE_TYPE_WITH_CODE (ThunarLocationButtons, - thunar_location_buttons, - GTK_TYPE_CONTAINER, - G_IMPLEMENT_INTERFACE (THUNAR_TYPE_NAVIGATOR, - thunar_location_buttons_navigator_init) - G_IMPLEMENT_INTERFACE (THUNAR_TYPE_LOCATION_BAR, - thunar_location_buttons_location_bar_init)); +static GObjectClass *thunar_location_buttons_parent_class; + + + +GType +thunar_location_buttons_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarLocationButtonsClass), + NULL, + NULL, + (GClassInitFunc) thunar_location_buttons_class_init, + NULL, + NULL, + sizeof (ThunarLocationButtons), + 0, + (GInstanceInitFunc) thunar_location_buttons_init, + NULL, + }; + + static const GInterfaceInfo navigator_info = + { + (GInterfaceInitFunc) thunar_location_buttons_navigator_init, + NULL, + NULL, + }; + + static const GInterfaceInfo location_bar_info = + { + (GInterfaceInitFunc) thunar_location_buttons_location_bar_init, + NULL, + NULL, + }; + + type = g_type_register_static (GTK_TYPE_CONTAINER, I_("ThunarLocationButtons"), &info, 0); + g_type_add_interface_static (type, THUNAR_TYPE_NAVIGATOR, &navigator_info); + g_type_add_interface_static (type, THUNAR_TYPE_LOCATION_BAR, &location_bar_info); + } + + return type; +} @@ -179,6 +218,9 @@ thunar_location_buttons_class_init (ThunarLocationButtonsClass *klass) GtkWidgetClass *gtkwidget_class; GObjectClass *gobject_class; + /* determine the parent type class */ + thunar_location_buttons_parent_class = g_type_class_peek_parent (klass); + gtk_label_quark = g_quark_from_static_string ("gtk-label"); thunar_file_quark = g_quark_from_static_string ("thunar-file"); diff --git a/thunar/thunar-location-dialog.c b/thunar/thunar-location-dialog.c index c912adf10..288d11c4b 100644 --- a/thunar/thunar-location-dialog.c +++ b/thunar/thunar-location-dialog.c @@ -26,8 +26,7 @@ -static void thunar_location_dialog_class_init (ThunarLocationDialogClass *klass); -static void thunar_location_dialog_init (ThunarLocationDialog *location_dialog); +static void thunar_location_dialog_init (ThunarLocationDialog *location_dialog); @@ -45,13 +44,31 @@ struct _ThunarLocationDialog -G_DEFINE_TYPE (ThunarLocationDialog, thunar_location_dialog, GTK_TYPE_DIALOG); - - - -static void -thunar_location_dialog_class_init (ThunarLocationDialogClass *klass) +GType +thunar_location_dialog_get_type (void) { + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarLocationDialogClass), + NULL, + NULL, + NULL, + NULL, + NULL, + sizeof (ThunarLocationDialog), + 0, + (GInstanceInitFunc) thunar_location_dialog_init, + NULL, + }; + + type = g_type_register_static (GTK_TYPE_DIALOG, I_("ThunarLocationDialog"), &info, 0); + } + + return type; } diff --git a/thunar/thunar-location-entry.c b/thunar/thunar-location-entry.c index 9b068fcf1..459d8fc55 100644 --- a/thunar/thunar-location-entry.c +++ b/thunar/thunar-location-entry.c @@ -70,13 +70,52 @@ struct _ThunarLocationEntry -G_DEFINE_TYPE_WITH_CODE (ThunarLocationEntry, - thunar_location_entry, - GTK_TYPE_HBOX, - G_IMPLEMENT_INTERFACE (THUNAR_TYPE_NAVIGATOR, - thunar_location_entry_navigator_init) - G_IMPLEMENT_INTERFACE (THUNAR_TYPE_LOCATION_BAR, - thunar_location_entry_location_bar_init)); +static GObjectClass *thunar_location_entry_parent_class; + + + +GType +thunar_location_entry_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarLocationEntryClass), + NULL, + NULL, + (GClassInitFunc) thunar_location_entry_class_init, + NULL, + NULL, + sizeof (ThunarLocationEntry), + 0, + (GInstanceInitFunc) thunar_location_entry_init, + NULL, + }; + + static const GInterfaceInfo navigator_info = + { + (GInterfaceInitFunc) thunar_location_entry_navigator_init, + NULL, + NULL, + }; + + static const GInterfaceInfo location_bar_info = + { + (GInterfaceInitFunc) thunar_location_entry_location_bar_init, + NULL, + NULL, + }; + + type = g_type_register_static (GTK_TYPE_HBOX, I_("ThunarLocationEntry"), &info, 0); + g_type_add_interface_static (type, THUNAR_TYPE_NAVIGATOR, &navigator_info); + g_type_add_interface_static (type, THUNAR_TYPE_LOCATION_BAR, &location_bar_info); + } + + return type; +} @@ -85,6 +124,9 @@ thunar_location_entry_class_init (ThunarLocationEntryClass *klass) { GObjectClass *gobject_class; + /* determine the parent type class */ + thunar_location_entry_parent_class = g_type_class_peek_parent (klass); + gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = thunar_location_entry_finalize; gobject_class->get_property = thunar_location_entry_get_property; diff --git a/thunar/thunar-metafile.c b/thunar/thunar-metafile.c index cb7e08c2e..8783ad8ea 100644 --- a/thunar/thunar-metafile.c +++ b/thunar/thunar-metafile.c @@ -66,7 +66,36 @@ struct _ThunarMetafile -G_DEFINE_TYPE (ThunarMetafile, thunar_metafile, G_TYPE_OBJECT); +static GObjectClass *thunar_metafile_parent_class; + + + +GType +thunar_metafile_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarMetafileClass), + NULL, + NULL, + (GClassInitFunc) thunar_metafile_class_init, + NULL, + NULL, + sizeof (ThunarMetafile), + 0, + (GInstanceInitFunc) thunar_metafile_init, + NULL, + }; + + type = g_type_register_static (G_TYPE_OBJECT, I_("ThunarMetafile"), &info, 0); + } + + return type; +} @@ -75,6 +104,9 @@ thunar_metafile_class_init (ThunarMetafileClass *klass) { GObjectClass *gobject_class; + /* determine the parent type class */ + thunar_metafile_parent_class = g_type_class_peek_parent (klass); + gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = thunar_metafile_finalize; } diff --git a/thunar/thunar-navigator.c b/thunar/thunar-navigator.c index 047a0efd8..75db0393e 100644 --- a/thunar/thunar-navigator.c +++ b/thunar/thunar-navigator.c @@ -62,9 +62,7 @@ thunar_navigator_get_type (void) NULL, }; - type = g_type_register_static (G_TYPE_INTERFACE, - "ThunarNavigator", - &info, 0); + type = g_type_register_static (G_TYPE_INTERFACE, I_("ThunarNavigator"), &info, 0); } return type; @@ -99,7 +97,7 @@ thunar_navigator_base_init (gpointer klass) * or the "current-directory" property. **/ navigator_signals[CHANGE_DIRECTORY] = - g_signal_new ("change-directory", + g_signal_new (I_("change-directory"), G_TYPE_FROM_INTERFACE (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (ThunarNavigatorIface, change_directory), diff --git a/thunar/thunar-open-with-action.c b/thunar/thunar-open-with-action.c index b7829549a..e8f36803d 100644 --- a/thunar/thunar-open-with-action.c +++ b/thunar/thunar-open-with-action.c @@ -82,9 +82,37 @@ struct _ThunarOpenWithAction -static guint open_with_action_signals[LAST_SIGNAL]; +static GObjectClass *thunar_open_with_action_parent_class; +static guint open_with_action_signals[LAST_SIGNAL]; -G_DEFINE_TYPE (ThunarOpenWithAction, thunar_open_with_action, GTK_TYPE_ACTION); + + +GType +thunar_open_with_action_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarOpenWithActionClass), + NULL, + NULL, + (GClassInitFunc) thunar_open_with_action_class_init, + NULL, + NULL, + sizeof (ThunarOpenWithAction), + 0, + (GInstanceInitFunc) thunar_open_with_action_init, + NULL, + }; + + type = g_type_register_static (GTK_TYPE_ACTION, I_("ThunarOpenWithAction"), &info, 0); + } + + return type; +} @@ -94,6 +122,9 @@ thunar_open_with_action_class_init (ThunarOpenWithActionClass *klass) GtkActionClass *gtkaction_class; GObjectClass *gobject_class; + /* determine the parent type class */ + thunar_open_with_action_parent_class = g_type_class_peek_parent (klass); + gobject_class = G_OBJECT_CLASS (klass); gobject_class->dispose = thunar_open_with_action_dispose; gobject_class->finalize = thunar_open_with_action_finalize; @@ -127,7 +158,7 @@ thunar_open_with_action_class_init (ThunarOpenWithActionClass *klass) * open @path_list with @application. **/ open_with_action_signals[OPEN_APPLICATION] = - g_signal_new ("open-application", + g_signal_new (I_("open-application"), G_TYPE_FROM_CLASS (gobject_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (ThunarOpenWithActionClass, open_application), @@ -251,7 +282,7 @@ thunar_open_with_action_activated (GtkWidget *item, return; /* query the launch parameters for this application item */ - application = g_object_get_data (G_OBJECT (item), "thunar-vfs-mime-application"); + application = g_object_get_data (G_OBJECT (item), I_("thunar-vfs-mime-application")); /* generate a single item list */ path_list.data = thunar_file_get_path (file); @@ -319,7 +350,7 @@ thunar_open_with_action_menu_mapped (GtkWidget *menu, text = g_strdup_printf (_("%s (default)"), thunar_vfs_mime_application_get_name (default_application)); item = gtk_image_menu_item_new_with_label (text); - g_object_set_data_full (G_OBJECT (item), "thunar-vfs-mime-application", default_application, (GDestroyNotify) thunar_vfs_mime_application_unref); + g_object_set_data_full (G_OBJECT (item), I_("thunar-vfs-mime-application"), default_application, (GDestroyNotify) thunar_vfs_mime_application_unref); g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (thunar_open_with_action_activated), open_with_action); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show (item); @@ -345,7 +376,7 @@ thunar_open_with_action_menu_mapped (GtkWidget *menu, for (lp = applications; lp != NULL; lp = lp->next) { item = gtk_image_menu_item_new_with_label (thunar_vfs_mime_application_get_name (lp->data)); - g_object_set_data_full (G_OBJECT (item), "thunar-vfs-mime-application", lp->data, (GDestroyNotify) thunar_vfs_mime_application_unref); + g_object_set_data_full (G_OBJECT (item), I_("thunar-vfs-mime-application"), lp->data, (GDestroyNotify) thunar_vfs_mime_application_unref); g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (thunar_open_with_action_activated), open_with_action); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show (item); diff --git a/thunar/thunar-path-entry.c b/thunar/thunar-path-entry.c index 296158149..9f46a5888 100644 --- a/thunar/thunar-path-entry.c +++ b/thunar/thunar-path-entry.c @@ -50,7 +50,6 @@ enum static void thunar_path_entry_class_init (ThunarPathEntryClass *klass); static void thunar_path_entry_editable_init (GtkEditableClass *iface); -static void thunar_path_entry_init (ThunarPathEntry *path_entry); static void thunar_path_entry_finalize (GObject *object); static void thunar_path_entry_get_property (GObject *object, guint prop_id, @@ -119,13 +118,47 @@ static const GtkTargetEntry drag_targets[] = { "text/uri-list", 0, 0, }, }; + + static GtkEditableClass *thunar_path_entry_editable_parent_iface; +static GObjectClass *thunar_path_entry_parent_class; + -G_DEFINE_TYPE_WITH_CODE (ThunarPathEntry, - thunar_path_entry, - GTK_TYPE_ENTRY, - G_IMPLEMENT_INTERFACE (GTK_TYPE_EDITABLE, - thunar_path_entry_editable_init)); + +GType +thunar_path_entry_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarPathEntryClass), + NULL, + NULL, + (GClassInitFunc) thunar_path_entry_class_init, + NULL, + NULL, + sizeof (ThunarPathEntry), + 0, + NULL, + NULL, + }; + + static const GInterfaceInfo editable_info = + { + (GInterfaceInitFunc) thunar_path_entry_editable_init, + NULL, + NULL, + }; + + type = g_type_register_static (GTK_TYPE_ENTRY, I_("ThunarPathEntry"), &info, 0); + g_type_add_interface_static (type, GTK_TYPE_EDITABLE, &editable_info); + } + + return type; +} @@ -136,6 +169,9 @@ thunar_path_entry_class_init (ThunarPathEntryClass *klass) GtkEntryClass *gtkentry_class; GObjectClass *gobject_class; + /* determine the parent type class */ + thunar_path_entry_parent_class = g_type_class_peek_parent (klass); + gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = thunar_path_entry_finalize; gobject_class->get_property = thunar_path_entry_get_property; @@ -193,14 +229,6 @@ thunar_path_entry_editable_init (GtkEditableClass *iface) -static void -thunar_path_entry_init (ThunarPathEntry *path_entry) -{ - path_entry->drag_button = -1; -} - - - static void thunar_path_entry_finalize (GObject *object) { @@ -506,7 +534,7 @@ thunar_path_entry_button_release_event (GtkWidget *widget, if (event->window == path_entry->icon_area && event->button == path_entry->drag_button) { /* reset the drag button state */ - path_entry->drag_button = -1; + path_entry->drag_button = 0; return TRUE; } @@ -525,7 +553,7 @@ thunar_path_entry_motion_notify_event (GtkWidget *widget, GdkPixbuf *icon; gint size; - if (event->window == path_entry->icon_area && path_entry->drag_button >= 0 && path_entry->current_file != NULL + if (event->window == path_entry->icon_area && path_entry->drag_button > 0 && path_entry->current_file != NULL && gtk_drag_check_threshold (widget, path_entry->drag_x, path_entry->drag_y, event->x, event->y)) { /* create the drag context */ @@ -543,7 +571,7 @@ thunar_path_entry_motion_notify_event (GtkWidget *widget, } /* reset the drag button state */ - path_entry->drag_button = -1; + path_entry->drag_button = 0; return TRUE; } diff --git a/thunar/thunar-preferences-dialog.c b/thunar/thunar-preferences-dialog.c index 3cde958f8..2b0a4a1ee 100644 --- a/thunar/thunar-preferences-dialog.c +++ b/thunar/thunar-preferences-dialog.c @@ -53,7 +53,36 @@ struct _ThunarPreferencesDialog -G_DEFINE_TYPE (ThunarPreferencesDialog, thunar_preferences_dialog, GTK_TYPE_DIALOG); +static GObjectClass *thunar_preferences_dialog_parent_class; + + + +GType +thunar_preferences_dialog_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarPreferencesDialogClass), + NULL, + NULL, + (GClassInitFunc) thunar_preferences_dialog_class_init, + NULL, + NULL, + sizeof (ThunarPreferencesDialog), + 0, + (GInstanceInitFunc) thunar_preferences_dialog_init, + NULL, + }; + + type = g_type_register_static (GTK_TYPE_DIALOG, I_("ThunarPreferencesDialog"), &info, 0); + } + + return type; +} @@ -108,6 +137,9 @@ thunar_preferences_dialog_class_init (ThunarPreferencesDialogClass *klass) GtkDialogClass *gtkdialog_class; GObjectClass *gobject_class; + /* determine the parent type class */ + thunar_preferences_dialog_parent_class = g_type_class_peek_parent (klass); + gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = thunar_preferences_dialog_finalize; diff --git a/thunar/thunar-preferences.c b/thunar/thunar-preferences.c index 9ab063d98..518354720 100644 --- a/thunar/thunar-preferences.c +++ b/thunar/thunar-preferences.c @@ -91,7 +91,36 @@ struct _ThunarPreferences -G_DEFINE_TYPE (ThunarPreferences, thunar_preferences, G_TYPE_OBJECT); +static GObjectClass *thunar_preferences_parent_class; + + + +GType +thunar_preferences_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarPreferencesClass), + NULL, + NULL, + (GClassInitFunc) thunar_preferences_class_init, + NULL, + NULL, + sizeof (ThunarPreferences), + 0, + (GInstanceInitFunc) thunar_preferences_init, + NULL, + }; + + type = g_type_register_static (G_TYPE_OBJECT, I_("ThunarPreferences"), &info, 0); + } + + return type; +} @@ -100,6 +129,9 @@ thunar_preferences_class_init (ThunarPreferencesClass *klass) { GObjectClass *gobject_class; + /* determine the parent type class */ + thunar_preferences_parent_class = g_type_class_peek_parent (klass); + gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = thunar_preferences_finalize; gobject_class->get_property = thunar_preferences_get_property; diff --git a/thunar/thunar-progress-dialog.c b/thunar/thunar-progress-dialog.c index b0ff84503..1c06f0c2c 100644 --- a/thunar/thunar-progress-dialog.c +++ b/thunar/thunar-progress-dialog.c @@ -88,7 +88,36 @@ struct _ThunarProgressDialog -G_DEFINE_TYPE (ThunarProgressDialog, thunar_progress_dialog, GTK_TYPE_DIALOG); +static GObjectClass *thunar_progress_dialog_parent_class; + + + +GType +thunar_progress_dialog_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarProgressDialogClass), + NULL, + NULL, + (GClassInitFunc) thunar_progress_dialog_class_init, + NULL, + NULL, + sizeof (ThunarProgressDialog), + 0, + (GInstanceInitFunc) thunar_progress_dialog_init, + NULL, + }; + + type = g_type_register_static (GTK_TYPE_DIALOG, I_("ThunarProgressDialog"), &info, 0); + } + + return type; +} @@ -109,6 +138,9 @@ thunar_progress_dialog_class_init (ThunarProgressDialogClass *klass) GtkDialogClass *gtkdialog_class; GObjectClass *gobject_class; + /* determine the parent type class */ + thunar_progress_dialog_parent_class = g_type_class_peek_parent (klass); + gobject_class = G_OBJECT_CLASS (klass); gobject_class->dispose = thunar_progress_dialog_dispose; gobject_class->get_property = thunar_progress_dialog_get_property; diff --git a/thunar/thunar-properties-dialog.c b/thunar/thunar-properties-dialog.c index 7a0f73fb7..67ed7db39 100644 --- a/thunar/thunar-properties-dialog.c +++ b/thunar/thunar-properties-dialog.c @@ -103,7 +103,36 @@ struct _ThunarPropertiesDialog -G_DEFINE_TYPE (ThunarPropertiesDialog, thunar_properties_dialog, GTK_TYPE_DIALOG); +static GObjectClass *thunar_properties_dialog_parent_class; + + + +GType +thunar_properties_dialog_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarPropertiesDialogClass), + NULL, + NULL, + (GClassInitFunc) thunar_properties_dialog_class_init, + NULL, + NULL, + sizeof (ThunarPropertiesDialog), + 0, + (GInstanceInitFunc) thunar_properties_dialog_init, + NULL, + }; + + type = g_type_register_static (GTK_TYPE_DIALOG, I_("ThunarPropertiesDialog"), &info, 0); + } + + return type; +} @@ -114,6 +143,9 @@ thunar_properties_dialog_class_init (ThunarPropertiesDialogClass *klass) GtkWidgetClass *gtkwidget_class; GObjectClass *gobject_class; + /* determine the parent type class */ + thunar_properties_dialog_parent_class = g_type_class_peek_parent (klass); + gobject_class = G_OBJECT_CLASS (klass); gobject_class->dispose = thunar_properties_dialog_dispose; gobject_class->finalize = thunar_properties_dialog_finalize; diff --git a/thunar/thunar-side-pane.c b/thunar/thunar-side-pane.c index 1c1e24441..f75110b7d 100644 --- a/thunar/thunar-side-pane.c +++ b/thunar/thunar-side-pane.c @@ -45,10 +45,7 @@ thunar_side_pane_get_type (void) NULL, }; - type = g_type_register_static (G_TYPE_INTERFACE, - "ThunarSidePane", - &info, 0); - + type = g_type_register_static (G_TYPE_INTERFACE, I_("ThunarSidePane"), &info, 0); g_type_interface_add_prerequisite (type, GTK_TYPE_WIDGET); g_type_interface_add_prerequisite (type, THUNAR_TYPE_NAVIGATOR); } diff --git a/thunar/thunar-standard-view.c b/thunar/thunar-standard-view.c index 148c13fae..2b0a73e09 100644 --- a/thunar/thunar-standard-view.c +++ b/thunar/thunar-standard-view.c @@ -320,10 +320,7 @@ thunar_standard_view_get_type (void) NULL, }; - type = g_type_register_static (GTK_TYPE_SCROLLED_WINDOW, - "ThunarStandardView", - &info, G_TYPE_FLAG_ABSTRACT); - + type = g_type_register_static (GTK_TYPE_SCROLLED_WINDOW, I_("ThunarStandardView"), &info, G_TYPE_FLAG_ABSTRACT); g_type_add_interface_static (type, THUNAR_TYPE_NAVIGATOR, &navigator_info); g_type_add_interface_static (type, THUNAR_TYPE_VIEW, &view_info); } @@ -386,7 +383,7 @@ thunar_standard_view_class_init (ThunarStandardViewClass *klass) * is an internal signal used to bind the action to keys. **/ standard_view_signals[DELETE_SELECTED_FILES] = - g_signal_new ("delete-selected-files", + g_signal_new (I_("delete-selected-files"), G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (ThunarStandardViewClass, delete_selected_files), @@ -2225,8 +2222,10 @@ thunar_standard_view_loading_unbound (gpointer user_data) if (G_UNLIKELY (standard_view->loading)) { standard_view->loading = FALSE; + g_object_freeze_notify (G_OBJECT (standard_view)); g_object_notify (G_OBJECT (standard_view), "loading"); g_object_notify (G_OBJECT (standard_view), "statusbar-text"); + g_object_thaw_notify (G_OBJECT (standard_view)); } } diff --git a/thunar/thunar-statusbar.c b/thunar/thunar-statusbar.c index 2004d416d..3f1a67306 100644 --- a/thunar/thunar-statusbar.c +++ b/thunar/thunar-statusbar.c @@ -148,7 +148,7 @@ thunar_statusbar_icon_get_type (void) NULL, }; - type = g_type_register_static (GTK_TYPE_WIDGET, "ThunarStatusbarIcon", &info, 0); + type = g_type_register_static (GTK_TYPE_WIDGET, I_("ThunarStatusbarIcon"), &info, 0); } return type; @@ -708,11 +708,40 @@ struct _ThunarStatusbar -G_DEFINE_TYPE_WITH_CODE (ThunarStatusbar, - thunar_statusbar, - GTK_TYPE_STATUSBAR, - G_IMPLEMENT_INTERFACE (THUNAR_TYPE_NAVIGATOR, - thunar_statusbar_navigator_init)); +GType +thunar_statusbar_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarStatusbarClass), + NULL, + NULL, + (GClassInitFunc) thunar_statusbar_class_init, + NULL, + NULL, + sizeof (ThunarStatusbar), + 0, + (GInstanceInitFunc) thunar_statusbar_init, + NULL, + }; + + static const GInterfaceInfo navigator_info = + { + (GInterfaceInitFunc) thunar_statusbar_navigator_init, + NULL, + NULL, + }; + + type = g_type_register_static (GTK_TYPE_STATUSBAR, I_("ThunarStatusbar"), &info, 0); + g_type_add_interface_static (type, THUNAR_TYPE_NAVIGATOR, &navigator_info); + } + + return type; +} diff --git a/thunar/thunar-text-renderer.c b/thunar/thunar-text-renderer.c index f4f7344ae..c1d232f24 100644 --- a/thunar/thunar-text-renderer.c +++ b/thunar/thunar-text-renderer.c @@ -134,11 +134,37 @@ struct _ThunarTextRenderer -static guint text_renderer_signals[LAST_SIGNAL]; +static GObjectClass *thunar_text_renderer_parent_class; +static guint text_renderer_signals[LAST_SIGNAL]; -G_DEFINE_TYPE (ThunarTextRenderer, thunar_text_renderer, GTK_TYPE_CELL_RENDERER); +GType +thunar_text_renderer_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarTextRendererClass), + NULL, + NULL, + (GClassInitFunc) thunar_text_renderer_class_init, + NULL, + NULL, + sizeof (ThunarTextRenderer), + 0, + (GInstanceInitFunc) thunar_text_renderer_init, + NULL, + }; + + type = g_type_register_static (GTK_TYPE_CELL_RENDERER, I_("ThunarTextRenderer"), &info, 0); + } + + return type; +} @@ -148,6 +174,9 @@ thunar_text_renderer_class_init (ThunarTextRendererClass *klass) GtkCellRendererClass *gtkcell_renderer_class; GObjectClass *gobject_class; + /* determine the parent type class */ + thunar_text_renderer_parent_class = g_type_class_peek_parent (klass); + gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = thunar_text_renderer_finalize; gobject_class->get_property = thunar_text_renderer_get_property; @@ -228,7 +257,7 @@ thunar_text_renderer_class_init (ThunarTextRendererClass *klass) * Emitted whenever the user successfully edits a cell. **/ text_renderer_signals[EDITED] = - g_signal_new ("edited", + g_signal_new (I_("edited"), G_OBJECT_CLASS_TYPE (gobject_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (ThunarTextRendererClass, edited), @@ -256,7 +285,7 @@ thunar_text_renderer_finalize (GObject *object) /* drop the cached widget */ thunar_text_renderer_set_widget (text_renderer, NULL); - G_OBJECT_CLASS (thunar_text_renderer_parent_class)->finalize (object); + (*G_OBJECT_CLASS (thunar_text_renderer_parent_class)->finalize) (object); } @@ -574,7 +603,7 @@ thunar_text_renderer_start_editing (GtkCellRenderer *renderer, gtk_editable_select_region (GTK_EDITABLE (text_renderer->entry), 0, -1); /* remember the tree path that we're editing */ - g_object_set_data_full (G_OBJECT (text_renderer->entry), "thunar-text-renderer-path", g_strdup (path), g_free); + g_object_set_data_full (G_OBJECT (text_renderer->entry), I_("thunar-text-renderer-path"), g_strdup (path), g_free); /* connect required signals */ g_signal_connect (G_OBJECT (text_renderer->entry), "editing-done", G_CALLBACK (thunar_text_renderer_editing_done), text_renderer); @@ -663,7 +692,7 @@ thunar_text_renderer_editing_done (GtkCellEditable *editable, if (G_LIKELY (!GTK_ENTRY (editable)->editing_canceled)) { text = gtk_entry_get_text (GTK_ENTRY (editable)); - path = g_object_get_data (G_OBJECT (editable), "thunar-text-renderer-path"); + path = g_object_get_data (G_OBJECT (editable), I_("thunar-text-renderer-path")); g_signal_emit (G_OBJECT (text_renderer), text_renderer_signals[EDITED], 0, path, text); } } diff --git a/thunar/thunar-thumbnail-generator.c b/thunar/thunar-thumbnail-generator.c index 441912519..a2b59e09e 100644 --- a/thunar/thunar-thumbnail-generator.c +++ b/thunar/thunar-thumbnail-generator.c @@ -65,7 +65,36 @@ struct _ThunarThumbnailInfo -G_DEFINE_TYPE (ThunarThumbnailGenerator, thunar_thumbnail_generator, G_TYPE_OBJECT); +static GObjectClass *thunar_thumbnail_generator_parent_class; + + + +GType +thunar_thumbnail_generator_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarThumbnailGeneratorClass), + NULL, + NULL, + (GClassInitFunc) thunar_thumbnail_generator_class_init, + NULL, + NULL, + sizeof (ThunarThumbnailGenerator), + 0, + (GInstanceInitFunc) thunar_thumbnail_generator_init, + NULL, + }; + + type = g_type_register_static (G_TYPE_OBJECT, I_("ThunarThumbnailGenerator"), &info, 0); + } + + return type; +} @@ -74,6 +103,9 @@ thunar_thumbnail_generator_class_init (ThunarThumbnailGeneratorClass *klass) { GObjectClass *gobject_class; + /* determine the parent type class */ + thunar_thumbnail_generator_parent_class = g_type_class_peek_parent (klass); + gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = thunar_thumbnail_generator_finalize; } diff --git a/thunar/thunar-view.c b/thunar/thunar-view.c index db85252f4..17e556d55 100644 --- a/thunar/thunar-view.c +++ b/thunar/thunar-view.c @@ -49,10 +49,7 @@ thunar_view_get_type (void) NULL, }; - type = g_type_register_static (G_TYPE_INTERFACE, - "ThunarView", - &info, 0); - + type = g_type_register_static (G_TYPE_INTERFACE, I_("ThunarView"), &info, 0); g_type_interface_add_prerequisite (type, GTK_TYPE_WIDGET); g_type_interface_add_prerequisite (type, THUNAR_TYPE_NAVIGATOR); } diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c index aa887425f..b89951da1 100644 --- a/thunar/thunar-window.c +++ b/thunar/thunar-window.c @@ -181,7 +181,36 @@ static const GtkToggleActionEntry toggle_action_entries[] = -G_DEFINE_TYPE (ThunarWindow, thunar_window, GTK_TYPE_WINDOW); +static GObjectClass *thunar_window_parent_class; + + + +GType +thunar_window_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarWindowClass), + NULL, + NULL, + (GClassInitFunc) thunar_window_class_init, + NULL, + NULL, + sizeof (ThunarWindow), + 0, + (GInstanceInitFunc) thunar_window_init, + NULL, + }; + + type = g_type_register_static (GTK_TYPE_WINDOW, I_("ThunarWindow"), &info, 0); + } + + return type; +} @@ -191,6 +220,9 @@ thunar_window_class_init (ThunarWindowClass *klass) GtkWidgetClass *gtkwidget_class; GObjectClass *gobject_class; + /* determine the parent type class */ + thunar_window_parent_class = g_type_class_peek_parent (klass); + gobject_class = G_OBJECT_CLASS (klass); gobject_class->dispose = thunar_window_dispose; gobject_class->finalize = thunar_window_finalize; @@ -999,7 +1031,7 @@ thunar_window_menu_item_selected (GtkWidget *menu_item, gchar *tooltip; /* determine the action for the menu item */ - action = g_object_get_data (G_OBJECT (menu_item), "gtk-action"); + action = g_object_get_data (G_OBJECT (menu_item), I_("gtk-action")); if (G_UNLIKELY (action == NULL)) return; diff --git a/thunarx/Makefile.am b/thunarx/Makefile.am index 1c1bad21f..aa3878431 100644 --- a/thunarx/Makefile.am +++ b/thunarx/Makefile.am @@ -36,6 +36,7 @@ libthunarx_1_la_SOURCES = \ thunarx-config.c \ thunarx-file-info.c \ thunarx-menu-provider.c \ + thunarx-private.h \ thunarx-property-page.c \ thunarx-property-page-provider.c \ thunarx-provider-factory.c \ diff --git a/thunarx/thunarx-file-info.c b/thunarx/thunarx-file-info.c index c1d279cc1..6a669d1b2 100644 --- a/thunarx/thunarx-file-info.c +++ b/thunarx/thunarx-file-info.c @@ -23,6 +23,7 @@ #endif #include <thunarx/thunarx-file-info.h> +#include <thunarx/thunarx-private.h> #include <thunarx/thunarx-alias.h> @@ -48,8 +49,7 @@ thunarx_file_info_get_type (void) NULL, }; - type = g_type_register_static (G_TYPE_INTERFACE, "ThunarxFileInfo", &info, 0); - + type = g_type_register_static (G_TYPE_INTERFACE, I_("ThunarxFileInfo"), &info, 0); g_type_interface_add_prerequisite (type, G_TYPE_OBJECT); } diff --git a/thunarx/thunarx-menu-provider.c b/thunarx/thunarx-menu-provider.c index f697a4956..70f82a16e 100644 --- a/thunarx/thunarx-menu-provider.c +++ b/thunarx/thunarx-menu-provider.c @@ -23,6 +23,7 @@ #endif #include <thunarx/thunarx-menu-provider.h> +#include <thunarx/thunarx-private.h> #include <thunarx/thunarx-alias.h> @@ -53,7 +54,7 @@ thunarx_menu_provider_get_type (void) }; /* register the menu provider interface */ - type = g_type_register_static (G_TYPE_INTERFACE, "ThunarxMenuProvider", &info, 0); + type = g_type_register_static (G_TYPE_INTERFACE, I_("ThunarxMenuProvider"), &info, 0); g_type_interface_add_prerequisite (type, G_TYPE_OBJECT); /* allocate the thunarx-menu-provider-action quark */ diff --git a/thunarx/thunarx-private.h b/thunarx/thunarx-private.h new file mode 100644 index 000000000..2f2d4ac42 --- /dev/null +++ b/thunarx/thunarx-private.h @@ -0,0 +1,40 @@ +/* $Id$ */ +/*- + * Copyright (c) 2005 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 + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#if !defined(THUNARX_INSIDE_THUNARX_H) && !defined(THUNARX_COMPILATION) +#error "Only <thunarx/thunarx.h> can be included directly, this file may disappear or change contents" +#endif + +#ifndef __THUNARX_PRIVATE_H__ +#define __THUNARX_PRIVATE_H__ + +#include <glib.h> + +G_BEGIN_DECLS; + +#if GLIB_CHECK_VERSION(2,9,0) +#define I_(string) (g_intern_static_string ((string))) +#else +#define I_(string) (g_quark_to_string (g_quark_from_static_string ((string)))) +#endif + +G_END_DECLS; + +#endif /* !__THUNARX_PRIVATE_H__ */ diff --git a/thunarx/thunarx-property-page-provider.c b/thunarx/thunarx-property-page-provider.c index c1caec61b..06aa0d530 100644 --- a/thunarx/thunarx-property-page-provider.c +++ b/thunarx/thunarx-property-page-provider.c @@ -22,6 +22,7 @@ #include <config.h> #endif +#include <thunarx/thunarx-private.h> #include <thunarx/thunarx-property-page-provider.h> #include <thunarx/thunarx-alias.h> @@ -53,7 +54,7 @@ thunarx_property_page_provider_get_type (void) }; /* register the property page provider interface */ - type = g_type_register_static (G_TYPE_INTERFACE, "ThunarxPropertyPageProvider", &info, 0); + type = g_type_register_static (G_TYPE_INTERFACE, I_("ThunarxPropertyPageProvider"), &info, 0); g_type_interface_add_prerequisite (type, G_TYPE_OBJECT); /* allocate the thunarx-property-page quark */ diff --git a/thunarx/thunarx-property-page.c b/thunarx/thunarx-property-page.c index 554ac6ffc..c37902a8e 100644 --- a/thunarx/thunarx-property-page.c +++ b/thunarx/thunarx-property-page.c @@ -24,6 +24,7 @@ #include <glib/gi18n-lib.h> +#include <thunarx/thunarx-private.h> #include <thunarx/thunarx-property-page.h> #include <thunarx/thunarx-alias.h> @@ -68,7 +69,36 @@ struct _ThunarxPropertyPagePrivate -G_DEFINE_TYPE (ThunarxPropertyPage, thunarx_property_page, GTK_TYPE_BIN); +static GObjectClass *thunarx_property_page_parent_class; + + + +GType +thunarx_property_page_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarxPropertyPageClass), + NULL, + NULL, + (GClassInitFunc) thunarx_property_page_class_init, + NULL, + NULL, + sizeof (ThunarxPropertyPage), + 0, + (GInstanceInitFunc) thunarx_property_page_init, + NULL, + }; + + type = g_type_register_static (GTK_TYPE_BIN, I_("ThunarxPropertyPage"), &info, 0); + } + + return type; +} @@ -79,6 +109,9 @@ thunarx_property_page_class_init (ThunarxPropertyPageClass *klass) GtkWidgetClass *gtkwidget_class; GObjectClass *gobject_class; + /* determine the parent type class */ + thunarx_property_page_parent_class = g_type_class_peek_parent (klass); + /* add our private data to the class type */ g_type_class_add_private (klass, sizeof (ThunarxPropertyPagePrivate)); diff --git a/thunarx/thunarx-provider-factory.c b/thunarx/thunarx-provider-factory.c index a9105d0d2..8b13437c1 100644 --- a/thunarx/thunarx-provider-factory.c +++ b/thunarx/thunarx-provider-factory.c @@ -24,6 +24,7 @@ #include <gdk/gdk.h> +#include <thunarx/thunarx-private.h> #include <thunarx/thunarx-provider-factory.h> #include <thunarx/thunarx-provider-module.h> #include <thunarx/thunarx-provider-plugin.h> @@ -71,7 +72,36 @@ struct _ThunarxProviderFactory -G_DEFINE_TYPE (ThunarxProviderFactory, thunarx_provider_factory, G_TYPE_OBJECT); +static GObjectClass *thunarx_provider_factory_parent_class; + + + +GType +thunarx_provider_factory_get_type (void) +{ + static GType type = G_TYPE_INVALID; + + if (G_UNLIKELY (type == G_TYPE_INVALID)) + { + static const GTypeInfo info = + { + sizeof (ThunarxProviderFactoryClass), + NULL, + NULL, + (GClassInitFunc) thunarx_provider_factory_class_init, + NULL, + NULL, + sizeof (ThunarxProviderFactory), + 0, + (GInstanceInitFunc) thunarx_provider_factory_init, + NULL, + }; + + type = g_type_register_static (G_TYPE_OBJECT, I_("ThunarxProviderFactory"), &info, 0); + } + + return type; +} @@ -80,6 +110,9 @@ thunarx_provider_factory_class_init (ThunarxProviderFactoryClass *klass) { GObjectClass *gobject_class; + /* determine the parent type class */ + thunarx_provider_factory_parent_class = g_type_class_peek_parent (klass); + gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = thunarx_provider_factory_finalize; } diff --git a/thunarx/thunarx-provider-module.c b/thunarx/thunarx-provider-module.c index 73ea19237..601a085dd 100644 --- a/thunarx/thunarx-provider-module.c +++ b/thunarx/thunarx-provider-module.c @@ -24,6 +24,7 @@ #include <gmodule.h> +#include <thunarx/thunarx-private.h> #include <thunarx/thunarx-provider-module.h> #include <thunarx/thunarx-provider-plugin.h> #include <thunarx/thunarx-alias.h> @@ -109,7 +110,7 @@ thunarx_provider_module_get_type (void) NULL, }; - type = g_type_register_static (G_TYPE_TYPE_MODULE, "ThunarxProviderModule", &info, 0); + type = g_type_register_static (G_TYPE_TYPE_MODULE, I_("ThunarxProviderModule"), &info, 0); g_type_add_interface_static (type, THUNARX_TYPE_PROVIDER_PLUGIN, &plugin_info); } diff --git a/thunarx/thunarx-provider-plugin.c b/thunarx/thunarx-provider-plugin.c index b1facb0a4..fe80c652d 100644 --- a/thunarx/thunarx-provider-plugin.c +++ b/thunarx/thunarx-provider-plugin.c @@ -24,6 +24,7 @@ #include <glib/gi18n-lib.h> +#include <thunarx/thunarx-private.h> #include <thunarx/thunarx-provider-plugin.h> #include <thunarx/thunarx-alias.h> @@ -55,7 +56,7 @@ thunarx_provider_plugin_get_type (void) }; /* register the provider plugin interface */ - type = g_type_register_static (G_TYPE_INTERFACE, "ThunarxProviderPlugin", &info, 0); + type = g_type_register_static (G_TYPE_INTERFACE, I_("ThunarxProviderPlugin"), &info, 0); } return type; -- GitLab