diff options
Diffstat (limited to 'plugins')
40 files changed, 1206 insertions, 1206 deletions
diff --git a/plugins/changecase/pluma-changecase-plugin.c b/plugins/changecase/pluma-changecase-plugin.c index 65b938d9..edf15fb4 100644 --- a/plugins/changecase/pluma-changecase-plugin.c +++ b/plugins/changecase/pluma-changecase-plugin.c @@ -1,13 +1,13 @@ /* * pluma-changecase-plugin.c - * + * * Copyright (C) 2004-2005 - Paolo Borelli * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. - * + * * This program 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 @@ -388,11 +388,11 @@ pluma_changecase_plugin_activate (PeasActivatable *activatable) manager = pluma_window_get_ui_manager (window); data->action_group = gtk_action_group_new ("PlumaChangecasePluginActions"); - gtk_action_group_set_translation_domain (data->action_group, + gtk_action_group_set_translation_domain (data->action_group, GETTEXT_PACKAGE); gtk_action_group_add_actions (data->action_group, action_entries, - G_N_ELEMENTS (action_entries), + G_N_ELEMENTS (action_entries), window); gtk_ui_manager_insert_action_group (manager, data->action_group, -1); diff --git a/plugins/changecase/pluma-changecase-plugin.h b/plugins/changecase/pluma-changecase-plugin.h index f610ac27..d6611097 100644 --- a/plugins/changecase/pluma-changecase-plugin.h +++ b/plugins/changecase/pluma-changecase-plugin.h @@ -1,6 +1,6 @@ /* * pluma-changecase-plugin.h - * + * * Copyright (C) 2004-2005 - Paolo Borelli * * This program is free software; you can redistribute it and/or modify diff --git a/plugins/docinfo/pluma-docinfo-plugin.c b/plugins/docinfo/pluma-docinfo-plugin.c index fbe1ea22..9fec4023 100644 --- a/plugins/docinfo/pluma-docinfo-plugin.c +++ b/plugins/docinfo/pluma-docinfo-plugin.c @@ -1,13 +1,13 @@ /* * pluma-docinfo-plugin.c - * - * Copyright (C) 2002-2005 Paolo Maggi + * + * Copyright (C) 2002-2005 Paolo Maggi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. - * + * * This program 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 @@ -161,7 +161,7 @@ get_docinfo_dialog (PlumaDocInfoPlugin *plugin) GTK_RESPONSE_OK); gtk_window_set_transient_for (GTK_WINDOW (dialog->dialog), GTK_WINDOW (window)); - + g_signal_connect (dialog->dialog, "destroy", G_CALLBACK (docinfo_dialog_destroy_cb), @@ -175,15 +175,15 @@ get_docinfo_dialog (PlumaDocInfoPlugin *plugin) return dialog; } -static void +static void calculate_info (PlumaDocument *doc, GtkTextIter *start, - GtkTextIter *end, + GtkTextIter *end, gint *chars, gint *words, gint *white_chars, gint *bytes) -{ +{ gchar *text; pluma_debug (DEBUG_PLUGINS); @@ -313,7 +313,7 @@ selectioninfo_real (PlumaDocument *doc, if (sel) { lines = gtk_text_iter_get_line (&end) - gtk_text_iter_get_line (&start) + 1; - + calculate_info (doc, &start, &end, &chars, &words, &white_chars, &bytes); @@ -383,15 +383,15 @@ docinfo_cb (GtkAction *action, dialog = get_docinfo_dialog (plugin); g_return_if_fail (dialog != NULL); - + data->dialog = dialog; gtk_widget_show (GTK_WIDGET (dialog->dialog)); } - - docinfo_real (doc, - data->dialog); - selectioninfo_real (doc, + + docinfo_real (doc, + data->dialog); + selectioninfo_real (doc, data->dialog); } @@ -419,18 +419,18 @@ docinfo_dialog_response_cb (GtkDialog *widget, case GTK_RESPONSE_OK: { PlumaDocument *doc; - + pluma_debug_message (DEBUG_PLUGINS, "GTK_RESPONSE_OK"); - + doc = pluma_window_get_active_document (window); g_return_if_fail (doc != NULL); - + docinfo_real (doc, data->dialog); selectioninfo_real (doc, data->dialog); - + break; } } @@ -545,7 +545,7 @@ pluma_docinfo_plugin_activate (PeasActivatable *activatable) PlumaDocInfoPluginPrivate *data; PlumaWindow *window; GtkUIManager *manager; - + pluma_debug (DEBUG_PLUGINS); plugin = PLUMA_DOCINFO_PLUGIN (activatable); @@ -554,8 +554,8 @@ pluma_docinfo_plugin_activate (PeasActivatable *activatable) data->dialog = NULL; data->ui_action_group = gtk_action_group_new ("PlumaDocInfoPluginActions"); - - gtk_action_group_set_translation_domain (data->ui_action_group, + + gtk_action_group_set_translation_domain (data->ui_action_group, GETTEXT_PACKAGE); gtk_action_group_add_actions (data->ui_action_group, action_entries, @@ -569,12 +569,12 @@ pluma_docinfo_plugin_activate (PeasActivatable *activatable) data->ui_id = gtk_ui_manager_new_merge_id (manager); - gtk_ui_manager_add_ui (manager, - data->ui_id, + gtk_ui_manager_add_ui (manager, + data->ui_id, MENU_PATH, - "DocumentStatistics", "DocumentStatistics", - GTK_UI_MANAGER_MENUITEM, + "DocumentStatistics", + GTK_UI_MANAGER_MENUITEM, FALSE); update_ui (data); diff --git a/plugins/docinfo/pluma-docinfo-plugin.h b/plugins/docinfo/pluma-docinfo-plugin.h index 5476e4fb..f9eaf9fc 100644 --- a/plugins/docinfo/pluma-docinfo-plugin.h +++ b/plugins/docinfo/pluma-docinfo-plugin.h @@ -1,7 +1,7 @@ /* * pluma-docinfo-plugin.h - * - * Copyright (C) 2002-2005 Paolo Maggi + * + * Copyright (C) 2002-2005 Paolo Maggi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/plugins/filebrowser/pluma-file-bookmarks-store.c b/plugins/filebrowser/pluma-file-bookmarks-store.c index bcd550a2..1a8ce12c 100644 --- a/plugins/filebrowser/pluma-file-bookmarks-store.c +++ b/plugins/filebrowser/pluma-file-bookmarks-store.c @@ -1,5 +1,5 @@ /* - * pluma-file-bookmarks-store.c - Pluma plugin providing easy file access + * pluma-file-bookmarks-store.c - Pluma plugin providing easy file access * from the sidepanel * * Copyright (C) 2006 - Jesse van den Kieboom <[email protected]> @@ -31,27 +31,27 @@ G_TYPE_INSTANCE_GET_PRIVATE((object), PLUMA_TYPE_FILE_BOOKMARKS_STORE, \ PlumaFileBookmarksStorePrivate)) -struct _PlumaFileBookmarksStorePrivate +struct _PlumaFileBookmarksStorePrivate { GVolumeMonitor * volume_monitor; GFileMonitor * bookmarks_monitor; }; -static void remove_node (GtkTreeModel * model, +static void remove_node (GtkTreeModel * model, GtkTreeIter * iter); static void on_fs_changed (GVolumeMonitor *monitor, GObject *object, PlumaFileBookmarksStore *model); - + static void on_bookmarks_file_changed (GFileMonitor * monitor, GFile * file, GFile * other_file, GFileMonitorEvent event_type, PlumaFileBookmarksStore * model); -static gboolean find_with_flags (GtkTreeModel * model, +static gboolean find_with_flags (GtkTreeModel * model, GtkTreeIter * iter, - gpointer obj, + gpointer obj, guint flags, guint notflags); @@ -110,11 +110,11 @@ pluma_file_bookmarks_store_init (PlumaFileBookmarksStore * obj) /* Private */ static void -add_node (PlumaFileBookmarksStore *model, +add_node (PlumaFileBookmarksStore *model, GdkPixbuf *pixbuf, - const gchar *name, - GObject *obj, - guint flags, + const gchar *name, + GObject *obj, + guint flags, GtkTreeIter *iter) { GtkTreeIter newiter; @@ -133,10 +133,10 @@ add_node (PlumaFileBookmarksStore *model, } static gboolean -add_file (PlumaFileBookmarksStore *model, +add_file (PlumaFileBookmarksStore *model, GFile *file, - const gchar *name, - guint flags, + const gchar *name, + guint flags, GtkTreeIter *iter) { GdkPixbuf *pixbuf = NULL; @@ -235,11 +235,11 @@ init_special_directories (PlumaFileBookmarksStore * model) PLUMA_FILE_BOOKMARKS_STORE_IS_SPECIAL_DIR, NULL); g_object_unref (file); } - + file = g_file_new_for_uri ("file:///"); add_file (model, file, _("File System"), PLUMA_FILE_BOOKMARKS_STORE_IS_ROOT, NULL); g_object_unref (file); - + check_mount_separator (model, PLUMA_FILE_BOOKMARKS_STORE_IS_ROOT, TRUE); } @@ -254,36 +254,36 @@ get_fs_properties (gpointer fs, *flags = PLUMA_FILE_BOOKMARKS_STORE_IS_FS; *name = NULL; *pixbuf = NULL; - + if (G_IS_DRIVE (fs)) { icon = g_drive_get_icon (G_DRIVE (fs)); *name = g_drive_get_name (G_DRIVE (fs)); - + *flags |= PLUMA_FILE_BOOKMARKS_STORE_IS_DRIVE; } else if (G_IS_VOLUME (fs)) { icon = g_volume_get_icon (G_VOLUME (fs)); *name = g_volume_get_name (G_VOLUME (fs)); - + *flags |= PLUMA_FILE_BOOKMARKS_STORE_IS_VOLUME; } else if (G_IS_MOUNT (fs)) { icon = g_mount_get_icon (G_MOUNT (fs)); *name = g_mount_get_name (G_MOUNT (fs)); - + *flags |= PLUMA_FILE_BOOKMARKS_STORE_IS_MOUNT; } - + if (icon) { *pixbuf = pluma_file_browser_utils_pixbuf_from_icon (icon, GTK_ICON_SIZE_MENU); g_object_unref (icon); } } - + static void add_fs (PlumaFileBookmarksStore *model, @@ -294,10 +294,10 @@ add_fs (PlumaFileBookmarksStore *model, gchar *name; GdkPixbuf *pixbuf; guint fsflags; - + get_fs_properties (fs, &name, &pixbuf, &fsflags); add_node (model, pixbuf, name, fs, flags | fsflags, iter); - + if (pixbuf) g_object_unref (pixbuf); @@ -312,7 +312,7 @@ process_volume_cb (GVolume *volume, GMount *mount; guint flags = PLUMA_FILE_BOOKMARKS_STORE_NONE; mount = g_volume_get_mount (volume); - + /* CHECK: should we use the LOCAL/REMOTE thing still? */ if (mount) { @@ -336,7 +336,7 @@ process_drive_novolumes (PlumaFileBookmarksStore *model, !g_drive_is_media_check_automatic (drive) && g_drive_can_poll_for_media (drive)) { - /* This can be the case for floppy drives or other + /* This can be the case for floppy drives or other drives where media detection fails. We show the drive and poll for media when the user activates it */ @@ -361,14 +361,14 @@ process_drive_cb (GDrive *drive, else { process_drive_novolumes (model, drive); - } + } } static void init_drives (PlumaFileBookmarksStore *model) { GList *drives; - + drives = g_volume_monitor_get_connected_drives (model->priv->volume_monitor); g_list_foreach (drives, (GFunc)process_drive_cb, model); @@ -381,15 +381,15 @@ process_volume_nodrive_cb (GVolume *volume, PlumaFileBookmarksStore *model) { GDrive *drive; - + drive = g_volume_get_drive (volume); - + if (drive) { g_object_unref (drive); return; } - + process_volume_cb (volume, model); } @@ -397,9 +397,9 @@ static void init_volumes (PlumaFileBookmarksStore *model) { GList *volumes; - + volumes = g_volume_monitor_get_volumes (model->priv->volume_monitor); - + g_list_foreach (volumes, (GFunc)process_volume_nodrive_cb, model); g_list_foreach (volumes, (GFunc)g_object_unref, NULL); g_list_free (volumes); @@ -410,9 +410,9 @@ process_mount_novolume_cb (GMount *mount, PlumaFileBookmarksStore *model) { GVolume *volume; - + volume = g_mount_get_volume (mount); - + if (volume) { g_object_unref (volume); @@ -428,9 +428,9 @@ static void init_mounts (PlumaFileBookmarksStore *model) { GList *mounts; - + mounts = g_volume_monitor_get_mounts (model->priv->volume_monitor); - + g_list_foreach (mounts, (GFunc)process_mount_novolume_cb, model); g_list_foreach (mounts, (GFunc)g_object_unref, NULL); g_list_free (mounts); @@ -447,10 +447,10 @@ init_fs (PlumaFileBookmarksStore * model) "mount-added", "mount-removed", "mount-changed", NULL }; - + model->priv->volume_monitor = g_volume_monitor_get (); - /* Connect signals */ + /* Connect signals */ for (ptr = signals; *ptr; ptr++) { g_signal_connect (model->priv->volume_monitor, @@ -461,16 +461,16 @@ init_fs (PlumaFileBookmarksStore * model) /* First go through all the connected drives */ init_drives (model); - + /* Then add all volumes, not associated with a drive */ init_volumes (model); - + /* Then finally add all mounts that have no volume */ init_mounts (model); } static gboolean -add_bookmark (PlumaFileBookmarksStore * model, +add_bookmark (PlumaFileBookmarksStore * model, gchar const * name, gchar const * uri) { @@ -478,9 +478,9 @@ add_bookmark (PlumaFileBookmarksStore * model, gboolean ret; guint flags = PLUMA_FILE_BOOKMARKS_STORE_IS_BOOKMARK; GtkTreeIter iter; - + file = g_file_new_for_uri (uri); - + if (g_file_is_native (file)) { flags |= PLUMA_FILE_BOOKMARKS_STORE_IS_LOCAL_BOOKMARK; } else { @@ -490,7 +490,7 @@ add_bookmark (PlumaFileBookmarksStore * model, ret = add_file (model, file, name, flags, &iter); g_object_unref (file); - + return ret; } @@ -727,7 +727,7 @@ find_with_flags (GtkTreeModel * model, GtkTreeIter * iter, gpointer obj, guint childflags = 0; GObject * childobj; gboolean fequal; - + if (!gtk_tree_model_get_iter_first (model, &child)) return FALSE; @@ -737,12 +737,12 @@ find_with_flags (GtkTreeModel * model, GtkTreeIter * iter, gpointer obj, &childobj, PLUMA_FILE_BOOKMARKS_STORE_COLUMN_FLAGS, &childflags, -1); - + fequal = (obj == childobj); - + if (childobj) g_object_unref (childobj); - + if ((obj == NULL || fequal) && (childflags & flags) == flags && !(childflags & notflags)) { @@ -832,14 +832,14 @@ pluma_file_bookmarks_store_get_uri (PlumaFileBookmarksStore * model, guint flags; gchar * ret = NULL; gboolean isfs; - + g_return_val_if_fail (PLUMA_IS_FILE_BOOKMARKS_STORE (model), NULL); g_return_val_if_fail (iter != NULL, NULL); gtk_tree_model_get (GTK_TREE_MODEL (model), iter, PLUMA_FILE_BOOKMARKS_STORE_COLUMN_FLAGS, &flags, - PLUMA_FILE_BOOKMARKS_STORE_COLUMN_OBJECT, + PLUMA_FILE_BOOKMARKS_STORE_COLUMN_OBJECT, &obj, -1); @@ -847,7 +847,7 @@ pluma_file_bookmarks_store_get_uri (PlumaFileBookmarksStore * model, return NULL; isfs = (flags & PLUMA_FILE_BOOKMARKS_STORE_IS_FS); - + if (isfs && (flags & PLUMA_FILE_BOOKMARKS_STORE_IS_MOUNT)) { file = g_mount_get_root (G_MOUNT (obj)); @@ -856,15 +856,15 @@ pluma_file_bookmarks_store_get_uri (PlumaFileBookmarksStore * model, { file = g_object_ref (obj); } - + g_object_unref (obj); - + if (file) { ret = g_file_get_uri (file); g_object_unref (file); } - + return ret; } @@ -888,7 +888,7 @@ on_fs_changed (GVolumeMonitor *monitor, /* clear all fs items */ while (find_with_flags (tree_model, &iter, NULL, flags, noflags)) remove_node (tree_model, &iter); - + /* then reinitialize */ init_fs (model); } diff --git a/plugins/filebrowser/pluma-file-bookmarks-store.h b/plugins/filebrowser/pluma-file-bookmarks-store.h index 4c368db6..94dcb1e7 100644 --- a/plugins/filebrowser/pluma-file-bookmarks-store.h +++ b/plugins/filebrowser/pluma-file-bookmarks-store.h @@ -1,5 +1,5 @@ /* - * pluma-file-bookmarks-store.h - Pluma plugin providing easy file access + * pluma-file-bookmarks-store.h - Pluma plugin providing easy file access * from the sidepanel * * Copyright (C) 2006 - Jesse van den Kieboom <[email protected]> @@ -37,7 +37,7 @@ typedef struct _PlumaFileBookmarksStore PlumaFileBookmarksStore; typedef struct _PlumaFileBookmarksStoreClass PlumaFileBookmarksStoreClass; typedef struct _PlumaFileBookmarksStorePrivate PlumaFileBookmarksStorePrivate; -enum +enum { PLUMA_FILE_BOOKMARKS_STORE_COLUMN_ICON = 0, PLUMA_FILE_BOOKMARKS_STORE_COLUMN_NAME, @@ -46,7 +46,7 @@ enum PLUMA_FILE_BOOKMARKS_STORE_N_COLUMNS }; -enum +enum { PLUMA_FILE_BOOKMARKS_STORE_NONE = 0, PLUMA_FILE_BOOKMARKS_STORE_IS_SEPARATOR = 1 << 0, /* Separator item */ @@ -64,14 +64,14 @@ enum PLUMA_FILE_BOOKMARKS_STORE_IS_LOCAL_BOOKMARK = 1 << 12 /* A local gtk bookmark */ }; -struct _PlumaFileBookmarksStore +struct _PlumaFileBookmarksStore { GtkTreeStore parent; PlumaFileBookmarksStorePrivate *priv; }; -struct _PlumaFileBookmarksStoreClass +struct _PlumaFileBookmarksStoreClass { GtkTreeStoreClass parent_class; }; diff --git a/plugins/filebrowser/pluma-file-browser-error.h b/plugins/filebrowser/pluma-file-browser-error.h index 798022f0..57f08292 100644 --- a/plugins/filebrowser/pluma-file-browser-error.h +++ b/plugins/filebrowser/pluma-file-browser-error.h @@ -1,5 +1,5 @@ /* - * pluma-file-browser-error.h - Pluma plugin providing easy file access + * pluma-file-browser-error.h - Pluma plugin providing easy file access * from the sidepanel * * Copyright (C) 2006 - Jesse van den Kieboom <[email protected]> diff --git a/plugins/filebrowser/pluma-file-browser-messages.c b/plugins/filebrowser/pluma-file-browser-messages.c index f4b20d05..2c703973 100644 --- a/plugins/filebrowser/pluma-file-browser-messages.c +++ b/plugins/filebrowser/pluma-file-browser-messages.c @@ -9,7 +9,7 @@ typedef struct { - PlumaWindow *window; + PlumaWindow *window; PlumaMessage *message; } MessageCacheData; @@ -23,18 +23,18 @@ typedef struct GList *merge_ids; GtkActionGroup *merged_actions; - + PlumaMessageBus *bus; PlumaFileBrowserWidget *widget; GHashTable *row_tracking; - + GHashTable *filters; } WindowData; typedef struct { gulong id; - + PlumaWindow *window; PlumaMessage *message; } FilterData; @@ -46,10 +46,10 @@ window_data_new (PlumaWindow *window, WindowData *data = g_slice_new (WindowData); GtkUIManager *manager; GList *groups; - + data->bus = pluma_window_get_message_bus (window); data->widget = widget; - data->row_tracking = g_hash_table_new_full (g_str_hash, + data->row_tracking = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify)g_free, (GDestroyNotify)gtk_tree_row_reference_free); @@ -58,15 +58,15 @@ window_data_new (PlumaWindow *window, g_str_equal, (GDestroyNotify)g_free, NULL); - + manager = pluma_file_browser_widget_get_ui_manager (widget); data->merge_ids = NULL; data->merged_actions = gtk_action_group_new ("MessageMergedActions"); - + groups = gtk_ui_manager_get_action_groups (manager); gtk_ui_manager_insert_action_group (manager, data->merged_actions, g_list_length (groups)); - + g_object_set_data (G_OBJECT (window), WINDOW_DATA_KEY, data); return data; @@ -84,13 +84,13 @@ window_data_free (PlumaWindow *window) WindowData *data = get_window_data (window); GtkUIManager *manager; GList *item; - - g_hash_table_destroy (data->row_tracking); + + g_hash_table_destroy (data->row_tracking); g_hash_table_destroy (data->filters); manager = pluma_file_browser_widget_get_ui_manager (data->widget); gtk_ui_manager_remove_action_group (manager, data->merged_actions); - + for (item = data->merge_ids; item; item = item->next) gtk_ui_manager_remove_ui (manager, GPOINTER_TO_INT (item->data)); @@ -103,19 +103,19 @@ window_data_free (PlumaWindow *window) } static FilterData * -filter_data_new (PlumaWindow *window, +filter_data_new (PlumaWindow *window, PlumaMessage *message) { FilterData *data = g_slice_new (FilterData); WindowData *wdata; - + data->window = window; data->id = 0; data->message = message; - + wdata = get_window_data (window); - - g_hash_table_insert (wdata->filters, + + g_hash_table_insert (wdata->filters, pluma_message_type_identifier (pluma_message_get_object_path (message), pluma_message_get_method (message)), data); @@ -128,10 +128,10 @@ filter_data_free (FilterData *data) { WindowData *wdata = get_window_data (data->window); gchar *identifier; - + identifier = pluma_message_type_identifier (pluma_message_get_object_path (data->message), pluma_message_get_method (data->message)); - + g_hash_table_remove (wdata->filters, identifier); g_free (identifier); @@ -140,16 +140,16 @@ filter_data_free (FilterData *data) } static GtkTreePath * -track_row_lookup (WindowData *data, +track_row_lookup (WindowData *data, const gchar *id) { GtkTreeRowReference *ref; - + ref = (GtkTreeRowReference *)g_hash_table_lookup (data->row_tracking, id); - + if (!ref) return NULL; - + return gtk_tree_row_reference_get_path (ref); } @@ -165,10 +165,10 @@ message_cache_data_new (PlumaWindow *window, PlumaMessage *message) { MessageCacheData *data = g_slice_new (MessageCacheData); - + data->window = window; data->message = message; - + return data; } @@ -179,10 +179,10 @@ message_get_root_cb (PlumaMessageBus *bus, { PlumaFileBrowserStore *store; gchar *uri; - + store = pluma_file_browser_widget_get_browser_store (data->widget); uri = pluma_file_browser_store_get_virtual_root (store); - + pluma_message_set (message, "uri", uri, NULL); g_free (uri); } @@ -194,12 +194,12 @@ message_set_root_cb (PlumaMessageBus *bus, { gchar *root = NULL; gchar *virtual = NULL; - + pluma_message_get (message, "uri", &root, NULL); - + if (!root) return; - + if (pluma_message_has_key (message, "virtual")) pluma_message_get (message, "virtual", &virtual, NULL); @@ -207,7 +207,7 @@ message_set_root_cb (PlumaMessageBus *bus, pluma_file_browser_widget_set_root_and_virtual_root (data->widget, root, virtual); else pluma_file_browser_widget_set_root (data->widget, root, TRUE); - + g_free (root); g_free (virtual); } @@ -221,57 +221,57 @@ message_set_emblem_cb (PlumaMessageBus *bus, gchar *emblem = NULL; GtkTreePath *path; PlumaFileBrowserStore *store; - + pluma_message_get (message, "id", &id, "emblem", &emblem, NULL); - + if (!id || !emblem) { g_free (id); g_free (emblem); - + return; } - + path = track_row_lookup (data, id); - + if (path != NULL) { GError *error = NULL; GdkPixbuf *pixbuf; - - pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), - emblem, - 10, - 0, + + pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), + emblem, + 10, + 0, &error); - + if (pixbuf) { GValue value = { 0, }; GtkTreeIter iter; - + store = pluma_file_browser_widget_get_browser_store (data->widget); - + if (gtk_tree_model_get_iter (GTK_TREE_MODEL (store), &iter, path)) { g_value_init (&value, GDK_TYPE_PIXBUF); g_value_set_object (&value, pixbuf); - - pluma_file_browser_store_set_value (store, + + pluma_file_browser_store_set_value (store, &iter, PLUMA_FILE_BROWSER_STORE_COLUMN_EMBLEM, &value); - + g_value_unset (&value); } - + g_object_unref (pixbuf); } - + if (error) g_error_free (error); } - + g_free (id); g_free (emblem); } @@ -292,20 +292,20 @@ track_row (WindowData *data, GtkTreeRowReference *ref; gchar *id; gchar *pathstr; - + pathstr = gtk_tree_path_to_string (path); id = item_id (pathstr, uri); - + ref = gtk_tree_row_reference_new (GTK_TREE_MODEL (store), path); g_hash_table_insert (data->row_tracking, g_strdup (id), ref); - + g_free (pathstr); - + return id; } static void -set_item_message (WindowData *data, +set_item_message (WindowData *data, GtkTreeIter *iter, GtkTreePath *path, PlumaMessage *message) @@ -314,14 +314,14 @@ set_item_message (WindowData *data, gchar *uri = NULL; guint flags = 0; gchar *track_id; - + store = pluma_file_browser_widget_get_browser_store (data->widget); - + gtk_tree_model_get (GTK_TREE_MODEL (store), iter, PLUMA_FILE_BROWSER_STORE_COLUMN_URI, &uri, PLUMA_FILE_BROWSER_STORE_COLUMN_FLAGS, &flags, -1); - + if (!uri) return; @@ -334,13 +334,13 @@ set_item_message (WindowData *data, "id", track_id, "uri", uri, NULL); - + if (pluma_message_has_key (message, "is_directory")) { - pluma_message_set (message, + pluma_message_set (message, "is_directory", FILE_IS_DIR (flags), NULL); - } + } g_free (uri); g_free (track_id); @@ -357,27 +357,27 @@ custom_message_filter_func (PlumaFileBrowserWidget *widget, guint flags = 0; gboolean filter = FALSE; GtkTreePath *path; - - gtk_tree_model_get (GTK_TREE_MODEL (store), iter, + + gtk_tree_model_get (GTK_TREE_MODEL (store), iter, PLUMA_FILE_BROWSER_STORE_COLUMN_URI, &uri, PLUMA_FILE_BROWSER_STORE_COLUMN_FLAGS, &flags, -1); - + if (!uri || FILE_IS_DUMMY (flags)) { g_free (uri); return FALSE; } - + path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), iter); set_item_message (wdata, iter, path, data->message); gtk_tree_path_free (path); - + pluma_message_set (data->message, "filter", filter, NULL); pluma_message_bus_send_message_sync (wdata->bus, data->message); pluma_message_get (data->message, "filter", &filter, NULL); - + return !filter; } @@ -393,31 +393,31 @@ message_add_filter_cb (PlumaMessageBus *bus, PlumaMessage *cbmessage; FilterData *filter_data; WindowData *data = get_window_data (window); - - pluma_message_get (message, + + pluma_message_get (message, "object_path", &object_path, "method", &method, NULL); - + // Check if there exists such a 'callback' message if (!object_path || !method) { g_free (object_path); g_free (method); - + return; } - + message_type = pluma_message_bus_lookup (bus, object_path, method); - + if (!message_type) { g_free (object_path); g_free (method); - + return; } - + // Check if the message type has the correct arguments if (pluma_message_type_lookup (message_type, "id") != G_TYPE_STRING || pluma_message_type_lookup (message_type, "uri") != G_TYPE_STRING || @@ -426,7 +426,7 @@ message_add_filter_cb (PlumaMessageBus *bus, { return; } - + cbmessage = pluma_message_type_instantiate (message_type, "id", NULL, "uri", NULL, @@ -436,7 +436,7 @@ message_add_filter_cb (PlumaMessageBus *bus, // Register the custom filter on the widget filter_data = filter_data_new (window, cbmessage); - id = pluma_file_browser_widget_add_filter (data->widget, + id = pluma_file_browser_widget_add_filter (data->widget, (PlumaFileBrowserWidgetFilterFunc)custom_message_filter_func, filter_data, (GDestroyNotify)filter_data_free); @@ -450,12 +450,12 @@ message_remove_filter_cb (PlumaMessageBus *bus, WindowData *data) { gulong id = 0; - + pluma_message_get (message, "id", &id, NULL); - + if (!id) return; - + pluma_file_browser_widget_remove_filter (data->widget, id); } @@ -465,7 +465,7 @@ message_up_cb (PlumaMessageBus *bus, WindowData *data) { PlumaFileBrowserStore *store = pluma_file_browser_widget_get_browser_store (data->widget); - + pluma_file_browser_store_set_virtual_root_up (store); } @@ -501,12 +501,12 @@ message_set_show_hidden_cb (PlumaMessageBus *bus, gboolean active = FALSE; PlumaFileBrowserStore *store; PlumaFileBrowserStoreFilterMode mode; - + pluma_message_get (message, "active", &active, NULL); - + store = pluma_file_browser_widget_get_browser_store (data->widget); mode = pluma_file_browser_store_get_filter_mode (store); - + if (active) mode &= ~PLUMA_FILE_BROWSER_STORE_FILTER_MODE_HIDE_HIDDEN; else @@ -523,12 +523,12 @@ message_set_show_binary_cb (PlumaMessageBus *bus, gboolean active = FALSE; PlumaFileBrowserStore *store; PlumaFileBrowserStoreFilterMode mode; - + pluma_message_get (message, "active", &active, NULL); - + store = pluma_file_browser_widget_get_browser_store (data->widget); mode = pluma_file_browser_store_get_filter_mode (store); - + if (active) mode &= ~PLUMA_FILE_BROWSER_STORE_FILTER_MODE_HIDE_BINARY; else @@ -563,12 +563,12 @@ message_add_context_item_cb (PlumaMessageBus *bus, gchar *name; GtkUIManager *manager; guint merge_id; - - pluma_message_get (message, - "action", &action, - "path", &path, + + pluma_message_get (message, + "action", &action, + "path", &path, NULL); - + if (!action || !path) { if (action) @@ -577,20 +577,20 @@ message_add_context_item_cb (PlumaMessageBus *bus, g_free (path); return; } - + gtk_action_group_add_action (data->merged_actions, action); manager = pluma_file_browser_widget_get_ui_manager (data->widget); name = g_strconcat (gtk_action_get_name (action), "MenuItem", NULL); merge_id = gtk_ui_manager_new_merge_id (manager); - - gtk_ui_manager_add_ui (manager, + + gtk_ui_manager_add_ui (manager, merge_id, path, name, gtk_action_get_name (action), GTK_UI_MANAGER_AUTO, FALSE); - + if (gtk_ui_manager_get_widget (manager, path)) { data->merge_ids = g_list_prepend (data->merge_ids, GINT_TO_POINTER (merge_id)); @@ -600,7 +600,7 @@ message_add_context_item_cb (PlumaMessageBus *bus, { pluma_message_set (message, "id", 0, NULL); } - + g_object_unref (action); g_free (path); g_free (name); @@ -613,14 +613,14 @@ message_remove_context_item_cb (PlumaMessageBus *bus, { guint merge_id = 0; GtkUIManager *manager; - + pluma_message_get (message, "id", &merge_id, NULL); - + if (merge_id == 0) return; - + manager = pluma_file_browser_widget_get_ui_manager (data->widget); - + data->merge_ids = g_list_remove (data->merge_ids, GINT_TO_POINTER (merge_id)); gtk_ui_manager_remove_ui (manager, merge_id); } @@ -644,26 +644,26 @@ register_methods (PlumaWindow *window, WindowData *data = get_window_data (window); /* Register method calls */ - pluma_message_bus_register (bus, - MESSAGE_OBJECT_PATH, "get_root", + pluma_message_bus_register (bus, + MESSAGE_OBJECT_PATH, "get_root", 1, "uri", G_TYPE_STRING, NULL); - - pluma_message_bus_register (bus, - MESSAGE_OBJECT_PATH, "set_root", - 1, + + pluma_message_bus_register (bus, + MESSAGE_OBJECT_PATH, "set_root", + 1, "uri", G_TYPE_STRING, "virtual", G_TYPE_STRING, NULL); - + pluma_message_bus_register (bus, MESSAGE_OBJECT_PATH, "set_emblem", 0, "id", G_TYPE_STRING, "emblem", G_TYPE_STRING, NULL); - + pluma_message_bus_register (bus, MESSAGE_OBJECT_PATH, "add_filter", 1, @@ -671,13 +671,13 @@ register_methods (PlumaWindow *window, "method", G_TYPE_STRING, "id", G_TYPE_ULONG, NULL); - + pluma_message_bus_register (bus, MESSAGE_OBJECT_PATH, "remove_filter", 0, "id", G_TYPE_ULONG, NULL); - + pluma_message_bus_register (bus, MESSAGE_OBJECT_PATH, "add_context_item", 1, @@ -691,22 +691,22 @@ register_methods (PlumaWindow *window, 0, "id", G_TYPE_UINT, NULL); - + pluma_message_bus_register (bus, MESSAGE_OBJECT_PATH, "up", 0, NULL); - + pluma_message_bus_register (bus, MESSAGE_OBJECT_PATH, "history_back", 0, NULL); pluma_message_bus_register (bus, MESSAGE_OBJECT_PATH, "history_forward", 0, NULL); - + pluma_message_bus_register (bus, MESSAGE_OBJECT_PATH, "refresh", 0, NULL); - pluma_message_bus_register (bus, - MESSAGE_OBJECT_PATH, "set_show_hidden", - 0, + pluma_message_bus_register (bus, + MESSAGE_OBJECT_PATH, "set_show_hidden", + 0, "active", G_TYPE_BOOLEAN, NULL); - pluma_message_bus_register (bus, + pluma_message_bus_register (bus, MESSAGE_OBJECT_PATH, "set_show_binary", - 0, + 0, "active", G_TYPE_BOOLEAN, NULL); @@ -733,10 +733,10 @@ register_methods (PlumaWindow *window, BUS_CONNECT (bus, history_forward, data); BUS_CONNECT (bus, refresh, data); - + BUS_CONNECT (bus, set_show_hidden, data); BUS_CONNECT (bus, set_show_binary, data); - + BUS_CONNECT (bus, show_bookmarks, data); BUS_CONNECT (bus, show_files, data); @@ -752,19 +752,19 @@ store_row_inserted (PlumaFileBrowserStore *store, gchar *uri = NULL; guint flags = 0; - gtk_tree_model_get (GTK_TREE_MODEL (store), iter, + gtk_tree_model_get (GTK_TREE_MODEL (store), iter, PLUMA_FILE_BROWSER_STORE_COLUMN_URI, &uri, PLUMA_FILE_BROWSER_STORE_COLUMN_FLAGS, &flags, -1); - + if (!FILE_IS_DUMMY (flags) && !FILE_IS_FILTERED (flags)) { WindowData *wdata = get_window_data (data->window); - + set_item_message (wdata, iter, path, data->message); pluma_message_bus_send_message_sync (wdata->bus, data->message); } - + g_free (uri); } @@ -776,23 +776,23 @@ store_row_deleted (PlumaFileBrowserStore *store, GtkTreeIter iter; gchar *uri = NULL; guint flags = 0; - + if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (store), &iter, path)) return; - - gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, + + gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, PLUMA_FILE_BROWSER_STORE_COLUMN_URI, &uri, PLUMA_FILE_BROWSER_STORE_COLUMN_FLAGS, &flags, -1); - + if (!FILE_IS_DUMMY (flags) && !FILE_IS_FILTERED (flags)) { WindowData *wdata = get_window_data (data->window); - + set_item_message (wdata, &iter, path, data->message); pluma_message_bus_send_message_sync (wdata->bus, data->message); } - + g_free (uri); } @@ -803,18 +803,18 @@ store_virtual_root_changed (PlumaFileBrowserStore *store, { WindowData *wdata = get_window_data (data->window); gchar *uri; - + uri = pluma_file_browser_store_get_virtual_root (store); - + if (!uri) return; - + pluma_message_set (data->message, "uri", uri, NULL); - + pluma_message_bus_send_message_sync (wdata->bus, data->message); - + g_free (uri); } @@ -825,11 +825,11 @@ store_begin_loading (PlumaFileBrowserStore *store, { GtkTreePath *path; WindowData *wdata = get_window_data (data->window); - + path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), iter); - + set_item_message (wdata, iter, path, data->message); - + pluma_message_bus_send_message_sync (wdata->bus, data->message); gtk_tree_path_free (path); } @@ -841,15 +841,15 @@ store_end_loading (PlumaFileBrowserStore *store, { GtkTreePath *path; WindowData *wdata = get_window_data (data->window); - + path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), iter); - + set_item_message (wdata, iter, path, data->message); - + pluma_message_bus_send_message_sync (wdata->bus, data->message); gtk_tree_path_free (path); } - + static void register_signals (PlumaWindow *window, PlumaFileBrowserWidget *widget) @@ -861,7 +861,7 @@ register_signals (PlumaWindow *window, PlumaMessageType *begin_loading_type; PlumaMessageType *end_loading_type; PlumaMessageType *root_changed_type; - + PlumaMessage *message; WindowData *data; @@ -872,7 +872,7 @@ register_signals (PlumaWindow *window, "id", G_TYPE_STRING, "uri", G_TYPE_STRING, NULL); - + begin_loading_type = pluma_message_bus_register (bus, MESSAGE_OBJECT_PATH, "begin_loading", 0, @@ -904,41 +904,41 @@ register_signals (PlumaWindow *window, NULL); store = pluma_file_browser_widget_get_browser_store (widget); - - message = pluma_message_type_instantiate (inserted_type, + + message = pluma_message_type_instantiate (inserted_type, "id", NULL, - "uri", NULL, - "is_directory", FALSE, + "uri", NULL, + "is_directory", FALSE, NULL); data = get_window_data (window); - data->row_inserted_id = - g_signal_connect_data (store, - "row-inserted", - G_CALLBACK (store_row_inserted), + data->row_inserted_id = + g_signal_connect_data (store, + "row-inserted", + G_CALLBACK (store_row_inserted), message_cache_data_new (window, message), (GClosureNotify)message_cache_data_free, 0); - message = pluma_message_type_instantiate (deleted_type, - "id", NULL, + message = pluma_message_type_instantiate (deleted_type, + "id", NULL, "uri", NULL, - "is_directory", FALSE, + "is_directory", FALSE, NULL); - data->row_deleted_id = - g_signal_connect_data (store, - "row-deleted", - G_CALLBACK (store_row_deleted), + data->row_deleted_id = + g_signal_connect_data (store, + "row-deleted", + G_CALLBACK (store_row_deleted), message_cache_data_new (window, message), (GClosureNotify)message_cache_data_free, 0); - + message = pluma_message_type_instantiate (root_changed_type, "id", NULL, "uri", NULL, NULL); - data->root_changed_id = + data->root_changed_id = g_signal_connect_data (store, "notify::virtual-root", G_CALLBACK (store_virtual_root_changed), @@ -949,8 +949,8 @@ register_signals (PlumaWindow *window, message = pluma_message_type_instantiate (begin_loading_type, "id", NULL, "uri", NULL, - NULL); - data->begin_loading_id = + NULL); + data->begin_loading_id = g_signal_connect_data (store, "begin_loading", G_CALLBACK (store_begin_loading), @@ -962,7 +962,7 @@ register_signals (PlumaWindow *window, "id", NULL, "uri", NULL, NULL); - data->end_loading_id = + data->end_loading_id = g_signal_connect_data (store, "end_loading", G_CALLBACK (store_end_loading), @@ -980,28 +980,28 @@ message_unregistered (PlumaMessageBus *bus, pluma_message_type_get_method (message_type)); FilterData *data; WindowData *wdata = get_window_data (window); - + data = g_hash_table_lookup (wdata->filters, identifier); - + if (data) pluma_file_browser_widget_remove_filter (wdata->widget, data->id); - + g_free (identifier); } -void -pluma_file_browser_messages_register (PlumaWindow *window, +void +pluma_file_browser_messages_register (PlumaWindow *window, PlumaFileBrowserWidget *widget) { window_data_new (window, widget); - + register_methods (window, widget); register_signals (window, widget); - + g_signal_connect (pluma_window_get_message_bus (window), "unregistered", G_CALLBACK (message_unregistered), - window); + window); } static void @@ -1009,15 +1009,15 @@ cleanup_signals (PlumaWindow *window) { WindowData *data = get_window_data (window); PlumaFileBrowserStore *store; - + store = pluma_file_browser_widget_get_browser_store (data->widget); - + g_signal_handler_disconnect (store, data->row_inserted_id); g_signal_handler_disconnect (store, data->row_deleted_id); g_signal_handler_disconnect (store, data->root_changed_id); g_signal_handler_disconnect (store, data->begin_loading_id); g_signal_handler_disconnect (store, data->end_loading_id); - + g_signal_handlers_disconnect_by_func (data->bus, message_unregistered, window); } @@ -1025,7 +1025,7 @@ void pluma_file_browser_messages_unregister (PlumaWindow *window) { PlumaMessageBus *bus = pluma_window_get_message_bus (window); - + cleanup_signals (window); pluma_message_bus_unregister_all (bus, MESSAGE_OBJECT_PATH); diff --git a/plugins/filebrowser/pluma-file-browser-messages.h b/plugins/filebrowser/pluma-file-browser-messages.h index 17b54f38..89598446 100644 --- a/plugins/filebrowser/pluma-file-browser-messages.h +++ b/plugins/filebrowser/pluma-file-browser-messages.h @@ -1,5 +1,5 @@ /* - * pluma-file-browser-messages.h - Pluma plugin providing easy file access + * pluma-file-browser-messages.h - Pluma plugin providing easy file access * from the sidepanel * * Copyright (C) 2008 - Jesse van den Kieboom <[email protected]> diff --git a/plugins/filebrowser/pluma-file-browser-plugin.h b/plugins/filebrowser/pluma-file-browser-plugin.h index 89324c91..2c5026fc 100644 --- a/plugins/filebrowser/pluma-file-browser-plugin.h +++ b/plugins/filebrowser/pluma-file-browser-plugin.h @@ -1,5 +1,5 @@ /* - * pluma-file-browser-plugin.h - Pluma plugin providing easy file access + * pluma-file-browser-plugin.h - Pluma plugin providing easy file access * from the sidepanel * * Copyright (C) 2006 - Jesse van den Kieboom <[email protected]> @@ -44,7 +44,7 @@ typedef struct _PlumaFileBrowserPluginPrivate PlumaFileBrowserPluginPrivate; typedef struct _PlumaFileBrowserPlugin PlumaFileBrowserPlugin; typedef struct _PlumaFileBrowserPluginClass PlumaFileBrowserPluginClass; -struct _PlumaFileBrowserPlugin +struct _PlumaFileBrowserPlugin { PeasExtensionBase parent_instance; @@ -52,7 +52,7 @@ struct _PlumaFileBrowserPlugin PlumaFileBrowserPluginPrivate *priv; }; -struct _PlumaFileBrowserPluginClass +struct _PlumaFileBrowserPluginClass { PeasExtensionBaseClass parent_class; }; diff --git a/plugins/filebrowser/pluma-file-browser-store.c b/plugins/filebrowser/pluma-file-browser-store.c index 6192c035..6a3feafc 100644 --- a/plugins/filebrowser/pluma-file-browser-store.c +++ b/plugins/filebrowser/pluma-file-browser-store.c @@ -1,5 +1,5 @@ /* - * pluma-file-browser-store.c - Pluma plugin providing easy file access + * pluma-file-browser-store.c - Pluma plugin providing easy file access * from the sidepanel * * Copyright (C) 2006 - Jesse van den Kieboom <[email protected]> @@ -86,7 +86,7 @@ typedef struct { GCancellable * cancellable; } MountInfo; -struct _FileBrowserNode +struct _FileBrowserNode { GFile *file; guint flags; @@ -100,7 +100,7 @@ struct _FileBrowserNode gboolean inserted; }; -struct _FileBrowserNodeDir +struct _FileBrowserNodeDir { FileBrowserNode node; GSList *children; @@ -110,7 +110,7 @@ struct _FileBrowserNodeDir PlumaFileBrowserStore *model; }; -struct _PlumaFileBrowserStorePrivate +struct _PlumaFileBrowserStorePrivate { FileBrowserNode *root; FileBrowserNode *virtual_root; @@ -130,7 +130,7 @@ static FileBrowserNode *model_find_node (PlumaFileBrowserStore *model, FileBrowserNode *node, GFile *uri); static void model_remove_node (PlumaFileBrowserStore * model, - FileBrowserNode * node, + FileBrowserNode * node, GtkTreePath * path, gboolean free_nodes); @@ -162,7 +162,7 @@ static gint pluma_file_browser_store_iter_n_children (GtkTreeModel * tree GtkTreeIter * iter); static gboolean pluma_file_browser_store_iter_nth_child (GtkTreeModel * tree_model, GtkTreeIter * iter, - GtkTreeIter * parent, + GtkTreeIter * parent, gint n); static gboolean pluma_file_browser_store_iter_parent (GtkTreeModel * tree_model, GtkTreeIter * iter, @@ -214,7 +214,7 @@ enum { }; /* Signals */ -enum +enum { BEGIN_LOADING, END_LOADING, @@ -254,10 +254,10 @@ pluma_file_browser_store_finalize (GObject * object) { AsyncData *data = (AsyncData *) (item->data); g_cancellable_cancel (data->cancellable); - + data->removed = TRUE; } - + cancel_mount_operation (obj); g_slist_free (obj->priv->async_handles); @@ -293,7 +293,7 @@ pluma_file_browser_store_get_property (GObject *object, break; case PROP_VIRTUAL_ROOT: set_gvalue_from_node (value, obj->priv->virtual_root); - break; + break; case PROP_FILTER_MODE: g_value_set_flags (value, obj->priv->filter_mode); break; @@ -391,7 +391,7 @@ pluma_file_browser_store_class_init (PlumaFileBrowserStoreClass * klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (PlumaFileBrowserStoreClass, rename), NULL, NULL, - pluma_file_browser_marshal_VOID__STRING_STRING, + pluma_file_browser_marshal_VOID__STRING_STRING, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING); @@ -663,13 +663,13 @@ pluma_file_browser_store_get_path (GtkTreeModel * tree_model, g_return_val_if_fail (iter != NULL, NULL); g_return_val_if_fail (iter->user_data != NULL, NULL); - return pluma_file_browser_store_get_path_real (PLUMA_FILE_BROWSER_STORE (tree_model), + return pluma_file_browser_store_get_path_real (PLUMA_FILE_BROWSER_STORE (tree_model), (FileBrowserNode *) (iter->user_data)); } static void pluma_file_browser_store_get_value (GtkTreeModel * tree_model, - GtkTreeIter * iter, + GtkTreeIter * iter, gint column, GValue * value) { @@ -778,7 +778,7 @@ filter_tree_model_iter_has_child_real (PlumaFileBrowserStore * model, FileBrowserNode * node) { GSList *item; - + if (!NODE_IS_DIR (node)) return FALSE; @@ -914,7 +914,7 @@ pluma_file_browser_store_row_inserted (GtkTreeModel * tree_model, GtkTreeIter * iter) { FileBrowserNode * node = (FileBrowserNode *)(iter->user_data); - + node->inserted = TRUE; } @@ -1147,7 +1147,7 @@ row_changed (PlumaFileBrowserStore * model, signal may alter the path */ gtk_tree_model_row_changed (GTK_TREE_MODEL(model), *path, iter); gtk_tree_path_free (*path); - + *path = gtk_tree_row_reference_get_path (ref); gtk_tree_row_reference_free (ref); } @@ -1159,7 +1159,7 @@ row_inserted (PlumaFileBrowserStore * model, { /* This function creates a row reference for the path because it's uncertain what might change the actual model/view when we insert - a node, maybe another directory load is triggered for example. + a node, maybe another directory load is triggered for example. Because functions that use this function rely on the notion that the path remains pointed towards the inserted node, we use the reference to keep track. */ @@ -1168,7 +1168,7 @@ row_inserted (PlumaFileBrowserStore * model, gtk_tree_model_row_inserted (GTK_TREE_MODEL(model), copy, iter); gtk_tree_path_free (copy); - + if (ref) { gtk_tree_path_free (*path); @@ -1188,7 +1188,7 @@ row_deleted (PlumaFileBrowserStore * model, const GtkTreePath * path) { GtkTreePath *copy = gtk_tree_path_copy (path); - + /* Delete a copy of the actual path here because the row-deleted signal may alter the path */ gtk_tree_model_row_deleted (GTK_TREE_MODEL(model), copy); @@ -1259,7 +1259,7 @@ model_refilter_node (PlumaFileBrowserStore * model, gtk_tree_path_next (*path); } } - + model_check_dummy (model, node); if (tmppath) @@ -1374,7 +1374,7 @@ file_browser_node_free (PlumaFileBrowserStore * model, g_object_unref (dir->monitor); } } - + if (node->file) { uri = g_file_get_uri (node->file); @@ -1391,7 +1391,7 @@ file_browser_node_free (PlumaFileBrowserStore * model, g_object_unref (node->emblem); g_free (node->name); - + if (NODE_IS_DIR (node)) g_slice_free (FileBrowserNodeDir, (FileBrowserNodeDir *)node); else @@ -1433,10 +1433,10 @@ model_remove_node_children (PlumaFileBrowserStore * model, // be freed if (free_nodes) file_browser_node_free_children (model, node); - + return; } - + if (path == NULL) path_child = pluma_file_browser_store_get_path_real (model, node); @@ -1460,10 +1460,10 @@ model_remove_node_children (PlumaFileBrowserStore * model, * model_remove_node: * @model: the #PlumaFileBrowserStore * @node: the FileBrowserNode to remove - * @path: the path to use to remove this node, or NULL to use the path + * @path: the path to use to remove this node, or NULL to use the path * calculated from the node itself * @free_nodes: whether to also remove the nodes from memory - * + * * Removes this node and all its children from the model. This function is used * to remove the node from the _model_. Don't use it to just free * a node. @@ -1506,7 +1506,7 @@ model_remove_node (PlumaFileBrowserStore * model, (node->parent)->children, node); } - + /* If this is the virtual root, than set the parent as the virtual root */ if (node == model->priv->virtual_root) set_virtual_root_from_node (model, parent); @@ -1549,7 +1549,7 @@ model_clear (PlumaFileBrowserStore * model, gboolean free_nodes) if (NODE_IS_DUMMY (dummy) && model_node_visibility (model, dummy)) { path = gtk_tree_path_new_first (); - + dummy->inserted = FALSE; row_deleted (model, path); gtk_tree_path_free (path); @@ -1563,7 +1563,7 @@ file_browser_node_unload (PlumaFileBrowserStore * model, FileBrowserNode * node, gboolean remove_children) { FileBrowserNodeDir *dir; - + if (node == NULL) return; @@ -1586,7 +1586,7 @@ file_browser_node_unload (PlumaFileBrowserStore * model, if (dir->monitor) { g_file_monitor_cancel (dir->monitor); g_object_unref (dir->monitor); - + dir->monitor = NULL; } @@ -1735,7 +1735,7 @@ model_check_dummy (PlumaFileBrowserStore * model, FileBrowserNode * node) path = pluma_file_browser_store_get_path_real (model, dummy); - + row_inserted (model, &path, &iter); gtk_tree_path_free (path); } @@ -1751,7 +1751,7 @@ model_check_dummy (PlumaFileBrowserStore * model, FileBrowserNode * node) (model, dummy); dummy->flags |= PLUMA_FILE_BROWSER_STORE_FLAG_IS_HIDDEN; - + dummy->inserted = FALSE; row_deleted (model, path); gtk_tree_path_free (path); @@ -1893,15 +1893,15 @@ static gchar const * backup_content_type (GFileInfo * info) { gchar const * content; - + if (!g_file_info_get_is_backup (info)) return NULL; - + content = g_file_info_get_content_type (info); - + if (!content || g_content_type_equals (content, "application/x-trash")) return "text/plain"; - + return content; } @@ -1918,12 +1918,12 @@ file_browser_node_set_from_info (PlumaFileBrowserStore * model, GError * error = NULL; if (info == NULL) { - info = g_file_query_info (node->file, + info = g_file_query_info (node->file, STANDARD_ATTRIBUTE_TYPES, G_FILE_QUERY_INFO_NONE, NULL, &error); - + if (!info) { if (!(error->domain == G_IO_ERROR && error->code == G_IO_ERROR_NOT_FOUND)) { uri = g_file_get_uri (node->file); @@ -1934,7 +1934,7 @@ file_browser_node_set_from_info (PlumaFileBrowserStore * model, return; } - + free_info = TRUE; } @@ -1946,13 +1946,13 @@ file_browser_node_set_from_info (PlumaFileBrowserStore * model, else { if (!(content = backup_content_type (info))) content = g_file_info_get_content_type (info); - - if (!content || + + if (!content || g_content_type_is_unknown (content) || g_content_type_is_a (content, "text/plain")) - node->flags |= PLUMA_FILE_BROWSER_STORE_FLAG_IS_TEXT; + node->flags |= PLUMA_FILE_BROWSER_STORE_FLAG_IS_TEXT; } - + model_recomposite_icon_real (model, node, info); if (free_info) @@ -1962,7 +1962,7 @@ file_browser_node_set_from_info (PlumaFileBrowserStore * model, path = pluma_file_browser_store_get_path_real (model, node); model_refilter_node (model, node, &path); gtk_tree_path_free (path); - + model_check_dummy (model, node->parent); } else { model_node_update_visibility (model, node); @@ -2006,11 +2006,11 @@ model_add_node_from_file (PlumaFileBrowserStore * model, &error); free_info = TRUE; } - + if (!info) { g_warning ("Error querying file info: %s", error->message); g_error_free (error); - + /* FIXME: What to do now then... */ node = file_browser_node_new (file, parent); } else if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY) { @@ -2021,7 +2021,7 @@ model_add_node_from_file (PlumaFileBrowserStore * model, file_browser_node_set_from_info (model, node, info, FALSE); model_add_node (model, node, parent); - + if (info && free_info) g_object_unref (info); } @@ -2056,7 +2056,7 @@ model_add_nodes_from_files (PlumaFileBrowserStore * model, type != G_FILE_TYPE_SYMBOLIC_LINK) { g_object_unref (info); continue; - } + } name = g_file_info_get_name (info); @@ -2098,7 +2098,7 @@ model_add_node_from_dir (PlumaFileBrowserStore * model, FileBrowserNode *node; /* Check if it already exists */ - if ((node = node_list_contains_file (FILE_BROWSER_NODE_DIR (parent)->children, file)) == NULL) { + if ((node = node_list_contains_file (FILE_BROWSER_NODE_DIR (parent)->children, file)) == NULL) { node = file_browser_node_dir_new (model, file, parent); file_browser_node_set_from_info (model, node, NULL, FALSE); @@ -2138,7 +2138,7 @@ on_directory_monitor_event (GFileMonitor * monitor, if (g_file_query_exists (file, NULL)) { model_add_node_from_file (dir->model, parent, file, NULL); } - + break; default: break; @@ -2154,33 +2154,33 @@ async_node_free (AsyncNode *async) } static void -model_iterate_next_files_cb (GFileEnumerator * enumerator, - GAsyncResult * result, +model_iterate_next_files_cb (GFileEnumerator * enumerator, + GAsyncResult * result, AsyncNode * async) { GList * files; GError * error = NULL; FileBrowserNodeDir * dir = async->dir; FileBrowserNode * parent = (FileBrowserNode *)dir; - + files = g_file_enumerator_next_files_finish (enumerator, result, &error); if (files == NULL) { g_file_enumerator_close (enumerator, NULL, NULL); async_node_free (async); - + if (!error) { /* We're done loading */ g_object_unref (dir->cancellable); dir->cancellable = NULL; - + /* * FIXME: This is temporarly, it is a bug in gio: * http://bugzilla.gnome.org/show_bug.cgi?id=565924 */ if (g_file_is_native (parent->file) && dir->monitor == NULL) { - dir->monitor = g_file_monitor_directory (parent->file, + dir->monitor = g_file_monitor_directory (parent->file, G_FILE_MONITOR_NONE, NULL, NULL); @@ -2199,7 +2199,7 @@ model_iterate_next_files_cb (GFileEnumerator * enumerator, /* Simply return if we were cancelled */ if (error->domain == G_IO_ERROR && error->code == G_IO_ERROR_CANCELLED) return; - + /* Otherwise handle the error appropriately */ g_signal_emit (dir->model, model_signals[ERROR], @@ -2216,7 +2216,7 @@ model_iterate_next_files_cb (GFileEnumerator * enumerator, async_node_free (async); } else { model_add_nodes_from_files (dir->model, parent, async->original_children, files); - + g_list_free (files); next_files_async (enumerator, async); } @@ -2235,7 +2235,7 @@ next_files_async (GFileEnumerator * enumerator, } static void -model_iterate_children_cb (GFile * file, +model_iterate_children_cb (GFile * file, GAsyncResult * result, AsyncNode * async) { @@ -2247,13 +2247,13 @@ model_iterate_children_cb (GFile * file, async_node_free (async); return; } - + enumerator = g_file_enumerate_children_finish (file, result, &error); if (enumerator == NULL) { /* Simply return if we were cancelled or if the dir is not there */ FileBrowserNodeDir *dir = async->dir; - + /* Otherwise handle the error appropriately */ g_signal_emit (dir->model, model_signals[ERROR], @@ -2289,7 +2289,7 @@ model_load_directory (PlumaFileBrowserStore * model, model_begin_loading (model, node); dir->cancellable = g_cancellable_new (); - + async = g_new (AsyncNode, 1); async->dir = dir; async->cancellable = g_object_ref (dir->cancellable); @@ -2309,7 +2309,7 @@ static GList * get_parent_files (PlumaFileBrowserStore * model, GFile * file) { GList * result = NULL; - + result = g_list_prepend (result, g_object_ref (file)); while ((file = g_file_get_parent (file))) { @@ -2355,7 +2355,7 @@ model_fill (PlumaFileBrowserStore * model, FileBrowserNode * node, if (node != model->priv->virtual_root) { /* Insert node */ iter.user_data = node; - + row_inserted(model, path, &iter); } @@ -2378,7 +2378,7 @@ model_fill (PlumaFileBrowserStore * model, FileBrowserNode * node, /* Move back up to node path */ gtk_tree_path_up (*path); } - + model_check_dummy (model, node); if (free_path) @@ -2439,8 +2439,8 @@ set_virtual_root_from_node (PlumaFileBrowserStore * model, for (item = FILE_BROWSER_NODE_DIR (node)->children; item; item = item->next) { check = (FileBrowserNode *) (item->data); - - if (NODE_IS_DIR (check)) { + + if (NODE_IS_DIR (check)) { for (copy = FILE_BROWSER_NODE_DIR (check)->children; copy; copy = copy->next) { @@ -2491,7 +2491,7 @@ set_virtual_root_from_file (PlumaFileBrowserStore * model, for (item = files; item; item = item->next) { check = G_FILE (item->data); - + parent = model_add_node_from_dir (model, parent, check); g_object_unref (check); } @@ -2509,21 +2509,21 @@ model_find_node_children (PlumaFileBrowserStore * model, FileBrowserNode *child; FileBrowserNode *result; GSList *children; - + if (!NODE_IS_DIR (parent)) return NULL; - + dir = FILE_BROWSER_NODE_DIR (parent); - + for (children = dir->children; children; children = children->next) { child = (FileBrowserNode *)(children->data); - + result = model_find_node (model, child, file); - + if (result) return result; } - + return NULL; } @@ -2540,7 +2540,7 @@ model_find_node (PlumaFileBrowserStore * model, if (NODE_IS_DIR (node) && g_file_has_prefix (file, node->file)) return model_find_node_children (model, node, file); - + return NULL; } @@ -2603,40 +2603,40 @@ handle_root_error (PlumaFileBrowserStore * model, GError *error) { FileBrowserNode * root; - g_signal_emit (model, - model_signals[ERROR], - 0, + g_signal_emit (model, + model_signals[ERROR], + 0, PLUMA_FILE_BROWSER_ERROR_SET_ROOT, error->message); - + /* Set the virtual root to the root */ root = model->priv->root; model->priv->virtual_root = root; - + /* Set the root to be loaded */ root->flags |= PLUMA_FILE_BROWSER_STORE_FLAG_LOADED; - + /* Check the dummy */ model_check_dummy (model, root); - + g_object_notify (G_OBJECT (model), "root"); g_object_notify (G_OBJECT (model), "virtual-root"); } static void -mount_cb (GFile * file, - GAsyncResult * res, +mount_cb (GFile * file, + GAsyncResult * res, MountInfo * mount_info) { gboolean mounted; GError * error = NULL; PlumaFileBrowserStore * model = mount_info->model; - + mounted = g_file_mount_enclosing_volume_finish (file, res, &error); if (mount_info->model) { - model->priv->mount_info = NULL; + model->priv->mount_info = NULL; model_end_loading (model, model->priv->root); } @@ -2653,7 +2653,7 @@ mount_cb (GFile * file, { handle_root_error (model, error); } - + if (error) g_error_free (error); @@ -2670,9 +2670,9 @@ model_mount_root (PlumaFileBrowserStore * model, gchar const * virtual_root) GFileInfo * info; GError * error = NULL; MountInfo * mount_info; - - info = g_file_query_info (model->priv->root->file, - G_FILE_ATTRIBUTE_STANDARD_TYPE, + + info = g_file_query_info (model->priv->root->file, + G_FILE_ATTRIBUTE_STANDARD_TYPE, G_FILE_QUERY_INFO_NONE, NULL, &error); @@ -2681,23 +2681,23 @@ model_mount_root (PlumaFileBrowserStore * model, gchar const * virtual_root) if (error->code == G_IO_ERROR_NOT_MOUNTED) { /* Try to mount it */ FILE_BROWSER_NODE_DIR (model->priv->root)->cancellable = g_cancellable_new (); - + mount_info = g_new(MountInfo, 1); mount_info->model = model; mount_info->virtual_root = g_strdup (virtual_root); - + /* FIXME: we should be setting the correct window */ mount_info->operation = gtk_mount_operation_new (NULL); mount_info->cancellable = g_object_ref (FILE_BROWSER_NODE_DIR (model->priv->root)->cancellable); - + model_begin_loading (model, model->priv->root); - g_file_mount_enclosing_volume (model->priv->root->file, + g_file_mount_enclosing_volume (model->priv->root->file, G_MOUNT_MOUNT_NONE, mount_info->operation, mount_info->cancellable, (GAsyncReadyCallback)mount_cb, mount_info); - + model->priv->mount_info = mount_info; return PLUMA_FILE_BROWSER_STORE_RESULT_MOUNTING; } @@ -2705,14 +2705,14 @@ model_mount_root (PlumaFileBrowserStore * model, gchar const * virtual_root) { handle_root_error (model, error); } - + g_error_free (error); } else { g_object_unref (info); - + return model_root_mounted (model, virtual_root); } - + return PLUMA_FILE_BROWSER_STORE_RESULT_OK; } @@ -2763,7 +2763,7 @@ pluma_file_browser_store_set_value (PlumaFileBrowserStore * tree_model, model_recomposite_icon (tree_model, iter); if (model_node_visibility (tree_model, node)) { - path = pluma_file_browser_store_get_path (GTK_TREE_MODEL (tree_model), + path = pluma_file_browser_store_get_path (GTK_TREE_MODEL (tree_model), iter); row_changed (tree_model, &path, iter); gtk_tree_path_free (path); @@ -2921,7 +2921,7 @@ void pluma_file_browser_store_cancel_mount_operation (PlumaFileBrowserStore *store) { g_return_if_fail (PLUMA_IS_FILE_BROWSER_STORE (store)); - + cancel_mount_operation (store); } @@ -2968,7 +2968,7 @@ pluma_file_browser_store_set_root_and_virtual_root (PlumaFileBrowserStore * g_object_unref (vfile); } - + /* make sure to cancel any previous mount operations */ cancel_mount_operation (model); @@ -2982,7 +2982,7 @@ pluma_file_browser_store_set_root_and_virtual_root (PlumaFileBrowserStore * if (file != NULL) { /* Create the root node */ node = file_browser_node_dir_new (model, file, NULL); - + g_object_unref (file); model->priv->root = node; @@ -3010,18 +3010,18 @@ gchar * pluma_file_browser_store_get_root (PlumaFileBrowserStore * model) { g_return_val_if_fail (PLUMA_IS_FILE_BROWSER_STORE (model), NULL); - + if (model->priv->root == NULL || model->priv->root->file == NULL) return NULL; else return g_file_get_uri (model->priv->root->file); } -gchar * +gchar * pluma_file_browser_store_get_virtual_root (PlumaFileBrowserStore * model) { g_return_val_if_fail (PLUMA_IS_FILE_BROWSER_STORE (model), NULL); - + if (model->priv->virtual_root == NULL || model->priv->virtual_root->file == NULL) return NULL; else @@ -3147,7 +3147,7 @@ reparent_node (FileBrowserNode * node, gboolean reparent) if (!node->file) { return; } - + if (reparent) { parent = node->parent->file; base = g_file_get_basename (node->file); @@ -3156,10 +3156,10 @@ reparent_node (FileBrowserNode * node, gboolean reparent) node->file = g_file_get_child (parent, base); g_free (base); } - + if (NODE_IS_DIR (node)) { dir = FILE_BROWSER_NODE_DIR (node); - + for (child = dir->children; child; child = child->next) { reparent_node ((FileBrowserNode *)child->data, TRUE); } @@ -3205,7 +3205,7 @@ pluma_file_browser_store_rename (PlumaFileBrowserStore * model, /* This makes sure the actual info for the node is requeried */ file_browser_node_set_name (node); file_browser_node_set_from_info (model, node, NULL, TRUE); - + reparent_node (node, FALSE); if (model_node_visibility (model, node)) { @@ -3217,7 +3217,7 @@ pluma_file_browser_store_rename (PlumaFileBrowserStore * model, model_resort_node (model, node); } else { g_object_unref (previous); - + if (error != NULL) *error = g_error_new_literal (pluma_file_browser_store_error_quark (), PLUMA_FILE_BROWSER_ERROR_RENAME, @@ -3246,7 +3246,7 @@ pluma_file_browser_store_rename (PlumaFileBrowserStore * model, PLUMA_FILE_BROWSER_ERROR_RENAME, err->message); } - + g_error_free (err); } @@ -3258,13 +3258,13 @@ static void async_data_free (AsyncData * data) { g_object_unref (data->cancellable); - + g_list_foreach (data->files, (GFunc)g_object_unref, NULL); g_list_free (data->files); - + if (!data->removed) data->model->priv->async_handles = g_slist_remove (data->model->priv->async_handles, data); - + g_free (data); } @@ -3285,7 +3285,7 @@ delete_file_finished (GFile *file, { GError * error = NULL; gboolean ok; - + if (data->trash) { ok = g_file_trash_finish (file, res, &error); @@ -3337,7 +3337,7 @@ delete_file_finished (GFile *file, return; } } - + /* Continue the job */ delete_files (data); } @@ -3387,7 +3387,7 @@ pluma_file_browser_store_delete_all (PlumaFileBrowserStore *model, GtkTreePath * path; g_return_val_if_fail (PLUMA_IS_FILE_BROWSER_STORE (model), PLUMA_FILE_BROWSER_STORE_RESULT_NO_CHANGE); - + if (rows == NULL) return PLUMA_FILE_BROWSER_STORE_RESULT_NO_CHANGE; @@ -3401,17 +3401,17 @@ pluma_file_browser_store_delete_all (PlumaFileBrowserStore *model, if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, path)) continue; - + /* Skip if the current path is actually a descendant of the previous path */ if (prev != NULL && gtk_tree_path_is_descendant (path, prev)) continue; - + prev = path; node = (FileBrowserNode *)(iter.user_data); files = g_list_prepend (files, g_object_ref (node->file)); } - + data = g_new (AsyncData, 1); data->model = model; @@ -3420,13 +3420,13 @@ pluma_file_browser_store_delete_all (PlumaFileBrowserStore *model, data->trash = trash; data->iter = files; data->removed = FALSE; - + model->priv->async_handles = g_slist_prepend (model->priv->async_handles, data); delete_files (data); g_list_free (rows); - + return PLUMA_FILE_BROWSER_STORE_RESULT_OK; } @@ -3449,10 +3449,10 @@ pluma_file_browser_store_delete (PlumaFileBrowserStore * model, rows = g_list_append(NULL, pluma_file_browser_store_get_path_real (model, node)); result = pluma_file_browser_store_delete_all (model, rows, trash); - + g_list_foreach (rows, (GFunc)gtk_tree_path_free, NULL); g_list_free (rows); - + return result; } @@ -3481,7 +3481,7 @@ pluma_file_browser_store_new_file (PlumaFileBrowserStore * model, file = unique_new_name (((FileBrowserNode *) parent_node)->file, _("file")); stream = g_file_create (file, G_FILE_CREATE_NONE, NULL, &error); - + if (!stream) { g_signal_emit (model, model_signals[ERROR], 0, @@ -3490,9 +3490,9 @@ pluma_file_browser_store_new_file (PlumaFileBrowserStore * model, g_error_free (error); } else { g_object_unref (stream); - node = model_add_node_from_file (model, - (FileBrowserNode *)parent_node, - file, + node = model_add_node_from_file (model, + (FileBrowserNode *)parent_node, + file, NULL); if (model_node_visibility (model, node)) { @@ -3539,9 +3539,9 @@ pluma_file_browser_store_new_directory (PlumaFileBrowserStore * model, error->message); g_error_free (error); } else { - node = model_add_node_from_file (model, - (FileBrowserNode *)parent_node, - file, + node = model_add_node_from_file (model, + (FileBrowserNode *)parent_node, + file, NULL); if (model_node_visibility (model, node)) { diff --git a/plugins/filebrowser/pluma-file-browser-store.h b/plugins/filebrowser/pluma-file-browser-store.h index da889dbd..362df820 100644 --- a/plugins/filebrowser/pluma-file-browser-store.h +++ b/plugins/filebrowser/pluma-file-browser-store.h @@ -1,5 +1,5 @@ /* - * pluma-file-browser-store.h - Pluma plugin providing easy file access + * pluma-file-browser-store.h - Pluma plugin providing easy file access * from the sidepanel * * Copyright (C) 2006 - Jesse van den Kieboom <[email protected]> @@ -33,7 +33,7 @@ G_BEGIN_DECLS #define PLUMA_IS_FILE_BROWSER_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PLUMA_TYPE_FILE_BROWSER_STORE)) #define PLUMA_FILE_BROWSER_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PLUMA_TYPE_FILE_BROWSER_STORE, PlumaFileBrowserStoreClass)) -typedef enum +typedef enum { PLUMA_FILE_BROWSER_STORE_COLUMN_ICON = 0, PLUMA_FILE_BROWSER_STORE_COLUMN_NAME, @@ -43,7 +43,7 @@ typedef enum PLUMA_FILE_BROWSER_STORE_COLUMN_NUM } PlumaFileBrowserStoreColumn; -typedef enum +typedef enum { PLUMA_FILE_BROWSER_STORE_FLAG_IS_DIRECTORY = 1 << 0, PLUMA_FILE_BROWSER_STORE_FLAG_IS_HIDDEN = 1 << 1, @@ -53,7 +53,7 @@ typedef enum PLUMA_FILE_BROWSER_STORE_FLAG_IS_DUMMY = 1 << 5 } PlumaFileBrowserStoreFlag; -typedef enum +typedef enum { PLUMA_FILE_BROWSER_STORE_RESULT_OK, PLUMA_FILE_BROWSER_STORE_RESULT_NO_CHANGE, @@ -63,7 +63,7 @@ typedef enum PLUMA_FILE_BROWSER_STORE_RESULT_NUM } PlumaFileBrowserStoreResult; -typedef enum +typedef enum { PLUMA_FILE_BROWSER_STORE_FILTER_MODE_NONE = 0, PLUMA_FILE_BROWSER_STORE_FILTER_MODE_HIDE_HIDDEN = 1 << 0, @@ -86,7 +86,7 @@ typedef gboolean (*PlumaFileBrowserStoreFilterFunc) (PlumaFileBrowserStore GtkTreeIter * iter, gpointer user_data); -struct _PlumaFileBrowserStore +struct _PlumaFileBrowserStore { GObject parent; @@ -101,7 +101,7 @@ struct _PlumaFileBrowserStoreClass { GtkTreeIter * iter); void (*end_loading) (PlumaFileBrowserStore * model, GtkTreeIter * iter); - void (*error) (PlumaFileBrowserStore * model, + void (*error) (PlumaFileBrowserStore * model, guint code, gchar * message); gboolean (*no_trash) (PlumaFileBrowserStore * model, @@ -131,7 +131,7 @@ PlumaFileBrowserStoreResult pluma_file_browser_store_set_virtual_root (PlumaFileBrowserStore * model, GtkTreeIter * iter); PlumaFileBrowserStoreResult -pluma_file_browser_store_set_virtual_root_from_string (PlumaFileBrowserStore * model, +pluma_file_browser_store_set_virtual_root_from_string (PlumaFileBrowserStore * model, gchar const *root); PlumaFileBrowserStoreResult pluma_file_browser_store_set_virtual_root_up (PlumaFileBrowserStore * model); @@ -139,25 +139,25 @@ PlumaFileBrowserStoreResult pluma_file_browser_store_set_virtual_root_top (PlumaFileBrowserStore * model); gboolean -pluma_file_browser_store_get_iter_virtual_root (PlumaFileBrowserStore * model, +pluma_file_browser_store_get_iter_virtual_root (PlumaFileBrowserStore * model, GtkTreeIter * iter); gboolean pluma_file_browser_store_get_iter_root (PlumaFileBrowserStore * model, GtkTreeIter * iter); gchar * pluma_file_browser_store_get_root (PlumaFileBrowserStore * model); gchar * pluma_file_browser_store_get_virtual_root (PlumaFileBrowserStore * model); -gboolean pluma_file_browser_store_iter_equal (PlumaFileBrowserStore * model, +gboolean pluma_file_browser_store_iter_equal (PlumaFileBrowserStore * model, GtkTreeIter * iter1, GtkTreeIter * iter2); -void pluma_file_browser_store_set_value (PlumaFileBrowserStore * tree_model, +void pluma_file_browser_store_set_value (PlumaFileBrowserStore * tree_model, GtkTreeIter * iter, - gint column, + gint column, GValue * value); -void _pluma_file_browser_store_iter_expanded (PlumaFileBrowserStore * model, +void _pluma_file_browser_store_iter_expanded (PlumaFileBrowserStore * model, GtkTreeIter * iter); -void _pluma_file_browser_store_iter_collapsed (PlumaFileBrowserStore * model, +void _pluma_file_browser_store_iter_collapsed (PlumaFileBrowserStore * model, GtkTreeIter * iter); PlumaFileBrowserStoreFilterMode @@ -165,7 +165,7 @@ pluma_file_browser_store_get_filter_mode (PlumaFileBrowserStore * m void pluma_file_browser_store_set_filter_mode (PlumaFileBrowserStore * model, PlumaFileBrowserStoreFilterMode mode); void pluma_file_browser_store_set_filter_func (PlumaFileBrowserStore * model, - PlumaFileBrowserStoreFilterFunc func, + PlumaFileBrowserStoreFilterFunc func, gpointer user_data); void pluma_file_browser_store_refilter (PlumaFileBrowserStore * model); PlumaFileBrowserStoreFilterMode @@ -178,11 +178,11 @@ gboolean pluma_file_browser_store_rename (PlumaFileBrowserStore * m GError ** error); PlumaFileBrowserStoreResult pluma_file_browser_store_delete (PlumaFileBrowserStore * model, - GtkTreeIter * iter, + GtkTreeIter * iter, gboolean trash); PlumaFileBrowserStoreResult pluma_file_browser_store_delete_all (PlumaFileBrowserStore * model, - GList *rows, + GList *rows, gboolean trash); gboolean pluma_file_browser_store_new_file (PlumaFileBrowserStore * model, diff --git a/plugins/filebrowser/pluma-file-browser-utils.c b/plugins/filebrowser/pluma-file-browser-utils.c index 8a2fbf64..1695a09a 100644 --- a/plugins/filebrowser/pluma-file-browser-utils.c +++ b/plugins/filebrowser/pluma-file-browser-utils.c @@ -1,5 +1,5 @@ /* - * pluma-file-bookmarks-store.c - Pluma plugin providing easy file access + * pluma-file-bookmarks-store.c - Pluma plugin providing easy file access * from the sidepanel * * Copyright (C) 2006 - Jesse van den Kieboom <[email protected]> @@ -27,8 +27,8 @@ static GdkPixbuf * process_icon_pixbuf (GdkPixbuf * pixbuf, - gchar const * name, - gint size, + gchar const * name, + gint size, GError * error) { GdkPixbuf * scale; @@ -39,11 +39,11 @@ process_icon_pixbuf (GdkPixbuf * pixbuf, error->message); g_error_free (error); } - + if (pixbuf && gdk_pixbuf_get_width (pixbuf) > size) { - scale = gdk_pixbuf_scale_simple (pixbuf, - size, - size, + scale = gdk_pixbuf_scale_simple (pixbuf, + size, + size, GDK_INTERP_BILINEAR); g_object_unref (pixbuf); pixbuf = scale; @@ -62,10 +62,10 @@ pluma_file_browser_utils_pixbuf_from_theme (gchar const * name, gtk_icon_size_lookup (size, &width, NULL); - pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), - name, - width, - 0, + pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), + name, + width, + 0, &error); pixbuf = process_icon_pixbuf (pixbuf, name, width, error); @@ -87,7 +87,7 @@ pluma_file_browser_utils_pixbuf_from_icon (GIcon * icon, theme = gtk_icon_theme_get_default (); gtk_icon_size_lookup (size, &width, NULL); - + info = gtk_icon_theme_lookup_by_gicon (theme, icon, width, @@ -95,7 +95,7 @@ pluma_file_browser_utils_pixbuf_from_icon (GIcon * icon, if (!info) return NULL; - + ret = gtk_icon_info_load_icon (info, NULL); g_object_unref (info); @@ -110,12 +110,12 @@ pluma_file_browser_utils_pixbuf_from_file (GFile * file, GFileInfo * info; GdkPixbuf * ret = NULL; - info = g_file_query_info (file, - G_FILE_ATTRIBUTE_STANDARD_ICON, + info = g_file_query_info (file, + G_FILE_ATTRIBUTE_STANDARD_ICON, G_FILE_QUERY_INFO_NONE, - NULL, + NULL, NULL); - + if (!info) return NULL; @@ -124,7 +124,7 @@ pluma_file_browser_utils_pixbuf_from_file (GFile * file, ret = pluma_file_browser_utils_pixbuf_from_icon (icon, size); g_object_unref (info); - + return ret; } @@ -133,11 +133,11 @@ pluma_file_browser_utils_file_basename (GFile * file) { gchar *uri; gchar *ret; - + uri = g_file_get_uri (file); ret = pluma_file_browser_utils_uri_basename (uri); g_free (uri); - + return ret; } @@ -181,13 +181,13 @@ pluma_file_browser_utils_confirmation_dialog (PlumaWindow * window, /* Add delete button */ button = gtk_button_new_with_mnemonic (_("_Delete")); gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_icon_name ("edit-delete", GTK_ICON_SIZE_BUTTON)); - + gtk_widget_show (button); gtk_widget_set_can_default (button, TRUE); gtk_dialog_add_action_widget (GTK_DIALOG (dlg), button, GTK_RESPONSE_OK); - + ret = gtk_dialog_run (GTK_DIALOG (dlg)); gtk_widget_destroy (dlg); diff --git a/plugins/filebrowser/pluma-file-browser-view.c b/plugins/filebrowser/pluma-file-browser-view.c index 134bf922..1b97aaf9 100644 --- a/plugins/filebrowser/pluma-file-browser-view.c +++ b/plugins/filebrowser/pluma-file-browser-view.c @@ -1,5 +1,5 @@ /* - * pluma-file-browser-view.c - Pluma plugin providing easy file access + * pluma-file-browser-view.c - Pluma plugin providing easy file access * from the sidepanel * * Copyright (C) 2006 - Jesse van den Kieboom <[email protected]> @@ -34,7 +34,7 @@ G_TYPE_INSTANCE_GET_PRIVATE((object), \ PLUMA_TYPE_FILE_BROWSER_VIEW, PlumaFileBrowserViewPrivate)) -struct _PlumaFileBrowserViewPrivate +struct _PlumaFileBrowserViewPrivate { GtkTreeViewColumn *column; GtkCellRenderer *pixbuf_renderer; @@ -54,7 +54,7 @@ struct _PlumaFileBrowserViewPrivate gboolean selected_on_button_down; gint drag_button; gboolean drag_started; - + gboolean restore_expand_state; gboolean is_refresh; GHashTable * expand_state; @@ -64,7 +64,7 @@ struct _PlumaFileBrowserViewPrivate enum { PROP_0, - + PROP_CLICK_POLICY, PROP_RESTORE_EXPAND_STATE }; @@ -88,30 +88,30 @@ static const GtkTargetEntry drag_source_targets[] = { G_DEFINE_DYNAMIC_TYPE (PlumaFileBrowserView, pluma_file_browser_view, GTK_TYPE_TREE_VIEW) -static void on_cell_edited (GtkCellRendererText * cell, +static void on_cell_edited (GtkCellRendererText * cell, gchar * path, gchar * new_text, PlumaFileBrowserView * tree_view); -static void on_begin_refresh (PlumaFileBrowserStore * model, +static void on_begin_refresh (PlumaFileBrowserStore * model, PlumaFileBrowserView * view); -static void on_end_refresh (PlumaFileBrowserStore * model, +static void on_end_refresh (PlumaFileBrowserStore * model, PlumaFileBrowserView * view); -static void on_unload (PlumaFileBrowserStore * model, +static void on_unload (PlumaFileBrowserStore * model, gchar const * uri, PlumaFileBrowserView * view); -static void on_row_inserted (PlumaFileBrowserStore * model, +static void on_row_inserted (PlumaFileBrowserStore * model, GtkTreePath * path, GtkTreeIter * iter, PlumaFileBrowserView * view); - + static void pluma_file_browser_view_finalize (GObject * object) { PlumaFileBrowserView *obj = PLUMA_FILE_BROWSER_VIEW(object); - + if (obj->priv->hand_cursor) g_object_unref (obj->priv->hand_cursor); @@ -135,12 +135,12 @@ add_expand_state (PlumaFileBrowserView * view, gchar const * uri) { GFile * file; - + if (!uri) return; file = g_file_new_for_uri (uri); - + if (view->priv->expand_state) g_hash_table_insert (view->priv->expand_state, file, file); else @@ -152,12 +152,12 @@ remove_expand_state (PlumaFileBrowserView * view, gchar const * uri) { GFile * file; - + if (!uri) return; file = g_file_new_for_uri (uri); - + if (view->priv->expand_state) g_hash_table_remove (view->priv->expand_state, file); @@ -181,7 +181,7 @@ row_expanded (GtkTreeView * tree_view, if (view->priv->restore_expand_state) { gtk_tree_model_get (view->priv->model, - iter, + iter, PLUMA_FILE_BROWSER_STORE_COLUMN_URI, &uri, -1); @@ -207,11 +207,11 @@ row_collapsed (GtkTreeView * tree_view, if (!PLUMA_IS_FILE_BROWSER_STORE (view->priv->model)) return; - + if (view->priv->restore_expand_state) { - gtk_tree_model_get (view->priv->model, - iter, + gtk_tree_model_get (view->priv->model, + iter, PLUMA_FILE_BROWSER_STORE_COLUMN_URI, &uri, -1); @@ -290,7 +290,7 @@ motion_notify_event (GtkWidget * widget, if (old_hover_path != NULL) gtk_tree_path_free (old_hover_path); } - + // Chainup return GTK_WIDGET_CLASS (pluma_file_browser_view_parent_class)->motion_notify_event (widget, event); } @@ -324,7 +324,7 @@ set_click_policy_property (PlumaFileBrowserView *obj, if (gtk_widget_get_realized (GTK_WIDGET (obj))) { win = gtk_widget_get_window (GTK_WIDGET (obj)); gdk_window_set_cursor (win, NULL); - + display = gtk_widget_get_display (GTK_WIDGET (obj)); if (display != NULL) @@ -339,7 +339,7 @@ set_click_policy_property (PlumaFileBrowserView *obj, } static void -directory_activated (PlumaFileBrowserView *view, +directory_activated (PlumaFileBrowserView *view, GtkTreeIter *iter) { pluma_file_browser_store_set_virtual_root (PLUMA_FILE_BROWSER_STORE (view->priv->model), iter); @@ -356,30 +356,30 @@ activate_selected_files (PlumaFileBrowserView *view) { PlumaFileBrowserStoreFlag flags; rows = gtk_tree_selection_get_selected_rows (selection, &view->priv->model); - + for (row = rows; row; row = row->next) { path = (GtkTreePath *)(row->data); - + /* Get iter from path */ if (!gtk_tree_model_get_iter (view->priv->model, &iter, path)) continue; - + gtk_tree_model_get (view->priv->model, &iter, PLUMA_FILE_BROWSER_STORE_COLUMN_FLAGS, &flags, -1); if (FILE_IS_DIR (flags)) { if (directory == NULL) directory = path; - + } else if (!FILE_IS_DUMMY (flags)) { g_signal_emit (view, signals[FILE_ACTIVATED], 0, &iter); } } - + if (directory != NULL) { if (gtk_tree_model_get_iter (view->priv->model, &iter, directory)) g_signal_emit (view, signals[DIRECTORY_ACTIVATED], 0, &iter); } - + g_list_foreach (rows, (GFunc)gtk_tree_path_free, NULL); g_list_free (rows); } @@ -429,10 +429,10 @@ drag_begin (GtkWidget *widget, GdkDragContext *context) { PlumaFileBrowserView *view = PLUMA_FILE_BROWSER_VIEW (widget); - + view->priv->drag_button = 0; view->priv->drag_started = TRUE; - + /* Chain up */ GTK_WIDGET_CLASS (pluma_file_browser_view_parent_class)->drag_begin (widget, context); } @@ -444,14 +444,14 @@ did_not_drag (PlumaFileBrowserView *view, GtkTreeView *tree_view; GtkTreeSelection *selection; GtkTreePath *path; - + tree_view = GTK_TREE_VIEW (view); selection = gtk_tree_view_get_selection (tree_view); if (gtk_tree_view_get_path_at_pos (tree_view, event->x, event->y, &path, NULL, NULL, NULL)) { if ((view->priv->click_policy == PLUMA_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE) - && !button_event_modifies_selection(event) + && !button_event_modifies_selection(event) && (event->button == 1 || event->button == 2)) { /* Activate all selected items, and leave them selected */ activate_selected_items (view); @@ -484,9 +484,9 @@ button_release_event (GtkWidget *widget, !view->priv->ignore_release) did_not_drag (view, event); } - + /* Chain up */ - return GTK_WIDGET_CLASS (pluma_file_browser_view_parent_class)->button_release_event (widget, event); + return GTK_WIDGET_CLASS (pluma_file_browser_view_parent_class)->button_release_event (widget, event); } static gboolean @@ -512,7 +512,7 @@ button_press_event (GtkWidget *widget, selection = gtk_tree_view_get_selection (tree_view); /* Get double click time */ - g_object_get (G_OBJECT (gtk_widget_get_settings (widget)), + g_object_get (G_OBJECT (gtk_widget_get_settings (widget)), "gtk-double-click-time", &double_click_time, NULL); @@ -521,11 +521,11 @@ button_press_event (GtkWidget *widget, click_count++; else click_count = 0; - + last_click_time = event->time; /* Ignore double click if we are in single click mode */ - if (view->priv->click_policy == PLUMA_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE && + if (view->priv->click_policy == PLUMA_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE && click_count >= 2) { return TRUE; } @@ -537,7 +537,7 @@ button_press_event (GtkWidget *widget, &path, NULL, NULL, NULL)) { /* Keep track of path of last click so double clicks only happen * on the same item */ - if ((event->button == 1 || event->button == 2) && + if ((event->button == 1 || event->button == 2) && event->type == GDK_BUTTON_PRESS) { if (view->priv->double_click_path[1]) gtk_tree_path_free (view->priv->double_click_path[1]); @@ -550,7 +550,7 @@ button_press_event (GtkWidget *widget, if (view->priv->double_click_path[1] && gtk_tree_path_compare (view->priv->double_click_path[0], view->priv->double_click_path[1]) == 0) activate_selected_items (view); - + /* Chain up */ widget_parent->button_press_event (widget, event); } else { @@ -586,14 +586,14 @@ button_press_event (GtkWidget *widget, view->priv->ignore_release = on_expander; } } - + if (call_parent) { /* Chain up */ widget_parent->button_press_event (widget, event); } else if (selected) { gtk_widget_grab_focus (widget); } - + if ((event->button == 1 || event->button == 2) && event->type == GDK_BUTTON_PRESS) { view->priv->drag_started = FALSE; @@ -603,7 +603,7 @@ button_press_event (GtkWidget *widget, gtk_tree_path_free (path); } else { - if ((event->button == 1 || event->button == 2) && + if ((event->button == 1 || event->button == 2) && event->type == GDK_BUTTON_PRESS) { if (view->priv->double_click_path[1]) gtk_tree_path_free (view->priv->double_click_path[1]); @@ -669,7 +669,7 @@ key_press_event (GtkWidget *widget, /* Chain up */ if (!handled) return GTK_WIDGET_CLASS (pluma_file_browser_view_parent_class)->key_press_event (widget, event); - + return TRUE; } @@ -679,31 +679,31 @@ fill_expand_state (PlumaFileBrowserView * view, GtkTreeIter * iter) GtkTreePath * path; GtkTreeIter child; gchar * uri; - + if (!gtk_tree_model_iter_has_child (view->priv->model, iter)) return; - + path = gtk_tree_model_get_path (view->priv->model, iter); - + if (gtk_tree_view_row_expanded (GTK_TREE_VIEW (view), path)) { - gtk_tree_model_get (view->priv->model, - iter, - PLUMA_FILE_BROWSER_STORE_COLUMN_URI, - &uri, + gtk_tree_model_get (view->priv->model, + iter, + PLUMA_FILE_BROWSER_STORE_COLUMN_URI, + &uri, -1); add_expand_state (view, uri); g_free (uri); } - + if (gtk_tree_model_iter_children (view->priv->model, &child, iter)) { do { fill_expand_state (view, &child); } while (gtk_tree_model_iter_next (view->priv->model, &child)); } - + gtk_tree_path_free (path); } @@ -711,20 +711,20 @@ static void uninstall_restore_signals (PlumaFileBrowserView * tree_view, GtkTreeModel * model) { - g_signal_handlers_disconnect_by_func (model, - on_begin_refresh, + g_signal_handlers_disconnect_by_func (model, + on_begin_refresh, tree_view); - - g_signal_handlers_disconnect_by_func (model, - on_end_refresh, + + g_signal_handlers_disconnect_by_func (model, + on_end_refresh, tree_view); - - g_signal_handlers_disconnect_by_func (model, - on_unload, + + g_signal_handlers_disconnect_by_func (model, + on_unload, tree_view); - g_signal_handlers_disconnect_by_func (model, - on_row_inserted, + g_signal_handlers_disconnect_by_func (model, + on_row_inserted, tree_view); } @@ -732,24 +732,24 @@ static void install_restore_signals (PlumaFileBrowserView * tree_view, GtkTreeModel * model) { - g_signal_connect (model, + g_signal_connect (model, "begin-refresh", - G_CALLBACK (on_begin_refresh), + G_CALLBACK (on_begin_refresh), tree_view); - g_signal_connect (model, + g_signal_connect (model, "end-refresh", - G_CALLBACK (on_end_refresh), + G_CALLBACK (on_end_refresh), tree_view); - g_signal_connect (model, + g_signal_connect (model, "unload", - G_CALLBACK (on_unload), + G_CALLBACK (on_unload), tree_view); - g_signal_connect_after (model, + g_signal_connect_after (model, "row-inserted", - G_CALLBACK (on_row_inserted), + G_CALLBACK (on_row_inserted), tree_view); } @@ -772,7 +772,7 @@ set_restore_expand_state (PlumaFileBrowserView * view, (GEqualFunc)g_file_equal, g_object_unref, NULL); - + if (view->priv->model && PLUMA_IS_FILE_BROWSER_STORE (view->priv->model)) { fill_expand_state (view, NULL); @@ -838,11 +838,11 @@ pluma_file_browser_view_class_init (PlumaFileBrowserViewClass * klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkTreeViewClass *tree_view_class = GTK_TREE_VIEW_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - + object_class->finalize = pluma_file_browser_view_finalize; object_class->get_property = get_property; object_class->set_property = set_property; - + /* Event handlers */ widget_class->motion_notify_event = motion_notify_event; widget_class->enter_notify_event = enter_notify_event; @@ -855,7 +855,7 @@ pluma_file_browser_view_class_init (PlumaFileBrowserViewClass * klass) /* Tree view handlers */ tree_view_class->row_expanded = row_expanded; tree_view_class->row_collapsed = row_collapsed; - + /* Default handlers */ klass->directory_activated = directory_activated; @@ -929,18 +929,18 @@ cell_data_cb (GtkTreeViewColumn * tree_column, GtkCellRenderer * cell, path = gtk_tree_model_get_path (tree_model, iter); if (obj->priv->click_policy == PLUMA_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE) { - if (obj->priv->hover_path != NULL && + if (obj->priv->hover_path != NULL && gtk_tree_path_compare (path, obj->priv->hover_path) == 0) - underline = PANGO_UNDERLINE_SINGLE; + underline = PANGO_UNDERLINE_SINGLE; } if (PLUMA_IS_FILE_BROWSER_STORE (tree_model)) { - if (obj->priv->editable != NULL && + if (obj->priv->editable != NULL && gtk_tree_row_reference_valid (obj->priv->editable)) { GtkTreePath *edpath = gtk_tree_row_reference_get_path (obj->priv->editable); - + editable = edpath && gtk_tree_path_compare (path, edpath) == 0; } } @@ -1028,7 +1028,7 @@ pluma_file_browser_view_set_model (PlumaFileBrowserView * tree_view, selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)); if (PLUMA_IS_FILE_BOOKMARKS_STORE (model)) { - gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE); + gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE); gtk_tree_view_set_row_separator_func (GTK_TREE_VIEW (tree_view), bookmarks_separator_func, @@ -1055,7 +1055,7 @@ pluma_file_browser_view_set_model (PlumaFileBrowserView * tree_view, if (tree_view->priv->restore_expand_state) install_restore_signals (tree_view, model); - + } if (tree_view->priv->hover_path != NULL) { @@ -1065,7 +1065,7 @@ pluma_file_browser_view_set_model (PlumaFileBrowserView * tree_view, if (PLUMA_IS_FILE_BROWSER_STORE (tree_view->priv->model)) { if (tree_view->priv->restore_expand_state) - uninstall_restore_signals (tree_view, + uninstall_restore_signals (tree_view, tree_view->priv->model); } @@ -1098,18 +1098,18 @@ pluma_file_browser_view_start_rename (PlumaFileBrowserView * tree_view, /* Start editing */ gtk_widget_grab_focus (GTK_WIDGET (tree_view)); - + if (gtk_tree_path_up (path)) gtk_tree_view_expand_to_path (GTK_TREE_VIEW (tree_view), path); - + gtk_tree_path_free (path); tree_view->priv->editable = rowref; gtk_tree_view_set_cursor (GTK_TREE_VIEW (tree_view), gtk_tree_row_reference_get_path (tree_view->priv->editable), tree_view->priv->column, TRUE); - + gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (tree_view), gtk_tree_row_reference_get_path (tree_view->priv->editable), tree_view->priv->column, @@ -1121,9 +1121,9 @@ pluma_file_browser_view_set_click_policy (PlumaFileBrowserView *tree_view, PlumaFileBrowserViewClickPolicy policy) { g_return_if_fail (PLUMA_IS_FILE_BROWSER_VIEW (tree_view)); - + set_click_policy_property (tree_view, policy); - + g_object_notify (G_OBJECT (tree_view), "click-policy"); } @@ -1146,13 +1146,13 @@ on_cell_edited (GtkCellRendererText * cell, gchar * path, gchar * new_text, GtkTreeIter iter; gboolean ret; GError * error = NULL; - + gtk_tree_row_reference_free (tree_view->priv->editable); tree_view->priv->editable = NULL; if (new_text == NULL || *new_text == '\0') return; - + treepath = gtk_tree_path_new_from_string (path); ret = gtk_tree_model_get_iter (GTK_TREE_MODEL (tree_view->priv->model), &iter, treepath); gtk_tree_path_free (treepath); @@ -1176,8 +1176,8 @@ on_cell_edited (GtkCellRendererText * cell, gchar * path, gchar * new_text, } } -static void -on_begin_refresh (PlumaFileBrowserStore * model, +static void +on_begin_refresh (PlumaFileBrowserStore * model, PlumaFileBrowserView * view) { /* Store the refresh state, so we can handle unloading of nodes while @@ -1185,8 +1185,8 @@ on_begin_refresh (PlumaFileBrowserStore * model, view->priv->is_refresh = TRUE; } -static void -on_end_refresh (PlumaFileBrowserStore * model, +static void +on_end_refresh (PlumaFileBrowserStore * model, PlumaFileBrowserView * view) { /* Store the refresh state, so we can handle unloading of nodes while @@ -1195,14 +1195,14 @@ on_end_refresh (PlumaFileBrowserStore * model, } static void -on_unload (PlumaFileBrowserStore * model, +on_unload (PlumaFileBrowserStore * model, gchar const * uri, PlumaFileBrowserView * view) { /* Don't remove the expand state if we are refreshing */ if (!view->priv->restore_expand_state || view->priv->is_refresh) return; - + remove_expand_state (view, uri); } @@ -1215,10 +1215,10 @@ restore_expand_state (PlumaFileBrowserView * view, GFile * file; GtkTreePath * path; - gtk_tree_model_get (GTK_TREE_MODEL (model), - iter, - PLUMA_FILE_BROWSER_STORE_COLUMN_URI, - &uri, + gtk_tree_model_get (GTK_TREE_MODEL (model), + iter, + PLUMA_FILE_BROWSER_STORE_COLUMN_URI, + &uri, -1); if (!uri) @@ -1233,15 +1233,15 @@ restore_expand_state (PlumaFileBrowserView * view, path, FALSE); } - + gtk_tree_path_free (path); - g_object_unref (file); + g_object_unref (file); g_free (uri); } -static void -on_row_inserted (PlumaFileBrowserStore * model, +static void +on_row_inserted (PlumaFileBrowserStore * model, GtkTreePath * path, GtkTreeIter * iter, PlumaFileBrowserView * view) @@ -1269,5 +1269,5 @@ _pluma_file_browser_view_register_type (GTypeModule *type_module) { pluma_file_browser_view_register_type (type_module); } - + // ex:ts=8:noet: diff --git a/plugins/filebrowser/pluma-file-browser-view.h b/plugins/filebrowser/pluma-file-browser-view.h index 299d210c..2e92a50f 100644 --- a/plugins/filebrowser/pluma-file-browser-view.h +++ b/plugins/filebrowser/pluma-file-browser-view.h @@ -1,5 +1,5 @@ /* - * pluma-file-browser-view.h - Pluma plugin providing easy file access + * pluma-file-browser-view.h - Pluma plugin providing easy file access * from the sidepanel * * Copyright (C) 2006 - Jesse van den Kieboom <[email protected]> @@ -39,22 +39,22 @@ typedef struct _PlumaFileBrowserViewPrivate PlumaFileBrowserViewPrivate; typedef enum { PLUMA_FILE_BROWSER_VIEW_CLICK_POLICY_DOUBLE, - PLUMA_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE + PLUMA_FILE_BROWSER_VIEW_CLICK_POLICY_SINGLE } PlumaFileBrowserViewClickPolicy; -struct _PlumaFileBrowserView +struct _PlumaFileBrowserView { GtkTreeView parent; PlumaFileBrowserViewPrivate *priv; }; -struct _PlumaFileBrowserViewClass +struct _PlumaFileBrowserViewClass { GtkTreeViewClass parent_class; /* Signals */ - void (*error) (PlumaFileBrowserView * filetree, + void (*error) (PlumaFileBrowserView * filetree, guint code, gchar const *message); void (*file_activated) (PlumaFileBrowserView * filetree, @@ -71,7 +71,7 @@ void _pluma_file_browser_view_register_type (GTypeModule * module); GtkWidget *pluma_file_browser_view_new (void); void pluma_file_browser_view_set_model (PlumaFileBrowserView * tree_view, GtkTreeModel * model); -void pluma_file_browser_view_start_rename (PlumaFileBrowserView * tree_view, +void pluma_file_browser_view_start_rename (PlumaFileBrowserView * tree_view, GtkTreeIter * iter); void pluma_file_browser_view_set_click_policy (PlumaFileBrowserView * tree_view, PlumaFileBrowserViewClickPolicy policy); diff --git a/plugins/filebrowser/pluma-file-browser-widget.c b/plugins/filebrowser/pluma-file-browser-widget.c index d8939ea8..367a575e 100644 --- a/plugins/filebrowser/pluma-file-browser-widget.c +++ b/plugins/filebrowser/pluma-file-browser-widget.c @@ -1,5 +1,5 @@ /* - * pluma-file-browser-widget.c - Pluma plugin providing easy file access + * pluma-file-browser-widget.c - Pluma plugin providing easy file access * from the sidepanel * * Copyright (C) 2006 - Jesse van den Kieboom <[email protected]> @@ -49,7 +49,7 @@ #define XML_UI_FILE "pluma-file-browser-widget-ui.xml" #define LOCATION_DATA_KEY "pluma-file-browser-widget-location" -enum +enum { BOOKMARKS_ID, SEPARATOR_CUSTOM_ID, @@ -58,7 +58,7 @@ enum NUM_DEFAULT_IDS }; -enum +enum { COLUMN_INDENT, COLUMN_ICON, @@ -69,16 +69,16 @@ enum }; /* Properties */ -enum +enum { PROP_0, - + PROP_FILTER_PATTERN, PROP_ENABLE_DELETE }; /* Signals */ -enum +enum { URI_ACTIVATED, ERROR, @@ -89,7 +89,7 @@ enum static guint signals[NUM_SIGNALS] = { 0 }; -typedef struct _SignalNode +typedef struct _SignalNode { GObject *object; gulong id; @@ -103,7 +103,7 @@ typedef struct GDestroyNotify destroy_notify; } FilterFunc; -typedef struct +typedef struct { GFile *root; GFile *virtual_root; @@ -115,7 +115,7 @@ typedef struct GdkPixbuf *icon; } NameIcon; -struct _PlumaFileBrowserWidgetPrivate +struct _PlumaFileBrowserWidgetPrivate { PlumaFileBrowserView *treeview; PlumaFileBrowserStore *file_store; @@ -152,29 +152,29 @@ struct _PlumaFileBrowserWidgetPrivate GtkWidget *location_previous_menu; GtkWidget *location_next_menu; GtkWidget *current_location_menu_item; - + gboolean enable_delete; - + GCancellable *cancellable; - + GdkCursor *busy_cursor; }; static void set_enable_delete (PlumaFileBrowserWidget *obj, gboolean enable); -static void on_model_set (GObject * gobject, +static void on_model_set (GObject * gobject, GParamSpec * arg1, PlumaFileBrowserWidget * obj); static void on_treeview_error (PlumaFileBrowserView * tree_view, - guint code, + guint code, gchar * message, PlumaFileBrowserWidget * obj); -static void on_file_store_error (PlumaFileBrowserStore * store, +static void on_file_store_error (PlumaFileBrowserStore * store, guint code, gchar * message, PlumaFileBrowserWidget * obj); -static gboolean on_file_store_no_trash (PlumaFileBrowserStore * store, - GList * files, +static gboolean on_file_store_no_trash (PlumaFileBrowserStore * store, + GList * files, PlumaFileBrowserWidget * obj); static void on_combo_changed (GtkComboBox * combo, PlumaFileBrowserWidget * obj); @@ -183,7 +183,7 @@ static gboolean on_treeview_popup_menu (PlumaFileBrowserView * treeview, static gboolean on_treeview_button_press_event (PlumaFileBrowserView * treeview, GdkEventButton * event, PlumaFileBrowserWidget * obj); -static gboolean on_treeview_key_press_event (PlumaFileBrowserView * treeview, +static gboolean on_treeview_key_press_event (PlumaFileBrowserView * treeview, GdkEventKey * event, PlumaFileBrowserWidget * obj); static void on_selection_changed (GtkTreeSelection * selection, @@ -196,11 +196,11 @@ static void on_virtual_root_changed (PlumaFileBrowserStore * model, static gboolean on_entry_filter_activate (PlumaFileBrowserWidget * obj); static void on_location_jump_activate (GtkMenuItem * item, PlumaFileBrowserWidget * obj); -static void on_bookmarks_row_changed (GtkTreeModel * model, +static void on_bookmarks_row_changed (GtkTreeModel * model, GtkTreePath * path, GtkTreeIter * iter, PlumaFileBrowserWidget * obj); -static void on_bookmarks_row_deleted (GtkTreeModel * model, +static void on_bookmarks_row_deleted (GtkTreeModel * model, GtkTreePath * path, PlumaFileBrowserWidget * obj); static void on_filter_mode_changed (PlumaFileBrowserStore * model, @@ -278,7 +278,7 @@ location_free (Location * loc) { if (loc->root) g_object_unref (loc->root); - + if (loc->virtual_root) g_object_unref (loc->virtual_root); @@ -322,7 +322,7 @@ cancel_async_operation (PlumaFileBrowserWidget *widget) { if (!widget->priv->cancellable) return; - + g_cancellable_cancel (widget->priv->cancellable); g_object_unref (widget->priv->cancellable); @@ -356,7 +356,7 @@ pluma_file_browser_widget_finalize (GObject * object) g_list_free (obj->priv->locations); g_hash_table_destroy (obj->priv->bookmarks_hash); - + cancel_async_operation (obj); g_object_unref (obj->priv->busy_cursor); @@ -531,10 +531,10 @@ get_from_bookmark_file (PlumaFileBrowserWidget * obj, GFile * file, NameIcon * item; data = g_hash_table_lookup (obj->priv->bookmarks_hash, file); - + if (data == NULL) return FALSE; - + item = (NameIcon *)data; *name = g_strdup (item->name); @@ -549,10 +549,10 @@ get_from_bookmark_file (PlumaFileBrowserWidget * obj, GFile * file, } static void -insert_path_item (PlumaFileBrowserWidget * obj, +insert_path_item (PlumaFileBrowserWidget * obj, GFile * file, - GtkTreeIter * after, - GtkTreeIter * iter, + GtkTreeIter * after, + GtkTreeIter * iter, guint indent) { gchar * unescape; @@ -562,21 +562,21 @@ insert_path_item (PlumaFileBrowserWidget * obj, if (!get_from_bookmark_file (obj, file, &unescape, &icon)) { /* It's not a bookmark, fetch the name and the icon ourselves */ unescape = pluma_file_browser_utils_file_basename (file); - + /* Get the icon */ icon = pluma_file_browser_utils_pixbuf_from_file (file, GTK_ICON_SIZE_MENU); } gtk_tree_store_insert_after (obj->priv->combo_model, iter, NULL, after); - - gtk_tree_store_set (obj->priv->combo_model, - iter, + + gtk_tree_store_set (obj->priv->combo_model, + iter, COLUMN_INDENT, indent, - COLUMN_ICON, icon, - COLUMN_NAME, unescape, + COLUMN_ICON, icon, + COLUMN_NAME, unescape, COLUMN_FILE, file, - COLUMN_ID, PATH_ID, + COLUMN_ID, PATH_ID, -1); if (icon) @@ -618,15 +618,15 @@ uri_num_parents (GFile * from, GFile * to) return 0; g_object_ref (from); - + while ((parent = g_file_get_parent (from)) && !(to && g_file_equal (from, to))) { g_object_unref (from); from = parent; - + ++parents; } - - g_object_unref (from); + + g_object_unref (from); return parents; } @@ -639,7 +639,7 @@ insert_location_path (PlumaFileBrowserWidget * obj) GtkTreeIter separator; GtkTreeIter iter; guint indent; - + if (!obj->priv->current_location) { g_message ("insert_location_path: no current location"); return; @@ -649,7 +649,7 @@ insert_location_path (PlumaFileBrowserWidget * obj) current = loc->virtual_root; combo_find_by_id (obj, SEPARATOR_ID, &separator); - + indent = uri_num_parents (loc->virtual_root, loc->root); while (current != NULL) { @@ -675,7 +675,7 @@ insert_location_path (PlumaFileBrowserWidget * obj) } tmp = g_file_get_parent (current); - + if (current != loc->virtual_root) g_object_unref (current); @@ -723,22 +723,22 @@ fill_combo_model (PlumaFileBrowserWidget * obj) } static void -indent_cell_data_func (GtkCellLayout * cell_layout, +indent_cell_data_func (GtkCellLayout * cell_layout, GtkCellRenderer * cell, - GtkTreeModel * model, - GtkTreeIter * iter, + GtkTreeModel * model, + GtkTreeIter * iter, gpointer data) { gchar * indent; guint num; - + gtk_tree_model_get (model, iter, COLUMN_INDENT, &num, -1); - + if (num == 0) g_object_set (cell, "text", "", NULL); else { indent = g_strnfill (num * 2, ' '); - + g_object_set (cell, "text", indent, NULL); g_free (indent); } @@ -792,12 +792,12 @@ create_combo (PlumaFileBrowserWidget * obj) gtk_widget_show (obj->priv->combo); } -static GtkActionEntry toplevel_actions[] = +static GtkActionEntry toplevel_actions[] = { {"FilterMenuAction", NULL, N_("_Filter")} }; -static const GtkActionEntry tree_actions_selection[] = +static const GtkActionEntry tree_actions_selection[] = { {"FileMoveToTrash", "mate-stock-trash", N_("_Move to Trash"), NULL, N_("Move selected file or folder to trash"), @@ -829,14 +829,14 @@ static const GtkActionEntry tree_actions_single_most_selection[] = N_("Add new empty file"), G_CALLBACK (on_action_file_new)} }; -static const GtkActionEntry tree_actions_single_selection[] = +static const GtkActionEntry tree_actions_single_selection[] = { {"FileRename", NULL, N_("_Rename"), NULL, N_("Rename selected file or folder"), G_CALLBACK (on_action_file_rename)} }; -static const GtkActionEntry tree_actions_sensitive[] = +static const GtkActionEntry tree_actions_sensitive[] = { {"DirectoryPrevious", "go-previous", N_("_Previous Location"), NULL, @@ -851,7 +851,7 @@ static const GtkActionEntry tree_actions_sensitive[] = G_CALLBACK (on_action_directory_open)} }; -static const GtkToggleActionEntry tree_actions_toggle[] = +static const GtkToggleActionEntry tree_actions_toggle[] = { {"FilterHidden", "dialog-password", N_("Show _Hidden"), NULL, @@ -1036,24 +1036,24 @@ create_toolbar (PlumaFileBrowserWidget * obj, gtk_box_pack_start (GTK_BOX (obj), toolbar, FALSE, FALSE, 0); gtk_widget_show (toolbar); - + set_enable_delete (obj, obj->priv->enable_delete); } -static void +static void set_enable_delete (PlumaFileBrowserWidget *obj, gboolean enable) { GtkAction *action; obj->priv->enable_delete = enable; - + if (obj->priv->action_group_selection == NULL) return; - + action = gtk_action_group_get_action (obj->priv->action_group_selection, "FileDelete"); - + g_object_set (action, "visible", enable, "sensitive", enable, NULL); } @@ -1093,7 +1093,7 @@ add_bookmark_hash (PlumaFileBrowserWidget * obj, if (uri == NULL) return; - + file = g_file_new_for_uri (uri); g_free (uri); @@ -1101,8 +1101,8 @@ add_bookmark_hash (PlumaFileBrowserWidget * obj, PLUMA_FILE_BOOKMARKS_STORE_COLUMN_ICON, &pixbuf, PLUMA_FILE_BOOKMARKS_STORE_COLUMN_NAME, - &name, -1); - + &name, -1); + item = g_new (NameIcon, 1); item->name = name; item->icon = pixbuf; @@ -1119,14 +1119,14 @@ init_bookmarks_hash (PlumaFileBrowserWidget * obj) GtkTreeModel *model; model = GTK_TREE_MODEL (obj->priv->bookmarks_store); - + if (!gtk_tree_model_get_iter_first (model, &iter)) return; - + do { add_bookmark_hash (obj, &iter); } while (gtk_tree_model_iter_next (model, &iter)); - + g_signal_connect (obj->priv->bookmarks_store, "row-changed", G_CALLBACK (on_bookmarks_row_changed), @@ -1139,7 +1139,7 @@ init_bookmarks_hash (PlumaFileBrowserWidget * obj) } static void -on_begin_loading (PlumaFileBrowserStore *model, +on_begin_loading (PlumaFileBrowserStore *model, GtkTreeIter *iter, PlumaFileBrowserWidget *obj) { @@ -1151,7 +1151,7 @@ on_begin_loading (PlumaFileBrowserStore *model, } static void -on_end_loading (PlumaFileBrowserStore *model, +on_end_loading (PlumaFileBrowserStore *model, GtkTreeIter *iter, PlumaFileBrowserWidget *obj) { @@ -1212,16 +1212,16 @@ create_tree (PlumaFileBrowserWidget * obj) g_signal_connect (obj->priv->file_store, "notify::virtual-root", G_CALLBACK (on_virtual_root_changed), obj); - + g_signal_connect (obj->priv->file_store, "begin-loading", G_CALLBACK (on_begin_loading), obj); - + g_signal_connect (obj->priv->file_store, "end-loading", G_CALLBACK (on_end_loading), obj); g_signal_connect (obj->priv->file_store, "error", G_CALLBACK (on_file_store_error), obj); - + init_bookmarks_hash (obj); gtk_widget_show (sw); @@ -1275,7 +1275,7 @@ pluma_file_browser_widget_init (PlumaFileBrowserWidget * obj) gtk_box_set_spacing (GTK_BOX (obj), 3); gtk_orientable_set_orientation (GTK_ORIENTABLE (obj), GTK_ORIENTATION_VERTICAL); - + display = gtk_widget_get_display (GTK_WIDGET (obj)); obj->priv->busy_cursor = gdk_cursor_new_for_display (display, GDK_WATCH); } @@ -1332,15 +1332,15 @@ pluma_file_browser_widget_get_first_selected (PlumaFileBrowserWidget *obj, GtkTreeModel *model; GList *rows = gtk_tree_selection_get_selected_rows (selection, &model); gboolean result; - + if (!rows) return FALSE; - + result = gtk_tree_model_get_iter(model, iter, (GtkTreePath *)(rows->data)); g_list_foreach (rows, (GFunc)gtk_tree_path_free, NULL); g_list_free (rows); - + return result; } @@ -1444,15 +1444,15 @@ get_deletable_files (PlumaFileBrowserWidget *obj) { /* Get all selected files */ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (obj->priv->treeview)); rows = gtk_tree_selection_get_selected_rows (selection, &model); - + for (row = rows; row; row = row->next) { path = (GtkTreePath *)(row->data); - + if (!gtk_tree_model_get_iter (model, &iter, path)) continue; - - gtk_tree_model_get (model, &iter, - PLUMA_FILE_BROWSER_STORE_COLUMN_FLAGS, + + gtk_tree_model_get (model, &iter, + PLUMA_FILE_BROWSER_STORE_COLUMN_FLAGS, &flags, -1); if (FILE_IS_DUMMY (flags)) @@ -1460,10 +1460,10 @@ get_deletable_files (PlumaFileBrowserWidget *obj) { paths = g_list_append (paths, gtk_tree_path_copy (path)); } - + g_list_foreach (rows, (GFunc)gtk_tree_path_free, NULL); g_list_free (rows); - + return paths; } @@ -1479,7 +1479,7 @@ delete_selected_files (PlumaFileBrowserWidget * obj, gboolean trash) if (!PLUMA_IS_FILE_BROWSER_STORE (model)) return FALSE; - + rows = get_deletable_files (obj); if (!rows) @@ -1494,7 +1494,7 @@ delete_selected_files (PlumaFileBrowserWidget * obj, gboolean trash) result = pluma_file_browser_store_delete_all (PLUMA_FILE_BROWSER_STORE (model), rows, trash); - + g_list_foreach (rows, (GFunc)gtk_tree_path_free, NULL); g_list_free (rows); @@ -1502,14 +1502,14 @@ delete_selected_files (PlumaFileBrowserWidget * obj, gboolean trash) } static gboolean -on_file_store_no_trash (PlumaFileBrowserStore * store, - GList * files, +on_file_store_no_trash (PlumaFileBrowserStore * store, + GList * files, PlumaFileBrowserWidget * obj) { gboolean confirm = FALSE; - + g_signal_emit (obj, signals[CONFIRM_NO_TRASH], 0, files, &confirm); - + return confirm; } @@ -1518,14 +1518,14 @@ get_topmost_file (GFile * file) { GFile * tmp; GFile * current; - + current = g_object_ref (file); - + while ((tmp = g_file_get_parent (current)) != NULL) { g_object_unref (current); current = tmp; } - + return current; } @@ -1542,7 +1542,7 @@ create_goto_menu_item (PlumaFileBrowserWidget * obj, GList * item, if (!get_from_bookmark_file (obj, loc->virtual_root, &unescape, &pixbuf)) { unescape = pluma_file_browser_utils_file_basename (loc->virtual_root); - + if (icon) pixbuf = g_object_ref (icon); } @@ -1553,7 +1553,7 @@ create_goto_menu_item (PlumaFileBrowserWidget * obj, GList * item, } else { result = gtk_menu_item_new_with_label (unescape); } - + g_object_set_data (G_OBJECT (result), LOCATION_DATA_KEY, item); g_signal_connect (result, "activate", G_CALLBACK (on_location_jump_activate), obj); @@ -1658,7 +1658,7 @@ jump_to_location (PlumaFileBrowserWidget * obj, GList * item, /* Set the new root + virtual root */ root = g_file_get_uri (loc->root); virtual_root = g_file_get_uri (loc->virtual_root); - + pluma_file_browser_widget_set_root_and_virtual_root (obj, root, virtual_root); @@ -1704,8 +1704,8 @@ clear_next_locations (PlumaFileBrowserWidget * obj) } static void -update_filter_mode (PlumaFileBrowserWidget * obj, - GtkAction * action, +update_filter_mode (PlumaFileBrowserWidget * obj, + GtkAction * action, PlumaFileBrowserStoreFilterMode mode) { gboolean active = @@ -1744,8 +1744,8 @@ set_filter_pattern_real (PlumaFileBrowserWidget * obj, if (pattern == NULL && obj->priv->filter_pattern_str == NULL) return; - - if (pattern != NULL && obj->priv->filter_pattern_str != NULL && + + if (pattern != NULL && obj->priv->filter_pattern_str != NULL && strcmp (pattern, obj->priv->filter_pattern_str) == 0) return; @@ -1860,7 +1860,7 @@ pluma_file_browser_widget_set_root_and_virtual_root (PlumaFileBrowserWidget *obj if (!virtual_root) result = - pluma_file_browser_store_set_root_and_virtual_root + pluma_file_browser_store_set_root_and_virtual_root (obj->priv->file_store, root, root); else result = @@ -1873,7 +1873,7 @@ pluma_file_browser_widget_set_root_and_virtual_root (PlumaFileBrowserWidget *obj void pluma_file_browser_widget_set_root (PlumaFileBrowserWidget * obj, - gchar const *root, + gchar const *root, gboolean virtual_root) { GFile *file; @@ -1898,7 +1898,7 @@ pluma_file_browser_widget_set_root (PlumaFileBrowserWidget * obj, (obj, str, root); g_free (str); - + g_object_unref (file); g_object_unref (parent); } @@ -1935,7 +1935,7 @@ pluma_file_browser_widget_get_filter_entry (PlumaFileBrowserWidget * obj) gulong pluma_file_browser_widget_add_filter (PlumaFileBrowserWidget * obj, - PlumaFileBrowserWidgetFilterFunc func, + PlumaFileBrowserWidgetFilterFunc func, gpointer user_data, GDestroyNotify notify) { @@ -1979,7 +1979,7 @@ pluma_file_browser_widget_remove_filter (PlumaFileBrowserWidget * obj, } } -void +void pluma_file_browser_widget_set_filter_pattern (PlumaFileBrowserWidget * obj, gchar const *pattern) { @@ -1987,7 +1987,7 @@ pluma_file_browser_widget_set_filter_pattern (PlumaFileBrowserWidget * obj, } gboolean -pluma_file_browser_widget_get_selected_directory (PlumaFileBrowserWidget * obj, +pluma_file_browser_widget_get_selected_directory (PlumaFileBrowserWidget * obj, GtkTreeIter * iter) { GtkTreeModel *model = @@ -2035,12 +2035,12 @@ pluma_file_browser_widget_get_num_selected_files_or_directories (PlumaFileBrowse if (PLUMA_IS_FILE_BOOKMARKS_STORE (model)) return 0; - + rows = gtk_tree_selection_get_selected_rows (selection, &model); - + for (row = rows; row; row = row->next) { path = (GtkTreePath *)(row->data); - + /* Get iter from path */ if (!gtk_tree_model_get_iter (model, &iter, path)) continue; @@ -2061,7 +2061,7 @@ pluma_file_browser_widget_get_num_selected_files_or_directories (PlumaFileBrowse g_list_foreach (rows, (GFunc)gtk_tree_path_free, NULL); g_list_free (rows); - + return result; } @@ -2075,15 +2075,15 @@ static AsyncData * async_data_new (PlumaFileBrowserWidget *widget) { AsyncData *ret; - + ret = g_new (AsyncData, 1); ret->widget = widget; - + cancel_async_operation (widget); widget->priv->cancellable = g_cancellable_new (); - + ret->cancellable = g_object_ref (widget->priv->cancellable); - + return ret; } @@ -2098,9 +2098,9 @@ static void set_busy (PlumaFileBrowserWidget *obj, gboolean busy) { GdkWindow *window; - + window = gtk_widget_get_window (GTK_WIDGET (obj->priv->treeview)); - + if (!GDK_IS_WINDOW (window)) return; @@ -2129,31 +2129,31 @@ activate_mount (PlumaFileBrowserWidget *widget, { GFile *root; gchar *uri; - + if (!mount) { gchar *message; gchar *name; - + name = g_volume_get_name (volume); message = g_strdup_printf (_("No mount object for mounted volume: %s"), name); - - g_signal_emit (widget, - signals[ERROR], - 0, + + g_signal_emit (widget, + signals[ERROR], + 0, PLUMA_FILE_BROWSER_ERROR_SET_ROOT, message); - + g_free (name); g_free (message); return; } - + root = g_mount_get_root (mount); uri = g_file_get_uri (root); - + pluma_file_browser_widget_set_root (widget, uri, FALSE); - + g_free (uri); g_object_unref (root); } @@ -2165,12 +2165,12 @@ try_activate_drive (PlumaFileBrowserWidget *widget, GList *volumes; GVolume *volume; GMount *mount; - + volumes = g_drive_get_volumes (drive); - + volume = G_VOLUME (volumes->data); mount = g_volume_get_mount (volume); - + if (mount) { /* try set the root of the mount */ @@ -2182,7 +2182,7 @@ try_activate_drive (PlumaFileBrowserWidget *widget, /* try to mount it then? */ try_mount_volume (widget, volume); } - + g_list_foreach (volumes, (GFunc)g_object_unref, NULL); g_list_free (volumes); } @@ -2200,11 +2200,11 @@ poll_for_media_cb (GDrive *drive, async_free (async); return; } - + /* finish poll operation */ set_busy (async->widget, FALSE); - - if (g_drive_poll_for_media_finish (drive, res, &error) && + + if (g_drive_poll_for_media_finish (drive, res, &error) && g_drive_has_media (drive) && g_drive_has_volumes (drive)) { @@ -2214,22 +2214,22 @@ poll_for_media_cb (GDrive *drive, { gchar *message; gchar *name; - + name = g_drive_get_name (drive); message = g_strdup_printf (_("Could not open media: %s"), name); - g_signal_emit (async->widget, - signals[ERROR], - 0, + g_signal_emit (async->widget, + signals[ERROR], + 0, PLUMA_FILE_BROWSER_ERROR_SET_ROOT, message); g_free (name); g_free (message); - + g_error_free (error); } - + async_free (async); } @@ -2246,14 +2246,14 @@ mount_volume_cb (GVolume *volume, async_free (async); return; } - + if (g_volume_mount_finish (volume, res, &error)) { GMount *mount; - + mount = g_volume_get_mount (volume); activate_mount (async->widget, volume, mount); - + if (mount) g_object_unref (mount); } @@ -2261,22 +2261,22 @@ mount_volume_cb (GVolume *volume, { gchar *message; gchar *name; - + name = g_volume_get_name (volume); message = g_strdup_printf (_("Could not mount volume: %s"), name); - g_signal_emit (async->widget, - signals[ERROR], - 0, + g_signal_emit (async->widget, + signals[ERROR], + 0, PLUMA_FILE_BROWSER_ERROR_SET_ROOT, message); g_free (name); g_free (message); - + g_error_free (error); } - + set_busy (async->widget, FALSE); async_free (async); } @@ -2295,8 +2295,8 @@ activate_drive (PlumaFileBrowserWidget *obj, /* most common use case is a floppy drive, we'll poll for media and go from there */ async = async_data_new (obj); - g_drive_poll_for_media (drive, - async->cancellable, + g_drive_poll_for_media (drive, + async->cancellable, (GAsyncReadyCallback)poll_for_media_cb, async); @@ -2304,8 +2304,8 @@ activate_drive (PlumaFileBrowserWidget *obj, set_busy (obj, TRUE); } -static void -try_mount_volume (PlumaFileBrowserWidget *widget, +static void +try_mount_volume (PlumaFileBrowserWidget *widget, GVolume *volume) { GMountOperation *operation; @@ -2313,14 +2313,14 @@ try_mount_volume (PlumaFileBrowserWidget *widget, operation = gtk_mount_operation_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (widget)))); async = async_data_new (widget); - + g_volume_mount (volume, G_MOUNT_MOUNT_NONE, operation, async->cancellable, (GAsyncReadyCallback)mount_volume_cb, async); - + g_object_unref (operation); set_busy (widget, TRUE); } @@ -2330,17 +2330,17 @@ activate_volume (PlumaFileBrowserWidget *obj, GtkTreeIter *iter) { GVolume *volume; - + gtk_tree_model_get (GTK_TREE_MODEL (obj->priv->bookmarks_store), iter, PLUMA_FILE_BOOKMARKS_STORE_COLUMN_OBJECT, &volume, -1); /* see if we can mount the volume */ - try_mount_volume (obj, volume); + try_mount_volume (obj, volume); g_object_unref (volume); } -void +void pluma_file_browser_widget_refresh (PlumaFileBrowserWidget *obj) { GtkTreeModel *model = @@ -2358,7 +2358,7 @@ pluma_file_browser_widget_refresh (PlumaFileBrowserWidget *obj) } } -void +void pluma_file_browser_widget_history_back (PlumaFileBrowserWidget *obj) { if (obj->priv->locations) { @@ -2391,7 +2391,7 @@ bookmark_open (PlumaFileBrowserWidget *obj, gtk_tree_model_get (model, iter, PLUMA_FILE_BOOKMARKS_STORE_COLUMN_FLAGS, &flags, -1); - + if (flags & PLUMA_FILE_BOOKMARKS_STORE_IS_DRIVE) { /* handle a drive node */ @@ -2498,7 +2498,7 @@ on_bookmark_activated (PlumaFileBrowserView *tree_view, } static void -on_file_activated (PlumaFileBrowserView *tree_view, +on_file_activated (PlumaFileBrowserView *tree_view, GtkTreeIter *iter, PlumaFileBrowserWidget *obj) { @@ -2508,18 +2508,18 @@ on_file_activated (PlumaFileBrowserView *tree_view, } static gboolean -virtual_root_is_root (PlumaFileBrowserWidget * obj, +virtual_root_is_root (PlumaFileBrowserWidget * obj, PlumaFileBrowserStore * model) { GtkTreeIter root; GtkTreeIter virtual_root; - + if (!pluma_file_browser_store_get_iter_root (model, &root)) return TRUE; - + if (!pluma_file_browser_store_get_iter_virtual_root (model, &virtual_root)) return TRUE; - + return pluma_file_browser_store_iter_equal (model, &root, &virtual_root); } @@ -2597,12 +2597,12 @@ on_virtual_root_changed (PlumaFileBrowserStore * model, g_object_unref (pixbuf); } - + action = gtk_action_group_get_action (obj->priv-> action_group, "DirectoryUp"); - gtk_action_set_sensitive (action, + gtk_action_set_sensitive (action, !virtual_root_is_root (obj, model)); action = @@ -2727,11 +2727,11 @@ on_combo_changed (GtkComboBox * combo, PlumaFileBrowserWidget * obj) gtk_tree_model_get (GTK_TREE_MODEL (obj->priv->combo_model), &iter, COLUMN_FILE, &file, -1); - + uri = g_file_get_uri (file); pluma_file_browser_store_set_virtual_root_from_string (obj->priv->file_store, uri); - + g_free (uri); g_object_unref (file); break; @@ -2764,13 +2764,13 @@ do_change_directory (PlumaFileBrowserWidget * obj, { GtkAction * action = NULL; - if ((event->state & - (~GDK_CONTROL_MASK & ~GDK_SHIFT_MASK & ~GDK_MOD1_MASK)) == + if ((event->state & + (~GDK_CONTROL_MASK & ~GDK_SHIFT_MASK & ~GDK_MOD1_MASK)) == event->state && event->keyval == GDK_KEY_BackSpace) action = gtk_action_group_get_action (obj->priv-> action_group_sensitive, "DirectoryPrevious"); - else if (!((event->state & GDK_MOD1_MASK) && + else if (!((event->state & GDK_MOD1_MASK) && (event->state & (~GDK_CONTROL_MASK & ~GDK_SHIFT_MASK)) == event->state)) return FALSE; @@ -2793,12 +2793,12 @@ do_change_directory (PlumaFileBrowserWidget * obj, default: break; } - + if (action != NULL) { gtk_action_activate (action); return TRUE; } - + return FALSE; } @@ -2903,7 +2903,7 @@ on_location_jump_activate (GtkMenuItem * item, } static void -on_bookmarks_row_changed (GtkTreeModel * model, +on_bookmarks_row_changed (GtkTreeModel * model, GtkTreePath * path, GtkTreeIter * iter, PlumaFileBrowserWidget *obj) @@ -2912,19 +2912,19 @@ on_bookmarks_row_changed (GtkTreeModel * model, } static void -on_bookmarks_row_deleted (GtkTreeModel * model, +on_bookmarks_row_deleted (GtkTreeModel * model, GtkTreePath * path, PlumaFileBrowserWidget *obj) { GtkTreeIter iter; gchar * uri; GFile * file; - + if (!gtk_tree_model_get_iter (model, &iter, path)) return; uri = pluma_file_bookmarks_store_get_uri (obj->priv->bookmarks_store, &iter); - + if (!uri) return; @@ -2935,7 +2935,7 @@ on_bookmarks_row_deleted (GtkTreeModel * model, g_free (uri); } -static void +static void on_filter_mode_changed (PlumaFileBrowserStore * model, GParamSpec * param, PlumaFileBrowserWidget * obj) @@ -2945,20 +2945,20 @@ on_filter_mode_changed (PlumaFileBrowserStore * model, gboolean active; mode = pluma_file_browser_store_get_filter_mode (model); - - action = GTK_TOGGLE_ACTION (gtk_action_group_get_action (obj->priv->action_group, + + action = GTK_TOGGLE_ACTION (gtk_action_group_get_action (obj->priv->action_group, "FilterHidden")); active = !(mode & PLUMA_FILE_BROWSER_STORE_FILTER_MODE_HIDE_HIDDEN); - + if (active != gtk_toggle_action_get_active (action)) gtk_toggle_action_set_active (action, active); - action = GTK_TOGGLE_ACTION (gtk_action_group_get_action (obj->priv->action_group, + action = GTK_TOGGLE_ACTION (gtk_action_group_get_action (obj->priv->action_group, "FilterBinary")); active = !(mode & PLUMA_FILE_BROWSER_STORE_FILTER_MODE_HIDE_BINARY); - + if (active != gtk_toggle_action_get_active (action)) - gtk_toggle_action_set_active (action, active); + gtk_toggle_action_set_active (action, active); } static void @@ -2974,7 +2974,7 @@ on_action_directory_previous (GtkAction * action, pluma_file_browser_widget_history_back (obj); } -static void +static void on_action_directory_up (GtkAction * action, PlumaFileBrowserWidget * obj) { @@ -2984,8 +2984,8 @@ on_action_directory_up (GtkAction * action, if (!PLUMA_IS_FILE_BROWSER_STORE (model)) return; - - pluma_file_browser_store_set_virtual_root_up (PLUMA_FILE_BROWSER_STORE (model)); + + pluma_file_browser_store_set_virtual_root_up (PLUMA_FILE_BROWSER_STORE (model)); } static void @@ -3021,7 +3021,7 @@ on_action_file_open (GtkAction * action, PlumaFileBrowserWidget * obj) GtkTreePath *path; model = gtk_tree_view_get_model (GTK_TREE_VIEW (obj->priv->treeview)); - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (obj->priv->treeview)); + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (obj->priv->treeview)); if (!PLUMA_IS_FILE_BROWSER_STORE (model)) return; @@ -3099,22 +3099,22 @@ on_action_directory_open (GtkAction * action, PlumaFileBrowserWidget * obj) GtkTreePath *path; model = gtk_tree_view_get_model (GTK_TREE_VIEW (obj->priv->treeview)); - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (obj->priv->treeview)); + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (obj->priv->treeview)); if (!PLUMA_IS_FILE_BROWSER_STORE (model)) return; rows = gtk_tree_selection_get_selected_rows (selection, &model); - + for (row = rows; row; row = row->next) { path = (GtkTreePath *)(row->data); if (gtk_tree_model_get_iter (model, &iter, path)) directory_opened |= directory_open (obj, model, &iter); - + gtk_tree_path_free (path); } - + if (!directory_opened) { if (pluma_file_browser_widget_get_selected_directory (obj, &iter)) directory_open (obj, model, &iter); @@ -3126,16 +3126,16 @@ on_action_directory_open (GtkAction * action, PlumaFileBrowserWidget * obj) static void on_action_filter_hidden (GtkAction * action, PlumaFileBrowserWidget * obj) { - update_filter_mode (obj, - action, + update_filter_mode (obj, + action, PLUMA_FILE_BROWSER_STORE_FILTER_MODE_HIDE_HIDDEN); } static void on_action_filter_binary (GtkAction * action, PlumaFileBrowserWidget * obj) { - update_filter_mode (obj, - action, + update_filter_mode (obj, + action, PLUMA_FILE_BROWSER_STORE_FILTER_MODE_HIDE_BINARY); } diff --git a/plugins/filebrowser/pluma-file-browser-widget.h b/plugins/filebrowser/pluma-file-browser-widget.h index 8af73381..7bb8cc79 100644 --- a/plugins/filebrowser/pluma-file-browser-widget.h +++ b/plugins/filebrowser/pluma-file-browser-widget.h @@ -1,5 +1,5 @@ /* - * pluma-file-browser-widget.h - Pluma plugin providing easy file access + * pluma-file-browser-widget.h - Pluma plugin providing easy file access * from the sidepanel * * Copyright (C) 2006 - Jesse van den Kieboom <[email protected]> @@ -46,21 +46,21 @@ gboolean (*PlumaFileBrowserWidgetFilterFunc) (PlumaFileBrowserWidget * obj, model, GtkTreeIter * iter, gpointer user_data); -struct _PlumaFileBrowserWidget +struct _PlumaFileBrowserWidget { GtkBox parent; PlumaFileBrowserWidgetPrivate *priv; }; -struct _PlumaFileBrowserWidgetClass +struct _PlumaFileBrowserWidgetClass { GtkBoxClass parent_class; /* Signals */ void (*uri_activated) (PlumaFileBrowserWidget * widget, gchar const *uri); - void (*error) (PlumaFileBrowserWidget * widget, + void (*error) (PlumaFileBrowserWidget * widget, guint code, gchar const *message); gboolean (*confirm_delete) (PlumaFileBrowserWidget * widget, @@ -87,23 +87,23 @@ pluma_file_browser_widget_set_root_and_virtual_root (PlumaFileBrowserWidget * ob gchar const *virtual_root); gboolean -pluma_file_browser_widget_get_selected_directory (PlumaFileBrowserWidget * obj, +pluma_file_browser_widget_get_selected_directory (PlumaFileBrowserWidget * obj, GtkTreeIter * iter); -PlumaFileBrowserStore * +PlumaFileBrowserStore * pluma_file_browser_widget_get_browser_store (PlumaFileBrowserWidget * obj); -PlumaFileBookmarksStore * +PlumaFileBookmarksStore * pluma_file_browser_widget_get_bookmarks_store (PlumaFileBrowserWidget * obj); PlumaFileBrowserView * pluma_file_browser_widget_get_browser_view (PlumaFileBrowserWidget * obj); GtkWidget * pluma_file_browser_widget_get_filter_entry (PlumaFileBrowserWidget * obj); -GtkUIManager * +GtkUIManager * pluma_file_browser_widget_get_ui_manager (PlumaFileBrowserWidget * obj); gulong pluma_file_browser_widget_add_filter (PlumaFileBrowserWidget * obj, - PlumaFileBrowserWidgetFilterFunc func, + PlumaFileBrowserWidgetFilterFunc func, gpointer user_data, GDestroyNotify notify); void pluma_file_browser_widget_remove_filter (PlumaFileBrowserWidget * obj, diff --git a/plugins/modelines/modeline-parser.c b/plugins/modelines/modeline-parser.c index c66c1ed5..3f347a7b 100644 --- a/plugins/modelines/modeline-parser.c +++ b/plugins/modelines/modeline-parser.c @@ -63,7 +63,7 @@ typedef struct _ModelineOptions GtkWrapMode wrap_mode; gboolean display_right_margin; guint right_margin_position; - + ModelineSet set; } ModelineOptions; @@ -94,7 +94,7 @@ modeline_parser_shutdown () if (kate_languages != NULL) g_hash_table_destroy (kate_languages); - + vim_languages = NULL; emacs_languages = NULL; kate_languages = NULL; @@ -225,7 +225,7 @@ skip_whitespaces (gchar **s) } /* Parse vi(m) modelines. - * Vi(m) modelines looks like this: + * Vi(m) modelines looks like this: * - first form: [text]{white}{vi:|vim:|ex:}[white]{options} * - second form: [text]{white}{vi:|vim:|ex:}[white]se[t] {options}:[text] * They can happen on the three first or last lines. @@ -290,7 +290,7 @@ parse_vim_modeline (gchar *s, { g_free (options->language_id); options->language_id = get_language_id_vim (value->str); - + options->set |= MODELINE_SET_LANGUAGE; } else if (strcmp (key->str, "et") == 0 || @@ -303,7 +303,7 @@ parse_vim_modeline (gchar *s, strcmp (key->str, "tabstop") == 0) { intval = atoi (value->str); - + if (intval) { options->tab_width = intval; @@ -314,7 +314,7 @@ parse_vim_modeline (gchar *s, strcmp (key->str, "shiftwidth") == 0) { intval = atoi (value->str); - + if (intval) { options->indent_width = intval; @@ -330,15 +330,15 @@ parse_vim_modeline (gchar *s, else if (strcmp (key->str, "textwidth") == 0) { intval = atoi (value->str); - + if (intval) { options->right_margin_position = intval; options->display_right_margin = TRUE; - + options->set |= MODELINE_SET_SHOW_RIGHT_MARGIN | MODELINE_SET_RIGHT_MARGIN_POSITION; - + } } } @@ -407,13 +407,13 @@ parse_emacs_modeline (gchar *s, { g_free (options->language_id); options->language_id = get_language_id_emacs (value->str); - + options->set |= MODELINE_SET_LANGUAGE; } else if (strcmp (key->str, "tab-width") == 0) { intval = atoi (value->str); - + if (intval) { options->tab_width = intval; @@ -423,7 +423,7 @@ parse_emacs_modeline (gchar *s, else if (strcmp (key->str, "indent-offset") == 0) { intval = atoi (value->str); - + if (intval) { options->indent_width = intval; @@ -434,14 +434,14 @@ parse_emacs_modeline (gchar *s, { intval = strcmp (value->str, "nil") == 0; options->insert_spaces = intval; - + options->set |= MODELINE_SET_INSERT_SPACES; } else if (strcmp (key->str, "autowrap") == 0) { intval = strcmp (value->str, "nil") != 0; options->wrap_mode = intval ? GTK_WRAP_WORD : GTK_WRAP_NONE; - + options->set |= MODELINE_SET_WRAP_MODE; } } @@ -505,13 +505,13 @@ parse_kate_modeline (gchar *s, { g_free (options->language_id); options->language_id = get_language_id_kate (value->str); - + options->set |= MODELINE_SET_LANGUAGE; } else if (strcmp (key->str, "tab-width") == 0) { intval = atoi (value->str); - + if (intval) { options->tab_width = intval; @@ -540,17 +540,17 @@ parse_kate_modeline (gchar *s, options->wrap_mode = intval ? GTK_WRAP_WORD : GTK_WRAP_NONE; - options->set |= MODELINE_SET_WRAP_MODE; + options->set |= MODELINE_SET_WRAP_MODE; } else if (strcmp (key->str, "word-wrap-column") == 0) { intval = atoi (value->str); - + if (intval) { options->right_margin_position = intval; options->display_right_margin = TRUE; - + options->set |= MODELINE_SET_RIGHT_MARGIN_POSITION | MODELINE_SET_SHOW_RIGHT_MARGIN; } @@ -612,7 +612,7 @@ check_previous (GtkSourceView *view, ModelineSet set) { GtkSourceBuffer *buffer = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view))); - + /* Do not restore default when this is the first time */ if (!previous) return FALSE; @@ -649,7 +649,7 @@ check_previous (GtkSourceView *view, case MODELINE_SET_LANGUAGE: { GtkSourceLanguage *language = gtk_source_buffer_get_language (buffer); - + return (language == NULL && previous->language_id == NULL) || (language != NULL && g_strcmp0 (gtk_source_language_get_id (language), previous->language_id) == 0); @@ -675,7 +675,7 @@ modeline_parser_apply_modeline (GtkSourceView *view) GtkTextBuffer *buffer; GtkTextIter iter, liter; gint line_count; - + options.language_id = NULL; options.set = MODELINE_SET_NONE; @@ -758,7 +758,7 @@ modeline_parser_apply_modeline (GtkSourceView *view) } } - ModelineOptions *previous = g_object_get_data (G_OBJECT (buffer), + ModelineOptions *previous = g_object_get_data (G_OBJECT (buffer), MODELINE_OPTIONS_DATA_KEY); /* Apply the options we got from modelines and restore defaults if @@ -774,17 +774,17 @@ modeline_parser_apply_modeline (GtkSourceView *view) (view, pluma_prefs_manager_get_insert_spaces ()); } - + if (has_option (&options, MODELINE_SET_TAB_WIDTH)) { gtk_source_view_set_tab_width (view, options.tab_width); } else if (check_previous (view, previous, MODELINE_SET_TAB_WIDTH)) { - gtk_source_view_set_tab_width (view, + gtk_source_view_set_tab_width (view, pluma_prefs_manager_get_tabs_size ()); } - + if (has_option (&options, MODELINE_SET_INDENT_WIDTH)) { gtk_source_view_set_indent_width (view, options.indent_width); @@ -793,37 +793,37 @@ modeline_parser_apply_modeline (GtkSourceView *view) { gtk_source_view_set_indent_width (view, -1); } - + if (has_option (&options, MODELINE_SET_WRAP_MODE)) { gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), options.wrap_mode); } else if (check_previous (view, previous, MODELINE_SET_WRAP_MODE)) { - gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), + gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), pluma_prefs_manager_get_wrap_mode ()); } - + if (has_option (&options, MODELINE_SET_RIGHT_MARGIN_POSITION)) { gtk_source_view_set_right_margin_position (view, options.right_margin_position); } else if (check_previous (view, previous, MODELINE_SET_RIGHT_MARGIN_POSITION)) { - gtk_source_view_set_right_margin_position (view, + gtk_source_view_set_right_margin_position (view, pluma_prefs_manager_get_right_margin_position ()); } - + if (has_option (&options, MODELINE_SET_SHOW_RIGHT_MARGIN)) { gtk_source_view_set_show_right_margin (view, options.display_right_margin); } else if (check_previous (view, previous, MODELINE_SET_SHOW_RIGHT_MARGIN)) { - gtk_source_view_set_show_right_margin (view, + gtk_source_view_set_show_right_margin (view, pluma_prefs_manager_get_display_right_margin ()); } - + if (previous) { *previous = options; @@ -834,13 +834,13 @@ modeline_parser_apply_modeline (GtkSourceView *view) previous = g_slice_new (ModelineOptions); *previous = options; previous->language_id = g_strdup (options.language_id); - - g_object_set_data_full (G_OBJECT (buffer), - MODELINE_OPTIONS_DATA_KEY, + + g_object_set_data_full (G_OBJECT (buffer), + MODELINE_OPTIONS_DATA_KEY, previous, (GDestroyNotify)free_modeline_options); } - + g_free (options.language_id); } diff --git a/plugins/modelines/modeline-parser.h b/plugins/modelines/modeline-parser.h index 72a1071f..ce6429b4 100644 --- a/plugins/modelines/modeline-parser.h +++ b/plugins/modelines/modeline-parser.h @@ -1,14 +1,14 @@ /* * modelie-parser.h * Emacs, Kate and Vim-style modelines support for pluma. - * + * * Copyright (C) 2005-2007 - Steve Frécinaux <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. - * + * * This program 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 diff --git a/plugins/modelines/pluma-modeline-plugin.c b/plugins/modelines/pluma-modeline-plugin.c index cc7e461b..b4904a89 100644 --- a/plugins/modelines/pluma-modeline-plugin.c +++ b/plugins/modelines/pluma-modeline-plugin.c @@ -1,14 +1,14 @@ /* * pluma-modeline-plugin.c * Emacs, Kate and Vim-style modelines support for pluma. - * + * * Copyright (C) 2005-2007 - Steve Frécinaux <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. - * + * * This program 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 @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ - + #ifdef HAVE_CONFIG_H # include <config.h> #endif @@ -279,10 +279,10 @@ pluma_modeline_plugin_deactivate (PeasActivatable *activatable) for (l = views; l != NULL; l = l->next) { disconnect_handlers (PLUMA_VIEW (l->data)); - + modeline_parser_deactivate (GTK_SOURCE_VIEW (l->data)); } - + g_list_free (views); } diff --git a/plugins/modelines/pluma-modeline-plugin.h b/plugins/modelines/pluma-modeline-plugin.h index c44faf36..f952b2ba 100644 --- a/plugins/modelines/pluma-modeline-plugin.h +++ b/plugins/modelines/pluma-modeline-plugin.h @@ -1,7 +1,7 @@ /* * pluma-modeline-plugin.h * Emacs, Kate and Vim-style modelines support for pluma. - * + * * Copyright (C) 2005-2007 - Steve Frécinaux <[email protected]> * * This program is free software; you can redistribute it and/or modify diff --git a/plugins/sort/pluma-sort-plugin.h b/plugins/sort/pluma-sort-plugin.h index fc495633..12deeaed 100644 --- a/plugins/sort/pluma-sort-plugin.h +++ b/plugins/sort/pluma-sort-plugin.h @@ -1,6 +1,6 @@ /* * pluma-sort-plugin.h - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) diff --git a/plugins/spell/pluma-automatic-spell-checker.c b/plugins/spell/pluma-automatic-spell-checker.c index 0bf16147..5b53e110 100644 --- a/plugins/spell/pluma-automatic-spell-checker.c +++ b/plugins/spell/pluma-automatic-spell-checker.c @@ -3,7 +3,7 @@ * pluma-automatic-spell-checker.c * This file is part of pluma * - * Copyright (C) 2002 Paolo Maggi + * Copyright (C) 2002 Paolo Maggi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,14 +17,14 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. */ /* - * Modified by the pluma Team, 2002. See the AUTHORS file for a - * list of people on the pluma Team. - * See the ChangeLog files for a list of changes. + * Modified by the pluma Team, 2002. See the AUTHORS file for a + * list of people on the pluma Team. + * See the ChangeLog files for a list of changes. */ /* This is a modified version of gtkspell 2.0.5 (gtkspell.sf.net) */ @@ -46,7 +46,7 @@ struct _PlumaAutomaticSpellChecker { PlumaDocument *doc; GSList *views; - + GtkTextMark *mark_insert_start; GtkTextMark *mark_insert_end; gboolean deferred_check; @@ -69,7 +69,7 @@ view_destroy (PlumaView *view, PlumaAutomaticSpellChecker *spell) } static void -check_word (PlumaAutomaticSpellChecker *spell, GtkTextIter *start, GtkTextIter *end) +check_word (PlumaAutomaticSpellChecker *spell, GtkTextIter *start, GtkTextIter *end) { gchar *word; @@ -80,34 +80,34 @@ check_word (PlumaAutomaticSpellChecker *spell, GtkTextIter *start, GtkTextIter * gtk_text_iter_get_offset (end)); */ - if (!pluma_spell_checker_check_word (spell->spell_checker, word, -1)) + if (!pluma_spell_checker_check_word (spell->spell_checker, word, -1)) { /* g_print ("Apply tag: [%d - %d]\n", gtk_text_iter_get_offset (start), gtk_text_iter_get_offset (end)); */ - gtk_text_buffer_apply_tag (GTK_TEXT_BUFFER (spell->doc), - spell->tag_highlight, - start, + gtk_text_buffer_apply_tag (GTK_TEXT_BUFFER (spell->doc), + spell->tag_highlight, + start, end); } - + g_free (word); } static void -check_range (PlumaAutomaticSpellChecker *spell, - GtkTextIter start, +check_range (PlumaAutomaticSpellChecker *spell, + GtkTextIter start, GtkTextIter end, - gboolean force_all) + gboolean force_all) { /* we need to "split" on word boundaries. - * luckily, Pango knows what "words" are + * luckily, Pango knows what "words" are * so we don't have to figure it out. */ GtkTextIter wstart; GtkTextIter wend; - GtkTextIter cursor; + GtkTextIter cursor; GtkTextIter precursor; gboolean highlight; @@ -118,65 +118,65 @@ check_range (PlumaAutomaticSpellChecker *spell, if (gtk_text_iter_inside_word (&end)) gtk_text_iter_forward_word_end (&end); - - if (!gtk_text_iter_starts_word (&start)) + + if (!gtk_text_iter_starts_word (&start)) { - if (gtk_text_iter_inside_word (&start) || - gtk_text_iter_ends_word (&start)) + if (gtk_text_iter_inside_word (&start) || + gtk_text_iter_ends_word (&start)) { gtk_text_iter_backward_word_start (&start); - } - else + } + else { /* if we're neither at the beginning nor inside a word, * me must be in some spaces. * skip forward to the beginning of the next word. */ - + if (gtk_text_iter_forward_word_end (&start)) gtk_text_iter_backward_word_start (&start); } } - gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (spell->doc), + gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (spell->doc), &cursor, gtk_text_buffer_get_insert (GTK_TEXT_BUFFER (spell->doc))); - + precursor = cursor; gtk_text_iter_backward_char (&precursor); - + highlight = gtk_text_iter_has_tag (&cursor, spell->tag_highlight) || gtk_text_iter_has_tag (&precursor, spell->tag_highlight); - - gtk_text_buffer_remove_tag (GTK_TEXT_BUFFER (spell->doc), - spell->tag_highlight, - &start, + + gtk_text_buffer_remove_tag (GTK_TEXT_BUFFER (spell->doc), + spell->tag_highlight, + &start, &end); /* Fix a corner case when replacement occurs at beginning of buffer: * An iter at offset 0 seems to always be inside a word, * even if it's not. Possibly a pango bug. */ - if (gtk_text_iter_get_offset (&start) == 0) + if (gtk_text_iter_get_offset (&start) == 0) { gtk_text_iter_forward_word_end(&start); gtk_text_iter_backward_word_start(&start); } wstart = start; - + while (pluma_spell_utils_skip_no_spell_check (&wstart, &end) && - gtk_text_iter_compare (&wstart, &end) < 0) + gtk_text_iter_compare (&wstart, &end) < 0) { - gboolean inword; + gboolean inword; /* move wend to the end of the current word. */ wend = wstart; - + gtk_text_iter_forward_word_end (&wend); inword = (gtk_text_iter_compare (&wstart, &cursor) < 0) && (gtk_text_iter_compare (&cursor, &wend) <= 0); - + if (inword && !force_all) { /* this word is being actively edited, @@ -186,8 +186,8 @@ check_range (PlumaAutomaticSpellChecker *spell, check_word (spell, &wstart, &wend); else spell->deferred_check = TRUE; - } - else + } + else { check_word (spell, &wstart, &wend); spell->deferred_check = FALSE; @@ -196,7 +196,7 @@ check_range (PlumaAutomaticSpellChecker *spell, /* now move wend to the beginning of the next word, */ gtk_text_iter_forward_word_end (&wend); gtk_text_iter_backward_word_start (&wend); - + /* make sure we've actually advanced * (we don't advance in some corner cases), */ if (gtk_text_iter_equal (&wstart, &wend)) @@ -208,16 +208,16 @@ check_range (PlumaAutomaticSpellChecker *spell, } static void -check_deferred_range (PlumaAutomaticSpellChecker *spell, - gboolean force_all) +check_deferred_range (PlumaAutomaticSpellChecker *spell, + gboolean force_all) { GtkTextIter start, end; - gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (spell->doc), - &start, + gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (spell->doc), + &start, spell->mark_insert_start); gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (spell->doc), - &end, + &end, spell->mark_insert_end); check_range (spell, start, end, force_all); @@ -232,20 +232,20 @@ check_deferred_range (PlumaAutomaticSpellChecker *spell, static void insert_text_before (GtkTextBuffer *buffer, GtkTextIter *iter, - gchar *text, gint len, PlumaAutomaticSpellChecker *spell) + gchar *text, gint len, PlumaAutomaticSpellChecker *spell) { gtk_text_buffer_move_mark (buffer, spell->mark_insert_start, iter); } static void insert_text_after (GtkTextBuffer *buffer, GtkTextIter *iter, - gchar *text, gint len, PlumaAutomaticSpellChecker *spell) + gchar *text, gint len, PlumaAutomaticSpellChecker *spell) { GtkTextIter start; /* we need to check a range of text. */ gtk_text_buffer_get_iter_at_mark (buffer, &start, spell->mark_insert_start); - + check_range (spell, start, *iter, FALSE); gtk_text_buffer_move_mark (buffer, spell->mark_insert_end, iter); @@ -259,17 +259,17 @@ insert_text_after (GtkTextBuffer *buffer, GtkTextIter *iter, */ static void -delete_range_after (GtkTextBuffer *buffer, GtkTextIter *start, GtkTextIter *end, - PlumaAutomaticSpellChecker *spell) +delete_range_after (GtkTextBuffer *buffer, GtkTextIter *start, GtkTextIter *end, + PlumaAutomaticSpellChecker *spell) { check_range (spell, *start, *end, FALSE); } static void -mark_set (GtkTextBuffer *buffer, +mark_set (GtkTextBuffer *buffer, GtkTextIter *iter, - GtkTextMark *mark, - PlumaAutomaticSpellChecker *spell) + GtkTextMark *mark, + PlumaAutomaticSpellChecker *spell) { /* if the cursor has moved and there is a deferred check so handle it now */ if ((mark == gtk_text_buffer_get_insert (buffer)) && spell->deferred_check) @@ -277,18 +277,18 @@ mark_set (GtkTextBuffer *buffer, } static void -get_word_extents_from_mark (GtkTextBuffer *buffer, - GtkTextIter *start, +get_word_extents_from_mark (GtkTextBuffer *buffer, + GtkTextIter *start, GtkTextIter *end, GtkTextMark *mark) { gtk_text_buffer_get_iter_at_mark(buffer, start, mark); - - if (!gtk_text_iter_starts_word (start)) + + if (!gtk_text_iter_starts_word (start)) gtk_text_iter_backward_word_start (start); - + *end = *start; - + if (gtk_text_iter_inside_word (end)) gtk_text_iter_forward_word_end (end); } @@ -302,17 +302,17 @@ remove_tag_to_word (PlumaAutomaticSpellChecker *spell, const gchar *word) gboolean found; gtk_text_buffer_get_iter_at_offset (GTK_TEXT_BUFFER (spell->doc), &iter, 0); - + found = TRUE; while (found) { - found = gtk_text_iter_forward_search (&iter, - word, + found = gtk_text_iter_forward_search (&iter, + word, GTK_TEXT_SEARCH_VISIBLE_ONLY | GTK_TEXT_SEARCH_TEXT_ONLY, - &match_start, + &match_start, &match_end, - NULL); + NULL); if (found) { @@ -321,7 +321,7 @@ remove_tag_to_word (PlumaAutomaticSpellChecker *spell, const gchar *word) { gtk_text_buffer_remove_tag (GTK_TEXT_BUFFER (spell->doc), spell->tag_highlight, - &match_start, + &match_start, &match_end); } @@ -331,55 +331,55 @@ remove_tag_to_word (PlumaAutomaticSpellChecker *spell, const gchar *word) } static void -add_to_dictionary (GtkWidget *menuitem, PlumaAutomaticSpellChecker *spell) +add_to_dictionary (GtkWidget *menuitem, PlumaAutomaticSpellChecker *spell) { gchar *word; - + GtkTextIter start, end; - - get_word_extents_from_mark (GTK_TEXT_BUFFER (spell->doc), &start, &end, spell->mark_click); - word = gtk_text_buffer_get_text (GTK_TEXT_BUFFER (spell->doc), - &start, - &end, + get_word_extents_from_mark (GTK_TEXT_BUFFER (spell->doc), &start, &end, spell->mark_click); + + word = gtk_text_buffer_get_text (GTK_TEXT_BUFFER (spell->doc), + &start, + &end, FALSE); - + pluma_spell_checker_add_word_to_personal (spell->spell_checker, word, -1); g_free (word); } static void -ignore_all (GtkWidget *menuitem, PlumaAutomaticSpellChecker *spell) +ignore_all (GtkWidget *menuitem, PlumaAutomaticSpellChecker *spell) { gchar *word; - + GtkTextIter start, end; - - get_word_extents_from_mark (GTK_TEXT_BUFFER (spell->doc), &start, &end, spell->mark_click); - word = gtk_text_buffer_get_text (GTK_TEXT_BUFFER (spell->doc), - &start, - &end, + get_word_extents_from_mark (GTK_TEXT_BUFFER (spell->doc), &start, &end, spell->mark_click); + + word = gtk_text_buffer_get_text (GTK_TEXT_BUFFER (spell->doc), + &start, + &end, FALSE); - + pluma_spell_checker_add_word_to_session (spell->spell_checker, word, -1); g_free (word); } static void -replace_word (GtkWidget *menuitem, PlumaAutomaticSpellChecker *spell) +replace_word (GtkWidget *menuitem, PlumaAutomaticSpellChecker *spell) { gchar *oldword; const gchar *newword; - + GtkTextIter start, end; - get_word_extents_from_mark (GTK_TEXT_BUFFER (spell->doc), &start, &end, spell->mark_click); + get_word_extents_from_mark (GTK_TEXT_BUFFER (spell->doc), &start, &end, spell->mark_click); oldword = gtk_text_buffer_get_text (GTK_TEXT_BUFFER (spell->doc), &start, &end, FALSE); - + newword = g_object_get_qdata (G_OBJECT (menuitem), suggestion_id); g_return_if_fail (newword != NULL); @@ -390,7 +390,7 @@ replace_word (GtkWidget *menuitem, PlumaAutomaticSpellChecker *spell) gtk_text_buffer_end_user_action (GTK_TEXT_BUFFER (spell->doc)); - pluma_spell_checker_set_correction (spell->spell_checker, + pluma_spell_checker_set_correction (spell->spell_checker, oldword, strlen (oldword), newword, strlen (newword)); @@ -398,49 +398,49 @@ replace_word (GtkWidget *menuitem, PlumaAutomaticSpellChecker *spell) } static GtkWidget * -build_suggestion_menu (PlumaAutomaticSpellChecker *spell, const gchar *word) +build_suggestion_menu (PlumaAutomaticSpellChecker *spell, const gchar *word) { GtkWidget *topmenu, *menu; GtkWidget *mi; GSList *suggestions; GSList *list; gchar *label_text; - + topmenu = menu = gtk_menu_new(); suggestions = pluma_spell_checker_get_suggestions (spell->spell_checker, word, -1); list = suggestions; - if (suggestions == NULL) - { + if (suggestions == NULL) + { /* no suggestions. put something in the menu anyway... */ GtkWidget *label; /* Translators: Displayed in the "Check Spelling" dialog if there are no suggestions for the current misspelled word */ label = gtk_label_new (_("(no suggested words)")); - + mi = gtk_menu_item_new (); gtk_widget_set_sensitive (mi, FALSE); gtk_container_add (GTK_CONTAINER(mi), label); gtk_widget_show_all (mi); gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), mi); - } - else + } + else { gint count = 0; - + /* build a set of menus with suggestions. */ - while (suggestions != NULL) + while (suggestions != NULL) { GtkWidget *label; - if (count == 10) + if (count == 10) { /* Separator */ mi = gtk_menu_item_new (); gtk_widget_show (mi); gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi); - + mi = gtk_menu_item_new_with_mnemonic (_("_More...")); gtk_widget_show (mi); gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi); @@ -449,22 +449,22 @@ build_suggestion_menu (PlumaAutomaticSpellChecker *spell, const gchar *word) gtk_menu_item_set_submenu (GTK_MENU_ITEM (mi), menu); count = 0; } - + label_text = g_strdup_printf ("<b>%s</b>", (gchar*) suggestions->data); - + label = gtk_label_new (label_text); gtk_label_set_use_markup (GTK_LABEL (label), TRUE); gtk_label_set_xalign (GTK_LABEL (label), 0.0); mi = gtk_menu_item_new (); gtk_container_add (GTK_CONTAINER(mi), label); - + gtk_widget_show_all (mi); gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi); - g_object_set_qdata_full (G_OBJECT (mi), - suggestion_id, - g_strdup (suggestions->data), + g_object_set_qdata_full (G_OBJECT (mi), + suggestion_id, + g_strdup (suggestions->data), (GDestroyNotify)g_free); g_free (label_text); @@ -498,9 +498,9 @@ build_suggestion_menu (PlumaAutomaticSpellChecker *spell, const gchar *word) /* Ignore all */ mi = gtk_image_menu_item_new_with_mnemonic (_("_Ignore All")); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (mi), - gtk_image_new_from_icon_name ("go-bottom", + gtk_image_new_from_icon_name ("go-bottom", GTK_ICON_SIZE_MENU)); - + g_signal_connect (mi, "activate", G_CALLBACK(ignore_all), @@ -513,7 +513,7 @@ build_suggestion_menu (PlumaAutomaticSpellChecker *spell, const gchar *word) /* + Add to Dictionary */ mi = gtk_image_menu_item_new_with_mnemonic (_("_Add")); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (mi), - gtk_image_new_from_icon_name ("list-add", + gtk_image_new_from_icon_name ("list-add", GTK_ICON_SIZE_MENU)); g_signal_connect (mi, @@ -522,23 +522,23 @@ build_suggestion_menu (PlumaAutomaticSpellChecker *spell, const gchar *word) spell); gtk_widget_show_all (mi); - + gtk_menu_shell_append (GTK_MENU_SHELL (topmenu), mi); return topmenu; } static void -populate_popup (GtkTextView *textview, GtkMenu *menu, PlumaAutomaticSpellChecker *spell) +populate_popup (GtkTextView *textview, GtkMenu *menu, PlumaAutomaticSpellChecker *spell) { GtkWidget *img, *mi; GtkTextIter start, end; char *word; /* we need to figure out if they picked a misspelled word. */ - get_word_extents_from_mark (GTK_TEXT_BUFFER (spell->doc), &start, &end, spell->mark_click); + get_word_extents_from_mark (GTK_TEXT_BUFFER (spell->doc), &start, &end, spell->mark_click); - /* if our highlight algorithm ever messes up, + /* if our highlight algorithm ever messes up, * this isn't correct, either. */ if (!gtk_text_iter_has_tag (&start, spell->tag_highlight)) return; /* word wasn't misspelled. */ @@ -574,9 +574,9 @@ pluma_automatic_spell_checker_recheck_all (PlumaAutomaticSpellChecker *spell) check_range (spell, start, end, TRUE); } -static void -add_word_signal_cb (PlumaSpellChecker *checker, - const gchar *word, +static void +add_word_signal_cb (PlumaSpellChecker *checker, + const gchar *word, gint len, PlumaAutomaticSpellChecker *spell) { @@ -592,7 +592,7 @@ add_word_signal_cb (PlumaSpellChecker *checker, g_free (w); } -static void +static void set_language_cb (PlumaSpellChecker *checker, const PlumaSpellCheckerLanguage *lang, PlumaAutomaticSpellChecker *spell) @@ -600,7 +600,7 @@ set_language_cb (PlumaSpellChecker *checker, pluma_automatic_spell_checker_recheck_all (spell); } -static void +static void clear_session_cb (PlumaSpellChecker *checker, PlumaAutomaticSpellChecker *spell) { @@ -609,14 +609,14 @@ clear_session_cb (PlumaSpellChecker *checker, /* When the user right-clicks on a word, they want to check that word. * Here, we do NOT move the cursor to the location of the clicked-upon word - * since that prevents the use of edit functions on the context menu. + * since that prevents the use of edit functions on the context menu. */ static gboolean button_press_event (GtkTextView *view, GdkEventButton *event, - PlumaAutomaticSpellChecker *spell) + PlumaAutomaticSpellChecker *spell) { - if (event->button == 3) + if (event->button == 3) { gint x, y; GtkTextIter iter; @@ -627,11 +627,11 @@ button_press_event (GtkTextView *view, if (spell->deferred_check) check_deferred_range (spell, TRUE); - gtk_text_view_window_to_buffer_coords (view, - GTK_TEXT_WINDOW_TEXT, + gtk_text_view_window_to_buffer_coords (view, + GTK_TEXT_WINDOW_TEXT, event->x, event->y, &x, &y); - + gtk_text_view_get_iter_at_location (view, &iter, x, y); gtk_text_buffer_move_mark (buffer, spell->mark_click, &iter); @@ -645,7 +645,7 @@ button_press_event (GtkTextView *view, * will contain the wrong set of suggestions. */ static gboolean -popup_menu_event (GtkTextView *view, PlumaAutomaticSpellChecker *spell) +popup_menu_event (GtkTextView *view, PlumaAutomaticSpellChecker *spell) { GtkTextIter iter; GtkTextBuffer *buffer; @@ -673,7 +673,7 @@ tag_table_changed (GtkTextTagTable *table, gtk_text_tag_table_get_size (table) - 1); } -static void +static void tag_added_or_removed (GtkTextTagTable *table, GtkTextTag *tag, PlumaAutomaticSpellChecker *spell) @@ -681,7 +681,7 @@ tag_added_or_removed (GtkTextTagTable *table, tag_table_changed (table, spell); } -static void +static void tag_changed (GtkTextTagTable *table, GtkTextTag *tag, gboolean size_changed, @@ -718,7 +718,7 @@ pluma_automatic_spell_checker_new (PlumaDocument *doc, g_return_val_if_fail (PLUMA_IS_SPELL_CHECKER (checker), NULL); g_return_val_if_fail ((spell = pluma_automatic_spell_checker_get_from_document (doc)) == NULL, spell); - + /* attach to the widget */ spell = g_new0 (PlumaAutomaticSpellChecker, 1); @@ -727,7 +727,7 @@ pluma_automatic_spell_checker_new (PlumaDocument *doc, if (automatic_spell_checker_id == 0) { - automatic_spell_checker_id = + automatic_spell_checker_id = g_quark_from_string ("PlumaAutomaticSpellCheckerID"); } if (suggestion_id == 0) @@ -735,26 +735,26 @@ pluma_automatic_spell_checker_new (PlumaDocument *doc, suggestion_id = g_quark_from_string ("PlumaAutoSuggestionID"); } - g_object_set_qdata_full (G_OBJECT (doc), - automatic_spell_checker_id, - spell, + g_object_set_qdata_full (G_OBJECT (doc), + automatic_spell_checker_id, + spell, (GDestroyNotify)pluma_automatic_spell_checker_free_internal); g_signal_connect (doc, "insert-text", - G_CALLBACK (insert_text_before), + G_CALLBACK (insert_text_before), spell); g_signal_connect_after (doc, "insert-text", - G_CALLBACK (insert_text_after), + G_CALLBACK (insert_text_after), spell); g_signal_connect_after (doc, "delete-range", - G_CALLBACK (delete_range_after), + G_CALLBACK (delete_range_after), spell); g_signal_connect (doc, "mark-set", - G_CALLBACK (mark_set), + G_CALLBACK (mark_set), spell); g_signal_connect (doc, @@ -791,7 +791,7 @@ pluma_automatic_spell_checker_new (PlumaDocument *doc, tag_table = gtk_text_buffer_get_tag_table (GTK_TEXT_BUFFER (doc)); - gtk_text_tag_set_priority (spell->tag_highlight, + gtk_text_tag_set_priority (spell->tag_highlight, gtk_text_tag_table_get_size (tag_table) - 1); g_signal_connect (tag_table, @@ -810,16 +810,16 @@ pluma_automatic_spell_checker_new (PlumaDocument *doc, /* we create the mark here, but we don't use it until text is * inserted, so we don't really care where iter points. */ gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER (doc), &start, &end); - + spell->mark_insert_start = gtk_text_buffer_get_mark (GTK_TEXT_BUFFER (doc), "pluma-automatic-spell-checker-insert-start"); if (spell->mark_insert_start == NULL) { - spell->mark_insert_start = + spell->mark_insert_start = gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (doc), "pluma-automatic-spell-checker-insert-start", - &start, + &start, TRUE); } else @@ -834,10 +834,10 @@ pluma_automatic_spell_checker_new (PlumaDocument *doc, if (spell->mark_insert_end == NULL) { - spell->mark_insert_end = + spell->mark_insert_end = gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (doc), "pluma-automatic-spell-checker-insert-end", - &start, + &start, TRUE); } else @@ -852,10 +852,10 @@ pluma_automatic_spell_checker_new (PlumaDocument *doc, if (spell->mark_click == NULL) { - spell->mark_click = + spell->mark_click = gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (doc), "pluma-automatic-spell-checker-click", - &start, + &start, TRUE); } else @@ -879,18 +879,18 @@ pluma_automatic_spell_checker_get_from_document (const PlumaDocument *doc) return NULL; return g_object_get_qdata (G_OBJECT (doc), automatic_spell_checker_id); -} +} void pluma_automatic_spell_checker_free (PlumaAutomaticSpellChecker *spell) { g_return_if_fail (spell != NULL); g_return_if_fail (pluma_automatic_spell_checker_get_from_document (spell->doc) == spell); - + if (automatic_spell_checker_id == 0) return; - g_object_set_qdata (G_OBJECT (spell->doc), automatic_spell_checker_id, NULL); + g_object_set_qdata (G_OBJECT (spell->doc), automatic_spell_checker_id, NULL); } static void @@ -899,19 +899,19 @@ pluma_automatic_spell_checker_free_internal (PlumaAutomaticSpellChecker *spell) GtkTextTagTable *table; GtkTextIter start, end; GSList *list; - + g_return_if_fail (spell != NULL); table = gtk_text_buffer_get_tag_table (GTK_TEXT_BUFFER (spell->doc)); if (table != NULL && spell->tag_highlight != NULL) { - gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER (spell->doc), - &start, + gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER (spell->doc), + &start, &end); - gtk_text_buffer_remove_tag (GTK_TEXT_BUFFER (spell->doc), - spell->tag_highlight, - &start, + gtk_text_buffer_remove_tag (GTK_TEXT_BUFFER (spell->doc), + spell->tag_highlight, + &start, &end); g_signal_handlers_disconnect_matched (G_OBJECT (table), @@ -921,7 +921,7 @@ pluma_automatic_spell_checker_free_internal (PlumaAutomaticSpellChecker *spell) gtk_text_tag_table_remove (table, spell->tag_highlight); } - + g_signal_handlers_disconnect_matched (G_OBJECT (spell->doc), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, @@ -938,7 +938,7 @@ pluma_automatic_spell_checker_free_internal (PlumaAutomaticSpellChecker *spell) while (list != NULL) { PlumaView *view = PLUMA_VIEW (list->data); - + g_signal_handlers_disconnect_matched (G_OBJECT (view), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, @@ -953,13 +953,13 @@ pluma_automatic_spell_checker_free_internal (PlumaAutomaticSpellChecker *spell) } g_slist_free (spell->views); - + g_free (spell); } void pluma_automatic_spell_checker_attach_view ( - PlumaAutomaticSpellChecker *spell, + PlumaAutomaticSpellChecker *spell, PlumaView *view) { g_return_if_fail (spell != NULL); @@ -970,25 +970,25 @@ pluma_automatic_spell_checker_attach_view ( g_signal_connect (view, "button-press-event", - G_CALLBACK (button_press_event), + G_CALLBACK (button_press_event), spell); g_signal_connect (view, "popup-menu", - G_CALLBACK (popup_menu_event), + G_CALLBACK (popup_menu_event), spell); g_signal_connect (view, "populate-popup", - G_CALLBACK (populate_popup), + G_CALLBACK (populate_popup), spell); g_signal_connect (view, "destroy", - G_CALLBACK (view_destroy), + G_CALLBACK (view_destroy), spell); spell->views = g_slist_prepend (spell->views, view); } -void +void pluma_automatic_spell_checker_detach_view ( PlumaAutomaticSpellChecker *spell, PlumaView *view) diff --git a/plugins/spell/pluma-automatic-spell-checker.h b/plugins/spell/pluma-automatic-spell-checker.h index e45c0e38..7fbb75f0 100644 --- a/plugins/spell/pluma-automatic-spell-checker.h +++ b/plugins/spell/pluma-automatic-spell-checker.h @@ -3,7 +3,7 @@ * pluma-automatic-spell-checker.h * This file is part of pluma * - * Copyright (C) 2002 Paolo Maggi + * Copyright (C) 2002 Paolo Maggi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,14 +17,14 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. */ /* - * Modified by the pluma Team, 2002. See the AUTHORS file for a - * list of people on the pluma Team. - * See the ChangeLog files for a list of changes. + * Modified by the pluma Team, 2002. See the AUTHORS file for a + * list of people on the pluma Team. + * See the ChangeLog files for a list of changes. */ /* This is a modified version of gtkspell 2.0.2 (gtkspell.sf.net) */ @@ -48,7 +48,7 @@ PlumaAutomaticSpellChecker *pluma_automatic_spell_checker_new ( PlumaAutomaticSpellChecker *pluma_automatic_spell_checker_get_from_document ( const PlumaDocument *doc); - + void pluma_automatic_spell_checker_free ( PlumaAutomaticSpellChecker *spell); diff --git a/plugins/spell/pluma-spell-checker-dialog.c b/plugins/spell/pluma-spell-checker-dialog.c index 05a69d4b..3689a280 100644 --- a/plugins/spell/pluma-spell-checker-dialog.c +++ b/plugins/spell/pluma-spell-checker-dialog.c @@ -3,7 +3,7 @@ * pluma-spell-checker-dialog.c * This file is part of pluma * - * Copyright (C) 2002 Paolo Maggi + * Copyright (C) 2002 Paolo Maggi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,14 +17,14 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. */ - + /* - * Modified by the pluma Team, 2002. See the AUTHORS file for a - * list of people on the pluma Team. - * See the ChangeLog files for a list of changes. + * Modified by the pluma Team, 2002. See the AUTHORS file for a + * list of people on the pluma Team. + * See the ChangeLog files for a list of changes. */ #ifdef HAVE_CONFIG_H @@ -38,7 +38,7 @@ #include "pluma-spell-checker-dialog.h" #include "pluma-spell-marshal.h" -struct _PlumaSpellCheckerDialog +struct _PlumaSpellCheckerDialog { GtkWindow parent_instance; @@ -77,26 +77,26 @@ enum NUM_COLUMNS }; -static void update_suggestions_list_model (PlumaSpellCheckerDialog *dlg, +static void update_suggestions_list_model (PlumaSpellCheckerDialog *dlg, GSList *suggestions); -static void word_entry_changed_handler (GtkEditable *editable, +static void word_entry_changed_handler (GtkEditable *editable, PlumaSpellCheckerDialog *dlg); -static void close_button_clicked_handler (GtkButton *button, +static void close_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg); static void suggestions_list_selection_changed_handler (GtkTreeSelection *selection, PlumaSpellCheckerDialog *dlg); -static void check_word_button_clicked_handler (GtkButton *button, +static void check_word_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg); -static void add_word_button_clicked_handler (GtkButton *button, +static void add_word_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg); -static void ignore_button_clicked_handler (GtkButton *button, +static void ignore_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg); -static void ignore_all_button_clicked_handler (GtkButton *button, +static void ignore_all_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg); -static void change_button_clicked_handler (GtkButton *button, +static void change_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg); -static void change_all_button_clicked_handler (GtkButton *button, +static void change_all_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg); static void suggestions_list_row_activated_handler (GtkTreeView *view, GtkTreePath *path, @@ -137,61 +137,61 @@ pluma_spell_checker_dialog_class_init (PlumaSpellCheckerDialogClass * klass) object_class->dispose = pluma_spell_checker_dialog_dispose; - signals[IGNORE] = + signals[IGNORE] = g_signal_new ("ignore", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (PlumaSpellCheckerDialogClass, ignore), NULL, NULL, pluma_marshal_VOID__STRING, - G_TYPE_NONE, - 1, + G_TYPE_NONE, + 1, G_TYPE_STRING); - signals[IGNORE_ALL] = + signals[IGNORE_ALL] = g_signal_new ("ignore_all", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (PlumaSpellCheckerDialogClass, ignore_all), NULL, NULL, pluma_marshal_VOID__STRING, - G_TYPE_NONE, - 1, + G_TYPE_NONE, + 1, G_TYPE_STRING); - signals[CHANGE] = + signals[CHANGE] = g_signal_new ("change", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (PlumaSpellCheckerDialogClass, change), NULL, NULL, pluma_marshal_VOID__STRING_STRING, - G_TYPE_NONE, - 2, + G_TYPE_NONE, + 2, G_TYPE_STRING, G_TYPE_STRING); - - signals[CHANGE_ALL] = + + signals[CHANGE_ALL] = g_signal_new ("change_all", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (PlumaSpellCheckerDialogClass, change_all), NULL, NULL, pluma_marshal_VOID__STRING_STRING, - G_TYPE_NONE, - 2, + G_TYPE_NONE, + 2, G_TYPE_STRING, G_TYPE_STRING); - signals[ADD_WORD_TO_PERSONAL] = + signals[ADD_WORD_TO_PERSONAL] = g_signal_new ("add_word_to_personal", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (PlumaSpellCheckerDialogClass, add_word_to_personal), NULL, NULL, pluma_marshal_VOID__STRING, - G_TYPE_NONE, - 1, + G_TYPE_NONE, + 1, G_TYPE_STRING); } @@ -216,7 +216,7 @@ create_dialog (PlumaSpellCheckerDialog *dlg, }; gboolean ret; gchar *ui_file; - + g_return_if_fail (dlg != NULL); dlg->spell_checker = NULL; @@ -260,9 +260,9 @@ create_dialog (PlumaSpellCheckerDialog *dlg, gtk_widget_set_sensitive (dlg->change_button, FALSE); gtk_widget_set_sensitive (dlg->change_all_button, FALSE); gtk_widget_set_sensitive (dlg->add_word_button, FALSE); - + gtk_label_set_label (GTK_LABEL (dlg->language_label), ""); - + gtk_container_add (GTK_CONTAINER (dlg), content); g_object_unref (content); @@ -273,14 +273,14 @@ create_dialog (PlumaSpellCheckerDialog *dlg, dlg->suggestions_list_model = GTK_TREE_MODEL ( gtk_list_store_new (NUM_COLUMNS, G_TYPE_STRING)); - gtk_tree_view_set_model (GTK_TREE_VIEW (dlg->suggestions_list), + gtk_tree_view_set_model (GTK_TREE_VIEW (dlg->suggestions_list), dlg->suggestions_list_model); /* Add the suggestions column */ cell = gtk_cell_renderer_text_new (); - column = gtk_tree_view_column_new_with_attributes (_("Suggestions"), cell, + column = gtk_tree_view_column_new_with_attributes (_("Suggestions"), cell, "text", COLUMN_SUGGESTIONS, NULL); - + gtk_tree_view_append_column (GTK_TREE_VIEW (dlg->suggestions_list), column); gtk_tree_view_set_search_column (GTK_TREE_VIEW (dlg->suggestions_list), @@ -304,8 +304,8 @@ create_dialog (PlumaSpellCheckerDialog *dlg, G_CALLBACK (word_entry_changed_handler), dlg); g_signal_connect (dlg->close_button, "clicked", G_CALLBACK (close_button_clicked_handler), dlg); - g_signal_connect (selection, "changed", - G_CALLBACK (suggestions_list_selection_changed_handler), + g_signal_connect (selection, "changed", + G_CALLBACK (suggestions_list_selection_changed_handler), dlg); g_signal_connect (dlg->check_word_button, "clicked", G_CALLBACK (check_word_button_clicked_handler), dlg); @@ -337,7 +337,7 @@ pluma_spell_checker_dialog_new (const gchar *data_dir) g_object_new (PLUMA_TYPE_SPELL_CHECKER_DIALOG, NULL)); g_return_val_if_fail (dlg != NULL, NULL); - + create_dialog (dlg, data_dir); return GTK_WIDGET (dlg); @@ -355,7 +355,7 @@ pluma_spell_checker_dialog_new_from_spell_checker (PlumaSpellChecker *spell, g_object_new (PLUMA_TYPE_SPELL_CHECKER_DIALOG, NULL)); g_return_val_if_fail (dlg != NULL, NULL); - + create_dialog (dlg, data_dir); pluma_spell_checker_dialog_set_spell_checker (dlg, spell); @@ -369,16 +369,16 @@ pluma_spell_checker_dialog_set_spell_checker (PlumaSpellCheckerDialog *dlg, Plum const PlumaSpellCheckerLanguage* language; const gchar *lang; gchar *tmp; - + g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg)); g_return_if_fail (spell != NULL); - + if (dlg->spell_checker != NULL) g_object_unref (dlg->spell_checker); dlg->spell_checker = spell; g_object_ref (dlg->spell_checker); - + language = pluma_spell_checker_get_language (dlg->spell_checker); lang = pluma_spell_checker_language_to_string (language); @@ -396,13 +396,13 @@ pluma_spell_checker_dialog_set_spell_checker (PlumaSpellCheckerDialog *dlg, Plum } void -pluma_spell_checker_dialog_set_misspelled_word (PlumaSpellCheckerDialog *dlg, +pluma_spell_checker_dialog_set_misspelled_word (PlumaSpellCheckerDialog *dlg, const gchar *word, gint len) { gchar *tmp; GSList *sug; - + g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg)); g_return_if_fail (word != NULL); @@ -414,15 +414,15 @@ pluma_spell_checker_dialog_set_misspelled_word (PlumaSpellCheckerDialog *dlg, g_free (dlg->misspelled_word); dlg->misspelled_word = g_strdup (word); - + tmp = g_strdup_printf("<b>%s</b>", word); gtk_label_set_label (GTK_LABEL (dlg->misspelled_word_label), tmp); g_free (tmp); sug = pluma_spell_checker_get_suggestions (dlg->spell_checker, - dlg->misspelled_word, + dlg->misspelled_word, -1); - + update_suggestions_list_model (dlg, sug); /* free the suggestion list */ @@ -431,19 +431,19 @@ pluma_spell_checker_dialog_set_misspelled_word (PlumaSpellCheckerDialog *dlg, gtk_widget_set_sensitive (dlg->ignore_button, TRUE); gtk_widget_set_sensitive (dlg->ignore_all_button, TRUE); - gtk_widget_set_sensitive (dlg->add_word_button, TRUE); + gtk_widget_set_sensitive (dlg->add_word_button, TRUE); } - + static void update_suggestions_list_model (PlumaSpellCheckerDialog *dlg, GSList *suggestions) { GtkListStore *store; GtkTreeIter iter; GtkTreeSelection *sel; - + g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg)); g_return_if_fail (GTK_IS_LIST_STORE (dlg->suggestions_list_model)); - + store = GTK_LIST_STORE (dlg->suggestions_list_model); gtk_list_store_clear (store); @@ -461,7 +461,7 @@ update_suggestions_list_model (PlumaSpellCheckerDialog *dlg, GSList *suggestions gtk_entry_set_text (GTK_ENTRY (dlg->word_entry), ""); gtk_widget_set_sensitive (dlg->suggestions_list, FALSE); - + return; } @@ -488,7 +488,7 @@ static void word_entry_changed_handler (GtkEditable *editable, PlumaSpellCheckerDialog *dlg) { const gchar *text; - + g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg)); text = gtk_entry_get_text (GTK_ENTRY (dlg->word_entry)); @@ -512,11 +512,11 @@ close_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg) { g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg)); - gtk_widget_destroy (GTK_WIDGET (dlg)); + gtk_widget_destroy (GTK_WIDGET (dlg)); } static void -suggestions_list_selection_changed_handler (GtkTreeSelection *selection, +suggestions_list_selection_changed_handler (GtkTreeSelection *selection, PlumaSpellCheckerDialog *dlg) { GtkTreeIter iter; @@ -535,7 +535,7 @@ suggestions_list_selection_changed_handler (GtkTreeSelection *selection, text = g_value_get_string (&value); gtk_entry_set_text (GTK_ENTRY (dlg->word_entry), text); - + g_value_unset (&value); } @@ -544,18 +544,18 @@ check_word_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *d { const gchar *word; gssize len; - + g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg)); word = gtk_entry_get_text (GTK_ENTRY (dlg->word_entry)); len = strlen (word); g_return_if_fail (len > 0); - + if (pluma_spell_checker_check_word (dlg->spell_checker, word, len)) { GtkListStore *store; GtkTreeIter iter; - + store = GTK_LIST_STORE (dlg->suggestions_list_model); gtk_list_store_clear (store); @@ -574,7 +574,7 @@ check_word_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *d sug = pluma_spell_checker_get_suggestions (dlg->spell_checker, word, len); - + update_suggestions_list_model (dlg, sug); /* free the suggestion list */ @@ -586,13 +586,13 @@ check_word_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *d static void add_word_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg) { - gchar *word; - + gchar *word; + g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg)); g_return_if_fail (dlg->misspelled_word != NULL); - pluma_spell_checker_add_word_to_personal (dlg->spell_checker, - dlg->misspelled_word, + pluma_spell_checker_add_word_to_personal (dlg->spell_checker, + dlg->misspelled_word, -1); word = g_strdup (dlg->misspelled_word); @@ -606,7 +606,7 @@ static void ignore_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg) { gchar *word; - + g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg)); g_return_if_fail (dlg->misspelled_word != NULL); @@ -621,12 +621,12 @@ static void ignore_all_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg) { gchar *word; - + g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg)); g_return_if_fail (dlg->misspelled_word != NULL); pluma_spell_checker_add_word_to_session (dlg->spell_checker, - dlg->misspelled_word, + dlg->misspelled_word, -1); word = g_strdup (dlg->misspelled_word); @@ -651,16 +651,16 @@ change_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg) g_return_if_fail (*entry_text != '\0'); change = g_strdup (entry_text); - pluma_spell_checker_set_correction (dlg->spell_checker, - dlg->misspelled_word, -1, + pluma_spell_checker_set_correction (dlg->spell_checker, + dlg->misspelled_word, -1, change, -1); - + word = g_strdup (dlg->misspelled_word); g_signal_emit (G_OBJECT (dlg), signals [CHANGE], 0, word, change); g_free (word); - g_free (change); + g_free (change); } /* double click on one of the suggestions is like clicking on "change" */ @@ -681,7 +681,7 @@ change_all_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *d const gchar *entry_text; gchar *change; gchar *word; - + g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg)); g_return_if_fail (dlg->misspelled_word != NULL); @@ -690,33 +690,33 @@ change_all_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *d g_return_if_fail (*entry_text != '\0'); change = g_strdup (entry_text); - pluma_spell_checker_set_correction (dlg->spell_checker, + pluma_spell_checker_set_correction (dlg->spell_checker, dlg->misspelled_word, -1, change, -1); - + word = g_strdup (dlg->misspelled_word); g_signal_emit (G_OBJECT (dlg), signals [CHANGE_ALL], 0, word, change); g_free (word); - g_free (change); + g_free (change); } -void +void pluma_spell_checker_dialog_set_completed (PlumaSpellCheckerDialog *dlg) { gchar *tmp; - + g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg)); tmp = g_strdup_printf("<b>%s</b>", _("Completed spell checking")); - gtk_label_set_label (GTK_LABEL (dlg->misspelled_word_label), + gtk_label_set_label (GTK_LABEL (dlg->misspelled_word_label), tmp); g_free (tmp); gtk_list_store_clear (GTK_LIST_STORE (dlg->suggestions_list_model)); gtk_entry_set_text (GTK_ENTRY (dlg->word_entry), ""); - + gtk_widget_set_sensitive (dlg->word_entry, FALSE); gtk_widget_set_sensitive (dlg->check_word_button, FALSE); gtk_widget_set_sensitive (dlg->ignore_button, FALSE); diff --git a/plugins/spell/pluma-spell-checker-dialog.h b/plugins/spell/pluma-spell-checker-dialog.h index 61166785..6fadff8d 100644 --- a/plugins/spell/pluma-spell-checker-dialog.h +++ b/plugins/spell/pluma-spell-checker-dialog.h @@ -3,7 +3,7 @@ * pluma-spell-checker-dialog.h * This file is part of pluma * - * Copyright (C) 2002 Paolo Maggi + * Copyright (C) 2002 Paolo Maggi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,14 +17,14 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. */ - + /* - * Modified by the pluma Team, 2002. See the AUTHORS file for a - * list of people on the pluma Team. - * See the ChangeLog files for a list of changes. + * Modified by the pluma Team, 2002. See the AUTHORS file for a + * list of people on the pluma Team. + * See the ChangeLog files for a list of changes. */ #ifndef __PLUMA_SPELL_CHECKER_DIALOG_H__ @@ -47,7 +47,7 @@ typedef struct _PlumaSpellCheckerDialog PlumaSpellCheckerDialog; typedef struct _PlumaSpellCheckerDialogClass PlumaSpellCheckerDialogClass; -struct _PlumaSpellCheckerDialogClass +struct _PlumaSpellCheckerDialogClass { GtkWindowClass parent_class; @@ -57,10 +57,10 @@ struct _PlumaSpellCheckerDialogClass void (*ignore_all) (PlumaSpellCheckerDialog *dlg, const gchar *word); void (*change) (PlumaSpellCheckerDialog *dlg, - const gchar *word, + const gchar *word, const gchar *change_to); void (*change_all) (PlumaSpellCheckerDialog *dlg, - const gchar *word, + const gchar *word, const gchar *change_to); void (*add_word_to_personal) (PlumaSpellCheckerDialog *dlg, const gchar *word); @@ -71,21 +71,21 @@ GType pluma_spell_checker_dialog_get_type (void) G_GNUC_CONST; /* Constructors */ GtkWidget *pluma_spell_checker_dialog_new (const gchar *data_dir); -GtkWidget *pluma_spell_checker_dialog_new_from_spell_checker +GtkWidget *pluma_spell_checker_dialog_new_from_spell_checker (PlumaSpellChecker *spell, const gchar *data_dir); void pluma_spell_checker_dialog_set_spell_checker (PlumaSpellCheckerDialog *dlg, PlumaSpellChecker *spell); -void pluma_spell_checker_dialog_set_misspelled_word - (PlumaSpellCheckerDialog *dlg, - const gchar* word, +void pluma_spell_checker_dialog_set_misspelled_word + (PlumaSpellCheckerDialog *dlg, + const gchar* word, gint len); -void pluma_spell_checker_dialog_set_completed +void pluma_spell_checker_dialog_set_completed (PlumaSpellCheckerDialog *dlg); - + G_END_DECLS #endif /* __PLUMA_SPELL_CHECKER_DIALOG_H__ */ diff --git a/plugins/spell/pluma-spell-checker-language.c b/plugins/spell/pluma-spell-checker-language.c index 960d91cd..f8e1dd19 100644 --- a/plugins/spell/pluma-spell-checker-language.c +++ b/plugins/spell/pluma-spell-checker-language.c @@ -3,7 +3,7 @@ * pluma-spell-checker-language.c * This file is part of pluma * - * Copyright (C) 2006 Paolo Maggi + * Copyright (C) 2006 Paolo Maggi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,14 +17,14 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. */ - + /* - * Modified by the pluma Team, 2006. See the AUTHORS file for a - * list of people on the pluma Team. - * See the ChangeLog files for a list of changes. + * Modified by the pluma Team, 2006. See the AUTHORS file for a + * list of people on the pluma Team. + * See the ChangeLog files for a list of changes. */ /* Part of the code taked from Epiphany. @@ -52,10 +52,10 @@ #define ISOCODESLOCALEDIR ISO_CODES_PREFIX "/share/locale" -struct _PlumaSpellCheckerLanguage +struct _PlumaSpellCheckerLanguage { gchar *abrev; - gchar *name; + gchar *name; }; static gboolean available_languages_initialized = FALSE; @@ -126,7 +126,7 @@ read_iso_3166_entry (xmlTextReaderPtr reader, xmlFree (code); /* g_print ("%s -> %s\n", lcode, name); */ - + g_hash_table_insert (table, lcode, name); } else @@ -242,7 +242,7 @@ create_iso_3166_table (void) table = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, (GDestroyNotify) xmlFree); - + load_iso_entries (3166, (GFunc) read_iso_3166_entry, table); return table; @@ -258,7 +258,7 @@ create_name_for_language (const char *code) g_return_val_if_fail (iso_639_table != NULL, NULL); g_return_val_if_fail (iso_3166_table != NULL, NULL); - + str = g_strsplit (code, "_", -1); len = g_strv_length (str); g_return_val_if_fail (len != 0, NULL); @@ -272,10 +272,10 @@ create_name_for_language (const char *code) else if (len == 2 && langname != NULL) { gchar *locale_code = g_ascii_strdown (str[1], -1); - + localename = (const char *) g_hash_table_lookup (iso_3166_table, locale_code); g_free (locale_code); - + if (localename != NULL) { /* Translators: the first %s is the language name, and @@ -313,14 +313,14 @@ enumerate_dicts (const char * const lang_tag, void * user_data) { gchar *lang_name; - + GTree *dicts = (GTree *)user_data; - + lang_name = create_name_for_language (lang_tag); g_return_if_fail (lang_name != NULL); - + /* g_print ("%s - %s\n", lang_tag, lang_name); */ - + g_tree_replace (dicts, g_strdup (lang_tag), lang_name); } @@ -338,15 +338,15 @@ lang_cmp (const PlumaSpellCheckerLanguage *a, } static gboolean -build_langs_list (const gchar *key, - const gchar *value, +build_langs_list (const gchar *key, + const gchar *value, gpointer data) { PlumaSpellCheckerLanguage *lang = g_new (PlumaSpellCheckerLanguage, 1); - + lang->abrev = g_strdup (key); lang->name = g_strdup (value); - + available_languages = g_slist_insert_sorted (available_languages, lang, (GCompareFunc)lang_cmp); @@ -364,12 +364,12 @@ pluma_spell_checker_get_available_languages (void) return available_languages; g_return_val_if_fail (available_languages == NULL, NULL); - + available_languages_initialized = TRUE; - + broker = enchant_broker_init (); g_return_val_if_fail (broker != NULL, NULL); - + /* Use a GTree to efficiently remove duplicates while building the list */ dicts = g_tree_new_full (key_cmp, NULL, @@ -378,21 +378,21 @@ pluma_spell_checker_get_available_languages (void) iso_639_table = create_iso_639_table (); iso_3166_table = create_iso_3166_table (); - + enchant_broker_list_dicts (broker, enumerate_dicts, dicts); enchant_broker_free (broker); - + g_hash_table_destroy (iso_639_table); g_hash_table_destroy (iso_3166_table); - + iso_639_table = NULL; iso_3166_table = NULL; - + g_tree_foreach (dicts, (GTraverseFunc)build_langs_list, NULL); - + g_tree_destroy (dicts); - + return available_languages; } @@ -412,7 +412,7 @@ const gchar * pluma_spell_checker_language_to_key (const PlumaSpellCheckerLanguage *lang) { g_return_val_if_fail (lang != NULL, NULL); - + return lang->abrev; } diff --git a/plugins/spell/pluma-spell-checker-language.h b/plugins/spell/pluma-spell-checker-language.h index d2ba1c14..39764cd7 100644 --- a/plugins/spell/pluma-spell-checker-language.h +++ b/plugins/spell/pluma-spell-checker-language.h @@ -3,7 +3,7 @@ * pluma-spell-checker-language.h * This file is part of pluma * - * Copyright (C) 2006 Paolo Maggi + * Copyright (C) 2006 Paolo Maggi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,14 +17,14 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. */ - + /* - * Modified by the pluma Team, 2006. See the AUTHORS file for a - * list of people on the pluma Team. - * See the ChangeLog files for a list of changes. + * Modified by the pluma Team, 2006. See the AUTHORS file for a + * list of people on the pluma Team. + * See the ChangeLog files for a list of changes. */ #ifndef __PLUMA_SPELL_CHECKER_LANGUAGE_H__ diff --git a/plugins/spell/pluma-spell-language-dialog.c b/plugins/spell/pluma-spell-language-dialog.c index d5a70127..363d11af 100644 --- a/plugins/spell/pluma-spell-language-dialog.c +++ b/plugins/spell/pluma-spell-language-dialog.c @@ -3,7 +3,7 @@ * pluma-spell-language-dialog.c * This file is part of pluma * - * Copyright (C) 2002 Paolo Maggi + * Copyright (C) 2002 Paolo Maggi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,14 +17,14 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. */ - + /* - * Modified by the pluma Team, 2002. See the AUTHORS file for a - * list of people on the pluma Team. - * See the ChangeLog files for a list of changes. + * Modified by the pluma Team, 2002. See the AUTHORS file for a + * list of people on the pluma Team. + * See the ChangeLog files for a list of changes. */ #ifdef HAVE_CONFIG_H @@ -47,7 +47,7 @@ enum }; -struct _PlumaSpellLanguageDialog +struct _PlumaSpellLanguageDialog { GtkDialog dialog; @@ -58,7 +58,7 @@ struct _PlumaSpellLanguageDialog G_DEFINE_TYPE(PlumaSpellLanguageDialog, pluma_spell_language_dialog, GTK_TYPE_DIALOG) -static void +static void pluma_spell_language_dialog_class_init (PlumaSpellLanguageDialogClass *klass) { /* GObjectClass *object_class = G_OBJECT_CLASS (klass); */ @@ -78,7 +78,7 @@ dialog_response_handler (GtkDialog *dlg, } } -static void +static void scroll_to_selected (GtkTreeView *tree_view) { GtkTreeModel *model; @@ -128,7 +128,7 @@ create_dialog (PlumaSpellLanguageDialog *dlg, "content", NULL }; - + pluma_dialog_add_button (GTK_DIALOG (dlg), _("_Cancel"), "process-stop", GTK_RESPONSE_CANCEL); pluma_dialog_add_button (GTK_DIALOG (dlg), _("_OK"), "gtk-ok", GTK_RESPONSE_OK); pluma_dialog_add_button (GTK_DIALOG (dlg), _("_Help"), "help-browser", GTK_RESPONSE_HELP); @@ -149,13 +149,13 @@ create_dialog (PlumaSpellLanguageDialog *dlg, ui_file = g_build_filename (data_dir, "languages-dialog.ui", NULL); ret = pluma_utils_get_ui_objects (ui_file, - root_objects, + root_objects, &error_widget, "content", &content, "languages_treeview", &dlg->languages_treeview, NULL); g_free (ui_file); - + if (!ret) { gtk_widget_show (error_widget); @@ -184,11 +184,11 @@ create_dialog (PlumaSpellLanguageDialog *dlg, /* Add the encoding column */ cell = gtk_cell_renderer_text_new (); column = gtk_tree_view_column_new_with_attributes (_("Languages"), - cell, + cell, "text", COLUMN_LANGUAGE_NAME, NULL); - + gtk_tree_view_append_column (GTK_TREE_VIEW (dlg->languages_treeview), column); @@ -200,7 +200,7 @@ create_dialog (PlumaSpellLanguageDialog *dlg, G_CALLBACK (scroll_to_selected), dlg); g_signal_connect (dlg->languages_treeview, - "row-activated", + "row-activated", G_CALLBACK (language_row_activated), dlg); } @@ -208,7 +208,7 @@ create_dialog (PlumaSpellLanguageDialog *dlg, static void pluma_spell_language_dialog_init (PlumaSpellLanguageDialog *dlg) { - + } static void @@ -267,7 +267,7 @@ pluma_spell_language_dialog_new (GtkWindow *parent, populate_language_list (dlg, cur_lang); gtk_window_set_transient_for (GTK_WINDOW (dlg), parent); - gtk_widget_grab_focus (dlg->languages_treeview); + gtk_widget_grab_focus (dlg->languages_treeview); return GTK_WIDGET (dlg); } diff --git a/plugins/spell/pluma-spell-language-dialog.h b/plugins/spell/pluma-spell-language-dialog.h index 7c014872..b2a59514 100644 --- a/plugins/spell/pluma-spell-language-dialog.h +++ b/plugins/spell/pluma-spell-language-dialog.h @@ -3,7 +3,7 @@ * pluma-spell-language-dialog.h * This file is part of pluma * - * Copyright (C) 2002 Paolo Maggi + * Copyright (C) 2002 Paolo Maggi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,14 +17,14 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. */ - + /* - * Modified by the pluma Team, 2002. See the AUTHORS file for a - * list of people on the pluma Team. - * See the ChangeLog files for a list of changes. + * Modified by the pluma Team, 2002. See the AUTHORS file for a + * list of people on the pluma Team. + * See the ChangeLog files for a list of changes. */ #ifndef __PLUMA_SPELL_LANGUAGE_DIALOG_H__ @@ -47,7 +47,7 @@ typedef struct _PlumaSpellLanguageDialog PlumaSpellLanguageDialog; typedef struct _PlumaSpellLanguageDialogClass PlumaSpellLanguageDialogClass; -struct _PlumaSpellLanguageDialogClass +struct _PlumaSpellLanguageDialogClass { GtkDialogClass parent_class; }; diff --git a/plugins/spell/pluma-spell-plugin.c b/plugins/spell/pluma-spell-plugin.c index 9c17c76f..b50319ce 100644 --- a/plugins/spell/pluma-spell-plugin.c +++ b/plugins/spell/pluma-spell-plugin.c @@ -1,13 +1,13 @@ /* * pluma-spell-plugin.c - * - * Copyright (C) 2002-2005 Paolo Maggi + * + * Copyright (C) 2002-2005 Paolo Maggi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. - * + * * This program 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 @@ -194,7 +194,7 @@ pluma_spell_plugin_dispose (GObject *object) G_OBJECT_CLASS (pluma_spell_plugin_parent_class)->dispose (object); } -static void +static void set_spell_language_cb (PlumaSpellChecker *spell, const PlumaSpellCheckerLanguage *lang, PlumaDocument *doc) @@ -278,9 +278,9 @@ get_spell_checker_from_document (PlumaDocument *doc) set_language_from_metadata (spell, doc); - g_object_set_qdata_full (G_OBJECT (doc), - spell_checker_id, - spell, + g_object_set_qdata_full (G_OBJECT (doc), + spell_checker_id, + spell, (GDestroyNotify) g_object_unref); g_signal_connect (spell, @@ -327,24 +327,24 @@ update_current (PlumaDocument *doc, range = get_check_range (doc); g_return_if_fail (range != NULL); - gtk_text_buffer_get_iter_at_offset (GTK_TEXT_BUFFER (doc), + gtk_text_buffer_get_iter_at_offset (GTK_TEXT_BUFFER (doc), &iter, current); if (!gtk_text_iter_inside_word (&iter)) - { + { /* if we're not inside a word, * we must be in some spaces. * skip forward to the beginning of the next word. */ if (!gtk_text_iter_is_end (&iter)) { gtk_text_iter_forward_word_end (&iter); - gtk_text_iter_backward_word_start (&iter); + gtk_text_iter_backward_word_start (&iter); } } else { if (!gtk_text_iter_starts_word (&iter)) - gtk_text_iter_backward_word_start (&iter); + gtk_text_iter_backward_word_start (&iter); } gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (doc), @@ -352,7 +352,7 @@ update_current (PlumaDocument *doc, range->end_mark); if (gtk_text_iter_compare (&end_iter, &iter) < 0) - { + { gtk_text_buffer_move_mark (GTK_TEXT_BUFFER (doc), range->current_mark, &end_iter); @@ -394,9 +394,9 @@ set_check_range (PlumaDocument *doc, range->current_mark = gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (doc), "check_range_current_mark", &iter, TRUE); - g_object_set_qdata_full (G_OBJECT (doc), - check_range_id, - range, + g_object_set_qdata_full (G_OBJECT (doc), + check_range_id, + range, (GDestroyNotify)g_free); } @@ -455,12 +455,12 @@ get_current_word (PlumaDocument *doc, gint *start, gint *end) range = get_check_range (doc); g_return_val_if_fail (range != NULL, NULL); - gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (doc), + gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (doc), &end_iter, range->end_mark); range_end = gtk_text_iter_get_offset (&end_iter); - gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (doc), + gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (doc), ¤t_iter, range->current_mark); end_iter = current_iter; @@ -501,7 +501,7 @@ goto_next_word (PlumaDocument *doc) range = get_check_range (doc); g_return_val_if_fail (range != NULL, FALSE); - gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (doc), + gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (doc), ¤t_iter, range->current_mark); gtk_text_buffer_get_end_iter (GTK_TEXT_BUFFER (doc), &end_iter); @@ -607,7 +607,7 @@ ignore_cb (PlumaSpellCheckerDialog *dlg, if (word == NULL) { pluma_spell_checker_dialog_set_completed (dlg); - + return; } @@ -1076,7 +1076,7 @@ update_ui (PlumaSpellPlugin *plugin) { action = gtk_action_group_get_action (data->action_group, "AutoSpell"); - + g_signal_handlers_block_by_func (action, auto_spell_cb, plugin); set_auto_spell (window, doc, autospell); @@ -1127,7 +1127,7 @@ set_auto_spell_from_metadata (PlumaSpellPlugin *plugin, if (active_str) { active = *active_str == '1'; - + g_free (active_str); } @@ -1141,7 +1141,7 @@ set_auto_spell_from_metadata (PlumaSpellPlugin *plugin, if (active_doc == doc && action_group != NULL) { GtkAction *action; - + action = gtk_action_group_get_action (action_group, "AutoSpell"); @@ -1256,7 +1256,7 @@ tab_removed_cb (PlumaWindow *window, PlumaDocument *doc; doc = pluma_tab_get_document (tab); - + g_signal_handlers_disconnect_by_func (doc, on_document_loaded, plugin); g_signal_handlers_disconnect_by_func (doc, on_document_saved, plugin); } @@ -1279,13 +1279,13 @@ pluma_spell_plugin_activate (PeasActivatable *activatable) manager = pluma_window_get_ui_manager (window); data->action_group = gtk_action_group_new ("PlumaSpellPluginActions"); - gtk_action_group_set_translation_domain (data->action_group, + gtk_action_group_set_translation_domain (data->action_group, GETTEXT_PACKAGE); gtk_action_group_add_actions (data->action_group, action_entries, G_N_ELEMENTS (action_entries), plugin); - gtk_action_group_add_toggle_actions (data->action_group, + gtk_action_group_add_toggle_actions (data->action_group, toggle_action_entries, G_N_ELEMENTS (toggle_action_entries), plugin); @@ -1295,7 +1295,7 @@ pluma_spell_plugin_activate (PeasActivatable *activatable) data->ui_id = gtk_ui_manager_new_merge_id (manager); data->message_cid = gtk_statusbar_get_context_id - (GTK_STATUSBAR (pluma_window_get_statusbar (window)), + (GTK_STATUSBAR (pluma_window_get_statusbar (window)), "spell_plugin_message"); gtk_ui_manager_add_ui (manager, @@ -1303,23 +1303,23 @@ pluma_spell_plugin_activate (PeasActivatable *activatable) MENU_PATH, "CheckSpell", "CheckSpell", - GTK_UI_MANAGER_MENUITEM, + GTK_UI_MANAGER_MENUITEM, FALSE); - gtk_ui_manager_add_ui (manager, - data->ui_id, + gtk_ui_manager_add_ui (manager, + data->ui_id, MENU_PATH, - "AutoSpell", "AutoSpell", - GTK_UI_MANAGER_MENUITEM, + "AutoSpell", + GTK_UI_MANAGER_MENUITEM, FALSE); - gtk_ui_manager_add_ui (manager, - data->ui_id, + gtk_ui_manager_add_ui (manager, + data->ui_id, MENU_PATH, - "ConfigSpell", "ConfigSpell", - GTK_UI_MANAGER_MENUITEM, + "ConfigSpell", + GTK_UI_MANAGER_MENUITEM, FALSE); update_ui (plugin); diff --git a/plugins/spell/pluma-spell-plugin.h b/plugins/spell/pluma-spell-plugin.h index aa45eb63..cecde9ce 100644 --- a/plugins/spell/pluma-spell-plugin.h +++ b/plugins/spell/pluma-spell-plugin.h @@ -1,7 +1,7 @@ /* * pluma-spell-plugin.h - * - * Copyright (C) 2002-2005 Paolo Maggi + * + * Copyright (C) 2002-2005 Paolo Maggi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/plugins/spell/pluma-spell-utils.c b/plugins/spell/pluma-spell-utils.c index 24a211c8..6898fa34 100644 --- a/plugins/spell/pluma-spell-utils.c +++ b/plugins/spell/pluma-spell-utils.c @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301 USA */ diff --git a/plugins/spell/pluma-spell-utils.h b/plugins/spell/pluma-spell-utils.h index a9d2eaf2..c0d5ffac 100644 --- a/plugins/spell/pluma-spell-utils.h +++ b/plugins/spell/pluma-spell-utils.h @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301 USA */ diff --git a/plugins/taglist/pluma-taglist-plugin-panel.c b/plugins/taglist/pluma-taglist-plugin-panel.c index 3c1b39a3..b489f5a0 100644 --- a/plugins/taglist/pluma-taglist-plugin-panel.c +++ b/plugins/taglist/pluma-taglist-plugin-panel.c @@ -64,7 +64,7 @@ struct _PlumaTaglistPluginPanelPrivate GtkWidget *preview; TagGroup *selected_tag_group; - + gchar *data_dir; }; @@ -132,7 +132,7 @@ static void pluma_taglist_plugin_panel_finalize (GObject *object) { PlumaTaglistPluginPanel *panel = PLUMA_TAGLIST_PLUGIN_PANEL (object); - + g_free (panel->priv->data_dir); G_OBJECT_CLASS (pluma_taglist_plugin_panel_parent_class)->finalize (object); @@ -436,7 +436,7 @@ selected_group_changed (GtkComboBox *combo, populate_tags_list (panel); } - + /* Clean up preview */ gtk_label_set_text (GTK_LABEL (panel->priv->preview), ""); @@ -783,9 +783,9 @@ pluma_taglist_plugin_panel_new (PlumaWindow *window, panel = g_object_new (PLUMA_TYPE_TAGLIST_PLUGIN_PANEL, "window", window, NULL); - + panel->priv->data_dir = g_strdup (data_dir); - + return GTK_WIDGET (panel); } diff --git a/plugins/taglist/pluma-taglist-plugin-panel.h b/plugins/taglist/pluma-taglist-plugin-panel.h index 346dbd37..6d41180d 100644 --- a/plugins/taglist/pluma-taglist-plugin-panel.h +++ b/plugins/taglist/pluma-taglist-plugin-panel.h @@ -2,7 +2,7 @@ * pluma-taglist-plugin-panel.h * This file is part of pluma * - * Copyright (C) 2005 - Paolo Maggi + * Copyright (C) 2005 - Paolo Maggi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,14 +16,14 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ - + /* - * Modified by the pluma Team, 2005. See the AUTHORS file for a - * list of people on the pluma Team. - * See the ChangeLog files for a list of changes. + * Modified by the pluma Team, 2005. See the AUTHORS file for a + * list of people on the pluma Team. + * See the ChangeLog files for a list of changes. * * $Id$ */ @@ -56,7 +56,7 @@ typedef struct _PlumaTaglistPluginPanelPrivate PlumaTaglistPluginPanelPrivate; */ typedef struct _PlumaTaglistPluginPanel PlumaTaglistPluginPanel; -struct _PlumaTaglistPluginPanel +struct _PlumaTaglistPluginPanel { GtkBox vbox; @@ -69,7 +69,7 @@ struct _PlumaTaglistPluginPanel */ typedef struct _PlumaTaglistPluginPanelClass PlumaTaglistPluginPanelClass; -struct _PlumaTaglistPluginPanelClass +struct _PlumaTaglistPluginPanelClass { GtkBoxClass parent_class; }; @@ -78,7 +78,7 @@ struct _PlumaTaglistPluginPanelClass * Public methods */ void _pluma_taglist_plugin_panel_register_type (GTypeModule *module); - + GType pluma_taglist_plugin_panel_get_type (void) G_GNUC_CONST; GtkWidget *pluma_taglist_plugin_panel_new (PlumaWindow *window, diff --git a/plugins/taglist/pluma-taglist-plugin-parser.h b/plugins/taglist/pluma-taglist-plugin-parser.h index d6a3b2f8..a98badb2 100644 --- a/plugins/taglist/pluma-taglist-plugin-parser.h +++ b/plugins/taglist/pluma-taglist-plugin-parser.h @@ -2,7 +2,7 @@ * pluma-taglist-plugin-parser.h * This file is part of pluma * - * Copyright (C) 2002-2005 - Paolo Maggi + * Copyright (C) 2002-2005 - Paolo Maggi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,14 +16,14 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. */ - + /* - * Modified by the pluma Team, 2002-2005. See the AUTHORS file for a - * list of people on the pluma Team. - * See the ChangeLog files for a list of changes. + * Modified by the pluma Team, 2002-2005. See the AUTHORS file for a + * list of people on the pluma Team. + * See the ChangeLog files for a list of changes. * * $Id$ */ diff --git a/plugins/taglist/pluma-taglist-plugin.c b/plugins/taglist/pluma-taglist-plugin.c index bbeec250..49b40cd2 100644 --- a/plugins/taglist/pluma-taglist-plugin.c +++ b/plugins/taglist/pluma-taglist-plugin.c @@ -1,6 +1,6 @@ /* * pluma-taglist-plugin.h - * + * * Copyright (C) 2002-2005 - Paolo Maggi * * This program is free software; you can redistribute it and/or modify @@ -20,9 +20,9 @@ */ /* - * Modified by the pluma Team, 2002-2005. See the AUTHORS file for a - * list of people on the pluma Team. - * See the ChangeLog files for a list of changes. + * Modified by the pluma Team, 2002-2005. See the AUTHORS file for a + * list of people on the pluma Team. + * See the ChangeLog files for a list of changes. * * $Id$ */ @@ -98,7 +98,7 @@ pluma_taglist_plugin_finalize (GObject *object) pluma_debug_message (DEBUG_PLUGINS, "PlumaTaglistPlugin finalizing"); free_taglist (); - + G_OBJECT_CLASS (pluma_taglist_plugin_parent_class)->finalize (object); } @@ -120,9 +120,9 @@ pluma_taglist_plugin_activate (PeasActivatable *activatable) priv->taglist_panel = pluma_taglist_plugin_panel_new (window, data_dir); g_free (data_dir); - pluma_panel_add_item_with_icon (side_panel, + pluma_panel_add_item_with_icon (side_panel, priv->taglist_panel, - _("Tags"), + _("Tags"), "list-add"); } @@ -132,14 +132,14 @@ pluma_taglist_plugin_deactivate (PeasActivatable *activatable) PlumaTaglistPluginPrivate *priv; PlumaWindow *window; PlumaPanel *side_panel; - + pluma_debug (DEBUG_PLUGINS); - + priv = PLUMA_TAGLIST_PLUGIN (activatable)->priv; window = PLUMA_WINDOW (priv->window); side_panel = pluma_window_get_side_panel (window); - pluma_panel_remove_item (side_panel, + pluma_panel_remove_item (side_panel, priv->taglist_panel); } diff --git a/plugins/taglist/pluma-taglist-plugin.h b/plugins/taglist/pluma-taglist-plugin.h index 0ffd1294..4ed84477 100644 --- a/plugins/taglist/pluma-taglist-plugin.h +++ b/plugins/taglist/pluma-taglist-plugin.h @@ -1,6 +1,6 @@ /* * pluma-taglist-plugin.h - * + * * Copyright (C) 2002-2005 - Paolo Maggi * * This program is free software; you can redistribute it and/or modify @@ -20,13 +20,13 @@ */ /* - * Modified by the pluma Team, 2002-2005. See the AUTHORS file for a - * list of people on the pluma Team. - * See the ChangeLog files for a list of changes. + * Modified by the pluma Team, 2002-2005. See the AUTHORS file for a + * list of people on the pluma Team. + * See the ChangeLog files for a list of changes. * * $Id$ */ - + #ifndef __PLUMA_TAGLIST_PLUGIN_H__ #define __PLUMA_TAGLIST_PLUGIN_H__ diff --git a/plugins/time/pluma-time-plugin.h b/plugins/time/pluma-time-plugin.h index 3b9bb7bf..c57d535f 100644 --- a/plugins/time/pluma-time-plugin.h +++ b/plugins/time/pluma-time-plugin.h @@ -1,6 +1,6 @@ /* * pluma-time-plugin.h - * + * * Copyright (C) 2002-2005 - Paolo Maggi * * This program is free software; you can redistribute it and/or modify |