diff options
author | Laurent Napias <[email protected]> | 2019-06-29 10:29:13 +0200 |
---|---|---|
committer | ZenWalker <[email protected]> | 2019-07-06 21:46:58 +0200 |
commit | db655f3fb2f67b695d36369e584fcb598e0e1bea (patch) | |
tree | ff7a4404cb6f0d1d8ca3a08ee50c60641641f1b4 | |
parent | 5153fb08a2e26015d07e7b3805de15d38bd05a9d (diff) | |
download | pluma-db655f3fb2f67b695d36369e584fcb598e0e1bea.tar.bz2 pluma-db655f3fb2f67b695d36369e584fcb598e0e1bea.tar.xz |
Remove trailing whitespaces
139 files changed, 3643 insertions, 3643 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 diff --git a/pluma/bacon-message-connection.c b/pluma/bacon-message-connection.c index 7b353421..0e71fabc 100644 --- a/pluma/bacon-message-connection.c +++ b/pluma/bacon-message-connection.c @@ -83,7 +83,7 @@ is_owned_by_user_and_socket (const char *path) if ((s.st_mode & S_IFSOCK) != S_IFSOCK) return FALSE; - + return TRUE; } diff --git a/pluma/dialogs/pluma-close-confirmation-dialog.c b/pluma/dialogs/pluma-close-confirmation-dialog.c index d1d9aed3..8c48c631 100644 --- a/pluma/dialogs/pluma-close-confirmation-dialog.c +++ b/pluma/dialogs/pluma-close-confirmation-dialog.c @@ -16,13 +16,13 @@ * * 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, 2004-2005. See the AUTHORS file for a - * list of people on the pluma Team. + * Modified by the pluma Team, 2004-2005. See the AUTHORS file for a + * list of people on the pluma Team. * See the ChangeLog files for a list of changes. * * $Id$ @@ -41,9 +41,9 @@ /* Properties */ -enum +enum { - PROP_0, + PROP_0, PROP_UNSAVED_DOCUMENTS, PROP_LOGOUT_MODE }; @@ -64,16 +64,16 @@ enum N_COLUMNS }; -struct _PlumaCloseConfirmationDialogPrivate +struct _PlumaCloseConfirmationDialogPrivate { gboolean logout_mode; GList *unsaved_documents; - + GList *selected_documents; GtkTreeModel *list_store; - + gboolean disable_save_to_disk; }; @@ -92,7 +92,7 @@ static void set_unsaved_document (PlumaCloseConfirmationDialog *dlg, static GList *get_selected_docs (GtkTreeModel *store); -/* Since we connect in the costructor we are sure this handler will be called +/* Since we connect in the costructor we are sure this handler will be called * before the user ones */ static void @@ -105,7 +105,7 @@ response_cb (PlumaCloseConfirmationDialog *dlg, g_return_if_fail (PLUMA_IS_CLOSE_CONFIRMATION_DIALOG (dlg)); priv = dlg->priv; - + if (priv->selected_documents != NULL) g_list_free (priv->selected_documents); @@ -113,7 +113,7 @@ response_cb (PlumaCloseConfirmationDialog *dlg, { if (GET_MODE (priv) == SINGLE_DOC_MODE) { - priv->selected_documents = + priv->selected_documents = g_list_copy (priv->unsaved_documents); } else @@ -133,7 +133,7 @@ set_logout_mode (PlumaCloseConfirmationDialog *dlg, gboolean logout_mode) { dlg->priv->logout_mode = logout_mode; - + if (logout_mode) { gtk_dialog_add_button (GTK_DIALOG (dlg), @@ -156,7 +156,7 @@ set_logout_mode (PlumaCloseConfirmationDialog *dlg, "process-stop", GTK_RESPONSE_CANCEL); } - + if (dlg->priv->disable_save_to_disk) { gtk_dialog_set_default_response (GTK_DIALOG (dlg), @@ -165,14 +165,14 @@ set_logout_mode (PlumaCloseConfirmationDialog *dlg, else { const gchar *icon_id = "document-save"; - + if (GET_MODE (dlg->priv) == SINGLE_DOC_MODE) { PlumaDocument *doc; - + doc = PLUMA_DOCUMENT (dlg->priv->unsaved_documents->data); - - if (pluma_document_get_readonly (doc) || + + if (pluma_document_get_readonly (doc) || pluma_document_is_untitled (doc)) icon_id = "document-save-as"; } @@ -188,28 +188,28 @@ set_logout_mode (PlumaCloseConfirmationDialog *dlg, icon_id, GTK_RESPONSE_YES); - gtk_dialog_set_default_response (GTK_DIALOG (dlg), + gtk_dialog_set_default_response (GTK_DIALOG (dlg), GTK_RESPONSE_YES); } } -static void +static void pluma_close_confirmation_dialog_init (PlumaCloseConfirmationDialog *dlg) { AtkObject *atk_obj; dlg->priv = PLUMA_CLOSE_CONFIRMATION_DIALOG_GET_PRIVATE (dlg); - dlg->priv->disable_save_to_disk = - pluma_app_get_lockdown (pluma_app_get_default ()) + dlg->priv->disable_save_to_disk = + pluma_app_get_lockdown (pluma_app_get_default ()) & PLUMA_LOCKDOWN_SAVE_TO_DISK; - gtk_container_set_border_width (GTK_CONTAINER (dlg), 5); + gtk_container_set_border_width (GTK_CONTAINER (dlg), 5); gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))), 14); gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE); gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dlg), TRUE); - + gtk_window_set_title (GTK_WINDOW (dlg), ""); gtk_window_set_modal (GTK_WINDOW (dlg), TRUE); @@ -218,14 +218,14 @@ pluma_close_confirmation_dialog_init (PlumaCloseConfirmationDialog *dlg) atk_obj = gtk_widget_get_accessible (GTK_WIDGET (dlg)); atk_object_set_role (atk_obj, ATK_ROLE_ALERT); atk_object_set_name (atk_obj, _("Question")); - + g_signal_connect (dlg, "response", G_CALLBACK (response_cb), NULL); } -static void +static void pluma_close_confirmation_dialog_finalize (GObject *object) { PlumaCloseConfirmationDialogPrivate *priv; @@ -243,9 +243,9 @@ pluma_close_confirmation_dialog_finalize (GObject *object) } static void -pluma_close_confirmation_dialog_set_property (GObject *object, - guint prop_id, - const GValue *value, +pluma_close_confirmation_dialog_set_property (GObject *object, + guint prop_id, + const GValue *value, GParamSpec *pspec) { PlumaCloseConfirmationDialog *dlg; @@ -257,7 +257,7 @@ pluma_close_confirmation_dialog_set_property (GObject *object, case PROP_UNSAVED_DOCUMENTS: set_unsaved_document (dlg, g_value_get_pointer (value)); break; - + case PROP_LOGOUT_MODE: set_logout_mode (dlg, g_value_get_boolean (value)); break; @@ -269,9 +269,9 @@ pluma_close_confirmation_dialog_set_property (GObject *object, } static void -pluma_close_confirmation_dialog_get_property (GObject *object, - guint prop_id, - GValue *value, +pluma_close_confirmation_dialog_get_property (GObject *object, + guint prop_id, + GValue *value, GParamSpec *pspec) { PlumaCloseConfirmationDialogPrivate *priv; @@ -294,7 +294,7 @@ pluma_close_confirmation_dialog_get_property (GObject *object, } } -static void +static void pluma_close_confirmation_dialog_class_init (PlumaCloseConfirmationDialogClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); @@ -310,7 +310,7 @@ pluma_close_confirmation_dialog_class_init (PlumaCloseConfirmationDialogClass *k g_param_spec_pointer ("unsaved_documents", "Unsaved Documents", "List of Unsaved Documents", - (G_PARAM_READWRITE | + (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY))); g_object_class_install_property (gobject_class, @@ -319,8 +319,8 @@ pluma_close_confirmation_dialog_class_init (PlumaCloseConfirmationDialogClass *k "Logout Mode", "Whether the dialog is in logout mode", FALSE, - (G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY))); + (G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY))); } static GList * @@ -338,7 +338,7 @@ get_selected_docs (GtkTreeModel *store) gboolean to_save; PlumaDocument *doc; - gtk_tree_model_get (store, &iter, + gtk_tree_model_get (store, &iter, SAVE_COLUMN, &to_save, DOC_COLUMN, &doc, -1); @@ -362,7 +362,7 @@ pluma_close_confirmation_dialog_get_selected_documents (PlumaCloseConfirmationDi } GtkWidget * -pluma_close_confirmation_dialog_new (GtkWindow *parent, +pluma_close_confirmation_dialog_new (GtkWindow *parent, GList *unsaved_documents, gboolean logout_mode) { @@ -379,28 +379,28 @@ pluma_close_confirmation_dialog_new (GtkWindow *parent, { gtk_window_group_add_window (pluma_window_get_group (PLUMA_WINDOW (parent)), GTK_WINDOW (dlg)); - - gtk_window_set_transient_for (GTK_WINDOW (dlg), parent); + + gtk_window_set_transient_for (GTK_WINDOW (dlg), parent); } return dlg; } GtkWidget * -pluma_close_confirmation_dialog_new_single (GtkWindow *parent, +pluma_close_confirmation_dialog_new_single (GtkWindow *parent, PlumaDocument *doc, gboolean logout_mode) { GtkWidget *dlg; GList *unsaved_documents; g_return_val_if_fail (doc != NULL, NULL); - + unsaved_documents = g_list_prepend (NULL, doc); - dlg = pluma_close_confirmation_dialog_new (parent, + dlg = pluma_close_confirmation_dialog_new (parent, unsaved_documents, logout_mode); - + g_list_free (unsaved_documents); return dlg; @@ -411,10 +411,10 @@ get_text_secondary_label (PlumaDocument *doc) { glong seconds; gchar *secondary_msg; - + seconds = MAX (1, _pluma_document_get_seconds_since_last_save_or_load (doc)); - if (seconds < 55) + if (seconds < 55) { secondary_msg = g_strdup_printf ( ngettext ("If you don't save, changes from the last %ld second " @@ -543,7 +543,7 @@ build_single_doc_dialog (PlumaCloseConfirmationDialog *dlg) /* Secondary label */ if (dlg->priv->disable_save_to_disk) - str = g_strdup (_("Saving has been disabled by the system administrator.")); + str = g_strdup (_("Saving has been disabled by the system administrator.")); else str = get_text_secondary_label (doc); secondary_label = gtk_label_new (str); @@ -560,17 +560,17 @@ build_single_doc_dialog (PlumaCloseConfirmationDialog *dlg) gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); - + gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), primary_label, FALSE, FALSE, 0); - + gtk_box_pack_start (GTK_BOX (vbox), secondary_label, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))), - hbox, - FALSE, - FALSE, + hbox, + FALSE, + FALSE, 0); gtk_widget_show_all (hbox); @@ -643,7 +643,7 @@ create_treeview (PlumaCloseConfirmationDialogPrivate *priv) g_object_unref (store); priv->list_store = GTK_TREE_MODEL (store); - + /* Add columns */ if (!priv->disable_save_to_disk) { @@ -734,11 +734,11 @@ build_multiple_docs_dialog (PlumaCloseConfirmationDialog *dlg) markup_str = g_strconcat ("<span weight=\"bold\" size=\"larger\">", str, "</span>", NULL); g_free (str); - + gtk_label_set_markup (GTK_LABEL (primary_label), markup_str); g_free (markup_str); gtk_box_pack_start (GTK_BOX (vbox), primary_label, FALSE, FALSE, 0); - + vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8); gtk_box_pack_start (GTK_BOX (vbox), vbox2, FALSE, FALSE, 0); @@ -757,10 +757,10 @@ build_multiple_docs_dialog (PlumaCloseConfirmationDialog *dlg) scrolledwindow = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_propagate_natural_height (GTK_SCROLLED_WINDOW (scrolledwindow), TRUE); gtk_box_pack_start (GTK_BOX (vbox2), scrolledwindow, TRUE, TRUE, 0); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow), - GTK_POLICY_AUTOMATIC, + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow), + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow), + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow), GTK_SHADOW_IN); treeview = create_treeview (priv); @@ -807,7 +807,7 @@ set_unsaved_document (PlumaCloseConfirmationDialog *dlg, { PlumaCloseConfirmationDialogPrivate *priv; - g_return_if_fail (list != NULL); + g_return_if_fail (list != NULL); priv = dlg->priv; g_return_if_fail (priv->unsaved_documents == NULL); @@ -821,7 +821,7 @@ set_unsaved_document (PlumaCloseConfirmationDialog *dlg, else { build_multiple_docs_dialog (dlg); - } + } } const GList * diff --git a/pluma/dialogs/pluma-close-confirmation-dialog.h b/pluma/dialogs/pluma-close-confirmation-dialog.h index 85d4dc4e..47b29346 100644 --- a/pluma/dialogs/pluma-close-confirmation-dialog.h +++ b/pluma/dialogs/pluma-close-confirmation-dialog.h @@ -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, 2004-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, 2004-2005. See the AUTHORS file for a + * list of people on the pluma Team. + * See the ChangeLog files for a list of changes. */ #ifndef __PLUMA_CLOSE_CONFIRMATION_DIALOG_H__ @@ -45,7 +45,7 @@ typedef struct _PlumaCloseConfirmationDialog PlumaCloseConfirmationDialog; typedef struct _PlumaCloseConfirmationDialogClass PlumaCloseConfirmationDialogClass; typedef struct _PlumaCloseConfirmationDialogPrivate PlumaCloseConfirmationDialogPrivate; -struct _PlumaCloseConfirmationDialog +struct _PlumaCloseConfirmationDialog { GtkDialog parent; @@ -53,7 +53,7 @@ struct _PlumaCloseConfirmationDialog PlumaCloseConfirmationDialogPrivate *priv; }; -struct _PlumaCloseConfirmationDialogClass +struct _PlumaCloseConfirmationDialogClass { GtkDialogClass parent_class; }; @@ -63,7 +63,7 @@ GType pluma_close_confirmation_dialog_get_type (void) G_GNUC_CONST; GtkWidget *pluma_close_confirmation_dialog_new (GtkWindow *parent, GList *unsaved_documents, gboolean logout_mode); -GtkWidget *pluma_close_confirmation_dialog_new_single (GtkWindow *parent, +GtkWidget *pluma_close_confirmation_dialog_new_single (GtkWindow *parent, PlumaDocument *doc, gboolean logout_mode); diff --git a/pluma/dialogs/pluma-encodings-dialog.c b/pluma/dialogs/pluma-encodings-dialog.c index cc94178b..3845a1b2 100644 --- a/pluma/dialogs/pluma-encodings-dialog.c +++ b/pluma/dialogs/pluma-encodings-dialog.c @@ -2,7 +2,7 @@ * pluma-encodings-dialog.c * 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$ */ @@ -93,7 +93,7 @@ enum { static void count_selected_items_func (GtkTreeModel *model, GtkTreePath *path, - GtkTreeIter *iter, + GtkTreeIter *iter, gpointer data) { int *count = data; @@ -132,7 +132,7 @@ displayed_selection_changed_callback (GtkTreeSelection *selection, static void get_selected_encodings_func (GtkTreeModel *model, GtkTreePath *path, - GtkTreeIter *iter, + GtkTreeIter *iter, gpointer data) { GSList **list = data; @@ -220,7 +220,7 @@ remove_button_clicked_callback (GtkWidget *button, &encodings); tmp = encodings; - while (tmp != NULL) + while (tmp != NULL) { dialog->priv->show_in_menu_list = g_slist_remove (dialog->priv->show_in_menu_list, tmp->data); @@ -269,7 +269,7 @@ init_shown_in_menu_tree_model (PlumaEncodingsDialog *dialog) g_slist_free (list); } -static void +static void response_handler (GtkDialog *dialog, gint response_id, PlumaEncodingsDialog *dlg) @@ -308,14 +308,14 @@ pluma_encodings_dialog_init (PlumaEncodingsDialog *dlg) }; dlg->priv = PLUMA_ENCODINGS_DIALOG_GET_PRIVATE (dlg); - + 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); gtk_window_set_title (GTK_WINDOW (dlg), _("Character Encodings")); gtk_window_set_default_size (GTK_WINDOW (dlg), 650, 400); - + /* HIG defaults */ gtk_container_set_border_width (GTK_CONTAINER (dlg), 5); gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))), @@ -348,7 +348,7 @@ pluma_encodings_dialog_init (PlumaEncodingsDialog *dlg) gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))), error_widget, TRUE, TRUE, 0); - gtk_container_set_border_width (GTK_CONTAINER (error_widget), 5); + gtk_container_set_border_width (GTK_CONTAINER (error_widget), 5); return; } @@ -356,7 +356,7 @@ pluma_encodings_dialog_init (PlumaEncodingsDialog *dlg) gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))), content, TRUE, TRUE, 0); g_object_unref (content); - gtk_container_set_border_width (GTK_CONTAINER (content), 5); + gtk_container_set_border_width (GTK_CONTAINER (content), 5); gtk_button_set_image (GTK_BUTTON (dlg->priv->add_button), gtk_image_new_from_icon_name ("list-add", GTK_ICON_SIZE_BUTTON)); gtk_button_set_image (GTK_BUTTON (dlg->priv->remove_button), gtk_image_new_from_icon_name ("list-remove", GTK_ICON_SIZE_BUTTON)); @@ -396,7 +396,7 @@ pluma_encodings_dialog_init (PlumaEncodingsDialog *dlg) /* Add the data */ i = 0; - while ((enc = pluma_encoding_get_from_index (i)) != NULL) + while ((enc = pluma_encoding_get_from_index (i)) != NULL) { gtk_list_store_append (dlg->priv->available_liststore, &parent_iter); diff --git a/pluma/dialogs/pluma-encodings-dialog.h b/pluma/dialogs/pluma-encodings-dialog.h index f191fbc9..0b0bf183 100644 --- a/pluma/dialogs/pluma-encodings-dialog.h +++ b/pluma/dialogs/pluma-encodings-dialog.h @@ -2,7 +2,7 @@ * pluma-encodings-dialog.h * This file is part of pluma * - * Copyright (C) 2003-2005 Paolo Maggi + * Copyright (C) 2003-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, 2003-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, 2003-2005. See the AUTHORS file for a + * list of people on the pluma Team. + * See the ChangeLog files for a list of changes. * * $Id$ */ @@ -55,7 +55,7 @@ typedef struct _PlumaEncodingsDialogPrivate PlumaEncodingsDialogPrivate; */ typedef struct _PlumaEncodingsDialog PlumaEncodingsDialog; -struct _PlumaEncodingsDialog +struct _PlumaEncodingsDialog { GtkDialog dialog; @@ -68,7 +68,7 @@ struct _PlumaEncodingsDialog */ typedef struct _PlumaEncodingsDialogClass PlumaEncodingsDialogClass; -struct _PlumaEncodingsDialogClass +struct _PlumaEncodingsDialogClass { GtkDialogClass parent_class; }; diff --git a/pluma/dialogs/pluma-preferences-dialog.c b/pluma/dialogs/pluma-preferences-dialog.c index 771726a9..a2b575b1 100644 --- a/pluma/dialogs/pluma-preferences-dialog.c +++ b/pluma/dialogs/pluma-preferences-dialog.c @@ -3,7 +3,7 @@ * pluma-preferences-dialog.c * This file is part of pluma * - * Copyright (C) 2001-2005 Paolo Maggi + * Copyright (C) 2001-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 @@ -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, 2001-2003. 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, 2001-2003. See the AUTHORS file for a + * list of people on the pluma Team. + * See the ChangeLog files for a list of changes. * * $Id$ */ @@ -96,7 +96,7 @@ struct _PlumaPreferencesDialogPrivate GtkWidget *schemes_treeview; GtkWidget *install_scheme_button; GtkWidget *uninstall_scheme_button; - + GtkWidget *install_scheme_file_schooser; /* Tabs */ @@ -123,16 +123,16 @@ struct _PlumaPreferencesDialogPrivate GtkWidget *auto_save_checkbutton; GtkWidget *auto_save_spinbutton; GtkWidget *autosave_hbox; - + /* Line numbers */ GtkWidget *display_line_numbers_checkbutton; /* Highlight current line */ GtkWidget *highlight_current_line_checkbutton; - + /* Highlight matching bracket */ GtkWidget *bracket_matching_checkbutton; - + /* Right margin */ GtkWidget *right_margin_checkbutton; GtkWidget *right_margin_position_spinbutton; @@ -149,7 +149,7 @@ struct _PlumaPreferencesDialogPrivate G_DEFINE_TYPE(PlumaPreferencesDialog, pluma_preferences_dialog, GTK_TYPE_DIALOG) -static void +static void pluma_preferences_dialog_class_init (PlumaPreferencesDialogClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); @@ -158,7 +158,7 @@ pluma_preferences_dialog_class_init (PlumaPreferencesDialogClass *klass) } static void -dialog_response_handler (GtkDialog *dlg, +dialog_response_handler (GtkDialog *dlg, gint res_id) { pluma_debug (DEBUG_PREFS); @@ -189,7 +189,7 @@ tabs_width_spinbutton_value_changed (GtkSpinButton *spin_button, pluma_prefs_manager_set_tabs_size (gtk_spin_button_get_value_as_int (spin_button)); } - + static void insert_spaces_checkbutton_toggled (GtkToggleButton *button, PlumaPreferencesDialog *dlg) @@ -317,12 +317,12 @@ auto_save_checkbutton_toggled (GtkToggleButton *button, if (gtk_toggle_button_get_active (button)) { - gtk_widget_set_sensitive (dlg->priv->auto_save_spinbutton, + gtk_widget_set_sensitive (dlg->priv->auto_save_spinbutton, pluma_prefs_manager_auto_save_interval_can_set()); pluma_prefs_manager_set_auto_save (TRUE); } - else + else { gtk_widget_set_sensitive (dlg->priv->auto_save_spinbutton, FALSE); pluma_prefs_manager_set_auto_save (FALSE); @@ -336,7 +336,7 @@ backup_copy_checkbutton_toggled (GtkToggleButton *button, pluma_debug (DEBUG_PREFS); g_return_if_fail (button == GTK_TOGGLE_BUTTON (dlg->priv->backup_copy_checkbutton)); - + pluma_prefs_manager_set_create_backup_copy (gtk_toggle_button_get_active (button)); } @@ -410,7 +410,7 @@ setup_editor_page (PlumaPreferencesDialog *dlg) auto_save_interval); /* Set widget sensitivity */ - gtk_widget_set_sensitive (dlg->priv->tabs_width_hbox, + gtk_widget_set_sensitive (dlg->priv->tabs_width_hbox, pluma_prefs_manager_tabs_size_can_set ()); gtk_widget_set_sensitive (dlg->priv->insert_spaces_checkbutton, pluma_prefs_manager_insert_spaces_can_set ()); @@ -424,9 +424,9 @@ setup_editor_page (PlumaPreferencesDialog *dlg) pluma_prefs_manager_draw_newlines_can_set ()); gtk_widget_set_sensitive (dlg->priv->backup_copy_checkbutton, pluma_prefs_manager_create_backup_copy_can_set ()); - gtk_widget_set_sensitive (dlg->priv->autosave_hbox, - pluma_prefs_manager_auto_save_can_set ()); - gtk_widget_set_sensitive (dlg->priv->auto_save_spinbutton, + gtk_widget_set_sensitive (dlg->priv->autosave_hbox, + pluma_prefs_manager_auto_save_can_set ()); + gtk_widget_set_sensitive (dlg->priv->auto_save_spinbutton, auto_save && pluma_prefs_manager_auto_save_interval_can_set ()); @@ -481,7 +481,7 @@ static void display_line_numbers_checkbutton_toggled (GtkToggleButton *button, PlumaPreferencesDialog *dlg) { - g_return_if_fail (button == + g_return_if_fail (button == GTK_TOGGLE_BUTTON (dlg->priv->display_line_numbers_checkbutton)); pluma_prefs_manager_set_display_line_numbers (gtk_toggle_button_get_active (button)); @@ -491,7 +491,7 @@ static void highlight_current_line_checkbutton_toggled (GtkToggleButton *button, PlumaPreferencesDialog *dlg) { - g_return_if_fail (button == + g_return_if_fail (button == GTK_TOGGLE_BUTTON (dlg->priv->highlight_current_line_checkbutton)); pluma_prefs_manager_set_highlight_current_line (gtk_toggle_button_get_active (button)); @@ -501,7 +501,7 @@ static void bracket_matching_checkbutton_toggled (GtkToggleButton *button, PlumaPreferencesDialog *dlg) { - g_return_if_fail (button == + g_return_if_fail (button == GTK_TOGGLE_BUTTON (dlg->priv->bracket_matching_checkbutton)); pluma_prefs_manager_set_bracket_matching ( @@ -511,21 +511,21 @@ bracket_matching_checkbutton_toggled (GtkToggleButton *button, static gboolean split_button_state = TRUE; static void -wrap_mode_checkbutton_toggled (GtkToggleButton *button, +wrap_mode_checkbutton_toggled (GtkToggleButton *button, PlumaPreferencesDialog *dlg) { if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dlg->priv->wrap_text_checkbutton))) { pluma_prefs_manager_set_wrap_mode (GTK_WRAP_NONE); - - gtk_widget_set_sensitive (dlg->priv->split_checkbutton, + + gtk_widget_set_sensitive (dlg->priv->split_checkbutton, FALSE); gtk_toggle_button_set_inconsistent ( GTK_TOGGLE_BUTTON (dlg->priv->split_checkbutton), TRUE); } else { - gtk_widget_set_sensitive (dlg->priv->split_checkbutton, + gtk_widget_set_sensitive (dlg->priv->split_checkbutton, TRUE); gtk_toggle_button_set_inconsistent ( @@ -535,13 +535,13 @@ wrap_mode_checkbutton_toggled (GtkToggleButton *button, if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dlg->priv->split_checkbutton))) { split_button_state = TRUE; - + pluma_prefs_manager_set_wrap_mode (GTK_WRAP_WORD); } else { split_button_state = FALSE; - + pluma_prefs_manager_set_wrap_mode (GTK_WRAP_CHAR); } } @@ -552,24 +552,24 @@ right_margin_checkbutton_toggled (GtkToggleButton *button, PlumaPreferencesDialog *dlg) { gboolean active; - + g_return_if_fail (button == GTK_TOGGLE_BUTTON (dlg->priv->right_margin_checkbutton)); active = gtk_toggle_button_get_active (button); - + pluma_prefs_manager_set_display_right_margin (active); gtk_widget_set_sensitive (dlg->priv->right_margin_position_hbox, - active && + active && pluma_prefs_manager_right_margin_position_can_set ()); } static void -right_margin_position_spinbutton_value_changed (GtkSpinButton *spin_button, +right_margin_position_spinbutton_value_changed (GtkSpinButton *spin_button, PlumaPreferencesDialog *dlg) { gint value; - + g_return_if_fail (spin_button == GTK_SPIN_BUTTON (dlg->priv->right_margin_position_spinbutton)); value = CLAMP (gtk_spin_button_get_value_as_int (spin_button), 1, 160); @@ -585,14 +585,14 @@ setup_view_page (PlumaPreferencesDialog *dlg) gboolean wrap_mode_can_set; pluma_debug (DEBUG_PREFS); - + /* Set initial state */ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->display_line_numbers_checkbutton), pluma_prefs_manager_get_display_line_numbers ()); - + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->highlight_current_line_checkbutton), pluma_prefs_manager_get_highlight_current_line ()); - + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->bracket_matching_checkbutton), pluma_prefs_manager_get_bracket_matching ()); @@ -622,15 +622,15 @@ setup_view_page (PlumaPreferencesDialog *dlg) } display_right_margin = pluma_prefs_manager_get_display_right_margin (); - + gtk_toggle_button_set_active ( - GTK_TOGGLE_BUTTON (dlg->priv->right_margin_checkbutton), + GTK_TOGGLE_BUTTON (dlg->priv->right_margin_checkbutton), display_right_margin); - + gtk_spin_button_set_value ( GTK_SPIN_BUTTON (dlg->priv->right_margin_position_spinbutton), (guint)CLAMP (pluma_prefs_manager_get_right_margin_position (), 1, 160)); - + /* Set widgets sensitivity */ gtk_widget_set_sensitive (dlg->priv->display_line_numbers_checkbutton, pluma_prefs_manager_display_line_numbers_can_set ()); @@ -639,45 +639,45 @@ setup_view_page (PlumaPreferencesDialog *dlg) gtk_widget_set_sensitive (dlg->priv->bracket_matching_checkbutton, pluma_prefs_manager_bracket_matching_can_set ()); wrap_mode_can_set = pluma_prefs_manager_wrap_mode_can_set (); - gtk_widget_set_sensitive (dlg->priv->wrap_text_checkbutton, + gtk_widget_set_sensitive (dlg->priv->wrap_text_checkbutton, wrap_mode_can_set); - gtk_widget_set_sensitive (dlg->priv->split_checkbutton, - wrap_mode_can_set && + gtk_widget_set_sensitive (dlg->priv->split_checkbutton, + wrap_mode_can_set && (wrap_mode != GTK_WRAP_NONE)); gtk_widget_set_sensitive (dlg->priv->right_margin_checkbutton, pluma_prefs_manager_display_right_margin_can_set ()); gtk_widget_set_sensitive (dlg->priv->right_margin_position_hbox, - display_right_margin && + display_right_margin && pluma_prefs_manager_right_margin_position_can_set ()); - + /* Connect signals */ g_signal_connect (dlg->priv->display_line_numbers_checkbutton, "toggled", - G_CALLBACK (display_line_numbers_checkbutton_toggled), + G_CALLBACK (display_line_numbers_checkbutton_toggled), dlg); g_signal_connect (dlg->priv->highlight_current_line_checkbutton, - "toggled", - G_CALLBACK (highlight_current_line_checkbutton_toggled), + "toggled", + G_CALLBACK (highlight_current_line_checkbutton_toggled), dlg); g_signal_connect (dlg->priv->bracket_matching_checkbutton, - "toggled", - G_CALLBACK (bracket_matching_checkbutton_toggled), + "toggled", + G_CALLBACK (bracket_matching_checkbutton_toggled), dlg); g_signal_connect (dlg->priv->wrap_text_checkbutton, - "toggled", - G_CALLBACK (wrap_mode_checkbutton_toggled), + "toggled", + G_CALLBACK (wrap_mode_checkbutton_toggled), dlg); g_signal_connect (dlg->priv->split_checkbutton, - "toggled", - G_CALLBACK (wrap_mode_checkbutton_toggled), + "toggled", + G_CALLBACK (wrap_mode_checkbutton_toggled), dlg); g_signal_connect (dlg->priv->right_margin_checkbutton, - "toggled", - G_CALLBACK (right_margin_checkbutton_toggled), + "toggled", + G_CALLBACK (right_margin_checkbutton_toggled), dlg); g_signal_connect (dlg->priv->right_margin_position_spinbutton, "value_changed", - G_CALLBACK (right_margin_position_spinbutton_value_changed), + G_CALLBACK (right_margin_position_spinbutton_value_changed), dlg); } @@ -696,7 +696,7 @@ default_font_font_checkbutton_toggled (GtkToggleButton *button, } else { - gtk_widget_set_sensitive (dlg->priv->font_hbox, + gtk_widget_set_sensitive (dlg->priv->font_hbox, pluma_prefs_manager_editor_font_can_set ()); pluma_prefs_manager_set_use_default_font (FALSE); } @@ -739,8 +739,8 @@ setup_font_colors_page_font_section (PlumaPreferencesDialog *dlg) dlg->priv->default_font_checkbutton, ATK_RELATION_CONTROLLED_BY); pluma_utils_set_atk_relation (dlg->priv->default_font_checkbutton, - dlg->priv->font_button, - ATK_RELATION_CONTROLLER_FOR); + dlg->priv->font_button, + ATK_RELATION_CONTROLLER_FOR); editor_font = pluma_prefs_manager_get_system_font (); label = g_strdup_printf(_("_Use the system fixed width font (%s)"), @@ -774,13 +774,13 @@ setup_font_colors_page_font_section (PlumaPreferencesDialog *dlg) dlg); /* Set initial widget sensitivity */ - gtk_widget_set_sensitive (dlg->priv->default_font_checkbutton, + gtk_widget_set_sensitive (dlg->priv->default_font_checkbutton, pluma_prefs_manager_use_default_font_can_set ()); if (use_default_font) gtk_widget_set_sensitive (dlg->priv->font_hbox, FALSE); else - gtk_widget_set_sensitive (dlg->priv->font_hbox, + gtk_widget_set_sensitive (dlg->priv->font_hbox, pluma_prefs_manager_editor_font_can_set ()); } @@ -789,8 +789,8 @@ set_buttons_sensisitivity_according_to_scheme (PlumaPreferencesDialog *dlg, const gchar *scheme_id) { gboolean editable; - - editable = (scheme_id != NULL) && + + editable = (scheme_id != NULL) && _pluma_style_scheme_manager_scheme_is_pluma_user_scheme ( pluma_get_style_scheme_manager (), scheme_id); @@ -858,7 +858,7 @@ ensure_color_scheme_id (const gchar *id) return gtk_source_style_scheme_get_id (scheme); } -/* If def_id is NULL, use the default scheme as returned by +/* If def_id is NULL, use the default scheme as returned by * pluma_style_scheme_manager_get_default_scheme. If this one returns NULL * use the first available scheme as default */ static const gchar * @@ -866,17 +866,17 @@ populate_color_scheme_list (PlumaPreferencesDialog *dlg, const gchar *def_id) { GSList *schemes; GSList *l; - + gtk_list_store_clear (dlg->priv->schemes_treeview_model); - + def_id = ensure_color_scheme_id (def_id); - if (def_id == NULL) + if (def_id == NULL) { g_warning ("Cannot build the list of available color schemes.\n" "Please check your GtkSourceView installation."); return NULL; } - + schemes = pluma_style_scheme_manager_list_schemes_sorted (pluma_get_style_scheme_manager ()); l = schemes; while (l != NULL) @@ -888,7 +888,7 @@ populate_color_scheme_list (PlumaPreferencesDialog *dlg, const gchar *def_id) GtkTreeIter iter; scheme = GTK_SOURCE_STYLE_SCHEME (l->data); - + id = gtk_source_style_scheme_get_id (scheme); name = gtk_source_style_scheme_get_name (scheme); description = gtk_source_style_scheme_get_description (scheme); @@ -905,39 +905,39 @@ populate_color_scheme_list (PlumaPreferencesDialog *dlg, const gchar *def_id) if (strcmp (id, def_id) == 0) { GtkTreeSelection *selection; - + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dlg->priv->schemes_treeview)); gtk_tree_selection_select_iter (selection, &iter); } - + l = g_slist_next (l); } - + g_slist_free (schemes); - + return def_id; } static void -add_scheme_chooser_response_cb (GtkDialog *chooser, +add_scheme_chooser_response_cb (GtkDialog *chooser, gint res_id, PlumaPreferencesDialog *dlg) { - gchar* filename; + gchar* filename; const gchar *scheme_id; - + if (res_id != GTK_RESPONSE_ACCEPT) { gtk_widget_hide (GTK_WIDGET (chooser)); return; } - + filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser)); if (filename == NULL) return; - + gtk_widget_hide (GTK_WIDGET (chooser)); - + scheme_id = _pluma_style_scheme_manager_install_scheme ( pluma_get_style_scheme_manager (), filename); @@ -1010,14 +1010,14 @@ scheme_file_chooser_dialog_new (const gchar *title, return result; } - + static void install_scheme_clicked (GtkButton *button, PlumaPreferencesDialog *dlg) { GtkWidget *chooser; GtkFileFilter *filter; - + if (dlg->priv->install_scheme_file_schooser != NULL) { gtk_window_present (GTK_WINDOW (dlg->priv->install_scheme_file_schooser)); gtk_widget_grab_focus (dlg->priv->install_scheme_file_schooser); @@ -1030,13 +1030,13 @@ install_scheme_clicked (GtkButton *button, "process-stop", GTK_RESPONSE_CANCEL, NULL); - pluma_dialog_add_button (GTK_DIALOG (chooser), + pluma_dialog_add_button (GTK_DIALOG (chooser), _("A_dd Scheme"), "list-add", GTK_RESPONSE_ACCEPT); gtk_window_set_destroy_with_parent (GTK_WINDOW (chooser), TRUE); - + /* Filters */ filter = gtk_file_filter_new (); gtk_file_filter_set_name (filter, _("Color Scheme Files")); @@ -1044,25 +1044,25 @@ install_scheme_clicked (GtkButton *button, gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), filter); gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (chooser), filter); - + filter = gtk_file_filter_new (); gtk_file_filter_set_name (filter, _("All Files")); gtk_file_filter_add_pattern (filter, "*"); gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), filter); gtk_dialog_set_default_response (GTK_DIALOG (chooser), GTK_RESPONSE_ACCEPT); - + g_signal_connect (chooser, "response", G_CALLBACK (add_scheme_chooser_response_cb), dlg); dlg->priv->install_scheme_file_schooser = chooser; - + g_object_add_weak_pointer (G_OBJECT (chooser), (gpointer) &dlg->priv->install_scheme_file_schooser); - - gtk_widget_show (chooser); + + gtk_widget_show (chooser); } static void @@ -1087,7 +1087,7 @@ uninstall_scheme_clicked (GtkButton *button, ID_COLUMN, &id, NAME_COLUMN, &name, -1); - + if (!_pluma_style_scheme_manager_uninstall_scheme (pluma_get_style_scheme_manager (), id)) { pluma_warning (GTK_WINDOW (dlg), @@ -1095,7 +1095,7 @@ uninstall_scheme_clicked (GtkButton *button, name); } else - { + { const gchar *real_new_id; gchar *new_id = NULL; GtkTreePath *path; @@ -1116,13 +1116,13 @@ uninstall_scheme_clicked (GtkButton *button, gtk_tree_path_next (path); if (!gtk_tree_model_get_iter (model, &new_iter, path)) { - /* It seems the removed style scheme was the - * last of the list. Try to move to the + /* It seems the removed style scheme was the + * last of the list. Try to move to the * previous one */ gtk_tree_path_free (path); path = gtk_tree_model_get_path (model, &iter); - + gtk_tree_path_prev (path); if (gtk_tree_model_get_iter (model, &new_iter, path)) new_iter_set = TRUE; @@ -1131,17 +1131,17 @@ uninstall_scheme_clicked (GtkButton *button, new_iter_set = TRUE; gtk_tree_path_free (path); - + if (new_iter_set) gtk_tree_model_get (model, &new_iter, ID_COLUMN, &new_id, -1); - + real_new_id = populate_color_scheme_list (dlg, new_id); g_free (new_id); - + set_buttons_sensisitivity_according_to_scheme (dlg, real_new_id); - + if (real_new_id != NULL) pluma_prefs_manager_set_source_style_scheme (real_new_id); } @@ -1197,9 +1197,9 @@ setup_font_colors_page_style_scheme_section (PlumaPreferencesDialog *dlg) GtkTreeViewColumn *column; GtkTreeSelection *selection; const gchar *def_id; - + pluma_debug (DEBUG_PREFS); - + /* Create GtkListStore for styles & setup treeview. */ dlg->priv->schemes_treeview_model = gtk_list_store_new (NUM_COLUMNS, G_TYPE_STRING, @@ -1234,7 +1234,7 @@ setup_font_colors_page_style_scheme_section (PlumaPreferencesDialog *dlg) gtk_button_set_image (GTK_BUTTON (dlg->priv->uninstall_scheme_button), gtk_image_new_from_icon_name ("list-remove", GTK_ICON_SIZE_BUTTON)); - + /* Connect signals */ g_signal_connect (dlg->priv->schemes_treeview, "cursor-changed", @@ -1248,7 +1248,7 @@ setup_font_colors_page_style_scheme_section (PlumaPreferencesDialog *dlg) "clicked", G_CALLBACK (uninstall_scheme_clicked), dlg); - + /* Set initial widget sensitivity */ set_buttons_sensisitivity_according_to_scheme (dlg, def_id); } @@ -1308,12 +1308,12 @@ pluma_preferences_dialog_init (PlumaPreferencesDialog *dlg) /* HIG defaults */ gtk_container_set_border_width (GTK_CONTAINER (dlg), 5); gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))), 2); /* 2 * 5 + 2 = 12 */ - + g_signal_connect (dlg, "response", G_CALLBACK (dialog_response_handler), NULL); - + file = pluma_dirs_get_ui_file ("pluma-preferences-dialog.ui"); ret = pluma_utils_get_ui_objects (file, root_objects, @@ -1364,11 +1364,11 @@ pluma_preferences_dialog_init (PlumaPreferencesDialog *dlg) if (!ret) { gtk_widget_show (error_widget); - + gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))), error_widget, TRUE, TRUE, 0); - + return; } diff --git a/pluma/dialogs/pluma-preferences-dialog.h b/pluma/dialogs/pluma-preferences-dialog.h index 17c57268..b5590239 100644 --- a/pluma/dialogs/pluma-preferences-dialog.h +++ b/pluma/dialogs/pluma-preferences-dialog.h @@ -3,7 +3,7 @@ * pluma-preferences-dialog.c * This file is part of pluma * - * Copyright (C) 2001-2005 Paolo Maggi + * Copyright (C) 2001-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 @@ -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, 2003. 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, 2003. See the AUTHORS file for a + * list of people on the pluma Team. + * See the ChangeLog files for a list of changes. * * $Id$ */ @@ -56,10 +56,10 @@ typedef struct _PlumaPreferencesDialogPrivate PlumaPreferencesDialogPrivate; */ typedef struct _PlumaPreferencesDialog PlumaPreferencesDialog; -struct _PlumaPreferencesDialog +struct _PlumaPreferencesDialog { GtkDialog dialog; - + /*< private > */ PlumaPreferencesDialogPrivate *priv; }; @@ -69,7 +69,7 @@ struct _PlumaPreferencesDialog */ typedef struct _PlumaPreferencesDialogClass PlumaPreferencesDialogClass; -struct _PlumaPreferencesDialogClass +struct _PlumaPreferencesDialogClass { GtkDialogClass parent_class; }; diff --git a/pluma/dialogs/pluma-search-dialog.c b/pluma/dialogs/pluma-search-dialog.c index 1d8f59c1..4754ab85 100644 --- a/pluma/dialogs/pluma-search-dialog.c +++ b/pluma/dialogs/pluma-search-dialog.c @@ -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 @@ enum static guint dialog_signals [LAST_SIGNAL] = { 0 }; -struct _PlumaSearchDialogPrivate +struct _PlumaSearchDialogPrivate { gboolean show_replace; @@ -135,28 +135,28 @@ pluma_search_dialog_present_with_time (PlumaSearchDialog *dialog, gtk_window_present_with_time (GTK_WINDOW (dialog), timestamp); - gtk_widget_grab_focus (dialog->priv->search_text_entry); + gtk_widget_grab_focus (dialog->priv->search_text_entry); } static gboolean show_replace (PlumaSearchDialog *dlg) { pluma_search_dialog_set_show_replace (dlg, TRUE); - + return TRUE; } -static void +static void pluma_search_dialog_class_init (PlumaSearchDialogClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkBindingSet *binding_set; - + object_class->set_property = pluma_search_dialog_set_property; object_class->get_property = pluma_search_dialog_get_property; - + klass->show_replace = show_replace; - + dialog_signals[SHOW_REPLACE] = g_signal_new ("show_replace", G_TYPE_FROM_CLASS (object_class), @@ -165,7 +165,7 @@ pluma_search_dialog_class_init (PlumaSearchDialogClass *klass) NULL, NULL, pluma_marshal_BOOLEAN__VOID, G_TYPE_BOOLEAN, 0); - + g_object_class_install_property (object_class, PROP_SHOW_REPLACE, g_param_spec_boolean ("show-replace", "Show Replace", @@ -176,8 +176,8 @@ pluma_search_dialog_class_init (PlumaSearchDialogClass *klass) g_type_class_add_private (object_class, sizeof (PlumaSearchDialogPrivate)); binding_set = gtk_binding_set_by_class (klass); - - /* Note: we cannot use the keyval/modifier associated with the + + /* Note: we cannot use the keyval/modifier associated with the * GTK_STOCK_FIND_AND_REPLACE stock item since MATE HIG suggests Ctrl+h * for Replace while gtk+ uses Ctrl+r */ gtk_binding_entry_add_signal (binding_set, GDK_KEY_h, GDK_CONTROL_MASK, "show_replace", 0); @@ -231,18 +231,18 @@ search_text_entry_changed (GtkEditable *editable, if (*search_string != '\0') { - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), + gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), PLUMA_SEARCH_DIALOG_FIND_RESPONSE, TRUE); - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), + gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), PLUMA_SEARCH_DIALOG_REPLACE_ALL_RESPONSE, TRUE); } else { - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), + gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), PLUMA_SEARCH_DIALOG_FIND_RESPONSE, FALSE); - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), + gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), PLUMA_SEARCH_DIALOG_REPLACE_RESPONSE, FALSE); - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), + gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), PLUMA_SEARCH_DIALOG_REPLACE_ALL_RESPONSE, FALSE); } } @@ -331,7 +331,7 @@ pluma_search_dialog_init (PlumaSearchDialog *dlg) gtk_window_set_destroy_with_parent (GTK_WINDOW (dlg), TRUE); pluma_dialog_add_button (GTK_DIALOG (dlg), _("_Close"), "window-close", GTK_RESPONSE_CANCEL); - + /* HIG defaults */ gtk_container_set_border_width (GTK_CONTAINER (dlg), 5); gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))), @@ -482,11 +482,11 @@ pluma_search_dialog_new (GtkWindow *parent, { gtk_window_set_transient_for (GTK_WINDOW (dlg), parent); - + gtk_window_set_destroy_with_parent (GTK_WINDOW (dlg), TRUE); } - + return GTK_WIDGET (dlg); } @@ -526,7 +526,7 @@ pluma_search_dialog_set_search_text (PlumaSearchDialog *dialog, gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), PLUMA_SEARCH_DIALOG_FIND_RESPONSE, (*text != '\0')); - + gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), PLUMA_SEARCH_DIALOG_REPLACE_ALL_RESPONSE, (*text != '\0')); diff --git a/pluma/dialogs/pluma-search-dialog.h b/pluma/dialogs/pluma-search-dialog.h index e6ebe8dc..cb23be31 100644 --- a/pluma/dialogs/pluma-search-dialog.h +++ b/pluma/dialogs/pluma-search-dialog.h @@ -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$ */ @@ -54,7 +54,7 @@ typedef struct _PlumaSearchDialogPrivate PlumaSearchDialogPrivate; */ typedef struct _PlumaSearchDialog PlumaSearchDialog; -struct _PlumaSearchDialog +struct _PlumaSearchDialog { GtkDialog dialog; @@ -67,10 +67,10 @@ struct _PlumaSearchDialog */ typedef struct _PlumaSearchDialogClass PlumaSearchDialogClass; -struct _PlumaSearchDialogClass +struct _PlumaSearchDialogClass { GtkDialogClass parent_class; - + /* Key bindings */ gboolean (* show_replace) (PlumaSearchDialog *dlg); }; @@ -126,7 +126,7 @@ gboolean pluma_search_dialog_get_backwards (PlumaSearchDialog *dialog); void pluma_search_dialog_set_wrap_around (PlumaSearchDialog *dialog, gboolean wrap_around); gboolean pluma_search_dialog_get_wrap_around (PlumaSearchDialog *dialog); - + void pluma_search_dialog_set_parse_escapes (PlumaSearchDialog *dialog, gboolean parse_escapes); diff --git a/pluma/pluma-app.h b/pluma/pluma-app.h index 02585d5d..22af85bd 100644 --- a/pluma/pluma-app.h +++ b/pluma/pluma-app.h @@ -2,7 +2,7 @@ * pluma-app.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$ */ @@ -55,7 +55,7 @@ typedef struct _PlumaAppPrivate PlumaAppPrivate; */ typedef struct _PlumaApp PlumaApp; -struct _PlumaApp +struct _PlumaApp { GObject object; @@ -68,7 +68,7 @@ struct _PlumaApp */ typedef struct _PlumaAppClass PlumaAppClass; -struct _PlumaAppClass +struct _PlumaAppClass { GObjectClass parent_class; }; diff --git a/pluma/pluma-close-button.c b/pluma/pluma-close-button.c index 16148f99..f417a661 100644 --- a/pluma/pluma-close-button.c +++ b/pluma/pluma-close-button.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/pluma/pluma-close-button.h b/pluma/pluma-close-button.h index 79ff48a4..5a89efb0 100644 --- a/pluma/pluma-close-button.h +++ b/pluma/pluma-close-button.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/pluma/pluma-commands-file.c b/pluma/pluma-commands-file.c index e9288ce9..689398a6 100644 --- a/pluma/pluma-commands-file.c +++ b/pluma/pluma-commands-file.c @@ -168,7 +168,7 @@ load_file_list (PlumaWindow *window, } else { - files_to_load = g_slist_prepend (files_to_load, + files_to_load = g_slist_prepend (files_to_load, l->data); } } @@ -178,7 +178,7 @@ load_file_list (PlumaWindow *window, if (files_to_load == NULL) return loaded_files; - + files_to_load = g_slist_reverse (files_to_load); l = files_to_load; @@ -459,7 +459,7 @@ _pluma_cmd_file_open (GtkAction *action, return; } - /* Translators: "Open Files" is the title of the file chooser window */ + /* Translators: "Open Files" is the title of the file chooser window */ open_dialog = pluma_file_chooser_dialog_new (_("Open Files"), GTK_WINDOW (window), GTK_FILE_CHOOSER_ACTION_OPEN, @@ -856,13 +856,13 @@ file_save (PlumaTab *tab, doc = pluma_tab_get_document (tab); g_return_if_fail (PLUMA_IS_DOCUMENT (doc)); - if (pluma_document_is_untitled (doc) || + if (pluma_document_is_untitled (doc) || pluma_document_get_readonly (doc)) { pluma_debug_message (DEBUG_COMMANDS, "Untitled or Readonly"); file_save_as (tab, window); - + return; } @@ -933,7 +933,7 @@ _pluma_cmd_file_save_documents_list (PlumaWindow *window, pluma_debug (DEBUG_COMMANDS); - g_return_if_fail (!(pluma_window_get_state (window) & + g_return_if_fail (!(pluma_window_get_state (window) & (PLUMA_WINDOW_STATE_PRINTING | PLUMA_WINDOW_STATE_SAVING_SESSION))); @@ -945,7 +945,7 @@ _pluma_cmd_file_save_documents_list (PlumaWindow *window, PlumaTabState state; g_return_if_fail (PLUMA_IS_DOCUMENT (l->data)); - + doc = PLUMA_DOCUMENT (l->data); t = pluma_tab_get_from_document (doc); state = pluma_tab_get_state (t); @@ -960,7 +960,7 @@ _pluma_cmd_file_save_documents_list (PlumaWindow *window, { /* FIXME: manage the case of local readonly files owned by the user is running pluma - Paolo (Dec. 8, 2005) */ - if (pluma_document_is_untitled (doc) || + if (pluma_document_is_untitled (doc) || pluma_document_get_readonly (doc)) { if (document_needs_saving (doc)) @@ -971,7 +971,7 @@ _pluma_cmd_file_save_documents_list (PlumaWindow *window, } else { - file_save (t, window); + file_save (t, window); } } else @@ -1034,7 +1034,7 @@ void pluma_commands_save_all_documents (PlumaWindow *window) { GList *docs; - + g_return_if_fail (PLUMA_IS_WINDOW (window)); pluma_debug (DEBUG_COMMANDS); @@ -1061,9 +1061,9 @@ pluma_commands_save_document (PlumaWindow *window, g_return_if_fail (PLUMA_IS_WINDOW (window)); g_return_if_fail (PLUMA_IS_DOCUMENT (document)); - + pluma_debug (DEBUG_COMMANDS); - + tab = pluma_tab_get_from_document (document); file_save (tab, window); } @@ -1426,7 +1426,7 @@ save_and_close_all_documents (const GList *docs, - PLUMA_TAB_STATE_LOADING: close, we are sure the file is unmodified - PLUMA_TAB_STATE_REVERTING: since the user wants to return back to the version of the file she previously saved, we can close - without saving (CHECK: are we sure this is the right behavior, suppose the case + without saving (CHECK: are we sure this is the right behavior, suppose the case the original file has been deleted) - [*] PLUMA_TAB_STATE_SAVING: invalid, ClosAll and Quit are unsensitive if the window state is SAVING. @@ -1456,12 +1456,12 @@ save_and_close_all_documents (const GList *docs, { if ((g_list_index ((GList *)docs, doc) >= 0) && (state != PLUMA_TAB_STATE_LOADING) && - (state != PLUMA_TAB_STATE_LOADING_ERROR) && + (state != PLUMA_TAB_STATE_LOADING_ERROR) && (state != PLUMA_TAB_STATE_REVERTING)) /* CHECK: is this the right behavior with REVERTING ?*/ - { + { /* The document must be saved before closing */ g_return_if_fail (document_needs_saving (doc)); - + /* FIXME: manage the case of local readonly files owned by the user is running pluma - Paolo (Dec. 8, 2005) */ if (pluma_document_is_untitled (doc) || @@ -1720,8 +1720,8 @@ _pluma_cmd_file_close_tab (PlumaTab *tab, PLUMA_IS_QUITTING, GBOOLEAN_TO_POINTER (FALSE)); - g_object_set_data (G_OBJECT (window), - PLUMA_IS_QUITTING_ALL, + g_object_set_data (G_OBJECT (window), + PLUMA_IS_QUITTING_ALL, GINT_TO_POINTER (FALSE)); @@ -1769,7 +1769,7 @@ file_close_all (PlumaWindow *window, g_object_set_data (G_OBJECT (window), PLUMA_IS_QUITTING, GBOOLEAN_TO_POINTER (is_quitting)); - + unsaved_docs = pluma_window_get_unsaved_documents (window); if (unsaved_docs == NULL) diff --git a/pluma/pluma-commands-search.c b/pluma/pluma-commands-search.c index d3c47803..d04b99cb 100644 --- a/pluma/pluma-commands-search.c +++ b/pluma/pluma-commands-search.c @@ -82,19 +82,19 @@ static void last_search_data_store_position (PlumaSearchDialog *dlg) { LastSearchData *data; - + data = g_object_get_data (G_OBJECT (dlg), PLUMA_LAST_SEARCH_DATA_KEY); - + if (data == NULL) { data = g_slice_new (LastSearchData); - + g_object_set_data_full (G_OBJECT (dlg), PLUMA_LAST_SEARCH_DATA_KEY, data, (GDestroyNotify) last_search_data_free); } - + gtk_window_get_position (GTK_WINDOW (dlg), &data->x, &data->y); @@ -133,7 +133,7 @@ text_not_found (PlumaWindow *window, const gchar *text) { gchar *searched; - + searched = pluma_utils_str_end_truncate (text, MAX_MSG_LENGTH); pluma_statusbar_flash_message (PLUMA_STATUSBAR (window->priv->statusbar), @@ -376,8 +376,8 @@ do_replace (PlumaSearchDialog *dialog, unescaped_search_text = pluma_utils_unescape_search_text (search_entry_text); - get_selected_text (GTK_TEXT_BUFFER (doc), - &selected_text, + get_selected_text (GTK_TEXT_BUFFER (doc), + &selected_text, NULL); match_case = pluma_search_dialog_get_match_case (dialog); @@ -476,7 +476,7 @@ do_replace_all (PlumaSearchDialog *dialog, PLUMA_SEARCH_SET_MATCH_REGEX (flags, match_regex); PLUMA_SEARCH_SET_ENTIRE_WORD (flags, entire_word); - count = pluma_document_replace_all (doc, + count = pluma_document_replace_all (doc, search_entry_text, replace_entry_text, flags); @@ -599,9 +599,9 @@ _pluma_cmd_search_find (GtkAction *action, else { g_return_if_fail (PLUMA_IS_SEARCH_DIALOG (data)); - + search_dialog = GTK_WIDGET (data); - + /* turn the dialog into a find dialog if needed */ if (pluma_search_dialog_get_show_replace (PLUMA_SEARCH_DIALOG (search_dialog))) pluma_search_dialog_set_show_replace (PLUMA_SEARCH_DIALOG (search_dialog), @@ -673,9 +673,9 @@ _pluma_cmd_search_replace (GtkAction *action, else { g_return_if_fail (PLUMA_IS_SEARCH_DIALOG (data)); - + replace_dialog = GTK_WIDGET (data); - + /* turn the dialog into a find dialog if needed */ if (!pluma_search_dialog_get_show_replace (PLUMA_SEARCH_DIALOG (replace_dialog))) pluma_search_dialog_set_show_replace (PLUMA_SEARCH_DIALOG (replace_dialog), @@ -730,15 +730,15 @@ do_find_again (PlumaWindow *window, PlumaView *active_view; gboolean wrap_around = TRUE; gpointer data; - + active_view = pluma_window_get_active_view (window); g_return_if_fail (active_view != NULL); data = g_object_get_data (G_OBJECT (window), PLUMA_SEARCH_DIALOG_KEY); - + if (data != NULL) wrap_around = pluma_search_dialog_get_wrap_around (PLUMA_SEARCH_DIALOG (data)); - + run_search (active_view, wrap_around, backward); @@ -788,7 +788,7 @@ _pluma_cmd_search_goto_line (GtkAction *action, if (active_view == NULL) return; - /* Focus the view if needed: we need to focus the view otherwise + /* Focus the view if needed: we need to focus the view otherwise activating the binding for goto line has no effect */ gtk_widget_grab_focus (GTK_WIDGET (active_view)); @@ -813,10 +813,10 @@ _pluma_cmd_search_incremental_search (GtkAction *action, if (active_view == NULL) return; - /* Focus the view if needed: we need to focus the view otherwise + /* Focus the view if needed: we need to focus the view otherwise activating the binding for incremental search has no effect */ gtk_widget_grab_focus (GTK_WIDGET (active_view)); - + /* incremental search is builtin in PlumaView, just activate * the corresponding binding. */ diff --git a/pluma/pluma-commands.h b/pluma/pluma-commands.h index 37e4df8d..2fc44259 100644 --- a/pluma/pluma-commands.h +++ b/pluma/pluma-commands.h @@ -4,8 +4,8 @@ * This file is part of pluma * * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence - * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi - * Copyright (C) 2002-2005 Paolo Maggi + * Copyright (C) 2000, 2001 Chema Celorio, 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 @@ -19,14 +19,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, 1998-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, 1998-2005. See the AUTHORS file for a + * list of people on the pluma Team. + * See the ChangeLog files for a list of changes. * * $Id$ */ @@ -134,8 +134,8 @@ void _pluma_cmd_search_clear_highlight (GtkAction *action, void _pluma_cmd_search_goto_line (GtkAction *action, PlumaWindow *window); void _pluma_cmd_search_incremental_search (GtkAction *action, - PlumaWindow *window); - + PlumaWindow *window); + void _pluma_cmd_documents_previous_document (GtkAction *action, PlumaWindow *window); void _pluma_cmd_documents_next_document (GtkAction *action, @@ -156,4 +156,4 @@ void _pluma_cmd_file_save_documents_list (PlumaWindow *window, G_END_DECLS -#endif /* __PLUMA_COMMANDS_H__ */ +#endif /* __PLUMA_COMMANDS_H__ */ diff --git a/pluma/pluma-debug.c b/pluma/pluma-debug.c index b35376b2..b8111423 100644 --- a/pluma/pluma-debug.c +++ b/pluma/pluma-debug.c @@ -4,7 +4,7 @@ * * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi - * 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 @@ -18,13 +18,13 @@ * * 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, 1998-2005. See the AUTHORS file for a - * list of people on the pluma Team. + * Modified by the pluma Team, 1998-2005. See the AUTHORS file for a + * list of people on the pluma Team. * See the ChangeLog files for a list of changes. * * $Id$ @@ -87,7 +87,7 @@ pluma_debug_init (void) if (g_getenv ("PLUMA_DEBUG_SAVER") != NULL) debug = debug | PLUMA_DEBUG_SAVER; -out: +out: #ifdef ENABLE_PROFILING if (debug != PLUMA_NO_DEBUG) @@ -104,7 +104,7 @@ pluma_debug_message (PlumaDebugSection section, const gchar *format, ...) { if (G_UNLIKELY (debug & section)) - { + { #ifdef ENABLE_PROFILING gdouble seconds; g_return_if_fail (timer != NULL); @@ -121,11 +121,11 @@ pluma_debug_message (PlumaDebugSection section, #ifdef ENABLE_PROFILING seconds = g_timer_elapsed (timer, NULL); - g_print ("[%f (%f)] %s:%d (%s) %s\n", + g_print ("[%f (%f)] %s:%d (%s) %s\n", seconds, seconds - last, file, line, function, msg); - last = seconds; + last = seconds; #else - g_print ("%s:%d (%s) %s\n", file, line, function, msg); + g_print ("%s:%d (%s) %s\n", file, line, function, msg); #endif fflush (stdout); @@ -146,13 +146,13 @@ void pluma_debug (PlumaDebugSection section, g_return_if_fail (timer != NULL); - seconds = g_timer_elapsed (timer, NULL); - g_print ("[%f (%f)] %s:%d (%s)\n", + seconds = g_timer_elapsed (timer, NULL); + g_print ("[%f (%f)] %s:%d (%s)\n", seconds, seconds - last, file, line, function); last = seconds; #else g_print ("%s:%d (%s)\n", file, line, function); -#endif +#endif fflush (stdout); } } diff --git a/pluma/pluma-debug.h b/pluma/pluma-debug.h index 3ef47256..c1d7b987 100644 --- a/pluma/pluma-debug.h +++ b/pluma/pluma-debug.h @@ -4,7 +4,7 @@ * * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi - * 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 @@ -18,13 +18,13 @@ * * 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, 1998-2005. See the AUTHORS file for a - * list of people on the pluma Team. + * Modified by the pluma Team, 1998-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/pluma/pluma-dirs.h b/pluma/pluma-dirs.h index a9c74d85..086ffe3c 100644 --- a/pluma/pluma-dirs.h +++ b/pluma/pluma-dirs.h @@ -16,8 +16,8 @@ * * 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. */ diff --git a/pluma/pluma-document-input-stream.c b/pluma/pluma-document-input-stream.c index 82e60acd..fdfb1697 100644 --- a/pluma/pluma-document-input-stream.c +++ b/pluma/pluma-document-input-stream.c @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with pluma; 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 */ @@ -141,7 +141,7 @@ pluma_document_input_stream_class_init (PlumaDocumentInputStreamClass *klass) * * The :newline-type property determines what is considered * as a line ending when reading complete lines from the stream. - */ + */ g_object_class_install_property (gobject_class, PROP_NEWLINE_TYPE, g_param_spec_enum ("newline-type", diff --git a/pluma/pluma-document-input-stream.h b/pluma/pluma-document-input-stream.h index 0297c489..649075fd 100644 --- a/pluma/pluma-document-input-stream.h +++ b/pluma/pluma-document-input-stream.h @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with pluma; 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 */ @@ -45,7 +45,7 @@ typedef struct _PlumaDocumentInputStreamPrivate PlumaDocumentInputStreamPrivate; struct _PlumaDocumentInputStream { GInputStream parent; - + PlumaDocumentInputStreamPrivate *priv; }; diff --git a/pluma/pluma-document-loader.c b/pluma/pluma-document-loader.c index 476cad90..5b50b779 100644 --- a/pluma/pluma-document-loader.c +++ b/pluma/pluma-document-loader.c @@ -17,10 +17,10 @@ * * 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-2007. See the AUTHORS file for a * list of people on the pluma Team. @@ -290,7 +290,7 @@ pluma_document_loader_load (PlumaDocumentLoader *loader) PLUMA_DOCUMENT_LOADER_GET_CLASS (loader)->load (loader); } -gboolean +gboolean pluma_document_loader_cancel (PlumaDocumentLoader *loader) { pluma_debug (DEBUG_LOADER); @@ -333,7 +333,7 @@ pluma_document_loader_get_encoding (PlumaDocumentLoader *loader) if (loader->encoding != NULL) return loader->encoding; - g_return_val_if_fail (loader->auto_detected_encoding != NULL, + g_return_val_if_fail (loader->auto_detected_encoding != NULL, pluma_encoding_get_current ()); return loader->auto_detected_encoding; diff --git a/pluma/pluma-document-loader.h b/pluma/pluma-document-loader.h index a28fd585..6dd2249b 100644 --- a/pluma/pluma-document-loader.h +++ b/pluma/pluma-document-loader.h @@ -17,10 +17,10 @@ * * 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-2007. See the AUTHORS file for a * list of people on the pluma Team. @@ -54,7 +54,7 @@ typedef struct _PlumaDocumentLoaderPrivate PlumaDocumentLoaderPrivate; */ typedef struct _PlumaDocumentLoader PlumaDocumentLoader; -struct _PlumaDocumentLoader +struct _PlumaDocumentLoader { GObject object; @@ -74,7 +74,7 @@ struct _PlumaDocumentLoader */ typedef struct _PlumaDocumentLoaderClass PlumaDocumentLoaderClass; -struct _PlumaDocumentLoaderClass +struct _PlumaDocumentLoaderClass { GObjectClass parent_class; @@ -106,13 +106,13 @@ void pluma_document_loader_loading (PlumaDocumentLoader *loader, void pluma_document_loader_load (PlumaDocumentLoader *loader); #if 0 gboolean pluma_document_loader_load_from_stdin (PlumaDocumentLoader *loader); -#endif +#endif gboolean pluma_document_loader_cancel (PlumaDocumentLoader *loader); PlumaDocument *pluma_document_loader_get_document (PlumaDocumentLoader *loader); /* Returns STDIN_URI if loading from stdin */ -#define STDIN_URI "stdin:" +#define STDIN_URI "stdin:" const gchar *pluma_document_loader_get_uri (PlumaDocumentLoader *loader); const PlumaEncoding *pluma_document_loader_get_encoding (PlumaDocumentLoader *loader); @@ -121,7 +121,7 @@ PlumaDocumentNewlineType pluma_document_loader_get_newline_type (PlumaDocumentLo goffset pluma_document_loader_get_bytes_read (PlumaDocumentLoader *loader); -/* You can get from the info: content_type, time_modified, standard_size, access_can_write +/* You can get from the info: content_type, time_modified, standard_size, access_can_write and also the metadata*/ GFileInfo *pluma_document_loader_get_info (PlumaDocumentLoader *loader); diff --git a/pluma/pluma-document-output-stream.c b/pluma/pluma-document-output-stream.c index ae9e66bf..6fe662c0 100644 --- a/pluma/pluma-document-output-stream.c +++ b/pluma/pluma-document-output-stream.c @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with pluma; 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/pluma/pluma-document-output-stream.h b/pluma/pluma-document-output-stream.h index 04071a98..faf37e57 100644 --- a/pluma/pluma-document-output-stream.h +++ b/pluma/pluma-document-output-stream.h @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with pluma; 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/pluma/pluma-document-saver.c b/pluma/pluma-document-saver.c index e4a48c6b..5b2df113 100644 --- a/pluma/pluma-document-saver.c +++ b/pluma/pluma-document-saver.c @@ -156,7 +156,7 @@ pluma_document_saver_dispose (GObject *object) G_OBJECT_CLASS (pluma_document_saver_parent_class)->dispose (object); } -static void +static void pluma_document_saver_class_init (PlumaDocumentSaverClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); diff --git a/pluma/pluma-document-saver.h b/pluma/pluma-document-saver.h index 4b3ee76b..a64cdadc 100644 --- a/pluma/pluma-document-saver.h +++ b/pluma/pluma-document-saver.h @@ -51,7 +51,7 @@ G_BEGIN_DECLS */ typedef struct _PlumaDocumentSaver PlumaDocumentSaver; -struct _PlumaDocumentSaver +struct _PlumaDocumentSaver { GObject object; @@ -74,7 +74,7 @@ struct _PlumaDocumentSaver */ typedef struct _PlumaDocumentSaverClass PlumaDocumentSaverClass; -struct _PlumaDocumentSaverClass +struct _PlumaDocumentSaverClass { GObjectClass parent_class; diff --git a/pluma/pluma-document.c b/pluma/pluma-document.c index b9519b25..ff2d80f0 100644 --- a/pluma/pluma-document.c +++ b/pluma/pluma-document.c @@ -3,8 +3,8 @@ * This file is part of pluma * * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence - * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi - * Copyright (C) 2002-2005 Paolo Maggi + * Copyright (C) 2000, 2001 Chema Celorio, 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 @@ -18,14 +18,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, 1998-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, 1998-2005. See the AUTHORS file for a + * list of people on the pluma Team. + * See the ChangeLog files for a list of changes. * * $Id$ */ @@ -58,7 +58,7 @@ #define METADATA_QUERY "metadata::*" #endif -#undef ENABLE_PROFILE +#undef ENABLE_PROFILE #ifdef ENABLE_PROFILE #define PROFILE(x) x @@ -88,17 +88,17 @@ static void pluma_document_save_real (PlumaDocument *doc, const PlumaEncoding *encoding, PlumaDocumentSaveFlags flags); static void to_search_region_range (PlumaDocument *doc, - GtkTextIter *start, + GtkTextIter *start, GtkTextIter *end); -static void insert_text_cb (PlumaDocument *doc, +static void insert_text_cb (PlumaDocument *doc, GtkTextIter *pos, - const gchar *text, + const gchar *text, gint length); - -static void delete_range_cb (PlumaDocument *doc, + +static void delete_range_cb (PlumaDocument *doc, GtkTextIter *start, GtkTextIter *end); - + struct _PlumaDocumentPrivate { gchar *uri; @@ -123,7 +123,7 @@ struct _PlumaDocumentPrivate /* Temp data while loading */ PlumaDocumentLoader *loader; - gboolean create; /* Create file if uri points + gboolean create; /* Create file if uri points * to a non existing file */ const PlumaEncoding *requested_encoding; gint requested_line_pos; @@ -140,7 +140,7 @@ struct _PlumaDocumentPrivate gpointer mount_operation_userdata; gint readonly : 1; - gint last_save_was_manually : 1; + gint last_save_was_manually : 1; gint language_set_by_user : 1; gint stop_cursor_moved_emission : 1; gint dispose_has_run : 1; @@ -203,7 +203,7 @@ get_untitled_number (void) { if (g_hash_table_lookup (allocated_untitled_numbers, GINT_TO_POINTER (i)) == NULL) { - g_hash_table_insert (allocated_untitled_numbers, + g_hash_table_insert (allocated_untitled_numbers, GINT_TO_POINTER (i), GINT_TO_POINTER (i)); @@ -225,7 +225,7 @@ release_untitled_number (gint n) static void pluma_document_dispose (GObject *object) { - PlumaDocument *doc = PLUMA_DOCUMENT (object); + PlumaDocument *doc = PLUMA_DOCUMENT (object); pluma_debug (DEBUG_DOCUMENT); @@ -256,7 +256,7 @@ pluma_document_dispose (GObject *object) &iter, gtk_text_buffer_get_insert (GTK_TEXT_BUFFER (doc))); - position = g_strdup_printf ("%d", + position = g_strdup_printf ("%d", gtk_text_iter_get_offset (&iter)); if (language == NULL) @@ -289,7 +289,7 @@ pluma_document_dispose (GObject *object) static void pluma_document_finalize (GObject *object) { - PlumaDocument *doc = PLUMA_DOCUMENT (object); + PlumaDocument *doc = PLUMA_DOCUMENT (object); pluma_debug (DEBUG_DOCUMENT); @@ -425,7 +425,7 @@ pluma_document_changed (GtkTextBuffer *buffer) GTK_TEXT_BUFFER_CLASS (pluma_document_parent_class)->changed (buffer); } -static void +static void pluma_document_class_init (PlumaDocumentClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); @@ -525,7 +525,7 @@ pluma_document_class_init (PlumaDocumentClass *klass) /* This signal is used to update the cursor position is the statusbar, * it's emitted either when the insert mark is moved explicitely or * when the buffer changes (insert/delete). - * We prevent the emission of the signal during replace_all to + * We prevent the emission of the signal during replace_all to * improve performance. */ document_signals[CURSOR_MOVED] = @@ -642,8 +642,8 @@ pluma_document_class_init (PlumaDocumentClass *klass) G_STRUCT_OFFSET (PlumaDocumentClass, search_highlight_updated), NULL, NULL, pluma_marshal_VOID__BOXED_BOXED, - G_TYPE_NONE, - 2, + G_TYPE_NONE, + 2, GTK_TYPE_TEXT_ITER | G_SIGNAL_TYPE_STATIC_SCOPE, GTK_TYPE_TEXT_ITER | G_SIGNAL_TYPE_STATIC_SCOPE); @@ -692,7 +692,7 @@ file_with_bom (GFile *file) } static void -set_language (PlumaDocument *doc, +set_language (PlumaDocument *doc, GtkSourceLanguage *lang, gboolean set_by_user) { @@ -700,9 +700,9 @@ set_language (PlumaDocument *doc, const gchar *bom_langs; pluma_debug (DEBUG_DOCUMENT); - + old_lang = gtk_source_buffer_get_language (GTK_SOURCE_BUFFER (doc)); - + if (old_lang == lang) return; @@ -725,7 +725,7 @@ set_language (PlumaDocument *doc, gtk_source_buffer_set_highlight_syntax (GTK_SOURCE_BUFFER (doc), pluma_prefs_manager_get_enable_syntax_highlighting ()); else - gtk_source_buffer_set_highlight_syntax (GTK_SOURCE_BUFFER (doc), + gtk_source_buffer_set_highlight_syntax (GTK_SOURCE_BUFFER (doc), FALSE); if (set_by_user && (doc->priv->uri != NULL)) @@ -739,7 +739,7 @@ set_language (PlumaDocument *doc, } static void -set_encoding (PlumaDocument *doc, +set_encoding (PlumaDocument *doc, const PlumaEncoding *encoding, gboolean set_by_user) { @@ -782,9 +782,9 @@ get_default_style_scheme (void) g_warning ("Default style scheme '%s' cannot be found, falling back to 'classic' style scheme ", scheme_id); def_style = gtk_source_style_scheme_manager_get_scheme (manager, "classic"); - if (def_style == NULL) + if (def_style == NULL) { - g_warning ("Style scheme 'classic' cannot be found, check your GtkSourceView installation."); + g_warning ("Style scheme 'classic' cannot be found, check your GtkSourceView installation."); } } @@ -950,10 +950,10 @@ pluma_document_init (PlumaDocument *doc) doc->priv->newline_type = PLUMA_DOCUMENT_NEWLINE_TYPE_DEFAULT; - gtk_source_buffer_set_max_undo_levels (GTK_SOURCE_BUFFER (doc), + gtk_source_buffer_set_max_undo_levels (GTK_SOURCE_BUFFER (doc), pluma_prefs_manager_get_undo_actions_limit ()); - gtk_source_buffer_set_highlight_matching_brackets (GTK_SOURCE_BUFFER (doc), + gtk_source_buffer_set_highlight_matching_brackets (GTK_SOURCE_BUFFER (doc), pluma_prefs_manager_get_bracket_matching ()); pluma_document_set_enable_search_highlighting (doc, @@ -964,12 +964,12 @@ pluma_document_init (PlumaDocument *doc) gtk_source_buffer_set_style_scheme (GTK_SOURCE_BUFFER (doc), style_scheme); - g_signal_connect_after (doc, + g_signal_connect_after (doc, "insert-text", G_CALLBACK (insert_text_cb), NULL); - g_signal_connect_after (doc, + g_signal_connect_after (doc, "delete-range", G_CALLBACK (delete_range_cb), NULL); @@ -1220,7 +1220,7 @@ set_readonly (PlumaDocument *doc, readonly = (readonly != FALSE); - if (doc->priv->readonly == readonly) + if (doc->priv->readonly == readonly) return FALSE; doc->priv->readonly = readonly; @@ -1297,9 +1297,9 @@ _pluma_document_check_externally_modified (PlumaDocument *doc) g_file_info_get_modification_time (info, &timeval); g_object_unref (info); - + return (timeval.tv_sec > doc->priv->mtime.tv_sec) || - (timeval.tv_sec == doc->priv->mtime.tv_sec && + (timeval.tv_sec == doc->priv->mtime.tv_sec && timeval.tv_usec > doc->priv->mtime.tv_usec); } } @@ -1356,7 +1356,7 @@ document_loader_loaded (PlumaDocumentLoader *loader, g_get_current_time (&doc->priv->time_of_last_save_or_load); - set_encoding (doc, + set_encoding (doc, pluma_document_loader_get_encoding (loader), (doc->priv->requested_encoding != NULL)); @@ -1421,7 +1421,7 @@ document_loader_loaded (PlumaDocumentLoader *loader, return; } - + g_signal_emit (doc, document_signals[LOADED], 0, @@ -1454,7 +1454,7 @@ document_loader_loading (PlumaDocumentLoader *loader, read = pluma_document_loader_get_bytes_read (loader); - g_signal_emit (doc, + g_signal_emit (doc, document_signals[LOADING], 0, read, @@ -1575,8 +1575,8 @@ document_saver_saving (PlumaDocumentSaver *saver, gtk_text_buffer_set_modified (GTK_TEXT_BUFFER (doc), FALSE); - set_encoding (doc, - doc->priv->requested_encoding, + set_encoding (doc, + doc->priv->requested_encoding, TRUE); } @@ -1692,7 +1692,7 @@ pluma_document_insert_file (PlumaDocument *doc, { g_return_val_if_fail (PLUMA_IS_DOCUMENT (doc), FALSE); g_return_val_if_fail (iter != NULL, FALSE); - g_return_val_if_fail (gtk_text_iter_get_buffer (iter) == + g_return_val_if_fail (gtk_text_iter_get_buffer (iter) == GTK_TEXT_BUFFER (doc), FALSE); /* TODO */ @@ -1700,16 +1700,16 @@ pluma_document_insert_file (PlumaDocument *doc, return FALSE; } -gboolean +gboolean pluma_document_is_untouched (PlumaDocument *doc) { g_return_val_if_fail (PLUMA_IS_DOCUMENT (doc), TRUE); - return (doc->priv->uri == NULL) && + return (doc->priv->uri == NULL) && (!gtk_text_buffer_get_modified (GTK_TEXT_BUFFER (doc))); } -gboolean +gboolean pluma_document_is_untitled (PlumaDocument *doc) { g_return_val_if_fail (PLUMA_IS_DOCUMENT (doc), TRUE); @@ -1743,7 +1743,7 @@ pluma_document_get_deleted (PlumaDocument *doc) * to the last line and FALSE is returned. */ gboolean -pluma_document_goto_line (PlumaDocument *doc, +pluma_document_goto_line (PlumaDocument *doc, gint line) { gboolean ret = TRUE; @@ -1783,11 +1783,11 @@ pluma_document_goto_line_offset (PlumaDocument *doc, gboolean ret = TRUE; guint offset_count; GtkTextIter iter; - + g_return_val_if_fail (PLUMA_IS_DOCUMENT (doc), FALSE); g_return_val_if_fail (line >= -1, FALSE); g_return_val_if_fail (line_offset >= -1, FALSE); - + gtk_text_buffer_get_iter_at_line (GTK_TEXT_BUFFER (doc), &iter, line); @@ -1801,7 +1801,7 @@ pluma_document_goto_line_offset (PlumaDocument *doc, { gtk_text_iter_set_line_offset (&iter, line_offset); } - + gtk_text_buffer_place_cursor (GTK_TEXT_BUFFER (doc), &iter); return ret; @@ -1850,7 +1850,7 @@ pluma_document_set_search_text (PlumaDocument *doc, gchar *converted_text; gboolean notify = FALSE; gboolean update_to_search_region = FALSE; - + g_return_if_fail (PLUMA_IS_DOCUMENT (doc)); g_return_if_fail ((text == NULL) || (doc->priv->search_text != text)); g_return_if_fail ((text == NULL) || g_utf8_validate (text, -1, NULL)); @@ -1869,19 +1869,19 @@ pluma_document_set_search_text (PlumaDocument *doc, converted_text = g_strdup(""); notify = pluma_document_get_can_search_again (doc); } - + g_free (doc->priv->search_text); - + doc->priv->search_text = converted_text; doc->priv->num_of_lines_search_text = compute_num_of_lines (doc->priv->search_text); update_to_search_region = TRUE; } - + if (!PLUMA_SEARCH_IS_DONT_SET_FLAGS (flags)) { if (doc->priv->search_flags != flags) update_to_search_region = TRUE; - + doc->priv->search_flags = flags; } @@ -1890,16 +1890,16 @@ pluma_document_set_search_text (PlumaDocument *doc, { GtkTextIter begin; GtkTextIter end; - + gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER (doc), &begin, &end); - + to_search_region_range (doc, &begin, &end); } - + if (notify) g_object_notify (G_OBJECT (doc), "can-search-again"); } @@ -1955,7 +1955,7 @@ pluma_document_get_can_search_again (PlumaDocument *doc) { g_return_val_if_fail (PLUMA_IS_DOCUMENT (doc), FALSE); - return ((doc->priv->search_text != NULL) && + return ((doc->priv->search_text != NULL) && (*doc->priv->search_text != '\0')); } @@ -1979,13 +1979,13 @@ pluma_document_search_forward (PlumaDocument *doc, gboolean found = FALSE; GtkTextIter m_start; GtkTextIter m_end; - + g_return_val_if_fail (PLUMA_IS_DOCUMENT (doc), FALSE); - g_return_val_if_fail ((start == NULL) || + g_return_val_if_fail ((start == NULL) || (gtk_text_iter_get_buffer (start) == GTK_TEXT_BUFFER (doc)), FALSE); - g_return_val_if_fail ((end == NULL) || + g_return_val_if_fail ((end == NULL) || (gtk_text_iter_get_buffer (end) == GTK_TEXT_BUFFER (doc)), FALSE); - + if (doc->priv->search_text == NULL) { pluma_debug_message (DEBUG_DOCUMENT, "doc->priv->search_text == NULL\n"); @@ -1993,7 +1993,7 @@ pluma_document_search_forward (PlumaDocument *doc, } else pluma_debug_message (DEBUG_DOCUMENT, "doc->priv->search_text == \"%s\"\n", doc->priv->search_text); - + if (start == NULL) gtk_text_buffer_get_start_iter (GTK_TEXT_BUFFER (doc), &iter); else @@ -2005,7 +2005,7 @@ pluma_document_search_forward (PlumaDocument *doc, { search_flags = search_flags | GTK_TEXT_SEARCH_CASE_INSENSITIVE; } - + while (!found) { if(!PLUMA_SEARCH_IS_MATCH_REGEX(doc->priv->search_flags)) @@ -2026,26 +2026,26 @@ pluma_document_search_forward (PlumaDocument *doc, TRUE, &doc->priv->last_replace_text); } - + if (found && PLUMA_SEARCH_IS_ENTIRE_WORD (doc->priv->search_flags)) { - found = gtk_text_iter_starts_word (&m_start) && + found = gtk_text_iter_starts_word (&m_start) && gtk_text_iter_ends_word (&m_end); - if (!found) + if (!found) iter = m_end; } else break; } - + if (found && (match_start != NULL)) *match_start = m_start; - + if (found && (match_end != NULL)) *match_end = m_end; - - return found; + + return found; } /** @@ -2140,10 +2140,10 @@ pluma_document_search_backward (PlumaDocument *doc, } /* FIXME this is an issue for introspection regardning @find */ -gint +gint pluma_document_replace_all (PlumaDocument *doc, - const gchar *find, - const gchar *replace, + const gchar *find, + const gchar *replace, guint flags) { GtkTextIter iter; @@ -2231,7 +2231,7 @@ pluma_document_replace_all (PlumaDocument *doc, { gboolean word; - word = gtk_text_iter_starts_word (&m_start) && + word = gtk_text_iter_starts_word (&m_start) && gtk_text_iter_ends_word (&m_end); if (!word) @@ -2245,7 +2245,7 @@ pluma_document_replace_all (PlumaDocument *doc, { ++cont; - gtk_text_buffer_delete (buffer, + gtk_text_buffer_delete (buffer, &m_start, &m_end); gtk_text_buffer_insert (buffer, @@ -2261,7 +2261,7 @@ pluma_document_replace_all (PlumaDocument *doc, gtk_text_buffer_end_user_action (buffer); /* re-enable cursor_moved emission and notify - * the current position + * the current position */ doc->priv->stop_cursor_moved_emission = FALSE; emit_cursor_moved (doc); @@ -2283,7 +2283,7 @@ pluma_document_replace_all (PlumaDocument *doc, * @lang: (allow-none): **/ void -pluma_document_set_language (PlumaDocument *doc, +pluma_document_set_language (PlumaDocument *doc, GtkSourceLanguage *lang) { g_return_if_fail (PLUMA_IS_DOCUMENT (doc)); @@ -2319,7 +2319,7 @@ _pluma_document_get_seconds_since_last_save_or_load (PlumaDocument *doc) GTimeVal current_time; pluma_debug (DEBUG_DOCUMENT); - + g_return_val_if_fail (PLUMA_IS_DOCUMENT (doc), -1); g_get_current_time (¤t_time); @@ -2348,10 +2348,10 @@ get_search_match_colors (PlumaDocument *doc, if (style == NULL) goto fallback; - g_object_get (style, - "foreground-set", foreground_set, + g_object_get (style, + "foreground-set", foreground_set, "foreground", &fg, - "background-set", background_set, + "background-set", background_set, "background", &bg, NULL); @@ -2371,7 +2371,7 @@ get_search_match_colors (PlumaDocument *doc, { *background_set = FALSE; } - } + } g_free (fg); g_free (bg); @@ -2379,7 +2379,7 @@ get_search_match_colors (PlumaDocument *doc, return; fallback: - pluma_debug_message (DEBUG_DOCUMENT, + pluma_debug_message (DEBUG_DOCUMENT, "Falling back to hard-coded colors " "for the \"found\" text tag."); @@ -2439,21 +2439,21 @@ search_region (PlumaDocument *doc, GtkTextSearchFlags search_flags = 0; gboolean found = TRUE; - GtkTextBuffer *buffer; + GtkTextBuffer *buffer; pluma_debug (DEBUG_DOCUMENT); - + buffer = GTK_TEXT_BUFFER (doc); - + if (doc->priv->found_tag == NULL) { - doc->priv->found_tag = gtk_text_buffer_create_tag (GTK_TEXT_BUFFER (doc), + doc->priv->found_tag = gtk_text_buffer_create_tag (GTK_TEXT_BUFFER (doc), "found", NULL); sync_found_tag (doc, NULL, NULL); - g_signal_connect (doc, + g_signal_connect (doc, "notify::style-scheme", G_CALLBACK (sync_found_tag), NULL); @@ -2463,7 +2463,7 @@ search_region (PlumaDocument *doc, * syntax highlighting tags */ text_tag_set_highest_priority (doc->priv->found_tag, GTK_TEXT_BUFFER (doc)); - + if (doc->priv->search_text == NULL) return; @@ -2502,28 +2502,28 @@ search_region (PlumaDocument *doc, { search_flags = search_flags | GTK_TEXT_SEARCH_CASE_INSENSITIVE; } - + do { if ((end != NULL) && gtk_text_iter_is_end (end)) end = NULL; - + found = gtk_text_iter_forward_search (&iter, - doc->priv->search_text, + doc->priv->search_text, search_flags, - &m_start, + &m_start, &m_end, end); - + iter = m_end; - + if (found && PLUMA_SEARCH_IS_ENTIRE_WORD (doc->priv->search_flags)) { gboolean word; - - word = gtk_text_iter_starts_word (&m_start) && + + word = gtk_text_iter_starts_word (&m_start) && gtk_text_iter_ends_word (&m_end); - + if (!word) continue; } @@ -2534,24 +2534,24 @@ search_region (PlumaDocument *doc, doc->priv->found_tag, &m_start, &m_end); - } + } } while (found); } static void to_search_region_range (PlumaDocument *doc, - GtkTextIter *start, + GtkTextIter *start, GtkTextIter *end) { pluma_debug (DEBUG_DOCUMENT); - + if (doc->priv->to_search_region == NULL) return; - + gtk_text_iter_set_line_offset (start, 0); gtk_text_iter_forward_to_line_end (end); - + /* g_print ("+ [%u (%u), %u (%u)]\n", gtk_text_iter_get_line (start), gtk_text_iter_get_offset (start), gtk_text_iter_get_line (end), gtk_text_iter_get_offset (end)); @@ -2563,7 +2563,7 @@ to_search_region_range (PlumaDocument *doc, /* Notify views of the updated highlight region */ gtk_text_iter_backward_lines (start, doc->priv->num_of_lines_search_text); gtk_text_iter_forward_lines (end, doc->priv->num_of_lines_search_text); - + g_signal_emit (doc, document_signals [SEARCH_HIGHLIGHT_UPDATED], 0, start, end); } @@ -2575,11 +2575,11 @@ _pluma_document_search_region (PlumaDocument *doc, PlumaTextRegion *region; pluma_debug (DEBUG_DOCUMENT); - + g_return_if_fail (PLUMA_IS_DOCUMENT (doc)); g_return_if_fail (start != NULL); g_return_if_fail (end != NULL); - + if (doc->priv->to_search_region == NULL) return; @@ -2587,24 +2587,24 @@ _pluma_document_search_region (PlumaDocument *doc, g_print ("U [%u (%u), %u (%u)]\n", gtk_text_iter_get_line (start), gtk_text_iter_get_offset (start), gtk_text_iter_get_line (end), gtk_text_iter_get_offset (end)); */ - + /* get the subregions not yet highlighted */ - region = pluma_text_region_intersect (doc->priv->to_search_region, + region = pluma_text_region_intersect (doc->priv->to_search_region, start, end); - if (region) + if (region) { gint i; GtkTextIter start_search; GtkTextIter end_search; i = pluma_text_region_subregions (region); - pluma_text_region_nth_subregion (region, + pluma_text_region_nth_subregion (region, 0, &start_search, NULL); - pluma_text_region_nth_subregion (region, + pluma_text_region_nth_subregion (region, i - 1, NULL, &end_search); @@ -2617,38 +2617,38 @@ _pluma_document_search_region (PlumaDocument *doc, /* remove the just highlighted region */ pluma_text_region_subtract (doc->priv->to_search_region, - start, + start, end); } } static void -insert_text_cb (PlumaDocument *doc, +insert_text_cb (PlumaDocument *doc, GtkTextIter *pos, - const gchar *text, + const gchar *text, gint length) { GtkTextIter start; GtkTextIter end; pluma_debug (DEBUG_DOCUMENT); - + start = end = *pos; /* * pos is invalidated when * insertion occurs (because the buffer contents change), but the * default signal handler revalidates it to point to the end of the - * inserted text + * inserted text */ gtk_text_iter_backward_chars (&start, g_utf8_strlen (text, length)); - + to_search_region_range (doc, &start, &end); } - -static void -delete_range_cb (PlumaDocument *doc, + +static void +delete_range_cb (PlumaDocument *doc, GtkTextIter *start, GtkTextIter *end) { @@ -2656,10 +2656,10 @@ delete_range_cb (PlumaDocument *doc, GtkTextIter d_end; pluma_debug (DEBUG_DOCUMENT); - + d_start = *start; d_end = *end; - + to_search_region_range (doc, &d_start, &d_end); } @@ -2668,12 +2668,12 @@ pluma_document_set_enable_search_highlighting (PlumaDocument *doc, gboolean enable) { g_return_if_fail (PLUMA_IS_DOCUMENT (doc)); - + enable = enable != FALSE; - + if ((doc->priv->to_search_region != NULL) == enable) return; - + if (doc->priv->to_search_region != NULL) { /* Disable search highlighting */ @@ -2682,7 +2682,7 @@ pluma_document_set_enable_search_highlighting (PlumaDocument *doc, /* If needed remove the found_tag */ GtkTextIter begin; GtkTextIter end; - + gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER (doc), &begin, &end); @@ -2692,7 +2692,7 @@ pluma_document_set_enable_search_highlighting (PlumaDocument *doc, &begin, &end); } - + pluma_text_region_destroy (doc->priv->to_search_region, TRUE); doc->priv->to_search_region = NULL; @@ -2705,11 +2705,11 @@ pluma_document_set_enable_search_highlighting (PlumaDocument *doc, /* If search_text is not empty, highligth all its occurrences */ GtkTextIter begin; GtkTextIter end; - + gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER (doc), &begin, &end); - + to_search_region_range (doc, &begin, &end); @@ -2721,7 +2721,7 @@ gboolean pluma_document_get_enable_search_highlighting (PlumaDocument *doc) { g_return_val_if_fail (PLUMA_IS_DOCUMENT (doc), FALSE); - + return (doc->priv->to_search_region != NULL); } @@ -2753,7 +2753,7 @@ _pluma_document_set_mount_operation_factory (PlumaDocument *doc, gpointer userdata) { g_return_if_fail (PLUMA_IS_DOCUMENT (doc)); - + doc->priv->mount_operation_factory = callback; doc->priv->mount_operation_userdata = userdata; } @@ -2762,11 +2762,11 @@ GMountOperation * _pluma_document_create_mount_operation (PlumaDocument *doc) { g_return_val_if_fail (PLUMA_IS_DOCUMENT (doc), NULL); - + if (doc->priv->mount_operation_factory == NULL) return g_mount_operation_new (); else - return doc->priv->mount_operation_factory (doc, + return doc->priv->mount_operation_factory (doc, doc->priv->mount_operation_userdata); } @@ -2811,7 +2811,7 @@ pluma_document_set_metadata (PlumaDocument *doc, for (key = first_key; key; key = va_arg (var_args, const gchar *)) { value = va_arg (var_args, const gchar *); - + pluma_metadata_manager_set (doc->priv->uri, key, value); @@ -2891,7 +2891,7 @@ pluma_document_set_metadata (PlumaDocument *doc, for (key = first_key; key; key = va_arg (var_args, const gchar *)) { value = va_arg (var_args, const gchar *); - + if (value != NULL) { g_file_info_set_attribute_string (info, @@ -2925,7 +2925,7 @@ pluma_document_set_metadata (PlumaDocument *doc, g_object_unref (location); } - + g_object_unref (info); } #endif diff --git a/pluma/pluma-document.h b/pluma/pluma-document.h index 1b6f187f..6649a6f7 100644 --- a/pluma/pluma-document.h +++ b/pluma/pluma-document.h @@ -3,8 +3,8 @@ * This file is part of pluma * * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence - * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi - * Copyright (C) 2002-2005 Paolo Maggi + * Copyright (C) 2000, 2001 Chema Celorio, 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 @@ -18,18 +18,18 @@ * * 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, 1998-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, 1998-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_DOCUMENT_H__ #define __PLUMA_DOCUMENT_H__ @@ -66,7 +66,7 @@ typedef enum typedef enum { - PLUMA_SEARCH_DONT_SET_FLAGS = 1 << 0, + PLUMA_SEARCH_DONT_SET_FLAGS = 1 << 0, PLUMA_SEARCH_ENTIRE_WORD = 1 << 1, PLUMA_SEARCH_CASE_SENSITIVE = 1 << 2, PLUMA_SEARCH_PARSE_ESCAPES = 1 << 3, @@ -94,11 +94,11 @@ typedef struct _PlumaDocumentPrivate PlumaDocumentPrivate; * Main object structure */ typedef struct _PlumaDocument PlumaDocument; - + struct _PlumaDocument { GtkSourceBuffer buffer; - + /*< private > */ PlumaDocumentPrivate *priv; }; @@ -198,11 +198,11 @@ void pluma_document_load (PlumaDocument *doc, const gchar *uri, const PlumaEncoding *encoding, gint line_pos, - gboolean create); + gboolean create); gboolean pluma_document_insert_file (PlumaDocument *doc, - GtkTextIter *iter, - const gchar *uri, + GtkTextIter *iter, + const gchar *uri, const PlumaEncoding *encoding); gboolean pluma_document_load_cancel (PlumaDocument *doc); @@ -210,8 +210,8 @@ gboolean pluma_document_load_cancel (PlumaDocument *doc); void pluma_document_save (PlumaDocument *doc, PlumaDocumentSaveFlags flags); -void pluma_document_save_as (PlumaDocument *doc, - const gchar *uri, +void pluma_document_save_as (PlumaDocument *doc, + const gchar *uri, const PlumaEncoding *encoding, PlumaDocumentSaveFlags flags); @@ -222,7 +222,7 @@ gboolean pluma_document_is_local (PlumaDocument *doc); gboolean pluma_document_get_deleted (PlumaDocument *doc); -gboolean pluma_document_goto_line (PlumaDocument *doc, +gboolean pluma_document_goto_line (PlumaDocument *doc, gint line); gboolean pluma_document_goto_line_offset(PlumaDocument *doc, @@ -259,19 +259,19 @@ gboolean pluma_document_search_backward (PlumaDocument *doc, GtkTextIter *match_end); gint pluma_document_replace_all (PlumaDocument *doc, - const gchar *find, - const gchar *replace, + const gchar *find, + const gchar *replace, guint flags); void pluma_document_set_language (PlumaDocument *doc, GtkSourceLanguage *lang); -GtkSourceLanguage +GtkSourceLanguage *pluma_document_get_language (PlumaDocument *doc); -const PlumaEncoding +const PlumaEncoding *pluma_document_get_encoding (PlumaDocument *doc); -void pluma_document_set_enable_search_highlighting +void pluma_document_set_enable_search_highlighting (PlumaDocument *doc, gboolean enable); @@ -291,13 +291,13 @@ void pluma_document_set_metadata (PlumaDocument *doc, const gchar *first_key, ...); -/* +/* * Non exported functions */ void _pluma_document_set_readonly (PlumaDocument *doc, gboolean readonly); -glong _pluma_document_get_seconds_since_last_save_or_load +glong _pluma_document_get_seconds_since_last_save_or_load (PlumaDocument *doc); /* Note: this is a sync stat: use only on local files */ @@ -307,7 +307,7 @@ gboolean _pluma_document_check_externally_modified void _pluma_document_search_region (PlumaDocument *doc, const GtkTextIter *start, const GtkTextIter *end); - + /* Search macros */ #define PLUMA_SEARCH_IS_DONT_SET_FLAGS(sflags) ((sflags & PLUMA_SEARCH_DONT_SET_FLAGS) != 0) #define PLUMA_SEARCH_SET_DONT_SET_FLAGS(sflags,state) ((state == TRUE) ? \ @@ -330,7 +330,7 @@ void _pluma_document_search_region (PlumaDocument *doc, (sflags |= PLUMA_SEARCH_MATCH_REGEX) : (sflags &= ~PLUMA_SEARCH_MATCH_REGEX)) -typedef GMountOperation *(*PlumaMountOperationFactory)(PlumaDocument *doc, +typedef GMountOperation *(*PlumaMountOperationFactory)(PlumaDocument *doc, gpointer userdata); void _pluma_document_set_mount_operation_factory diff --git a/pluma/pluma-documents-panel.c b/pluma/pluma-documents-panel.c index d7cbf2b4..a3263a96 100644 --- a/pluma/pluma-documents-panel.c +++ b/pluma/pluma-documents-panel.c @@ -2,7 +2,7 @@ * pluma-documents-panel.c * 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$ */ @@ -98,7 +98,7 @@ tab_get_name (PlumaTab *tab) } else { - tab_name = g_markup_printf_escaped ("<i>%s</i>", + tab_name = g_markup_printf_escaped ("<i>%s</i>", docname); } } @@ -144,7 +144,7 @@ static void window_active_tab_changed (PlumaWindow *window, PlumaTab *tab, PlumaDocumentsPanel *panel) -{ +{ g_return_if_fail (tab != NULL); if (!_pluma_window_is_removing_tabs (window)) @@ -177,7 +177,7 @@ refresh_list (PlumaDocumentsPanel *panel) PlumaTab *active_tab; /* g_debug ("refresh_list"); */ - + list_store = GTK_LIST_STORE (panel->priv->model); gtk_list_store_clear (list_store); @@ -190,9 +190,9 @@ refresh_list (PlumaDocumentsPanel *panel) l = tabs; panel->priv->adding_tab = TRUE; - + while (l != NULL) - { + { GdkPixbuf *pixbuf; gchar *name; GtkTreeIter iter; @@ -225,7 +225,7 @@ refresh_list (PlumaDocumentsPanel *panel) l = g_list_next (l); } - + panel->priv->adding_tab = FALSE; g_list_free (tabs); @@ -295,8 +295,8 @@ window_tab_added (PlumaWindow *window, get_iter_from_tab (panel, tab, &sibling); panel->priv->adding_tab = TRUE; - - if (gtk_list_store_iter_is_valid (GTK_LIST_STORE (panel->priv->model), + + if (gtk_list_store_iter_is_valid (GTK_LIST_STORE (panel->priv->model), &sibling)) { gtk_list_store_insert_after (GTK_LIST_STORE (panel->priv->model), @@ -307,7 +307,7 @@ window_tab_added (PlumaWindow *window, { PlumaTab *active_tab; - gtk_list_store_append (GTK_LIST_STORE (panel->priv->model), + gtk_list_store_append (GTK_LIST_STORE (panel->priv->model), &iter); active_tab = pluma_window_get_active_tab (panel->priv->window); @@ -448,7 +448,7 @@ static void pluma_documents_panel_finalize (GObject *object) { /* PlumaDocumentsPanel *tab = PLUMA_DOCUMENTS_PANEL (object); */ - + /* TODO: disconnect signal with window */ G_OBJECT_CLASS (pluma_documents_panel_parent_class)->finalize (object); @@ -468,7 +468,7 @@ pluma_documents_panel_dispose (GObject *object) G_OBJECT_CLASS (pluma_documents_panel_parent_class)->dispose (object); } -static void +static void pluma_documents_panel_class_init (PlumaDocumentsPanelClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); @@ -533,7 +533,7 @@ panel_button_press_event (GtkTreeView *treeview, NULL, NULL, NULL)) - { + { gtk_tree_view_set_cursor (treeview, path, @@ -632,19 +632,19 @@ treeview_row_inserted (GtkTreeModel *tree_model, GtkWidget *nb; gint old_position; gint new_position; - + if (panel->priv->adding_tab) return; - + tab = pluma_window_get_active_tab (panel->priv->window); g_return_if_fail (tab != NULL); panel->priv->is_reodering = TRUE; - + indeces = gtk_tree_path_get_indices (path); - + /* g_debug ("New Index: %d (path: %s)", indeces[0], gtk_tree_path_to_string (path));*/ - + nb = _pluma_window_get_notebook (panel->priv->window); new_position = indeces[0]; @@ -652,7 +652,7 @@ treeview_row_inserted (GtkTreeModel *tree_model, GTK_WIDGET (tab)); if (new_position > old_position) new_position = MAX (0, new_position - 1); - + pluma_notebook_reorder_tab (PLUMA_NOTEBOOK (nb), tab, new_position); @@ -669,17 +669,17 @@ pluma_documents_panel_init (PlumaDocumentsPanel *panel) GtkTreeSelection *selection; panel->priv = PLUMA_DOCUMENTS_PANEL_GET_PRIVATE (panel); - + panel->priv->adding_tab = FALSE; panel->priv->is_reodering = FALSE; gtk_orientable_set_orientation (GTK_ORIENTABLE (panel), GTK_ORIENTATION_VERTICAL); - + /* Create the scrolled window */ sw = gtk_scrolled_window_new (NULL, NULL); g_return_if_fail (sw != NULL); - + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); @@ -687,7 +687,7 @@ pluma_documents_panel_init (PlumaDocumentsPanel *panel) GTK_SHADOW_IN); gtk_widget_show (sw); gtk_box_pack_start (GTK_BOX (panel), sw, TRUE, TRUE, 0); - + /* Create the empty model */ panel->priv->model = GTK_TREE_MODEL (gtk_list_store_new (N_COLUMNS, GDK_TYPE_PIXBUF, @@ -704,7 +704,7 @@ pluma_documents_panel_init (PlumaDocumentsPanel *panel) g_object_set (panel->priv->treeview, "has-tooltip", TRUE, NULL); gtk_widget_show (panel->priv->treeview); - + column = gtk_tree_view_column_new (); gtk_tree_view_column_set_title (column, _("Documents")); @@ -717,12 +717,12 @@ pluma_documents_panel_init (PlumaDocumentsPanel *panel) gtk_tree_view_append_column (GTK_TREE_VIEW (panel->priv->treeview), column); - + selection = gtk_tree_view_get_selection ( GTK_TREE_VIEW (panel->priv->treeview)); gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE); - + g_signal_connect (panel->priv->treeview, "cursor_changed", G_CALLBACK (treeview_cursor_changed), diff --git a/pluma/pluma-documents-panel.h b/pluma/pluma-documents-panel.h index f1c5bc12..aa7a23b2 100644 --- a/pluma/pluma-documents-panel.h +++ b/pluma/pluma-documents-panel.h @@ -2,7 +2,7 @@ * pluma-documents-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$ */ @@ -55,7 +55,7 @@ typedef struct _PlumaDocumentsPanelPrivate PlumaDocumentsPanelPrivate; */ typedef struct _PlumaDocumentsPanel PlumaDocumentsPanel; -struct _PlumaDocumentsPanel +struct _PlumaDocumentsPanel { GtkBox vbox; @@ -68,7 +68,7 @@ struct _PlumaDocumentsPanel */ typedef struct _PlumaDocumentsPanelClass PlumaDocumentsPanelClass; -struct _PlumaDocumentsPanelClass +struct _PlumaDocumentsPanelClass { GtkBoxClass parent_class; }; diff --git a/pluma/pluma-encodings-combo-box.c b/pluma/pluma-encodings-combo-box.c index f4815997..7daaa083 100644 --- a/pluma/pluma-encodings-combo-box.c +++ b/pluma/pluma-encodings-combo-box.c @@ -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, + * Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ - + /* - * Modified by the pluma Team, 2003-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, 2003-2005. See the AUTHORS file for a + * list of people on the pluma Team. + * See the ChangeLog files for a list of changes. * * $Id: pluma-encodings-combo-box.c 6112 2008-01-23 08:26:24Z sfre $ */ @@ -108,7 +108,7 @@ pluma_encodings_combo_box_get_property (GObject *object, combo = PLUMA_ENCODINGS_COMBO_BOX (object); switch (prop_id) - { + { case PROP_SAVE_MODE: g_value_set_boolean (value, combo->priv->save_mode); break; diff --git a/pluma/pluma-encodings-combo-box.h b/pluma/pluma-encodings-combo-box.h index f6465cbf..3888e2ae 100644 --- a/pluma/pluma-encodings-combo-box.h +++ b/pluma/pluma-encodings-combo-box.h @@ -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, + * Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ - + /* - * Modified by the pluma Team, 2003-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, 2003-2005. See the AUTHORS file for a + * list of people on the pluma Team. + * See the ChangeLog files for a list of changes. * * $Id: pluma-encodings-option-menu.h 4429 2005-12-12 17:28:04Z pborelli $ */ diff --git a/pluma/pluma-encodings.c b/pluma/pluma-encodings.c index 6d3da492..592bcf8f 100644 --- a/pluma/pluma-encodings.c +++ b/pluma/pluma-encodings.c @@ -2,7 +2,7 @@ * pluma-encodings.c * 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, + * 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$ */ @@ -46,8 +46,8 @@ struct _PlumaEncoding const gchar *name; }; -/* - * The original versions of the following tables are taken from profterm +/* + * The original versions of the following tables are taken from profterm * * Copyright (C) 2002 Red Hat, Inc. */ @@ -108,7 +108,7 @@ typedef enum PLUMA_ENCODING_KOI8_R, PLUMA_ENCODING_KOI8__R, PLUMA_ENCODING_KOI8_U, - + PLUMA_ENCODING_SHIFT_JIS, PLUMA_ENCODING_TCVN, PLUMA_ENCODING_TIS_620, @@ -129,7 +129,7 @@ typedef enum PLUMA_ENCODING_UTF_8, PLUMA_ENCODING_UNKNOWN - + } PlumaEncodingIndex; static const PlumaEncoding utf8_encoding = { @@ -141,8 +141,8 @@ static const PlumaEncoding utf8_encoding = { /* initialized in pluma_encoding_lazy_init() */ static PlumaEncoding unknown_encoding = { PLUMA_ENCODING_UNKNOWN, - NULL, - NULL + NULL, + NULL }; static const PlumaEncoding encodings [] = { @@ -248,7 +248,7 @@ static const PlumaEncoding encodings [] = { "KOI8-R", N_("Cyrillic") }, { PLUMA_ENCODING_KOI8_U, "KOI8U", N_("Cyrillic/Ukrainian") }, - + { PLUMA_ENCODING_SHIFT_JIS, "SHIFT_JIS", N_("Japanese") }, { PLUMA_ENCODING_TCVN, @@ -312,12 +312,12 @@ pluma_encoding_get_from_charset (const gchar *charset) if (g_ascii_strcasecmp (charset, "UTF-8") == 0) return pluma_encoding_get_utf8 (); - i = 0; + i = 0; while (i < PLUMA_ENCODING_LAST) { if (g_ascii_strcasecmp (charset, encodings[i].charset) == 0) return &encodings[i]; - + ++i; } @@ -364,17 +364,17 @@ pluma_encoding_get_current (void) if (initialized != FALSE) return locale_encoding; - if (g_get_charset (&locale_charset) == FALSE) + if (g_get_charset (&locale_charset) == FALSE) { g_return_val_if_fail (locale_charset != NULL, &utf8_encoding); - + locale_encoding = pluma_encoding_get_from_charset (locale_charset); } else { locale_encoding = &utf8_encoding; } - + if (locale_encoding == NULL) { locale_encoding = &unknown_encoding; @@ -391,7 +391,7 @@ gchar * pluma_encoding_to_string (const PlumaEncoding* enc) { g_return_val_if_fail (enc != NULL, NULL); - + pluma_encoding_lazy_init (); g_return_val_if_fail (enc->charset != NULL, NULL); @@ -443,7 +443,7 @@ pluma_encoding_copy (const PlumaEncoding *enc) return (PlumaEncoding *) enc; } -void +void pluma_encoding_free (PlumaEncoding *enc) { g_return_if_fail (enc != NULL); @@ -451,13 +451,13 @@ pluma_encoding_free (PlumaEncoding *enc) /** * pluma_encoding_get_type: - * + * * Retrieves the GType object which is associated with the * #PlumaEncoding class. - * + * * Return value: the GType associated with #PlumaEncoding. **/ -GType +GType pluma_encoding_get_type (void) { static GType our_type = 0; @@ -469,5 +469,5 @@ pluma_encoding_get_type (void) (GBoxedFreeFunc) pluma_encoding_free); return our_type; -} +} diff --git a/pluma/pluma-encodings.h b/pluma/pluma-encodings.h index 763dc783..0b3a3123 100644 --- a/pluma/pluma-encodings.h +++ b/pluma/pluma-encodings.h @@ -2,7 +2,7 @@ * pluma-encodings.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, + * 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/pluma/pluma-file-chooser-dialog.h b/pluma/pluma-file-chooser-dialog.h index 2cab4e31..841a4b7b 100644 --- a/pluma/pluma-file-chooser-dialog.h +++ b/pluma/pluma-file-chooser-dialog.h @@ -2,7 +2,7 @@ * pluma-file-chooser-dialog.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$ */ diff --git a/pluma/pluma-gio-document-loader.c b/pluma/pluma-gio-document-loader.c index 35b31098..761fba2f 100644 --- a/pluma/pluma-gio-document-loader.c +++ b/pluma/pluma-gio-document-loader.c @@ -21,7 +21,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ - + /* * Modified by the pluma Team, 2005-2008. See the AUTHORS file for a * list of people on the pluma Team. @@ -172,12 +172,12 @@ static AsyncData * async_data_new (PlumaGioDocumentLoader *gvloader) { AsyncData *async; - + async = g_slice_new (AsyncData); async->loader = gvloader; async->cancellable = g_object_ref (gvloader->priv->cancellable); async->tried_mount = FALSE; - + return async; } @@ -222,7 +222,7 @@ get_metadata_encoding (PlumaDocumentLoader *loader) if (charset == NULL) return NULL; - + enc = pluma_encoding_get_from_charset (charset); } #endif @@ -263,9 +263,9 @@ close_input_stream_ready_cb (GInputStream *stream, async_data_free (async); return; } - + pluma_debug_message (DEBUG_SAVER, "Finished closing input stream"); - + if (!g_input_stream_close_finish (stream, res, &error)) { pluma_debug_message (DEBUG_SAVER, "Closing input stream error: %s", error->message); @@ -420,7 +420,7 @@ static void read_file_chunk (AsyncData *async) { PlumaGioDocumentLoader *gvloader; - + gvloader = async->loader; g_input_stream_read_async (G_INPUT_STREAM (gvloader->priv->stream), @@ -457,7 +457,7 @@ finish_query_info (AsyncData *async) GInputStream *conv_stream; GFileInfo *info; GSList *candidate_encodings; - + gvloader = async->loader; loader = PLUMA_DOCUMENT_LOADER (gvloader); info = loader->info; @@ -488,7 +488,7 @@ finish_query_info (AsyncData *async) gvloader->priv->converter = pluma_smart_charset_converter_new (candidate_encodings); g_slist_free (candidate_encodings); - + conv_stream = g_converter_input_stream_new (gvloader->priv->stream, G_CONVERTER (gvloader->priv->converter)); g_object_unref (gvloader->priv->stream); @@ -518,7 +518,7 @@ query_info_cb (GFile *source, { async_data_free (async); return; - } + } gvloader = async->loader; @@ -535,7 +535,7 @@ query_info_cb (GFile *source, } PLUMA_DOCUMENT_LOADER (gvloader)->info = info; - + finish_query_info (async); } @@ -557,7 +557,7 @@ mount_ready_callback (GFile *file, } mounted = g_file_mount_enclosing_volume_finish (file, res, &error); - + if (!mounted) { async_failed (async, error); @@ -598,7 +598,7 @@ async_read_ready_callback (GObject *source, { GError *error = NULL; PlumaGioDocumentLoader *gvloader; - + pluma_debug (DEBUG_LOADER); /* manual check for cancelled state */ @@ -609,19 +609,19 @@ async_read_ready_callback (GObject *source, } gvloader = async->loader; - + gvloader->priv->stream = G_INPUT_STREAM (g_file_read_finish (gvloader->priv->gfile, res, &error)); if (!gvloader->priv->stream) - { + { if (error->code == G_IO_ERROR_NOT_MOUNTED && !async->tried_mount) { recover_not_mounted (async); g_error_free (error); return; } - + /* Propagate error */ g_propagate_error (&gvloader->priv->error, error); pluma_document_loader_loading (PLUMA_DOCUMENT_LOADER (gvloader), @@ -632,7 +632,7 @@ async_read_ready_callback (GObject *source, return; } - /* get the file info: note we cannot use + /* get the file info: note we cannot use * g_file_input_stream_query_info_async since it is not able to get the * content type etc, beside it is not supported by gvfs. * Using the file instead of the stream is slightly racy, but for @@ -650,7 +650,7 @@ async_read_ready_callback (GObject *source, static void open_async_read (AsyncData *async) { - g_file_read_async (async->loader->priv->gfile, + g_file_read_async (async->loader->priv->gfile, G_PRIORITY_HIGH, async->cancellable, (GAsyncReadyCallback) async_read_ready_callback, @@ -662,7 +662,7 @@ pluma_gio_document_loader_load (PlumaDocumentLoader *loader) { PlumaGioDocumentLoader *gvloader = PLUMA_GIO_DOCUMENT_LOADER (loader); AsyncData *async; - + pluma_debug (DEBUG_LOADER); /* make sure no load operation is currently running */ @@ -677,7 +677,7 @@ pluma_gio_document_loader_load (PlumaDocumentLoader *loader) gvloader->priv->cancellable = g_cancellable_new (); async = async_data_new (gvloader); - + open_async_read (async); } diff --git a/pluma/pluma-gio-document-loader.h b/pluma/pluma-gio-document-loader.h index f2fad8ae..a350d8ce 100644 --- a/pluma/pluma-gio-document-loader.h +++ b/pluma/pluma-gio-document-loader.h @@ -18,10 +18,10 @@ * * 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-2008. See the AUTHORS file for a * list of people on the pluma Team. diff --git a/pluma/pluma-gio-document-saver.c b/pluma/pluma-gio-document-saver.c index 593ab33a..b9bb657e 100644 --- a/pluma/pluma-gio-document-saver.c +++ b/pluma/pluma-gio-document-saver.c @@ -56,7 +56,7 @@ typedef struct #define REMOTE_QUERY_ATTRIBUTES G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE "," \ G_FILE_ATTRIBUTE_TIME_MODIFIED - + #define PLUMA_GIO_DOCUMENT_SAVER_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \ PLUMA_TYPE_GIO_DOCUMENT_SAVER, \ PlumaGioDocumentSaverPrivate)) @@ -80,7 +80,7 @@ struct _PlumaGioDocumentSaverPrivate GCancellable *cancellable; GOutputStream *stream; GInputStream *input; - + GError *error; }; @@ -129,7 +129,7 @@ static AsyncData * async_data_new (PlumaGioDocumentSaver *gvsaver) { AsyncData *async; - + async = g_slice_new (AsyncData); async->saver = gvsaver; async->cancellable = g_object_ref (gvsaver->priv->cancellable); @@ -156,7 +156,7 @@ async_data_free (AsyncData *async) g_slice_free (AsyncData, async); } -static void +static void pluma_gio_document_saver_class_init (PlumaGioDocumentSaverClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); @@ -181,7 +181,7 @@ pluma_gio_document_saver_init (PlumaGioDocumentSaver *gvsaver) } static void -remote_save_completed_or_failed (PlumaGioDocumentSaver *gvsaver, +remote_save_completed_or_failed (PlumaGioDocumentSaver *gvsaver, AsyncData *async) { pluma_document_saver_saving (PLUMA_DOCUMENT_SAVER (gvsaver), @@ -295,7 +295,7 @@ remote_get_info_cb (GFile *source, async_data_free (async); return; } - + saver = async->saver; pluma_debug_message (DEBUG_SAVER, "Finished query info on file"); @@ -332,9 +332,9 @@ close_async_ready_get_info_cb (GOutputStream *stream, async_data_free (async); return; } - + pluma_debug_message (DEBUG_SAVER, "Finished closing stream"); - + if (!g_output_stream_close_finish (stream, res, &error)) { pluma_debug_message (DEBUG_SAVER, "Closing stream error: %s", error->message); @@ -343,7 +343,7 @@ close_async_ready_get_info_cb (GOutputStream *stream, return; } - /* get the file info: note we cannot use + /* get the file info: note we cannot use * g_file_output_stream_query_info_async since it is not able to get the * content type etc, beside it is not supported by gvfs. * I'm not sure this is actually necessary, can't we just use @@ -513,11 +513,11 @@ async_replace_ready_callback (GFile *source, async_data_free (async); return; } - + gvsaver = async->saver; saver = PLUMA_DOCUMENT_SAVER (gvsaver); file_stream = g_file_replace_finish (source, res, &error); - + /* handle any error that might occur */ if (!file_stream) { @@ -545,7 +545,7 @@ async_replace_ready_callback (GFile *source, { gvsaver->priv->stream = G_OUTPUT_STREAM (file_stream); } - + gvsaver->priv->input = pluma_document_input_stream_new (GTK_TEXT_BUFFER (saver->document), saver->newline_type); @@ -604,7 +604,7 @@ mount_ready_callback (GFile *file, } mounted = g_file_mount_enclosing_volume_finish (file, res, &error); - + if (!mounted) { async_failed (async, error); @@ -621,7 +621,7 @@ recover_not_mounted (AsyncData *async) { PlumaDocument *doc; GMountOperation *mount_operation; - + pluma_debug (DEBUG_LOADER); doc = pluma_document_saver_get_document (PLUMA_DOCUMENT_SAVER (async->saver)); @@ -655,7 +655,7 @@ check_modification_callback (GFile *source, async_data_free (async); return; } - + gvsaver = async->saver; info = g_file_query_info_finish (source, res, &error); if (info == NULL) @@ -666,7 +666,7 @@ check_modification_callback (GFile *source, g_error_free (error); return; } - + /* it's perfectly fine if the file doesn't exist yet */ if (error->code != G_IO_ERROR_NOT_FOUND) { @@ -716,7 +716,7 @@ check_modified_async (AsyncData *async) { pluma_debug_message (DEBUG_SAVER, "Check externally modified"); - g_file_query_info_async (async->saver->priv->gfile, + g_file_query_info_async (async->saver->priv->gfile, G_FILE_ATTRIBUTE_TIME_MODIFIED, G_FILE_QUERY_INFO_NONE, G_PRIORITY_HIGH, @@ -731,14 +731,14 @@ save_remote_file_real (PlumaGioDocumentSaver *gvsaver) AsyncData *async; pluma_debug_message (DEBUG_SAVER, "Starting gio save"); - + /* First find out if the file is modified externally. This requires * a stat, but I don't think we can do this any other way */ async = async_data_new (gvsaver); - + check_modified_async (async); - + /* return false to stop timeout */ return FALSE; } diff --git a/pluma/pluma-gio-document-saver.h b/pluma/pluma-gio-document-saver.h index 61af8252..21ecbb3e 100644 --- a/pluma/pluma-gio-document-saver.h +++ b/pluma/pluma-gio-document-saver.h @@ -21,7 +21,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ - + /* * Modified by the pluma Team, 2005-2007. See the AUTHORS file for a * list of people on the pluma Team. @@ -53,7 +53,7 @@ typedef struct _PlumaGioDocumentSaverPrivate PlumaGioDocumentSaverPrivate; */ typedef struct _PlumaGioDocumentSaver PlumaGioDocumentSaver; -struct _PlumaGioDocumentSaver +struct _PlumaGioDocumentSaver { PlumaDocumentSaver saver; diff --git a/pluma/pluma-help.c b/pluma/pluma-help.c index 9a764f8c..b409a181 100644 --- a/pluma/pluma-help.c +++ b/pluma/pluma-help.c @@ -2,7 +2,7 @@ * pluma-help.c * 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$ */ @@ -38,7 +38,7 @@ #include <string.h> #include <gtk/gtk.h> -gboolean +gboolean pluma_help_display (GtkWindow *parent, const gchar *name, /* "pluma" if NULL */ const gchar *link_id) @@ -46,7 +46,7 @@ pluma_help_display (GtkWindow *parent, GError *error = NULL; gboolean ret; gchar *link; - + g_return_val_if_fail ((parent == NULL) || GTK_IS_WINDOW (parent), FALSE); if (name == NULL) @@ -54,7 +54,7 @@ pluma_help_display (GtkWindow *parent, else if (strcmp (name, "pluma.xml") == 0) { g_warning ("%s: Using \"pluma.xml\" for the help name is deprecated, use \"pluma\" or simply NULL instead", G_STRFUNC); - + name = "pluma"; } @@ -77,7 +77,7 @@ pluma_help_display (GtkWindow *parent, dialog = gtk_message_dialog_new (parent, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, - GTK_BUTTONS_CLOSE, + GTK_BUTTONS_CLOSE, _("There was an error displaying the help.")); gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), diff --git a/pluma/pluma-help.h b/pluma/pluma-help.h index e4756320..26f2167e 100644 --- a/pluma/pluma-help.h +++ b/pluma/pluma-help.h @@ -2,7 +2,7 @@ * pluma-help.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$ */ @@ -38,7 +38,7 @@ G_BEGIN_DECLS gboolean pluma_help_display (GtkWindow *parent, const gchar *name, /* "pluma" if NULL */ const gchar *link_id); - + G_END_DECLS #endif /* __PLUMA_HELP_H__ */ diff --git a/pluma/pluma-history-entry.c b/pluma/pluma-history-entry.c index 717d69d4..64b52409 100644 --- a/pluma/pluma-history-entry.c +++ b/pluma/pluma-history-entry.c @@ -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, 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. * * $Id$ */ @@ -58,9 +58,9 @@ struct _PlumaHistoryEntryPrivate { gchar *history_id; guint history_length; - + GtkEntryCompletion *completion; - + GSettings *settings; }; @@ -130,7 +130,7 @@ pluma_history_entry_finalize (GObject *object) PlumaHistoryEntryPrivate *priv; priv = PLUMA_HISTORY_ENTRY (object)->priv; - + g_free (priv->history_id); if (priv->settings != NULL) @@ -142,16 +142,16 @@ pluma_history_entry_finalize (GObject *object) G_OBJECT_CLASS (pluma_history_entry_parent_class)->finalize (object); } -static void +static void pluma_history_entry_class_init (PlumaHistoryEntryClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - + object_class->set_property = pluma_history_entry_set_property; object_class->get_property = pluma_history_entry_get_property; object_class->finalize = pluma_history_entry_finalize; object_class->dispose = pluma_history_entry_dispose; - + g_object_class_install_property (object_class, PROP_HISTORY_ID, g_param_spec_string ("history-id", @@ -304,7 +304,7 @@ insert_history_item (PlumaHistoryEntry *entry, if (g_utf8_strlen (text, -1) <= MIN_ITEM_LEN) return; - + store = get_history_store (entry); /* remove the text from the store if it was already @@ -372,7 +372,7 @@ pluma_history_entry_load_history (PlumaHistoryEntry *entry) l = l->next, i++) { gtk_list_store_append (store, &iter); - gtk_list_store_set (store, + gtk_list_store_set (store, &iter, 0, l->data, @@ -445,16 +445,16 @@ pluma_history_entry_set_enable_completion (PlumaHistoryEntry *entry, gboolean enable) { g_return_if_fail (PLUMA_IS_HISTORY_ENTRY (entry)); - + if (enable) { if (entry->priv->completion != NULL) return; - + entry->priv->completion = gtk_entry_completion_new (); - gtk_entry_completion_set_model (entry->priv->completion, + gtk_entry_completion_set_model (entry->priv->completion, GTK_TREE_MODEL (get_history_store (entry))); - + /* Use model column 0 as the text column */ gtk_entry_completion_set_text_column (entry->priv->completion, 0); @@ -463,9 +463,9 @@ pluma_history_entry_set_enable_completion (PlumaHistoryEntry *entry, gtk_entry_completion_set_popup_completion (entry->priv->completion, FALSE); gtk_entry_completion_set_inline_completion (entry->priv->completion, TRUE); - + /* Assign the completion to the entry */ - gtk_entry_set_completion (GTK_ENTRY (pluma_history_entry_get_entry(entry)), + gtk_entry_set_completion (GTK_ENTRY (pluma_history_entry_get_entry(entry)), entry->priv->completion); } else @@ -473,20 +473,20 @@ pluma_history_entry_set_enable_completion (PlumaHistoryEntry *entry, if (entry->priv->completion == NULL) return; - gtk_entry_set_completion (GTK_ENTRY (pluma_history_entry_get_entry (entry)), + gtk_entry_set_completion (GTK_ENTRY (pluma_history_entry_get_entry (entry)), NULL); - + g_object_unref (entry->priv->completion); - + entry->priv->completion = NULL; } } - + gboolean pluma_history_entry_get_enable_completion (PlumaHistoryEntry *entry) { g_return_val_if_fail (PLUMA_IS_HISTORY_ENTRY (entry), FALSE); - + return entry->priv->completion != NULL; } @@ -517,12 +517,12 @@ pluma_history_entry_new (const gchar *history_id, g_object_unref (store); /* loading has to happen after the model - * has been set. However the model is not a + * has been set. However the model is not a * G_PARAM_CONSTRUCT property of GtkComboBox * so we cannot do this in the constructor. - * For now we simply do here since this widget is + * For now we simply do here since this widget is * not bound to other programming languages. - * A maybe better alternative is to override the + * A maybe better alternative is to override the * model property of combobox and mark CONTRUCT_ONLY. * This would also ensure that the model cannot be * set explicitely at a later time. @@ -531,14 +531,14 @@ pluma_history_entry_new (const gchar *history_id, pluma_history_entry_set_enable_completion (PLUMA_HISTORY_ENTRY (ret), enable_completion); - + return ret; } /* * Utility function to get the editable text entry internal widget. - * I would prefer to not expose this implementation detail and - * simply make the PlumaHistoryEntry widget implement the + * I would prefer to not expose this implementation detail and + * simply make the PlumaHistoryEntry widget implement the * GtkEditable interface. Unfortunately both GtkEditable and * GtkComboBox have a "changed" signal and I am not sure how to * handle the conflict. diff --git a/pluma/pluma-history-entry.h b/pluma/pluma-history-entry.h index bca90d89..17a17a7f 100644 --- a/pluma/pluma-history-entry.h +++ b/pluma/pluma-history-entry.h @@ -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, 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. * * $Id$ */ @@ -78,11 +78,11 @@ guint pluma_history_entry_get_history_length (PlumaHistoryEntry *gentry); gchar *pluma_history_entry_get_history_id (PlumaHistoryEntry *entry); -void pluma_history_entry_set_enable_completion +void pluma_history_entry_set_enable_completion (PlumaHistoryEntry *entry, gboolean enable); - -gboolean pluma_history_entry_get_enable_completion + +gboolean pluma_history_entry_get_enable_completion (PlumaHistoryEntry *entry); GtkWidget *pluma_history_entry_get_entry (PlumaHistoryEntry *entry); diff --git a/pluma/pluma-io-error-message-area.c b/pluma/pluma-io-error-message-area.c index 53487fbb..937bc880 100644 --- a/pluma/pluma-io-error-message-area.c +++ b/pluma/pluma-io-error-message-area.c @@ -2,7 +2,7 @@ * pluma-io-error-message-area.c * 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,18 +16,18 @@ * * 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$ */ - + /* * Verbose error reporting for file I/O operations (load, save, revert, create) */ @@ -84,7 +84,7 @@ set_contents (GtkWidget *area, GtkWidget *contents) { GtkWidget *content_area; - + content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (area)); gtk_container_add (GTK_CONTAINER (content_area), contents); } @@ -190,9 +190,9 @@ create_io_loading_error_message_area (const gchar *primary_text, static gboolean parse_gio_error (gint code, - gchar **error_message, - gchar **message_details, - const gchar *uri, + gchar **error_message, + gchar **message_details, + const gchar *uri, const gchar *uri_for_display) { gboolean ret = TRUE; @@ -210,7 +210,7 @@ parse_gio_error (gint code, { gchar *scheme_string; gchar *scheme_markup; - + scheme_string = g_uri_parse_scheme (uri); if ((scheme_string != NULL) && g_utf8_validate (scheme_string, -1, NULL)) @@ -225,7 +225,7 @@ parse_gio_error (gint code, else { *message_details = g_strdup (_("pluma cannot handle this location.")); - } + } g_free (scheme_string); } @@ -234,25 +234,25 @@ parse_gio_error (gint code, case G_IO_ERROR_NOT_MOUNTABLE_FILE: *message_details = g_strdup (_("The location of the file cannot be mounted.")); break; - + case G_IO_ERROR_NOT_MOUNTED: *message_details = g_strdup( _("The location of the file cannot be accessed because it is not mounted.")); - break; + break; case G_IO_ERROR_IS_DIRECTORY: *error_message = g_strdup_printf (_("%s is a directory."), uri_for_display); *message_details = g_strdup (_("Please check that you typed the " "location correctly and try again.")); break; - + case G_IO_ERROR_INVALID_FILENAME: *error_message = g_strdup_printf (_("%s is not a valid location."), uri_for_display); *message_details = g_strdup (_("Please check that you typed the " "location correctly and try again.")); break; - + case G_IO_ERROR_HOST_NOT_FOUND: /* This case can be hit for user-typed strings like "foo" due to * the code that guesses web addresses when there's no initial "/". @@ -285,7 +285,7 @@ parse_gio_error (gint code, g_free (host_markup); } } - + if (!*message_details) { /* use the same string as INVALID_HOST */ @@ -316,9 +316,9 @@ parse_gio_error (gint code, static gboolean parse_pluma_error (gint code, - gchar **error_message, - gchar **message_details, - const gchar *uri, + gchar **error_message, + gchar **message_details, + const gchar *uri, const gchar *uri_for_display) { gboolean ret = TRUE; @@ -338,10 +338,10 @@ parse_pluma_error (gint code, } static void -parse_error (const GError *error, - gchar **error_message, - gchar **message_details, - const gchar *uri, +parse_error (const GError *error, + gchar **error_message, + gchar **message_details, + const gchar *uri, const gchar *uri_for_display) { gboolean ret = FALSE; @@ -362,12 +362,12 @@ parse_error (const GError *error, uri, uri_for_display); } - + if (!ret) { - g_warning ("Hit unhandled case %d (%s) in %s.", - error->code, error->message, G_STRFUNC); - *message_details = g_strdup_printf (_("Unexpected error: %s"), + g_warning ("Hit unhandled case %d (%s) in %s.", + error->code, error->message, G_STRFUNC); + *message_details = g_strdup_printf (_("Unexpected error: %s"), error->message); } } @@ -385,7 +385,7 @@ pluma_unrecoverable_reverting_error_message_area_new (const gchar *uri, g_return_val_if_fail (uri != NULL, NULL); g_return_val_if_fail (error != NULL, NULL); - g_return_val_if_fail ((error->domain == PLUMA_DOCUMENT_ERROR) || + g_return_val_if_fail ((error->domain == PLUMA_DOCUMENT_ERROR) || (error->domain == G_IO_ERROR), NULL); full_formatted_uri = pluma_utils_uri_for_display (uri); @@ -394,8 +394,8 @@ pluma_unrecoverable_reverting_error_message_area_new (const gchar *uri, * though the dialog uses wrapped text, if the URI doesn't contain * white space then the text-wrapping code is too stupid to wrap it. */ - temp_uri_for_display = pluma_utils_str_middle_truncate (full_formatted_uri, - MAX_URI_IN_DIALOG_LENGTH); + temp_uri_for_display = pluma_utils_str_middle_truncate (full_formatted_uri, + MAX_URI_IN_DIALOG_LENGTH); g_free (full_formatted_uri); uri_for_display = g_markup_printf_escaped ("<i>%s</i>", temp_uri_for_display); @@ -444,8 +444,8 @@ create_combo_box (GtkWidget *message_area, GtkWidget *vbox) g_free (label_markup); gtk_label_set_use_markup (GTK_LABEL (label), TRUE); menu = pluma_encodings_combo_box_new (TRUE); - g_object_set_data (G_OBJECT (message_area), - "pluma-message-area-encoding-menu", + g_object_set_data (G_OBJECT (message_area), + "pluma-message-area-encoding-menu", menu); gtk_label_set_mnemonic_widget (GTK_LABEL (label), menu); @@ -518,10 +518,10 @@ create_conversion_error_message_area (const gchar *primary_text, gtk_box_pack_start (GTK_BOX (hbox_content), image, FALSE, FALSE, 0); gtk_widget_set_halign (image, GTK_ALIGN_CENTER); gtk_widget_set_valign (image, GTK_ALIGN_START); - + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_box_pack_start (GTK_BOX (hbox_content), vbox, TRUE, TRUE, 0); - + primary_markup = g_strdup_printf ("<b>%s</b>", primary_text); primary_label = gtk_label_new (primary_markup); g_free (primary_markup); @@ -567,13 +567,13 @@ pluma_io_loading_error_message_area_new (const gchar *uri, GtkWidget *message_area; gboolean edit_anyway = FALSE; gboolean convert_error = FALSE; - + g_return_val_if_fail (uri != NULL, NULL); g_return_val_if_fail (error != NULL, NULL); g_return_val_if_fail ((error->domain == G_CONVERT_ERROR) || (error->domain == PLUMA_DOCUMENT_ERROR) || (error->domain == G_IO_ERROR), NULL); - + full_formatted_uri = pluma_utils_uri_for_display (uri); /* Truncate the URI so it doesn't get insanely wide. Note that even @@ -583,7 +583,7 @@ pluma_io_loading_error_message_area_new (const gchar *uri, temp_uri_for_display = pluma_utils_str_middle_truncate (full_formatted_uri, MAX_URI_IN_DIALOG_LENGTH); g_free (full_formatted_uri); - + uri_for_display = g_markup_printf_escaped ("<i>%s</i>", temp_uri_for_display); g_free (temp_uri_for_display); @@ -626,7 +626,7 @@ pluma_io_loading_error_message_area_new (const gchar *uri, else if (is_gio_error (error, G_IO_ERROR_INVALID_DATA) && encoding != NULL) { error_message = g_strdup_printf (_("Could not open the file %s using the %s character encoding."), - uri_for_display, + uri_for_display, encoding_name); message_details = g_strconcat (_("Please check that you are not trying to open a binary file."), "\n", _("Select a different character encoding from the menu and try again."), NULL); @@ -660,7 +660,7 @@ pluma_io_loading_error_message_area_new (const gchar *uri, g_free (encoding_name); g_free (error_message); g_free (message_details); - + return message_area; } @@ -677,35 +677,35 @@ pluma_conversion_error_while_saving_message_area_new ( gchar *uri_for_display; gchar *temp_uri_for_display; GtkWidget *message_area; - + g_return_val_if_fail (uri != NULL, NULL); g_return_val_if_fail (error != NULL, NULL); g_return_val_if_fail (error->domain == G_CONVERT_ERROR || error->domain == G_IO_ERROR, NULL); g_return_val_if_fail (encoding != NULL, NULL); - + full_formatted_uri = pluma_utils_uri_for_display (uri); /* Truncate the URI so it doesn't get insanely wide. Note that even * though the dialog uses wrapped text, if the URI doesn't contain * white space then the text-wrapping code is too stupid to wrap it. */ - temp_uri_for_display = pluma_utils_str_middle_truncate (full_formatted_uri, - MAX_URI_IN_DIALOG_LENGTH); + temp_uri_for_display = pluma_utils_str_middle_truncate (full_formatted_uri, + MAX_URI_IN_DIALOG_LENGTH); g_free (full_formatted_uri); - + uri_for_display = g_markup_printf_escaped ("<i>%s</i>", temp_uri_for_display); g_free (temp_uri_for_display); encoding_name = pluma_encoding_to_string (encoding); - + error_message = g_strdup_printf (_("Could not save the file %s using the %s character encoding."), - uri_for_display, + uri_for_display, encoding_name); message_details = g_strconcat (_("The document contains one or more characters that cannot be encoded " "using the specified character encoding."), "\n", _("Select a different character encoding from the menu and try again."), NULL); - + message_area = create_conversion_error_message_area ( error_message, message_details, @@ -715,7 +715,7 @@ pluma_conversion_error_while_saving_message_area_new ( g_free (encoding_name); g_free (error_message); g_free (message_details); - + return message_area; } @@ -726,10 +726,10 @@ pluma_conversion_error_message_area_get_encoding (GtkWidget *message_area) g_return_val_if_fail (GTK_IS_INFO_BAR (message_area), NULL); - menu = g_object_get_data (G_OBJECT (message_area), - "pluma-message-area-encoding-menu"); + menu = g_object_get_data (G_OBJECT (message_area), + "pluma-message-area-encoding-menu"); g_return_val_if_fail (menu, NULL); - + return pluma_encodings_combo_box_get_selected_encoding (PLUMA_ENCODINGS_COMBO_BOX (menu)); } @@ -750,17 +750,17 @@ pluma_file_already_open_warning_message_area_new (const gchar *uri) gchar *full_formatted_uri; gchar *uri_for_display; gchar *temp_uri_for_display; - + full_formatted_uri = pluma_utils_uri_for_display (uri); /* Truncate the URI so it doesn't get insanely wide. Note that even * though the dialog uses wrapped text, if the URI doesn't contain * white space then the text-wrapping code is too stupid to wrap it. */ - temp_uri_for_display = pluma_utils_str_middle_truncate (full_formatted_uri, - MAX_URI_IN_DIALOG_LENGTH); + temp_uri_for_display = pluma_utils_str_middle_truncate (full_formatted_uri, + MAX_URI_IN_DIALOG_LENGTH); g_free (full_formatted_uri); - + uri_for_display = g_markup_printf_escaped ("<i>%s</i>", temp_uri_for_display); g_free (temp_uri_for_display); @@ -790,7 +790,7 @@ pluma_file_already_open_warning_message_area_new (const gchar *uri) primary_text = g_strdup_printf (_("This file (%s) is already open in another pluma window."), uri_for_display); g_free (uri_for_display); - + primary_markup = g_strdup_printf ("<b>%s</b>", primary_text); g_free (primary_text); primary_label = gtk_label_new (primary_markup); @@ -851,15 +851,15 @@ pluma_externally_modified_saving_error_message_area_new ( * though the dialog uses wrapped text, if the URI doesn't contain * white space then the text-wrapping code is too stupid to wrap it. */ - temp_uri_for_display = pluma_utils_str_middle_truncate (full_formatted_uri, - MAX_URI_IN_DIALOG_LENGTH); + temp_uri_for_display = pluma_utils_str_middle_truncate (full_formatted_uri, + MAX_URI_IN_DIALOG_LENGTH); g_free (full_formatted_uri); uri_for_display = g_markup_printf_escaped ("<i>%s</i>", temp_uri_for_display); g_free (temp_uri_for_display); message_area = gtk_info_bar_new (); - + info_bar_add_icon_button_with_text (GTK_INFO_BAR (message_area), _("S_ave Anyway"), "document-save", @@ -947,15 +947,15 @@ pluma_no_backup_saving_error_message_area_new (const gchar *uri, * though the dialog uses wrapped text, if the URI doesn't contain * white space then the text-wrapping code is too stupid to wrap it. */ - temp_uri_for_display = pluma_utils_str_middle_truncate (full_formatted_uri, - MAX_URI_IN_DIALOG_LENGTH); + temp_uri_for_display = pluma_utils_str_middle_truncate (full_formatted_uri, + MAX_URI_IN_DIALOG_LENGTH); g_free (full_formatted_uri); uri_for_display = g_markup_printf_escaped ("<i>%s</i>", temp_uri_for_display); g_free (temp_uri_for_display); message_area = gtk_info_bar_new (); - + info_bar_add_icon_button_with_text (GTK_INFO_BAR (message_area), _("S_ave Anyway"), "document-save", @@ -1033,7 +1033,7 @@ pluma_unrecoverable_saving_error_message_area_new (const gchar *uri, g_return_val_if_fail (uri != NULL, NULL); g_return_val_if_fail (error != NULL, NULL); - g_return_val_if_fail ((error->domain == PLUMA_DOCUMENT_ERROR) || + g_return_val_if_fail ((error->domain == PLUMA_DOCUMENT_ERROR) || (error->domain == G_IO_ERROR), NULL); full_formatted_uri = pluma_utils_uri_for_display (uri); @@ -1042,7 +1042,7 @@ pluma_unrecoverable_saving_error_message_area_new (const gchar *uri, * though the dialog uses wrapped text, if the URI doesn't contain * white space then the text-wrapping code is too stupid to wrap it. */ - temp_uri_for_display = pluma_utils_str_middle_truncate (full_formatted_uri, + temp_uri_for_display = pluma_utils_str_middle_truncate (full_formatted_uri, MAX_URI_IN_DIALOG_LENGTH); g_free (full_formatted_uri); @@ -1075,7 +1075,7 @@ pluma_unrecoverable_saving_error_message_area_new (const gchar *uri, } else if (is_gio_error (error, G_IO_ERROR_INVALID_FILENAME)) { - message_details = g_strdup (_("%s is not a valid location. " + message_details = g_strdup (_("%s is not a valid location. " "Please check that you typed the " "location correctly and try again.")); } @@ -1117,10 +1117,10 @@ pluma_unrecoverable_saving_error_message_area_new (const gchar *uri, } else { - parse_error (error, - &error_message, - &message_details, - uri, + parse_error (error, + &error_message, + &message_details, + uri, uri_for_display); } @@ -1160,7 +1160,7 @@ pluma_externally_modified_message_area_new (const gchar *uri, * though the dialog uses wrapped text, if the URI doesn't contain * white space then the text-wrapping code is too stupid to wrap it. */ - temp_uri_for_display = pluma_utils_str_middle_truncate (full_formatted_uri, + temp_uri_for_display = pluma_utils_str_middle_truncate (full_formatted_uri, MAX_URI_IN_DIALOG_LENGTH); g_free (full_formatted_uri); @@ -1180,7 +1180,7 @@ pluma_externally_modified_message_area_new (const gchar *uri, secondary_text = _("Do you want to reload the file?"); message_area = gtk_info_bar_new (); - + info_bar_add_icon_button_with_text (GTK_INFO_BAR (message_area), _("_Reload"), "view-refresh", diff --git a/pluma/pluma-io-error-message-area.h b/pluma/pluma-io-error-message-area.h index c0bbc612..2a7983cb 100644 --- a/pluma/pluma-io-error-message-area.h +++ b/pluma/pluma-io-error-message-area.h @@ -2,7 +2,7 @@ * pluma-io-error-message-area.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$ */ @@ -46,7 +46,7 @@ GtkWidget *pluma_conversion_error_while_saving_message_area_new (const gchar const PlumaEncoding *encoding, const GError *error); -const PlumaEncoding +const PlumaEncoding *pluma_conversion_error_message_area_get_encoding (GtkWidget *message_area); GtkWidget *pluma_file_already_open_warning_message_area_new (const gchar *uri); diff --git a/pluma/pluma-language-manager.c b/pluma/pluma-language-manager.c index 47841d9f..9eb3f66a 100644 --- a/pluma/pluma-language-manager.c +++ b/pluma/pluma-language-manager.c @@ -3,7 +3,7 @@ * pluma-languages-manager.c * This file is part of pluma * - * Copyright (C) 2003-2006 - Paolo Maggi + * Copyright (C) 2003-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, + * Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ - + /* - * Modified by the pluma Team, 2003-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, 2003-2006. 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/pluma/pluma-language-manager.h b/pluma/pluma-language-manager.h index 7f27a49e..2d5d85bc 100644 --- a/pluma/pluma-language-manager.h +++ b/pluma/pluma-language-manager.h @@ -3,7 +3,7 @@ * pluma-languages-manager.h * This file is part of pluma * - * Copyright (C) 2003-2005 - Paolo Maggi + * Copyright (C) 2003-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 @@ -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, + * Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ - + /* - * Modified by the pluma Team, 2003-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, 2003-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/pluma/pluma-message-bus.c b/pluma/pluma-message-bus.c index 1dd89c47..28639c26 100644 --- a/pluma/pluma-message-bus.c +++ b/pluma/pluma-message-bus.c @@ -46,8 +46,8 @@ * * // Register 'method' at '/plugins/example' with one required * // string argument 'arg1' - * PlumaMessageType *message_type = pluma_message_bus_register ("/plugins/example", "method", - * 0, + * PlumaMessageType *message_type = pluma_message_bus_register ("/plugins/example", "method", + * 0, * "arg1", G_TYPE_STRING, * NULL); * </programlisting> @@ -61,20 +61,20 @@ * gpointer userdata) * { * gchar *arg1 = NULL; - * + * * pluma_message_get (message, "arg1", &arg1, NULL); * g_message ("Evoked /plugins/example.method with: %s", arg1); * g_free (arg1); * } * * PlumaMessageBus *bus = pluma_message_bus_get_default (); - * - * guint id = pluma_message_bus_connect (bus, + * + * guint id = pluma_message_bus_connect (bus, * "/plugins/example", "method", * example_method_cb, * NULL, * NULL); - * + * * </programlisting> * </example> * <example> @@ -82,14 +82,14 @@ * <programlisting> * PlumaMessageBus *bus = pluma_message_bus_get_default (); * - * pluma_message_bus_send (bus, - * "/plugins/example", "method", - * "arg1", "Hello World", + * pluma_message_bus_send (bus, + * "/plugins/example", "method", + * "arg1", "Hello World", * NULL); * </programlisting> * </example> */ - + #define PLUMA_MESSAGE_BUS_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), PLUMA_TYPE_MESSAGE_BUS, PlumaMessageBusPrivate)) typedef struct @@ -125,7 +125,7 @@ struct _PlumaMessageBusPrivate guint idle_id; guint next_id; - + GHashTable *types; /* mapping from identifier to PlumaMessageType */ }; @@ -159,10 +159,10 @@ message_free (Message *message) { g_free (message->method); g_free (message->object_path); - + g_list_foreach (message->listeners, (GFunc)listener_free, NULL); g_list_free (message->listeners); - + g_free (message); } @@ -177,16 +177,16 @@ static void pluma_message_bus_finalize (GObject *object) { PlumaMessageBus *bus = PLUMA_MESSAGE_BUS (object); - + if (bus->priv->idle_id != 0) g_source_remove (bus->priv->idle_id); - + message_queue_free (bus->priv->message_queue); g_hash_table_destroy (bus->priv->messages); g_hash_table_destroy (bus->priv->idmap); g_hash_table_destroy (bus->priv->types); - + G_OBJECT_CLASS (pluma_message_bus_parent_class)->finalize (object); } @@ -194,9 +194,9 @@ static void pluma_message_bus_class_init (PlumaMessageBusClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - + object_class->finalize = pluma_message_bus_finalize; - + klass->dispatch = pluma_message_bus_dispatch_real; /** @@ -205,7 +205,7 @@ pluma_message_bus_class_init (PlumaMessageBusClass *klass) * @message: the #PlumaMessage to dispatch * * The "dispatch" signal is emitted when a message is to be dispatched. - * The message is dispatched in the default handler of this signal. + * The message is dispatched in the default handler of this signal. * Primary use of this signal is to customize the dispatch of a message * (for instance to automatically dispatch all messages over DBus). *2 @@ -246,7 +246,7 @@ pluma_message_bus_class_init (PlumaMessageBusClass *klass) * @bus: a #PlumaMessageBus * @message_type: the unregistered #PlumaMessageType * - * The "unregistered" signal is emitted when a message has been + * The "unregistered" signal is emitted when a message has been * unregistered from the bus. * */ @@ -270,12 +270,12 @@ message_new (PlumaMessageBus *bus, const gchar *method) { Message *message = g_new (Message, 1); - + message->object_path = g_strdup (object_path); message->method = g_strdup (method); message->listeners = NULL; - g_hash_table_insert (bus->priv->messages, + g_hash_table_insert (bus->priv->messages, pluma_message_type_identifier (object_path, method), message); return message; @@ -289,17 +289,17 @@ lookup_message (PlumaMessageBus *bus, { gchar *identifier; Message *message; - + identifier = pluma_message_type_identifier (object_path, method); message = (Message *)g_hash_table_lookup (bus->priv->messages, identifier); g_free (identifier); if (!message && !create) return NULL; - + if (!message) message = message_new (bus, object_path, method); - + return message; } @@ -312,7 +312,7 @@ add_listener (PlumaMessageBus *bus, { Listener *listener; IdMap *idmap; - + listener = g_new (Listener, 1); listener->id = ++bus->priv->next_id; listener->callback = callback; @@ -321,12 +321,12 @@ add_listener (PlumaMessageBus *bus, listener->destroy_data = destroy_data; message->listeners = g_list_append (message->listeners, listener); - + idmap = g_new (IdMap, 1); idmap->message = message; idmap->listener = g_list_last (message->listeners); - g_hash_table_insert (bus->priv->idmap, GINT_TO_POINTER (listener->id), idmap); + g_hash_table_insert (bus->priv->idmap, GINT_TO_POINTER (listener->id), idmap); return listener->id; } @@ -336,16 +336,16 @@ remove_listener (PlumaMessageBus *bus, GList *listener) { Listener *lst; - + lst = (Listener *)listener->data; - + /* remove from idmap */ g_hash_table_remove (bus->priv->idmap, GINT_TO_POINTER (lst->id)); listener_free (lst); /* remove from list of listeners */ message->listeners = g_list_delete_link (message->listeners, listener); - + if (!message->listeners) { /* remove message because it does not have any listeners */ @@ -359,7 +359,7 @@ block_listener (PlumaMessageBus *bus, GList *listener) { Listener *lst; - + lst = (Listener *)listener->data; lst->blocked = TRUE; } @@ -370,7 +370,7 @@ unblock_listener (PlumaMessageBus *bus, GList *listener) { Listener *lst; - + lst = (Listener *)listener->data; lst->blocked = FALSE; } @@ -381,11 +381,11 @@ dispatch_message_real (PlumaMessageBus *bus, PlumaMessage *message) { GList *item; - + for (item = msg->listeners; item; item = item->next) { Listener *listener = (Listener *)item->data; - + if (!listener->blocked) listener->callback (bus, message, listener->userdata); } @@ -398,12 +398,12 @@ pluma_message_bus_dispatch_real (PlumaMessageBus *bus, const gchar *object_path; const gchar *method; Message *msg; - + object_path = pluma_message_get_object_path (message); method = pluma_message_get_method (message); msg = lookup_message (bus, object_path, method, FALSE); - + if (msg) dispatch_message_real (bus, msg, message); } @@ -412,7 +412,7 @@ static void dispatch_message (PlumaMessageBus *bus, PlumaMessage *message) { - g_signal_emit (bus, message_bus_signals[DISPATCH], 0, message); + g_signal_emit (bus, message_bus_signals[DISPATCH], 0, message); } static gboolean @@ -420,7 +420,7 @@ idle_dispatch (PlumaMessageBus *bus) { GList *list; GList *item; - + /* make sure to set idle_id to 0 first so that any new async messages will be queued properly */ bus->priv->idle_id = 0; @@ -428,14 +428,14 @@ idle_dispatch (PlumaMessageBus *bus) /* reverse queue to get correct delivery order */ list = g_list_reverse (bus->priv->message_queue); bus->priv->message_queue = NULL; - + for (item = list; item; item = item->next) { PlumaMessage *msg = PLUMA_MESSAGE (item->data); - + dispatch_message (bus, msg); } - + message_queue_free (list); return FALSE; } @@ -448,15 +448,15 @@ process_by_id (PlumaMessageBus *bus, MatchCallback processor) { IdMap *idmap; - + idmap = (IdMap *)g_hash_table_lookup (bus->priv->idmap, GINT_TO_POINTER (id)); - + if (idmap == NULL) { g_warning ("No handler registered with id `%d'", id); return; } - + processor (bus, idmap->message, idmap->listener); } @@ -470,27 +470,27 @@ process_by_match (PlumaMessageBus *bus, { Message *message; GList *item; - + message = lookup_message (bus, object_path, method, FALSE); - + if (!message) { g_warning ("No such handler registered for %s.%s", object_path, method); return; } - + for (item = message->listeners; item; item = item->next) { Listener *listener = (Listener *)item->data; - - if (listener->callback == callback && + + if (listener->callback == callback && listener->userdata == userdata) { processor (bus, message, item); return; } } - + g_warning ("No such handler registered for %s.%s", object_path, method); } @@ -498,7 +498,7 @@ static void pluma_message_bus_init (PlumaMessageBus *self) { self->priv = PLUMA_MESSAGE_BUS_GET_PRIVATE (self); - + self->priv->messages = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify)g_free, @@ -508,7 +508,7 @@ pluma_message_bus_init (PlumaMessageBus *self) g_direct_equal, NULL, (GDestroyNotify)g_free); - + self->priv->types = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify)g_free, @@ -527,20 +527,20 @@ PlumaMessageBus * pluma_message_bus_get_default (void) { static PlumaMessageBus *default_bus = NULL; - + if (G_UNLIKELY (default_bus == NULL)) { default_bus = g_object_new (PLUMA_TYPE_MESSAGE_BUS, NULL); g_object_add_weak_pointer (G_OBJECT (default_bus), (gpointer) &default_bus); } - + return default_bus; } /** * pluma_message_bus_new: - * + * * Create a new message bus. Use pluma_message_bus_get_default() to get the * default, application wide, message bus. Creating a new bus is useful for * associating a specific bus with for instance a #PlumaWindow. @@ -560,7 +560,7 @@ pluma_message_bus_new (void) * @object_path: the object path * @method: the method * - * Get the registered #PlumaMessageType for @method at @object_path. The + * Get the registered #PlumaMessageType for @method at @object_path. The * returned #PlumaMessageType is owned by the bus and should not be unreffed. * * Return value: the registered #PlumaMessageType or %NULL if no message type @@ -574,14 +574,14 @@ pluma_message_bus_lookup (PlumaMessageBus *bus, { gchar *identifier; PlumaMessageType *message_type; - + g_return_val_if_fail (PLUMA_IS_MESSAGE_BUS (bus), NULL); g_return_val_if_fail (object_path != NULL, NULL); g_return_val_if_fail (method != NULL, NULL); identifier = pluma_message_type_identifier (object_path, method); message_type = PLUMA_MESSAGE_TYPE (g_hash_table_lookup (bus->priv->types, identifier)); - + g_free (identifier); return message_type; } @@ -595,9 +595,9 @@ pluma_message_bus_lookup (PlumaMessageBus *bus, * @...: NULL terminated list of key/gtype method argument pairs * * Register a message on the bus. A message must be registered on the bus before - * it can be send. This function registers the type arguments for @method at - * @object_path. The arguments are specified with the variable arguments which - * should contain pairs of const gchar *key and GType terminated by %NULL. The + * it can be send. This function registers the type arguments for @method at + * @object_path. The arguments are specified with the variable arguments which + * should contain pairs of const gchar *key and GType terminated by %NULL. The * last @num_optional arguments are registered as optional (and are thus not * required when sending a message). * @@ -621,7 +621,7 @@ pluma_message_bus_register (PlumaMessageBus *bus, g_return_val_if_fail (PLUMA_IS_MESSAGE_BUS (bus), NULL); g_return_val_if_fail (pluma_message_type_is_valid_object_path (object_path), NULL); - + if (pluma_message_bus_is_registered (bus, object_path, method)) { g_warning ("Message type for '%s.%s' is already registered", object_path, method); @@ -630,14 +630,14 @@ pluma_message_bus_register (PlumaMessageBus *bus, identifier = pluma_message_type_identifier (object_path, method); g_hash_table_lookup (bus->priv->types, identifier); - + va_start (var_args, num_optional); - message_type = pluma_message_type_new_valist (object_path, + message_type = pluma_message_type_new_valist (object_path, method, num_optional, var_args); va_end (var_args); - + if (message_type) { g_hash_table_insert (bus->priv->types, identifier, message_type); @@ -647,8 +647,8 @@ pluma_message_bus_register (PlumaMessageBus *bus, { g_free (identifier); } - - return message_type; + + return message_type; } static void @@ -657,18 +657,18 @@ pluma_message_bus_unregister_real (PlumaMessageBus *bus, gboolean remove_from_store) { gchar *identifier; - + g_return_if_fail (PLUMA_IS_MESSAGE_BUS (bus)); - identifier = pluma_message_type_identifier (pluma_message_type_get_object_path (message_type), + identifier = pluma_message_type_identifier (pluma_message_type_get_object_path (message_type), pluma_message_type_get_method (message_type)); - + /* Keep message type alive for signal emission */ pluma_message_type_ref (message_type); if (!remove_from_store || g_hash_table_remove (bus->priv->types, identifier)) g_signal_emit (bus, message_bus_signals[UNREGISTERED], 0, message_type); - + pluma_message_type_unref (message_type); g_free (identifier); } @@ -678,7 +678,7 @@ pluma_message_bus_unregister_real (PlumaMessageBus *bus, * @bus: a #PlumaMessageBus * @message_type: the #PlumaMessageType to unregister * - * Unregisters a previously registered message type. This is especially useful + * Unregisters a previously registered message type. This is especially useful * for plugins which should unregister message types when they are deactivated. * * This function emits the #PlumaMessageBus::unregistered signal. @@ -692,7 +692,7 @@ pluma_message_bus_unregister (PlumaMessageBus *bus, pluma_message_bus_unregister_real (bus, message_type, TRUE); } -typedef struct +typedef struct { PlumaMessageBus *bus; const gchar *object_path; @@ -705,11 +705,11 @@ unregister_each (const gchar *identifier, { if (strcmp (pluma_message_type_get_object_path (message_type), info->object_path) == 0) - { + { pluma_message_bus_unregister_real (info->bus, message_type, FALSE); return TRUE; } - + return FALSE; } @@ -734,7 +734,7 @@ pluma_message_bus_unregister_all (PlumaMessageBus *bus, g_return_if_fail (PLUMA_IS_MESSAGE_BUS (bus)); g_return_if_fail (object_path != NULL); - g_hash_table_foreach_remove (bus->priv->types, + g_hash_table_foreach_remove (bus->priv->types, (GHRFunc)unregister_each, &info); } @@ -745,10 +745,10 @@ pluma_message_bus_unregister_all (PlumaMessageBus *bus, * @object_path: the object path * @method: the method * - * Check whether a message type @method at @object_path is registered on the + * Check whether a message type @method at @object_path is registered on the * bus. * - * Return value: %TRUE if the @method at @object_path is a registered message + * Return value: %TRUE if the @method at @object_path is a registered message * type on the bus * */ @@ -759,14 +759,14 @@ pluma_message_bus_is_registered (PlumaMessageBus *bus, { gchar *identifier; gboolean ret; - + g_return_val_if_fail (PLUMA_IS_MESSAGE_BUS (bus), FALSE); g_return_val_if_fail (object_path != NULL, FALSE); g_return_val_if_fail (method != NULL, FALSE); identifier = pluma_message_type_identifier (object_path, method); ret = g_hash_table_lookup (bus->priv->types, identifier) != NULL; - + g_free(identifier); return ret; } @@ -796,13 +796,13 @@ foreach_type (const gchar *key, * Calls @func for each message type registered on the bus * */ -void +void pluma_message_bus_foreach (PlumaMessageBus *bus, PlumaMessageBusForeach func, gpointer userdata) { ForeachInfo info = {func, userdata}; - + g_return_if_fail (PLUMA_IS_MESSAGE_BUS (bus)); g_return_if_fail (func != NULL); @@ -826,7 +826,7 @@ pluma_message_bus_foreach (PlumaMessageBus *bus, * */ guint -pluma_message_bus_connect (PlumaMessageBus *bus, +pluma_message_bus_connect (PlumaMessageBus *bus, const gchar *object_path, const gchar *method, PlumaMessageCallback callback, @@ -839,10 +839,10 @@ pluma_message_bus_connect (PlumaMessageBus *bus, g_return_val_if_fail (object_path != NULL, 0); g_return_val_if_fail (method != NULL, 0); g_return_val_if_fail (callback != NULL, 0); - + /* lookup the message and create if it does not exist yet */ message = lookup_message (bus, object_path, method, TRUE); - + return add_listener (bus, message, callback, userdata, destroy_data); } @@ -859,7 +859,7 @@ pluma_message_bus_disconnect (PlumaMessageBus *bus, guint id) { g_return_if_fail (PLUMA_IS_MESSAGE_BUS (bus)); - + process_by_id (bus, id, remove_listener); } @@ -871,8 +871,8 @@ pluma_message_bus_disconnect (PlumaMessageBus *bus, * @callback: (scope call): the connected callback * @userdata: the userdata with which the callback was connected * - * Disconnects a previously connected message callback by matching the - * provided callback function and userdata. See also + * Disconnects a previously connected message callback by matching the + * provided callback function and userdata. See also * pluma_message_bus_disconnect(). * */ @@ -884,7 +884,7 @@ pluma_message_bus_disconnect_by_func (PlumaMessageBus *bus, gpointer userdata) { g_return_if_fail (PLUMA_IS_MESSAGE_BUS (bus)); - + process_by_match (bus, object_path, method, callback, userdata, remove_listener); } @@ -902,7 +902,7 @@ pluma_message_bus_block (PlumaMessageBus *bus, guint id) { g_return_if_fail (PLUMA_IS_MESSAGE_BUS (bus)); - + process_by_id (bus, id, block_listener); } @@ -926,7 +926,7 @@ pluma_message_bus_block_by_func (PlumaMessageBus *bus, gpointer userdata) { g_return_if_fail (PLUMA_IS_MESSAGE_BUS (bus)); - + process_by_match (bus, object_path, method, callback, userdata, block_listener); } @@ -943,7 +943,7 @@ pluma_message_bus_unblock (PlumaMessageBus *bus, guint id) { g_return_if_fail (PLUMA_IS_MESSAGE_BUS (bus)); - + process_by_id (bus, id, unblock_listener); } @@ -966,7 +966,7 @@ pluma_message_bus_unblock_by_func (PlumaMessageBus *bus, gpointer userdata) { g_return_if_fail (PLUMA_IS_MESSAGE_BUS (bus)); - + process_by_match (bus, object_path, method, callback, userdata, unblock_listener); } @@ -979,7 +979,7 @@ validate_message (PlumaMessage *message) pluma_message_get_method (message)); return FALSE; } - + return TRUE; } @@ -991,8 +991,8 @@ send_message_real (PlumaMessageBus *bus, { return; } - - bus->priv->message_queue = g_list_prepend (bus->priv->message_queue, + + bus->priv->message_queue = g_list_prepend (bus->priv->message_queue, g_object_ref (message)); if (bus->priv->idle_id == 0) @@ -1008,7 +1008,7 @@ send_message_real (PlumaMessageBus *bus, * @message: the message to send * * This sends the provided @message asynchronously over the bus. To send - * a message synchronously, use pluma_message_bus_send_message_sync(). The + * a message synchronously, use pluma_message_bus_send_message_sync(). The * convenience function pluma_message_bus_send() can be used to easily send * a message without constructing the message object explicitly first. * @@ -1019,7 +1019,7 @@ pluma_message_bus_send_message (PlumaMessageBus *bus, { g_return_if_fail (PLUMA_IS_MESSAGE_BUS (bus)); g_return_if_fail (PLUMA_IS_MESSAGE (message)); - + send_message_real (bus, message); } @@ -1031,7 +1031,7 @@ send_message_sync_real (PlumaMessageBus *bus, { return; } - + dispatch_message (bus, message); } @@ -1041,7 +1041,7 @@ send_message_sync_real (PlumaMessageBus *bus, * @message: the message to send * * This sends the provided @message synchronously over the bus. To send - * a message asynchronously, use pluma_message_bus_send_message(). The + * a message asynchronously, use pluma_message_bus_send_message(). The * convenience function pluma_message_bus_send_sync() can be used to easily send * a message without constructing the message object explicitly first. * @@ -1053,7 +1053,7 @@ pluma_message_bus_send_message_sync (PlumaMessageBus *bus, g_return_if_fail (PLUMA_IS_MESSAGE_BUS (bus)); g_return_if_fail (PLUMA_IS_MESSAGE (message)); - send_message_sync_real (bus, message); + send_message_sync_real (bus, message); } static PlumaMessage * @@ -1063,16 +1063,16 @@ create_message (PlumaMessageBus *bus, va_list var_args) { PlumaMessageType *message_type; - + message_type = pluma_message_bus_lookup (bus, object_path, method); - + if (!message_type) { g_warning ("Could not find message type for '%s.%s'", object_path, method); return NULL; } - return pluma_message_type_instantiate_valist (message_type, + return pluma_message_type_instantiate_valist (message_type, var_args); } @@ -1083,9 +1083,9 @@ create_message (PlumaMessageBus *bus, * @method: the method * @...: NULL terminated list of key/value pairs * - * This provides a convenient way to quickly send a message @method at - * @object_path asynchronously over the bus. The variable argument list - * specifies key (string) value pairs used to construct the message arguments. + * This provides a convenient way to quickly send a message @method at + * @object_path asynchronously over the bus. The variable argument list + * specifies key (string) value pairs used to construct the message arguments. * To send a message synchronously use pluma_message_bus_send_sync(). * */ @@ -1097,11 +1097,11 @@ pluma_message_bus_send (PlumaMessageBus *bus, { va_list var_args; PlumaMessage *message; - + va_start (var_args, method); message = create_message (bus, object_path, method, var_args); - + if (message) { send_message_real (bus, message); @@ -1122,9 +1122,9 @@ pluma_message_bus_send (PlumaMessageBus *bus, * @method: the method * @...: NULL terminated list of key/value pairs * - * This provides a convenient way to quickly send a message @method at - * @object_path synchronously over the bus. The variable argument list - * specifies key (string) value pairs used to construct the message + * This provides a convenient way to quickly send a message @method at + * @object_path synchronously over the bus. The variable argument list + * specifies key (string) value pairs used to construct the message * arguments. To send a message asynchronously use pluma_message_bus_send(). * * Return value: (transfer full): the constructed #PlumaMessage. The caller owns a reference @@ -1139,15 +1139,15 @@ pluma_message_bus_send_sync (PlumaMessageBus *bus, { va_list var_args; PlumaMessage *message; - + va_start (var_args, method); message = create_message (bus, object_path, method, var_args); - + if (message) send_message_sync_real (bus, message); va_end (var_args); - + return message; } diff --git a/pluma/pluma-message-bus.h b/pluma/pluma-message-bus.h index 67b30688..6830cfcc 100644 --- a/pluma/pluma-message-bus.h +++ b/pluma/pluma-message-bus.h @@ -21,13 +21,13 @@ typedef struct _PlumaMessageBusPrivate PlumaMessageBusPrivate; struct _PlumaMessageBus { GObject parent; - + PlumaMessageBusPrivate *priv; }; struct _PlumaMessageBusClass { GObjectClass parent_class; - + void (*dispatch) (PlumaMessageBus *bus, PlumaMessage *message); void (*registered) (PlumaMessageBus *bus, @@ -73,8 +73,8 @@ void pluma_message_bus_foreach (PlumaMessageBus *bus, gpointer userdata); -/* connecting to message events */ -guint pluma_message_bus_connect (PlumaMessageBus *bus, +/* connecting to message events */ +guint pluma_message_bus_connect (PlumaMessageBus *bus, const gchar *object_path, const gchar *method, PlumaMessageCallback callback, @@ -112,7 +112,7 @@ void pluma_message_bus_send_message (PlumaMessageBus *bus, PlumaMessage *message); void pluma_message_bus_send_message_sync (PlumaMessageBus *bus, PlumaMessage *message); - + void pluma_message_bus_send (PlumaMessageBus *bus, const gchar *object_path, const gchar *method, diff --git a/pluma/pluma-message-type.c b/pluma/pluma-message-type.c index 786d4f77..0278829c 100644 --- a/pluma/pluma-message-type.c +++ b/pluma/pluma-message-type.c @@ -10,12 +10,12 @@ * the Object Path, Method and Arguments of the message. * * A message type can contain any number of required and optional arguments. - * To instantiate a #PlumaMessage from a #PlumaMessageType, use + * To instantiate a #PlumaMessage from a #PlumaMessageType, use * pluma_message_type_instantiate(). * * Registering a new message type on a #PlumaMessageBus with * pluma_message_bus_register() internally creates a new #PlumaMessageType. When - * then using pluma_message_bus_send(), an actual instantiation of the + * then using pluma_message_bus_send(), an actual instantiation of the * registered type is internally created and send over the bus. * * <example> @@ -47,10 +47,10 @@ struct _PlumaMessageType gchar *object_path; gchar *method; - + guint num_arguments; guint num_required; - + GHashTable *arguments; // mapping of key -> ArgumentInfo }; @@ -68,7 +68,7 @@ pluma_message_type_ref (PlumaMessageType *message_type) { g_return_val_if_fail (message_type != NULL, NULL); g_atomic_int_inc (&message_type->ref_count); - + return message_type; } @@ -80,30 +80,30 @@ pluma_message_type_ref (PlumaMessageType *message_type) * drops to 0, @message_type is destroyed. * */ -void +void pluma_message_type_unref (PlumaMessageType *message_type) { g_return_if_fail (message_type != NULL); if (!g_atomic_int_dec_and_test (&message_type->ref_count)) return; - + g_free (message_type->object_path); g_free (message_type->method); - + g_hash_table_destroy (message_type->arguments); g_free (message_type); } /** * pluma_message_type_get_type: - * + * * Retrieves the GType object which is associated with the * #PlumaMessageType class. - * + * * Return value: the GType associated with #PlumaMessageType. **/ -GType +GType pluma_message_type_get_type (void) { static GType our_type = 0; @@ -148,17 +148,17 @@ pluma_message_type_is_valid_object_path (const gchar *object_path) { if (!object_path) return FALSE; - + /* needs to start with / */ if (*object_path != '/') return FALSE; - + while (*object_path) { if (*object_path == '/') { ++object_path; - + if (!*object_path || !(g_ascii_isalpha (*object_path) || *object_path == '_')) return FALSE; } @@ -166,10 +166,10 @@ pluma_message_type_is_valid_object_path (const gchar *object_path) { return FALSE; } - + ++object_path; } - + return TRUE; } @@ -186,7 +186,7 @@ gboolean pluma_message_type_is_supported (GType type) { gint i = 0; - + static const GType type_list[] = { G_TYPE_BOOLEAN, @@ -249,7 +249,7 @@ pluma_message_type_new_valist (const gchar *object_path, g_return_val_if_fail (pluma_message_type_is_valid_object_path (object_path), NULL); message_type = g_new0(PlumaMessageType, 1); - + message_type->ref_count = 1; message_type->object_path = g_strdup(object_path); message_type->method = g_strdup(method); @@ -285,11 +285,11 @@ pluma_message_type_new (const gchar *object_path, { PlumaMessageType *message_type; va_list var_args; - + va_start(var_args, num_optional); message_type = pluma_message_type_new_valist (object_path, method, num_optional, var_args); va_end(var_args); - + return message_type; } @@ -310,7 +310,7 @@ pluma_message_type_set (PlumaMessageType *message_type, ...) { va_list va_args; - + va_start (va_args, num_optional); pluma_message_type_set_valist (message_type, num_optional, va_args); va_end (va_args); @@ -323,11 +323,11 @@ pluma_message_type_set (PlumaMessageType *message_type, * @va_args: key/gtype pair variable argument list * * Sets argument names/types supplied by the NULL terminated variable - * argument list @va_args. The last @num_optional provided arguments are + * argument list @va_args. The last @num_optional provided arguments are * considered optional. * */ -void +void pluma_message_type_set_valist (PlumaMessageType *message_type, guint num_optional, va_list var_args) @@ -343,35 +343,35 @@ pluma_message_type_set_valist (PlumaMessageType *message_type, // get corresponding GType GType gtype = va_arg (var_args, GType); ArgumentInfo *info; - + if (!pluma_message_type_is_supported (gtype)) { g_error ("Message type '%s' is not supported", g_type_name (gtype)); pluma_message_type_unref (message_type); g_free (optional); - + return; } - + info = g_new(ArgumentInfo, 1); info->type = gtype; info->required = TRUE; g_hash_table_insert (message_type->arguments, g_strdup (key), info); - + ++message_type->num_arguments; ++added; - + if (num_optional > 0) { for (i = num_optional - 1; i > 0; --i) optional[i] = optional[i - 1]; - + *optional = info; } } - + message_type->num_required += added; // set required for last num_optional arguments @@ -383,7 +383,7 @@ pluma_message_type_set_valist (PlumaMessageType *message_type, --message_type->num_required; } } - + g_free (optional); } @@ -403,12 +403,12 @@ pluma_message_type_instantiate_valist (PlumaMessageType *message_type, va_list va_args) { PlumaMessage *message; - + g_return_val_if_fail (message_type != NULL, NULL); - + message = PLUMA_MESSAGE (g_object_new (PLUMA_TYPE_MESSAGE, "type", message_type, NULL)); pluma_message_set_valist (message, va_args); - + return message; } @@ -429,11 +429,11 @@ pluma_message_type_instantiate (PlumaMessageType *message_type, { PlumaMessage *message; va_list va_args; - + va_start (va_args, message_type); message = pluma_message_type_instantiate_valist (message_type, va_args); va_end (va_args); - + return message; } @@ -482,10 +482,10 @@ pluma_message_type_lookup (PlumaMessageType *message_type, const gchar *key) { ArgumentInfo *info = g_hash_table_lookup (message_type->arguments, key); - + if (!info) return G_TYPE_INVALID; - + return info->type; } @@ -512,7 +512,7 @@ foreach_gtype (const gchar *key, * Calls @func for each argument in the message type. * */ -void +void pluma_message_type_foreach (PlumaMessageType *message_type, PlumaMessageTypeForeach func, gpointer user_data) diff --git a/pluma/pluma-message-type.h b/pluma/pluma-message-type.h index af5d47d9..64a180ae 100644 --- a/pluma/pluma-message-type.h +++ b/pluma/pluma-message-type.h @@ -11,9 +11,9 @@ G_BEGIN_DECLS #define PLUMA_TYPE_MESSAGE_TYPE (pluma_message_type_get_type ()) #define PLUMA_MESSAGE_TYPE(x) ((PlumaMessageType *)(x)) -typedef void (*PlumaMessageTypeForeach) (const gchar *key, - GType type, - gboolean required, +typedef void (*PlumaMessageTypeForeach) (const gchar *key, + GType type, + gboolean required, gpointer user_data); typedef struct _PlumaMessageType PlumaMessageType; @@ -25,7 +25,7 @@ gchar *pluma_message_type_identifier (const gchar *object_path, const gchar *method); gboolean pluma_message_type_is_valid_object_path (const gchar *object_path); -PlumaMessageType *pluma_message_type_new (const gchar *object_path, +PlumaMessageType *pluma_message_type_new (const gchar *object_path, const gchar *method, guint num_optional, ...) G_GNUC_NULL_TERMINATED; @@ -55,7 +55,7 @@ const gchar *pluma_message_type_get_method (PlumaMessageType *message_type); GType pluma_message_type_lookup (PlumaMessageType *message_type, const gchar *key); - + void pluma_message_type_foreach (PlumaMessageType *message_type, PlumaMessageTypeForeach func, gpointer user_data); diff --git a/pluma/pluma-message.c b/pluma/pluma-message.c index 4d8f7a4b..cdb2e6e3 100644 --- a/pluma/pluma-message.c +++ b/pluma/pluma-message.c @@ -42,7 +42,7 @@ static void pluma_message_finalize (GObject *object) { PlumaMessage *message = PLUMA_MESSAGE (object); - + pluma_message_type_unref (message->priv->type); g_hash_table_destroy (message->priv->values); @@ -99,16 +99,16 @@ add_value (PlumaMessage *message, { GValue *value; GType type = pluma_message_type_lookup (message->priv->type, key); - + if (type == G_TYPE_INVALID) return NULL; - + value = g_new0 (GValue, 1); g_value_init (value, type); g_value_reset (value); g_hash_table_insert (message->priv->values, g_strdup (key), value); - + return value; } @@ -116,11 +116,11 @@ static void pluma_message_class_init (PlumaMessageClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS(klass); - + object_class->finalize = pluma_message_finalize; object_class->get_property = pluma_message_get_property; object_class->set_property = pluma_message_set_property; - + /** * PlumaMessage:object_path: * @@ -148,7 +148,7 @@ pluma_message_class_init (PlumaMessageClass *klass) NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); - + /** * PlumaMEssage:type: * @@ -186,17 +186,17 @@ pluma_message_init (PlumaMessage *self) } static gboolean -set_value_real (GValue *to, +set_value_real (GValue *to, const GValue *from) { GType from_type; GType to_type; - + from_type = G_VALUE_TYPE (from); to_type = G_VALUE_TYPE (to); if (!g_type_is_a (from_type, to_type)) - { + { if (!g_value_transform (from, to)) { g_warning ("%s: Unable to make conversion from %s to %s", @@ -205,10 +205,10 @@ set_value_real (GValue *to, g_type_name (to_type)); return FALSE; } - + return TRUE; } - + g_value_copy (from, to); return TRUE; } @@ -219,10 +219,10 @@ value_lookup (PlumaMessage *message, gboolean create) { GValue *ret = (GValue *)g_hash_table_lookup (message->priv->values, key); - + if (!ret && create) ret = add_value (message, key); - + return ret; } @@ -239,7 +239,7 @@ const gchar * pluma_message_get_method (PlumaMessage *message) { g_return_val_if_fail (PLUMA_IS_MESSAGE (message), NULL); - + return pluma_message_type_get_method (message->priv->type); } @@ -256,7 +256,7 @@ const gchar * pluma_message_get_object_path (PlumaMessage *message) { g_return_val_if_fail (PLUMA_IS_MESSAGE (message), NULL); - + return pluma_message_type_get_object_path (message->priv->type); } @@ -305,21 +305,21 @@ pluma_message_set_valist (PlumaMessage *message, GValue *container = value_lookup (message, key, TRUE); GValue value = {0,}; gchar *error = NULL; - + if (!container) { - g_warning ("%s: Cannot set value for %s, does not exist", + g_warning ("%s: Cannot set value for %s, does not exist", G_STRLOC, key); - + /* skip value */ va_arg (var_args, gpointer); continue; } - + g_value_init (&value, G_VALUE_TYPE (container)); G_VALUE_COLLECT (&value, var_args, 0, &error); - + if (error) { g_warning ("%s: %s", G_STRLOC, error); @@ -347,17 +347,17 @@ pluma_message_set_value (PlumaMessage *message, { GValue *container; g_return_if_fail (PLUMA_IS_MESSAGE (message)); - + container = value_lookup (message, key, TRUE); - + if (!container) { - g_warning ("%s: Cannot set value for %s, does not exist", - G_STRLOC, + g_warning ("%s: Cannot set value for %s, does not exist", + G_STRLOC, key); return; } - + set_value_real (container, value); } @@ -378,9 +378,9 @@ pluma_message_set_valuesv (PlumaMessage *message, gint n_values) { gint i; - + g_return_if_fail (PLUMA_IS_MESSAGE (message)); - + for (i = 0; i < n_values; i++) { pluma_message_set_value (message, keys[i], &values[i]); @@ -398,14 +398,14 @@ pluma_message_set_valuesv (PlumaMessage *message, * value for the specified key. * */ -void +void pluma_message_get (PlumaMessage *message, ...) { va_list ap; g_return_if_fail (PLUMA_IS_MESSAGE (message)); - + va_start (ap, message); pluma_message_get_valist (message, ap); va_end (ap); @@ -428,7 +428,7 @@ pluma_message_get_valist (PlumaMessage *message, const gchar *key; g_return_if_fail (PLUMA_IS_MESSAGE (message)); - + while ((key = va_arg (var_args, const gchar *)) != NULL) { GValue *container; @@ -436,30 +436,30 @@ pluma_message_get_valist (PlumaMessage *message, gchar *error = NULL; container = value_lookup (message, key, FALSE); - + if (!container) - { + { /* skip value */ va_arg (var_args, gpointer); continue; } - + /* copy the value here, to be sure it isn't tainted */ g_value_init (©, G_VALUE_TYPE (container)); g_value_copy (container, ©); - + G_VALUE_LCOPY (©, var_args, 0, &error); - + if (error) { g_warning ("%s: %s", G_STRLOC, error); g_free (error); - + /* purposely leak the value here, because it might be in a bad state */ continue; } - + g_value_unset (©); } } @@ -474,17 +474,17 @@ pluma_message_get_valist (PlumaMessage *message, * with the correct type. * */ -void +void pluma_message_get_value (PlumaMessage *message, const gchar *key, GValue *value) { GValue *container; - + g_return_if_fail (PLUMA_IS_MESSAGE (message)); - + container = value_lookup (message, key, FALSE); - + if (!container) { g_warning ("%s: Invalid key `%s'", @@ -492,7 +492,7 @@ pluma_message_get_value (PlumaMessage *message, key); return; } - + g_value_init (value, G_VALUE_TYPE (container)); set_value_real (value, container); } @@ -507,7 +507,7 @@ pluma_message_get_value (PlumaMessage *message, * Return value: the type of @key * */ -GType +GType pluma_message_get_key_type (PlumaMessage *message, const gchar *key) { @@ -532,14 +532,14 @@ pluma_message_has_key (PlumaMessage *message, const gchar *key) { g_return_val_if_fail (PLUMA_IS_MESSAGE (message), FALSE); - + return value_lookup (message, key, FALSE) != NULL; } typedef struct { PlumaMessage *message; - gboolean valid; + gboolean valid; } ValidateInfo; static void @@ -549,12 +549,12 @@ validate_key (const gchar *key, ValidateInfo *info) { GValue *value; - + if (!info->valid || !required) return; - + value = value_lookup (info->message, key, FALSE); - + if (!value) info->valid = FALSE; } @@ -575,16 +575,16 @@ pluma_message_validate (PlumaMessage *message) g_return_val_if_fail (PLUMA_IS_MESSAGE (message), FALSE); g_return_val_if_fail (message->priv->type != NULL, FALSE); - + if (!message->priv->valid) { - pluma_message_type_foreach (message->priv->type, + pluma_message_type_foreach (message->priv->type, (PlumaMessageTypeForeach)validate_key, &info); message->priv->valid = info.valid; } - + return message->priv->valid; } diff --git a/pluma/pluma-message.h b/pluma/pluma-message.h index 48d1a81a..60019ef2 100644 --- a/pluma/pluma-message.h +++ b/pluma/pluma-message.h @@ -20,7 +20,7 @@ typedef struct _PlumaMessagePrivate PlumaMessagePrivate; struct _PlumaMessage { GObject parent; - + PlumaMessagePrivate *priv; }; diff --git a/pluma/pluma-metadata-manager.c b/pluma/pluma-metadata-manager.c index e684688e..f8010b75 100644 --- a/pluma/pluma-metadata-manager.c +++ b/pluma/pluma-metadata-manager.c @@ -3,7 +3,7 @@ * pluma-metadata-manager.c * This file is part of pluma * - * Copyright (C) 2003-2007 Paolo Maggi + * Copyright (C) 2003-2007 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, 2003-2007. 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, 2003-2007. 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 @@ -56,10 +56,10 @@ struct _Item GHashTable *values; }; - + struct _PlumaMetadataManager { - gboolean values_loaded; /* It is true if the file + gboolean values_loaded; /* It is true if the file has been read */ guint timeout_id; @@ -76,7 +76,7 @@ static void item_free (gpointer data) { Item *item; - + g_return_if_fail (data != NULL); #ifdef PLUMA_METADATA_VERBOSE_DEBUG @@ -96,7 +96,7 @@ pluma_metadata_manager_arm_timeout (void) { if (pluma_metadata_manager->timeout_id == 0) { - pluma_metadata_manager->timeout_id = + pluma_metadata_manager->timeout_id = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT_IDLE, 2, (GSourceFunc)pluma_metadata_manager_save, @@ -117,9 +117,9 @@ pluma_metadata_manager_init (void) pluma_metadata_manager->values_loaded = FALSE; - pluma_metadata_manager->items = - g_hash_table_new_full (g_str_hash, - g_str_equal, + pluma_metadata_manager->items = + g_hash_table_new_full (g_str_hash, + g_str_equal, g_free, item_free); @@ -153,13 +153,13 @@ static void parseItem (xmlDocPtr doc, xmlNodePtr cur) { Item *item; - + xmlChar *uri; xmlChar *atime; - + #ifdef PLUMA_METADATA_VERBOSE_DEBUG pluma_debug (DEBUG_METADATA); -#endif +#endif if (xmlStrcmp (cur->name, (const xmlChar *)"document") != 0) return; @@ -167,7 +167,7 @@ parseItem (xmlDocPtr doc, xmlNodePtr cur) uri = xmlGetProp (cur, (const xmlChar *)"uri"); if (uri == NULL) return; - + atime = xmlGetProp (cur, (const xmlChar *)"atime"); if (atime == NULL) { @@ -179,9 +179,9 @@ parseItem (xmlDocPtr doc, xmlNodePtr cur) item->atime = g_ascii_strtoull ((char *)atime, NULL, 0); - item->values = g_hash_table_new_full (g_str_hash, - g_str_equal, - g_free, + item->values = g_hash_table_new_full (g_str_hash, + g_str_equal, + g_free, g_free); cur = cur->xmlChildrenNode; @@ -198,7 +198,7 @@ parseItem (xmlDocPtr doc, xmlNodePtr cur) if ((key != NULL) && (value != NULL)) g_hash_table_insert (item->values, - g_strdup ((gchar *)key), + g_strdup ((gchar *)key), g_strdup ((gchar *)value)); if (key != NULL) @@ -248,7 +248,7 @@ load_values (void) g_return_val_if_fail (pluma_metadata_manager->values_loaded == FALSE, FALSE); pluma_metadata_manager->values_loaded = TRUE; - + xmlKeepBlanksDefault (0); /* FIXME: file locking - Paolo */ @@ -269,25 +269,25 @@ load_values (void) } cur = xmlDocGetRootElement (doc); - if (cur == NULL) + if (cur == NULL) { g_message ("The metadata file '%s' is empty", METADATA_FILE); xmlFreeDoc (doc); - + return FALSE; } - if (xmlStrcmp (cur->name, (const xmlChar *) "metadata")) + if (xmlStrcmp (cur->name, (const xmlChar *) "metadata")) { g_message ("File '%s' is of the wrong type", METADATA_FILE); xmlFreeDoc (doc); - + return FALSE; } cur = xmlDocGetRootElement (doc); cur = cur->xmlChildrenNode; - + while (cur != NULL) { parseItem (doc, cur); @@ -331,7 +331,7 @@ pluma_metadata_manager_get (const gchar *uri, return NULL; item->atime = time (NULL); - + if (item->values == NULL) return NULL; @@ -354,7 +354,7 @@ pluma_metadata_manager_set (const gchar *uri, g_return_if_fail (key != NULL); pluma_debug_message (DEBUG_METADATA, "URI: %s --- key: %s --- value: %s", uri, key, value); - + pluma_metadata_manager_init (); if (!pluma_metadata_manager->values_loaded) @@ -378,11 +378,11 @@ pluma_metadata_manager_set (const gchar *uri, g_strdup (uri), item); } - + if (item->values == NULL) - item->values = g_hash_table_new_full (g_str_hash, - g_str_equal, - g_free, + item->values = g_hash_table_new_full (g_str_hash, + g_str_equal, + g_free, g_free); if (value != NULL) g_hash_table_insert (item->values, @@ -404,13 +404,13 @@ save_values (const gchar *key, const gchar *value, xmlNodePtr parent) #ifdef PLUMA_METADATA_VERBOSE_DEBUG pluma_debug (DEBUG_METADATA); -#endif +#endif g_return_if_fail (key != NULL); - + if (value == NULL) return; - + xml_node = xmlNewChild (parent, NULL, (const xmlChar *)"entry", @@ -425,7 +425,7 @@ save_values (const gchar *key, const gchar *value, xmlNodePtr parent) #ifdef PLUMA_METADATA_VERBOSE_DEBUG pluma_debug_message (DEBUG_METADATA, "entry: %s = %s", key, value); -#endif +#endif } static void @@ -450,14 +450,14 @@ save_item (const gchar *key, const gpointer *data, xmlNodePtr parent) #ifdef PLUMA_METADATA_VERBOSE_DEBUG pluma_debug_message (DEBUG_METADATA, "uri: %s", key); -#endif +#endif atime = g_strdup_printf ("%ld", item->atime); - xmlSetProp (xml_node, (const xmlChar *)"atime", (const xmlChar *)atime); + xmlSetProp (xml_node, (const xmlChar *)"atime", (const xmlChar *)atime); #ifdef PLUMA_METADATA_VERBOSE_DEBUG pluma_debug_message (DEBUG_METADATA, "atime: %s", atime); -#endif +#endif g_free (atime); @@ -477,7 +477,7 @@ get_oldest (const gchar *key, const gpointer value, const gchar ** key_to_remove } else { - const Item *item_to_remove = + const Item *item_to_remove = g_hash_table_lookup (pluma_metadata_manager->items, *key_to_remove); @@ -487,7 +487,7 @@ get_oldest (const gchar *key, const gpointer value, const gchar ** key_to_remove { *key_to_remove = key; } - } + } } static void @@ -502,7 +502,7 @@ resize_items (void) &key_to_remove); g_return_if_fail (key_to_remove != NULL); - + g_hash_table_remove (pluma_metadata_manager->items, key_to_remove); } @@ -510,7 +510,7 @@ resize_items (void) static gboolean pluma_metadata_manager_save (gpointer data) -{ +{ xmlDocPtr doc; xmlNodePtr root; gchar *file_name; @@ -520,7 +520,7 @@ pluma_metadata_manager_save (gpointer data) pluma_metadata_manager->timeout_id = 0; resize_items (); - + xmlIndentTreeOutput = TRUE; doc = xmlNewDoc ((const xmlChar *)"1.0"); @@ -533,7 +533,7 @@ pluma_metadata_manager_save (gpointer data) g_hash_table_foreach (pluma_metadata_manager->items, (GHFunc)save_item, - root); + root); /* FIXME: lock file - Paolo */ file_name = get_metadata_filename (); @@ -554,7 +554,7 @@ pluma_metadata_manager_save (gpointer data) g_free (file_name); } - xmlFreeDoc (doc); + xmlFreeDoc (doc); pluma_debug_message (DEBUG_METADATA, "DONE"); diff --git a/pluma/pluma-metadata-manager.h b/pluma/pluma-metadata-manager.h index 7b3b1899..ffa10807 100644 --- a/pluma/pluma-metadata-manager.h +++ b/pluma/pluma-metadata-manager.h @@ -3,7 +3,7 @@ * pluma-metadata-manager.h * This file is part of pluma * - * Copyright (C) 2003 Paolo Maggi + * Copyright (C) 2003 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, 2003. 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, 2003. See the AUTHORS file for a + * list of people on the pluma Team. + * See the ChangeLog files for a list of changes. */ #ifndef __PLUMA_METADATA_MANAGER_H__ diff --git a/pluma/pluma-notebook.c b/pluma/pluma-notebook.c index 6278fbcb..d4c8206a 100644 --- a/pluma/pluma-notebook.c +++ b/pluma/pluma-notebook.c @@ -2,7 +2,7 @@ * pluma-notebook.c * 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. */ /* This file is a modified version of the epiphany file ephy-notebook.c @@ -213,7 +213,7 @@ find_notebook_at_pointer (gint abs_x, gint abs_y) gdk_window_get_user_data (toplevel_win, &toplevel); /* toplevel should be an PlumaWindow */ - if ((toplevel != NULL) && + if ((toplevel != NULL) && PLUMA_IS_WINDOW (toplevel)) { return PLUMA_NOTEBOOK (_pluma_window_get_notebook @@ -226,7 +226,7 @@ find_notebook_at_pointer (gint abs_x, gint abs_y) static gboolean is_in_notebook_window (PlumaNotebook *notebook, - gint abs_x, + gint abs_x, gint abs_y) { PlumaNotebook *nb_at_pointer; @@ -239,8 +239,8 @@ is_in_notebook_window (PlumaNotebook *notebook, } static gint -find_tab_num_at_pos (PlumaNotebook *notebook, - gint abs_x, +find_tab_num_at_pos (PlumaNotebook *notebook, + gint abs_x, gint abs_y) { GtkPositionType tab_pos; @@ -281,14 +281,14 @@ find_tab_num_at_pos (PlumaNotebook *notebook, max_x = x_root + allocation.x + allocation.width; max_y = y_root + allocation.y + allocation.height; - if (((tab_pos == GTK_POS_TOP) || + if (((tab_pos == GTK_POS_TOP) || (tab_pos == GTK_POS_BOTTOM)) && (abs_x <= max_x)) { return page_num; } - else if (((tab_pos == GTK_POS_LEFT) || - (tab_pos == GTK_POS_RIGHT)) && + else if (((tab_pos == GTK_POS_LEFT) || + (tab_pos == GTK_POS_RIGHT)) && (abs_y <= max_y)) { return page_num; @@ -296,12 +296,12 @@ find_tab_num_at_pos (PlumaNotebook *notebook, ++page_num; } - + return AFTER_ALL_TABS; } -static gint -find_notebook_and_tab_at_pos (gint abs_x, +static gint +find_notebook_and_tab_at_pos (gint abs_x, gint abs_y, PlumaNotebook **notebook, gint *page_num) @@ -311,7 +311,7 @@ find_notebook_and_tab_at_pos (gint abs_x, { return NOT_IN_APP_WINDOWS; } - + *page_num = find_tab_num_at_pos (*notebook, abs_x, abs_y); if (*page_num < 0) @@ -332,8 +332,8 @@ find_notebook_and_tab_at_pos (gint abs_x, * @dest_position: the position for @tab * * Moves @tab from @src to @dest. - * If dest_position is greater than or equal to the number of tabs - * of the destination nootebook or negative, tab will be moved to the + * If dest_position is greater than or equal to the number of tabs + * of the destination nootebook or negative, tab will be moved to the * end of the tabs. */ void @@ -342,7 +342,7 @@ pluma_notebook_move_tab (PlumaNotebook *src, PlumaTab *tab, gint dest_position) { - g_return_if_fail (PLUMA_IS_NOTEBOOK (src)); + g_return_if_fail (PLUMA_IS_NOTEBOOK (src)); g_return_if_fail (PLUMA_IS_NOTEBOOK (dest)); g_return_if_fail (src != dest); g_return_if_fail (PLUMA_IS_TAB (tab)); @@ -361,8 +361,8 @@ pluma_notebook_move_tab (PlumaNotebook *src, * @dest_position: the position for @tab * * Reorders the page containing @tab, so that it appears in @dest_position position. - * If dest_position is greater than or equal to the number of tabs - * of the destination notebook or negative, tab will be moved to the + * If dest_position is greater than or equal to the number of tabs + * of the destination notebook or negative, tab will be moved to the * end of the tabs. */ void @@ -371,24 +371,24 @@ pluma_notebook_reorder_tab (PlumaNotebook *src, gint dest_position) { gint old_position; - - g_return_if_fail (PLUMA_IS_NOTEBOOK (src)); + + g_return_if_fail (PLUMA_IS_NOTEBOOK (src)); g_return_if_fail (PLUMA_IS_TAB (tab)); - old_position = gtk_notebook_page_num (GTK_NOTEBOOK (src), + old_position = gtk_notebook_page_num (GTK_NOTEBOOK (src), GTK_WIDGET (tab)); - + if (old_position == dest_position) return; - gtk_notebook_reorder_child (GTK_NOTEBOOK (src), + gtk_notebook_reorder_child (GTK_NOTEBOOK (src), GTK_WIDGET (tab), dest_position); - + if (!src->priv->drag_in_progress) { - g_signal_emit (G_OBJECT (src), - signals[TABS_REORDERED], + g_signal_emit (G_OBJECT (src), + signals[TABS_REORDERED], 0); } } @@ -436,8 +436,8 @@ drag_stop (PlumaNotebook *notebook) { if (notebook->priv->drag_in_progress) { - g_signal_emit (G_OBJECT (notebook), - signals[TABS_REORDERED], + g_signal_emit (G_OBJECT (notebook), + signals[TABS_REORDERED], 0); } @@ -464,10 +464,10 @@ move_current_tab (PlumaNotebook *notebook, if (dest_position != cur_page_num) { GtkWidget *cur_tab; - + cur_tab = gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), cur_page_num); - + pluma_notebook_reorder_tab (PLUMA_NOTEBOOK (notebook), PLUMA_TAB (cur_tab), dest_position); @@ -487,11 +487,11 @@ motion_notify_cb (PlumaNotebook *notebook, { if (notebook->priv->tab_drag_and_drop_enabled == FALSE) return FALSE; - + if (gtk_drag_check_threshold (GTK_WIDGET (notebook), notebook->priv->x_start, notebook->priv->y_start, - event->x_root, + event->x_root, event->y_root)) { if (drag_ready) @@ -507,16 +507,16 @@ motion_notify_cb (PlumaNotebook *notebook, result = find_notebook_and_tab_at_pos ((gint)event->x_root, (gint)event->y_root, - &dest, + &dest, &page_num); if (result != NOT_IN_APP_WINDOWS) { if (dest != notebook) { - move_current_tab_to_another_notebook (notebook, + move_current_tab_to_another_notebook (notebook, dest, - event, + event, page_num); } else @@ -554,7 +554,7 @@ move_current_tab_to_another_notebook (PlumaNotebook *src, g_return_if_fail (dest != src); cur_page = gtk_notebook_get_current_page (GTK_NOTEBOOK (src)); - tab = PLUMA_TAB (gtk_notebook_get_nth_page (GTK_NOTEBOOK (src), + tab = PLUMA_TAB (gtk_notebook_get_nth_page (GTK_NOTEBOOK (src), cur_page)); /* stop drag in origin window */ @@ -608,8 +608,8 @@ button_release_cb (PlumaNotebook *notebook, { /* Tab was detached */ g_signal_emit (G_OBJECT (notebook), - signals[TAB_DETACHED], - 0, + signals[TAB_DETACHED], + 0, cur_page); } @@ -645,26 +645,26 @@ button_press_cb (PlumaNotebook *notebook, event->x_root, event->y_root); - if ((event->button == 1) && - (event->type == GDK_BUTTON_PRESS) && + if ((event->button == 1) && + (event->type == GDK_BUTTON_PRESS) && (tab_clicked >= 0)) { notebook->priv->x_start = event->x_root; notebook->priv->y_start = event->y_root; - + notebook->priv->motion_notify_handler_id = g_signal_connect (G_OBJECT (notebook), "motion-notify-event", - G_CALLBACK (motion_notify_cb), + G_CALLBACK (motion_notify_cb), NULL); } - else if ((event->type == GDK_BUTTON_PRESS) && + else if ((event->type == GDK_BUTTON_PRESS) && (event->button == 3 || event->button == 2)) { if (tab_clicked == -1) { // CHECK: do we really need it? - + /* consume event, so that we don't pop up the context menu when * the mouse if not over a tab label */ @@ -678,7 +678,7 @@ button_press_cb (PlumaNotebook *notebook, } /* Switch to the page the mouse is over, but don't consume the event */ - gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), + gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), tab_clicked); } } @@ -814,40 +814,40 @@ pluma_notebook_init (PlumaNotebook *notebook) notebook->priv->close_buttons_sensitive = TRUE; notebook->priv->tab_drag_and_drop_enabled = TRUE; - + gtk_notebook_set_scrollable (GTK_NOTEBOOK (notebook), TRUE); gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE); gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE); - g_signal_connect (notebook, + g_signal_connect (notebook, "button-press-event", - (GCallback)button_press_cb, + (GCallback)button_press_cb, NULL); - g_signal_connect (notebook, + g_signal_connect (notebook, "button-release-event", (GCallback)button_release_cb, NULL); - g_signal_connect (notebook, + g_signal_connect (notebook, "grab-focus", (GCallback)grab_focus_cb, NULL); - g_signal_connect (notebook, + g_signal_connect (notebook, "focus-in-event", (GCallback)focus_in_cb, NULL); - g_signal_connect (notebook, + g_signal_connect (notebook, "focus-out-event", (GCallback)focus_out_cb, NULL); - gtk_widget_add_events (GTK_WIDGET (notebook), + gtk_widget_add_events (GTK_WIDGET (notebook), GDK_BUTTON1_MOTION_MASK); - g_signal_connect_after (G_OBJECT (notebook), + g_signal_connect_after (G_OBJECT (notebook), "switch_page", G_CALLBACK (pluma_notebook_switch_page_cb), NULL); @@ -873,17 +873,17 @@ pluma_notebook_change_current_page (GtkNotebook *notebook, { gboolean wrap_around; gint current; - + current = gtk_notebook_get_current_page (notebook); if (current != -1) { current = current + offset; - + g_object_get (gtk_widget_get_settings (GTK_WIDGET (notebook)), "gtk-keynav-wrap-around", &wrap_around, NULL); - + if (wrap_around) { if (current < 0) @@ -895,7 +895,7 @@ pluma_notebook_change_current_page (GtkNotebook *notebook, current = 0; } } - + gtk_notebook_set_current_page (notebook, current); } else @@ -980,7 +980,7 @@ pluma_notebook_add_tab (PlumaNotebook *nb, g_return_if_fail (PLUMA_IS_TAB (tab)); tab_label = create_tab_label (nb, tab); - gtk_notebook_insert_page (GTK_NOTEBOOK (nb), + gtk_notebook_insert_page (GTK_NOTEBOOK (nb), GTK_WIDGET (tab), tab_label, position); @@ -989,19 +989,19 @@ pluma_notebook_add_tab (PlumaNotebook *nb, g_signal_emit (G_OBJECT (nb), signals[TAB_ADDED], 0, tab); /* The signal handler may have reordered the tabs */ - position = gtk_notebook_page_num (GTK_NOTEBOOK (nb), + position = gtk_notebook_page_num (GTK_NOTEBOOK (nb), GTK_WIDGET (tab)); if (jump_to) { PlumaView *view; - + gtk_notebook_set_current_page (GTK_NOTEBOOK (nb), position); - g_object_set_data (G_OBJECT (tab), + g_object_set_data (G_OBJECT (tab), "jump_to", GINT_TO_POINTER (jump_to)); view = pluma_tab_get_view (tab); - + gtk_widget_grab_focus (GTK_WIDGET (view)); } } @@ -1030,7 +1030,7 @@ smart_tab_switching_on_closure (PlumaNotebook *nb, child = GTK_WIDGET (l->data); page_num = gtk_notebook_page_num (GTK_NOTEBOOK (nb), child); - gtk_notebook_set_current_page (GTK_NOTEBOOK (nb), + gtk_notebook_set_current_page (GTK_NOTEBOOK (nb), page_num); } } @@ -1096,9 +1096,9 @@ pluma_notebook_remove_tab (PlumaNotebook *nb, */ void pluma_notebook_remove_all_tabs (PlumaNotebook *nb) -{ +{ g_return_if_fail (PLUMA_IS_NOTEBOOK (nb)); - + g_list_free (nb->priv->focused_pages); nb->priv->focused_pages = NULL; @@ -1172,13 +1172,13 @@ pluma_notebook_set_tab_drag_and_drop_enabled (PlumaNotebook *nb, gboolean enable) { g_return_if_fail (PLUMA_IS_NOTEBOOK (nb)); - + enable = (enable != FALSE); - + if (enable == nb->priv->tab_drag_and_drop_enabled) return; - - nb->priv->tab_drag_and_drop_enabled = enable; + + nb->priv->tab_drag_and_drop_enabled = enable; } /** @@ -1189,11 +1189,11 @@ pluma_notebook_set_tab_drag_and_drop_enabled (PlumaNotebook *nb, * * Returns: %TRUE if the drag and drop is enabled. */ -gboolean +gboolean pluma_notebook_get_tab_drag_and_drop_enabled (PlumaNotebook *nb) { g_return_val_if_fail (PLUMA_IS_NOTEBOOK (nb), TRUE); - + return nb->priv->tab_drag_and_drop_enabled; } diff --git a/pluma/pluma-notebook.h b/pluma/pluma-notebook.h index 7477798a..7f469915 100644 --- a/pluma/pluma-notebook.h +++ b/pluma/pluma-notebook.h @@ -2,7 +2,7 @@ * pluma-notebook.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. */ /* This file is a modified version of the epiphany file ephy-notebook.h @@ -34,7 +34,7 @@ * Copyright (C) 2003, 2004 Christian Persch * */ - + #ifndef PLUMA_NOTEBOOK_H #define PLUMA_NOTEBOOK_H @@ -62,7 +62,7 @@ typedef struct _PlumaNotebookPrivate PlumaNotebookPrivate; * Main object structure */ typedef struct _PlumaNotebook PlumaNotebook; - + struct _PlumaNotebook { GtkNotebook notebook; @@ -113,7 +113,7 @@ void pluma_notebook_remove_all_tabs (PlumaNotebook *nb); void pluma_notebook_reorder_tab (PlumaNotebook *src, PlumaTab *tab, gint dest_position); - + void pluma_notebook_move_tab (PlumaNotebook *src, PlumaNotebook *dest, PlumaTab *tab, diff --git a/pluma/pluma-panel.c b/pluma/pluma-panel.c index cb2c437c..0fbbb834 100644 --- a/pluma/pluma-panel.c +++ b/pluma/pluma-panel.c @@ -2,7 +2,7 @@ * pluma-panel.c * 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,13 +16,13 @@ * * 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. + * 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$ @@ -43,10 +43,10 @@ #define PLUMA_PANEL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), PLUMA_TYPE_PANEL, PlumaPanelPrivate)) -struct _PlumaPanelPrivate +struct _PlumaPanelPrivate { GtkOrientation orientation; - + /* Title bar (vertical panel only) */ GtkWidget *title_image; GtkWidget *title_label; @@ -57,7 +57,7 @@ struct _PlumaPanelPrivate typedef struct _PlumaPanelItem PlumaPanelItem; -struct _PlumaPanelItem +struct _PlumaPanelItem { gchar *name; GtkWidget *icon; @@ -101,7 +101,7 @@ pluma_panel_get_property (GObject *object, GParamSpec *pspec) { PlumaPanel *panel = PLUMA_PANEL (object); - + switch (prop_id) { case PROP_ORIENTATION: @@ -238,7 +238,7 @@ pluma_panel_class_init (PlumaPanelClass *klass) G_STRUCT_OFFSET (PlumaPanelClass, focus_document), NULL, NULL, g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); + G_TYPE_NONE, 0); binding_set = gtk_binding_set_by_class (klass); gtk_binding_entry_add_signal (binding_set, @@ -308,7 +308,7 @@ sync_title (PlumaPanel *panel, if (item != NULL) { - gtk_label_set_text (GTK_LABEL (panel->priv->title_label), + gtk_label_set_text (GTK_LABEL (panel->priv->title_label), item->name); set_gtk_image_from_gtk_image (GTK_IMAGE (panel->priv->title_image), @@ -316,7 +316,7 @@ sync_title (PlumaPanel *panel, } else { - gtk_label_set_text (GTK_LABEL (panel->priv->title_label), + gtk_label_set_text (GTK_LABEL (panel->priv->title_label), _("Empty")); gtk_image_set_from_icon_name (GTK_IMAGE (panel->priv->title_image), @@ -421,10 +421,10 @@ build_horizontal_panel (PlumaPanel *panel) box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_box_pack_start (GTK_BOX (box), - panel->priv->notebook, - TRUE, - TRUE, + gtk_box_pack_start (GTK_BOX (box), + panel->priv->notebook, + TRUE, + TRUE, 0); /* Toolbar, close button and first separator */ @@ -433,16 +433,16 @@ build_horizontal_panel (PlumaPanel *panel) gtk_box_pack_start (GTK_BOX (box), sidebar, - FALSE, - FALSE, + FALSE, + FALSE, 0); close_button = create_close_button (panel); gtk_box_pack_start (GTK_BOX (sidebar), close_button, - FALSE, - FALSE, + FALSE, + FALSE, 0); gtk_widget_show_all (box); @@ -465,32 +465,32 @@ build_vertical_panel (PlumaPanel *panel) /* Create title hbox */ title_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_container_set_border_width (GTK_CONTAINER (title_hbox), 5); - + gtk_box_pack_start (GTK_BOX (panel), title_hbox, FALSE, FALSE, 0); - + icon_name_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_box_pack_start (GTK_BOX (title_hbox), - icon_name_hbox, - TRUE, - TRUE, + gtk_box_pack_start (GTK_BOX (title_hbox), + icon_name_hbox, + TRUE, + TRUE, 0); - - panel->priv->title_image = + + panel->priv->title_image = gtk_image_new_from_icon_name ("text-x-generic", GTK_ICON_SIZE_MENU); - gtk_box_pack_start (GTK_BOX (icon_name_hbox), - panel->priv->title_image, - FALSE, - TRUE, + gtk_box_pack_start (GTK_BOX (icon_name_hbox), + panel->priv->title_image, + FALSE, + TRUE, 0); dummy_label = gtk_label_new (" "); - gtk_box_pack_start (GTK_BOX (icon_name_hbox), - dummy_label, - FALSE, - FALSE, - 0); + gtk_box_pack_start (GTK_BOX (icon_name_hbox), + dummy_label, + FALSE, + FALSE, + 0); panel->priv->title_label = gtk_label_new (_("Empty")); gtk_label_set_xalign (GTK_LABEL (panel->priv->title_label), 0.0); @@ -505,9 +505,9 @@ build_vertical_panel (PlumaPanel *panel) close_button = create_close_button (panel); gtk_box_pack_start (GTK_BOX (title_hbox), - close_button, - FALSE, - FALSE, + close_button, + FALSE, + FALSE, 0); gtk_widget_show_all (title_hbox); @@ -524,7 +524,7 @@ pluma_panel_constructor (GType type, guint n_construct_properties, GObjectConstructParam *construct_properties) { - + /* Invoke parent constructor. */ PlumaPanelClass *klass = PLUMA_PANEL_CLASS (g_type_class_peek (PLUMA_TYPE_PANEL)); GObjectClass *parent_class = G_OBJECT_CLASS (g_type_class_peek_parent (klass)); @@ -532,7 +532,7 @@ pluma_panel_constructor (GType type, n_construct_properties, construct_properties); - /* Build the panel, now that we know the orientation + /* Build the panel, now that we know the orientation (_init has been called previously) */ PlumaPanel *panel = PLUMA_PANEL (obj); @@ -621,8 +621,8 @@ build_tab_label (PlumaPanel *panel, * Adds a new item to the @panel. */ void -pluma_panel_add_item (PlumaPanel *panel, - GtkWidget *item, +pluma_panel_add_item (PlumaPanel *panel, + GtkWidget *item, const gchar *name, GtkWidget *image) { @@ -630,7 +630,7 @@ pluma_panel_add_item (PlumaPanel *panel, GtkWidget *tab_label; GtkWidget *menu_label; gint w, h; - + g_return_if_fail (PLUMA_IS_PANEL (panel)); g_return_if_fail (GTK_IS_WIDGET (item)); g_return_if_fail (name != NULL); @@ -653,7 +653,7 @@ pluma_panel_add_item (PlumaPanel *panel, gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &w, &h); gtk_widget_set_size_request (data->icon, w, h); - + g_object_set_data (G_OBJECT (item), PANEL_ITEM_KEY, data); @@ -684,8 +684,8 @@ pluma_panel_add_item (PlumaPanel *panel, * Same as pluma_panel_add_item() but using an image from icon name. */ void -pluma_panel_add_item_with_icon (PlumaPanel *panel, - GtkWidget *item, +pluma_panel_add_item_with_icon (PlumaPanel *panel, + GtkWidget *item, const gchar *name, const gchar *icon_name) { @@ -716,20 +716,20 @@ pluma_panel_remove_item (PlumaPanel *panel, { PlumaPanelItem *data; gint page_num; - + g_return_val_if_fail (PLUMA_IS_PANEL (panel), FALSE); g_return_val_if_fail (GTK_IS_WIDGET (item), FALSE); page_num = gtk_notebook_page_num (GTK_NOTEBOOK (panel->priv->notebook), item); - + if (page_num == -1) return FALSE; - + data = (PlumaPanelItem *)g_object_get_data (G_OBJECT (item), PANEL_ITEM_KEY); g_return_val_if_fail (data != NULL, FALSE); - + g_free (data->name); g_free (data); @@ -740,7 +740,7 @@ pluma_panel_remove_item (PlumaPanel *panel, /* ref the item to keep it alive during signal emission */ g_object_ref (G_OBJECT (item)); - gtk_notebook_remove_page (GTK_NOTEBOOK (panel->priv->notebook), + gtk_notebook_remove_page (GTK_NOTEBOOK (panel->priv->notebook), page_num); /* if we removed all the pages, reset the title */ @@ -819,7 +819,7 @@ pluma_panel_item_is_active (PlumaPanel *panel, * pluma_panel_get_orientation: * @panel: a #PlumaPanel * - * Gets the orientation of the @panel. + * Gets the orientation of the @panel. * * Returns: the #GtkOrientation of #PlumaPanel */ @@ -836,7 +836,7 @@ pluma_panel_get_orientation (PlumaPanel *panel) * @panel: a #PlumaPanel * * Gets the number of items in a @panel. - * + * * Returns: the number of items contained in #PlumaPanel */ gint diff --git a/pluma/pluma-panel.h b/pluma/pluma-panel.h index e697c175..5ebbf031 100644 --- a/pluma/pluma-panel.h +++ b/pluma/pluma-panel.h @@ -2,7 +2,7 @@ * pluma-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$ */ @@ -53,7 +53,7 @@ typedef struct _PlumaPanelPrivate PlumaPanelPrivate; */ typedef struct _PlumaPanel PlumaPanel; -struct _PlumaPanel +struct _PlumaPanel { GtkBox vbox; @@ -66,7 +66,7 @@ struct _PlumaPanel */ typedef struct _PlumaPanelClass PlumaPanelClass; -struct _PlumaPanelClass +struct _PlumaPanelClass { GtkBoxClass parent_class; @@ -83,7 +83,7 @@ struct _PlumaPanelClass void (*_pluma_reserved1) (void); void (*_pluma_reserved2) (void); void (*_pluma_reserved3) (void); - void (*_pluma_reserved4) (void); + void (*_pluma_reserved4) (void); }; /* diff --git a/pluma/pluma-plugins-engine.h b/pluma/pluma-plugins-engine.h index 2cf20004..277888fb 100644 --- a/pluma/pluma-plugins-engine.h +++ b/pluma/pluma-plugins-engine.h @@ -2,7 +2,7 @@ * pluma-plugins-engine.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/pluma/pluma-prefs-manager-app.h b/pluma/pluma-prefs-manager-app.h index 4cc60ce9..debc594a 100644 --- a/pluma/pluma-prefs-manager-app.h +++ b/pluma/pluma-prefs-manager-app.h @@ -2,7 +2,7 @@ * pluma-prefs-manager-app.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/pluma/pluma-prefs-manager-private.h b/pluma/pluma-prefs-manager-private.h index f69e9d48..392397f3 100644 --- a/pluma/pluma-prefs-manager-private.h +++ b/pluma/pluma-prefs-manager-private.h @@ -3,7 +3,7 @@ * pluma-prefs-manager-private.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_PREFS_MANAGER_PRIVATE_H__ diff --git a/pluma/pluma-prefs-manager.c b/pluma/pluma-prefs-manager.c index 01434bbd..2bbfbfa2 100644 --- a/pluma/pluma-prefs-manager.c +++ b/pluma/pluma-prefs-manager.c @@ -3,7 +3,7 @@ * pluma-prefs-manager.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 @@ -65,7 +65,7 @@ pluma_prefs_manager_ ## name ## _can_set (void) \ pluma_debug (DEBUG_PREFS); \ \ return pluma_prefs_manager_key_is_writable (key); \ -} +} @@ -92,7 +92,7 @@ pluma_prefs_manager_ ## name ## _can_set (void) \ pluma_debug (DEBUG_PREFS); \ \ return pluma_prefs_manager_key_is_writable (key); \ -} +} @@ -119,7 +119,7 @@ pluma_prefs_manager_ ## name ## _can_set (void) \ pluma_debug (DEBUG_PREFS); \ \ return pluma_prefs_manager_key_is_writable (key); \ -} +} @@ -194,7 +194,7 @@ pluma_prefs_manager_shutdown (void) pluma_prefs_manager->interface_settings = NULL; } -static gboolean +static gboolean pluma_prefs_manager_get_bool (const gchar* key) { pluma_debug (DEBUG_PREFS); @@ -202,7 +202,7 @@ pluma_prefs_manager_get_bool (const gchar* key) return g_settings_get_boolean (pluma_prefs_manager->settings, key); } -static gint +static gint pluma_prefs_manager_get_int (const gchar* key) { pluma_debug (DEBUG_PREFS); @@ -226,7 +226,7 @@ pluma_prefs_manager_get_enum (const gchar* key) return g_settings_get_enum (pluma_prefs_manager->settings, key); } -static void +static void pluma_prefs_manager_set_bool (const gchar* key, gboolean value) { pluma_debug (DEBUG_PREFS); @@ -237,7 +237,7 @@ pluma_prefs_manager_set_bool (const gchar* key, gboolean value) g_settings_set_boolean (pluma_prefs_manager->settings, key, value); } -static void +static void pluma_prefs_manager_set_int (const gchar* key, gint value) { pluma_debug (DEBUG_PREFS); @@ -248,13 +248,13 @@ pluma_prefs_manager_set_int (const gchar* key, gint value) g_settings_set_int (pluma_prefs_manager->settings, key, value); } -static void +static void pluma_prefs_manager_set_string (const gchar* key, const gchar* value) { pluma_debug (DEBUG_PREFS); g_return_if_fail (value != NULL); - + g_return_if_fail (g_settings_is_writable ( pluma_prefs_manager->settings, key)); @@ -272,7 +272,7 @@ pluma_prefs_manager_set_enum (const gchar* key, gint value) g_settings_set_enum (pluma_prefs_manager->settings, key, value); } -static gboolean +static gboolean pluma_prefs_manager_key_is_writable (const gchar* key) { pluma_debug (DEBUG_PREFS); @@ -318,13 +318,13 @@ DEFINE_INT_PREF (auto_save_interval, DEFINE_INT_PREF (undo_actions_limit, GPM_UNDO_ACTIONS_LIMIT) -static GtkWrapMode +static GtkWrapMode get_wrap_mode_from_string (const gchar* str) { GtkWrapMode res; g_return_val_if_fail (str != NULL, GTK_WRAP_WORD); - + if (strcmp (str, "GTK_WRAP_NONE") == 0) res = GTK_WRAP_NONE; else @@ -344,9 +344,9 @@ pluma_prefs_manager_get_wrap_mode (void) { gchar *str; GtkWrapMode res; - + pluma_debug (DEBUG_PREFS); - + str = pluma_prefs_manager_get_string (GPM_WRAP_MODE); res = get_wrap_mode_from_string (str); @@ -355,12 +355,12 @@ pluma_prefs_manager_get_wrap_mode (void) return res; } - + void pluma_prefs_manager_set_wrap_mode (GtkWrapMode wp) { const gchar * str; - + pluma_debug (DEBUG_PREFS); switch (wp) @@ -380,30 +380,30 @@ pluma_prefs_manager_set_wrap_mode (GtkWrapMode wp) pluma_prefs_manager_set_string (GPM_WRAP_MODE, str); } - + gboolean pluma_prefs_manager_wrap_mode_can_set (void) { pluma_debug (DEBUG_PREFS); - + return pluma_prefs_manager_key_is_writable (GPM_WRAP_MODE); } /* Tabs size */ -DEFINE_INT_PREF (tabs_size, +DEFINE_INT_PREF (tabs_size, GPM_TABS_SIZE) /* Insert spaces */ -DEFINE_BOOL_PREF (insert_spaces, +DEFINE_BOOL_PREF (insert_spaces, GPM_INSERT_SPACES) /* Auto indent */ -DEFINE_BOOL_PREF (auto_indent, +DEFINE_BOOL_PREF (auto_indent, GPM_AUTO_INDENT) /* Display line numbers */ -DEFINE_BOOL_PREF (display_line_numbers, +DEFINE_BOOL_PREF (display_line_numbers, GPM_DISPLAY_LINE_NUMBERS) /* Toolbar visibility */ @@ -412,14 +412,14 @@ DEFINE_BOOL_PREF (toolbar_visible, /* Toolbar suttons style */ -PlumaToolbarSetting -pluma_prefs_manager_get_toolbar_buttons_style (void) +PlumaToolbarSetting +pluma_prefs_manager_get_toolbar_buttons_style (void) { gchar *str; PlumaToolbarSetting res; - + pluma_debug (DEBUG_PREFS); - + str = pluma_prefs_manager_get_string (GPM_TOOLBAR_BUTTONS_STYLE); if (strcmp (str, "PLUMA_TOOLBAR_ICONS") == 0) @@ -428,7 +428,7 @@ pluma_prefs_manager_get_toolbar_buttons_style (void) { if (strcmp (str, "PLUMA_TOOLBAR_ICONS_AND_TEXT") == 0) res = PLUMA_TOOLBAR_ICONS_AND_TEXT; - else + else { if (strcmp (str, "PLUMA_TOOLBAR_ICONS_BOTH_HORIZ") == 0) res = PLUMA_TOOLBAR_ICONS_BOTH_HORIZ; @@ -446,7 +446,7 @@ void pluma_prefs_manager_set_toolbar_buttons_style (PlumaToolbarSetting tbs) { const gchar * str; - + pluma_debug (DEBUG_PREFS); switch (tbs) @@ -475,7 +475,7 @@ gboolean pluma_prefs_manager_toolbar_buttons_style_can_set (void) { pluma_debug (DEBUG_PREFS); - + return pluma_prefs_manager_key_is_writable (GPM_TOOLBAR_BUTTONS_STYLE); } @@ -483,11 +483,11 @@ pluma_prefs_manager_toolbar_buttons_style_can_set (void) /* Statusbar visiblity */ DEFINE_BOOL_PREF (statusbar_visible, GPM_STATUSBAR_VISIBLE) - + /* Side Pane visiblity */ DEFINE_BOOL_PREF (side_pane_visible, GPM_SIDE_PANE_VISIBLE) - + /* Bottom Panel visiblity */ DEFINE_BOOL_PREF (bottom_panel_visible, GPM_BOTTOM_PANEL_VISIBLE) @@ -507,9 +507,9 @@ pluma_prefs_manager_get_print_wrap_mode (void) { gchar *str; GtkWrapMode res; - + pluma_debug (DEBUG_PREFS); - + str = pluma_prefs_manager_get_string (GPM_PRINT_WRAP_MODE); if (strcmp (str, "GTK_WRAP_NONE") == 0) @@ -526,7 +526,7 @@ pluma_prefs_manager_get_print_wrap_mode (void) return res; } - + void pluma_prefs_manager_set_print_wrap_mode (GtkWrapMode pwp) { @@ -555,11 +555,11 @@ gboolean pluma_prefs_manager_print_wrap_mode_can_set (void) { pluma_debug (DEBUG_PREFS); - + return pluma_prefs_manager_key_is_writable (GPM_PRINT_WRAP_MODE); } -/* Print line numbers */ +/* Print line numbers */ DEFINE_INT_PREF (print_line_numbers, GPM_PRINT_LINE_NUMBERS) @@ -602,8 +602,8 @@ pluma_prefs_manager_get_default_print_font_numbers (void) return pluma_prefs_manager_get_default_string_value (GPM_PRINT_FONT_NUMBERS); } -/* Max number of files in "Recent Files" menu. - * This is configurable only using gsettings, dconf or dconf-editor +/* Max number of files in "Recent Files" menu. + * This is configurable only using gsettings, dconf or dconf-editor */ gint pluma_prefs_manager_get_max_recents (void) @@ -677,16 +677,16 @@ pluma_prefs_manager_get_auto_detected_encodings (void) strings = pluma_prefs_manager_get_gslist (pluma_prefs_manager->settings, GPM_AUTO_DETECTED_ENCODINGS); if (strings != NULL) - { + { GSList *tmp; const PlumaEncoding *enc; tmp = strings; - + while (tmp) { const char *charset = tmp->data; - + if (strcmp (charset, "CURRENT") == 0) g_get_charset (&charset); @@ -704,7 +704,7 @@ pluma_prefs_manager_get_auto_detected_encodings (void) } g_slist_foreach (strings, (GFunc) g_free, NULL); - g_slist_free (strings); + g_slist_free (strings); res = g_slist_reverse (res); } @@ -728,12 +728,12 @@ pluma_prefs_manager_get_shown_in_menu_encodings (void) strings = pluma_prefs_manager_get_gslist (pluma_prefs_manager->settings, GPM_SHOWN_IN_MENU_ENCODINGS); if (strings != NULL) - { + { GSList *tmp; const PlumaEncoding *enc; tmp = strings; - + while (tmp) { const char *charset = tmp->data; @@ -754,7 +754,7 @@ pluma_prefs_manager_get_shown_in_menu_encodings (void) } g_slist_foreach (strings, (GFunc) g_free, NULL); - g_slist_free (strings); + g_slist_free (strings); res = g_slist_reverse (res); } @@ -764,9 +764,9 @@ pluma_prefs_manager_get_shown_in_menu_encodings (void) void pluma_prefs_manager_set_shown_in_menu_encodings (const GSList *encs) -{ +{ GSList *list = NULL; - + g_return_if_fail (pluma_prefs_manager != NULL); g_return_if_fail (pluma_prefs_manager->settings != NULL); g_return_if_fail (pluma_prefs_manager_shown_in_menu_encodings_can_set ()); @@ -775,7 +775,7 @@ pluma_prefs_manager_set_shown_in_menu_encodings (const GSList *encs) { const PlumaEncoding *enc; const gchar *charset; - + enc = (const PlumaEncoding *)encs->data; charset = pluma_encoding_get_charset (enc); @@ -797,7 +797,7 @@ gboolean pluma_prefs_manager_shown_in_menu_encodings_can_set (void) { pluma_debug (DEBUG_PREFS); - + return pluma_prefs_manager_key_is_writable (GPM_SHOWN_IN_MENU_ENCODINGS); } @@ -809,12 +809,12 @@ DEFINE_BOOL_PREF (highlight_current_line, /* Highlight matching bracket */ DEFINE_BOOL_PREF (bracket_matching, GPM_BRACKET_MATCHING) - + /* Display Right Margin */ DEFINE_BOOL_PREF (display_right_margin, GPM_DISPLAY_RIGHT_MARGIN) -/* Right Margin Position */ +/* Right Margin Position */ DEFINE_INT_PREF (right_margin_position, GPM_RIGHT_MARGIN_POSITION) @@ -853,7 +853,7 @@ pluma_prefs_manager_get_smart_home_end (void) return res; } - + void pluma_prefs_manager_set_smart_home_end (GtkSourceSmartHomeEndType smart_he) { @@ -886,7 +886,7 @@ gboolean pluma_prefs_manager_smart_home_end_can_set (void) { pluma_debug (DEBUG_PREFS); - + return pluma_prefs_manager_key_is_writable (GPM_SMART_HOME_END); } @@ -906,7 +906,7 @@ GSList * pluma_prefs_manager_get_writable_vfs_schemes (void) { GSList *strings; - + pluma_debug (DEBUG_PREFS); g_return_val_if_fail (pluma_prefs_manager != NULL, NULL); @@ -915,8 +915,8 @@ pluma_prefs_manager_get_writable_vfs_schemes (void) strings = pluma_prefs_manager_get_gslist (pluma_prefs_manager->settings, GPM_WRITABLE_VFS_SCHEMES); /* The 'file' scheme is writable by default. */ - strings = g_slist_prepend (strings, g_strdup ("file")); - + strings = g_slist_prepend (strings, g_strdup ("file")); + pluma_debug_message (DEBUG_PREFS, "Done"); return strings; @@ -950,7 +950,7 @@ pluma_prefs_manager_get_active_plugins (void) void pluma_prefs_manager_set_active_plugins (const GSList *plugins) -{ +{ g_return_if_fail (pluma_prefs_manager != NULL); g_return_if_fail (pluma_prefs_manager->settings != NULL); g_return_if_fail (pluma_prefs_manager_active_plugins_can_set ()); diff --git a/pluma/pluma-print-job.c b/pluma/pluma-print-job.c index 786cd697..d4afbd2f 100644 --- a/pluma/pluma-print-job.c +++ b/pluma/pluma-print-job.c @@ -3,7 +3,7 @@ * This file is part of pluma * * Copyright (C) 2000-2001 Chema Celorio, Paolo Maggi - * Copyright (C) 2002-2008 Paolo Maggi + * Copyright (C) 2002-2008 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, 1998-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, 1998-2005. See the AUTHORS file for a + * list of people on the pluma Team. + * See the ChangeLog files for a list of changes. * * $Id: pluma-print.c 6022 2007-12-09 14:38:57Z pborelli $ */ @@ -62,7 +62,7 @@ struct _PlumaPrintJobPrivate GtkWidget *preview; PlumaPrintJobStatus status; - + gchar *status_string; gdouble progress; @@ -94,7 +94,7 @@ enum PROP_VIEW }; -enum +enum { PRINTING, SHOW_PREVIEW, @@ -113,7 +113,7 @@ set_view (PlumaPrintJob *job, PlumaView *view) job->priv->doc = PLUMA_DOCUMENT (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view))); } -static void +static void pluma_print_job_get_property (GObject *object, guint prop_id, GValue *value, @@ -132,7 +132,7 @@ pluma_print_job_get_property (GObject *object, } } -static void +static void pluma_print_job_set_property (GObject *object, guint prop_id, const GValue *value, @@ -157,7 +157,7 @@ pluma_print_job_finalize (GObject *object) PlumaPrintJob *job = PLUMA_PRINT_JOB (object); g_free (job->priv->status_string); - + if (job->priv->compositor != NULL) g_object_unref (job->priv->compositor); @@ -167,7 +167,7 @@ pluma_print_job_finalize (GObject *object) G_OBJECT_CLASS (pluma_print_job_parent_class)->finalize (object); } -static void +static void pluma_print_job_class_init (PlumaPrintJobClass *klass) { GObjectClass *object_class; @@ -221,7 +221,7 @@ pluma_print_job_class_init (PlumaPrintJobClass *klass) 2, G_TYPE_UINT, G_TYPE_POINTER); - + g_type_class_add_private (object_class, sizeof (PlumaPrintJobPrivate)); } @@ -231,7 +231,7 @@ line_numbers_checkbutton_toggled (GtkToggleButton *button, { if (gtk_toggle_button_get_active (button)) { - gtk_widget_set_sensitive (job->priv->line_numbers_hbox, + gtk_widget_set_sensitive (job->priv->line_numbers_hbox, pluma_prefs_manager_print_line_numbers_can_set ()); } else @@ -246,7 +246,7 @@ wrap_mode_checkbutton_toggled (GtkToggleButton *button, { if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (job->priv->text_wrapping_checkbutton))) { - gtk_widget_set_sensitive (job->priv->do_not_split_checkbutton, + gtk_widget_set_sensitive (job->priv->do_not_split_checkbutton, FALSE); gtk_toggle_button_set_inconsistent ( GTK_TOGGLE_BUTTON (job->priv->do_not_split_checkbutton), @@ -278,7 +278,7 @@ restore_button_clicked (GtkButton *button, g_free (font); } - + if (pluma_prefs_manager_print_font_header_can_set ()) { gchar *font; @@ -305,7 +305,7 @@ restore_button_clicked (GtkButton *button, } static GObject * -create_custom_widget_cb (GtkPrintOperation *operation, +create_custom_widget_cb (GtkPrintOperation *operation, PlumaPrintJob *job) { gboolean ret; @@ -374,7 +374,7 @@ create_custom_widget_cb (GtkPrintOperation *operation, { gtk_spin_button_set_value (GTK_SPIN_BUTTON (job->priv->line_numbers_spinbutton), (guint) line_numbers); - gtk_widget_set_sensitive (job->priv->line_numbers_hbox, can_set); + gtk_widget_set_sensitive (job->priv->line_numbers_hbox, can_set); } else { @@ -410,7 +410,7 @@ create_custom_widget_cb (GtkPrintOperation *operation, can_set = pluma_prefs_manager_print_wrap_mode_can_set (); gtk_widget_set_sensitive (job->priv->text_wrapping_checkbutton, can_set); - gtk_widget_set_sensitive (job->priv->do_not_split_checkbutton, + gtk_widget_set_sensitive (job->priv->do_not_split_checkbutton, can_set && (wrap_mode != GTK_WRAP_NONE)); /* Set initial values */ @@ -493,7 +493,7 @@ custom_widget_apply_cb (GtkPrintOperation *operation, else { pluma_prefs_manager_set_print_wrap_mode (GTK_WRAP_CHAR); - } + } } pluma_prefs_manager_set_print_font_body (gtk_font_chooser_get_font (GTK_FONT_CHOOSER (job->priv->body_fontbutton))); @@ -507,12 +507,12 @@ create_compositor (PlumaPrintJob *job) gchar *print_font_body; gchar *print_font_header; gchar *print_font_numbers; - + /* Create and initialize print compositor */ print_font_body = pluma_prefs_manager_get_print_font_body (); print_font_header = pluma_prefs_manager_get_print_font_header (); print_font_numbers = pluma_prefs_manager_get_print_font_numbers (); - + job->priv->compositor = GTK_SOURCE_PRINT_COMPOSITOR ( g_object_new (GTK_SOURCE_TYPE_PRINT_COMPOSITOR, "buffer", GTK_SOURCE_BUFFER (job->priv->doc), @@ -531,7 +531,7 @@ create_compositor (PlumaPrintJob *job) g_free (print_font_body); g_free (print_font_header); g_free (print_font_numbers); - + if (pluma_prefs_manager_get_print_header ()) { gchar *doc_name; @@ -544,7 +544,7 @@ create_compositor (PlumaPrintJob *job) left = g_strdup_printf (_("File: %s"), name_to_display); /* Translators: %N is the current page number, %Q is the total - * number of pages (ex. Page 2 of 10) + * number of pages (ex. Page 2 of 10) */ gtk_source_print_compositor_set_header_format (job->priv->compositor, TRUE, @@ -555,11 +555,11 @@ create_compositor (PlumaPrintJob *job) g_free (doc_name); g_free (name_to_display); g_free (left); - } + } } static void -begin_print_cb (GtkPrintOperation *operation, +begin_print_cb (GtkPrintOperation *operation, GtkPrintContext *context, PlumaPrintJob *job) { @@ -568,7 +568,7 @@ begin_print_cb (GtkPrintOperation *operation, job->priv->status = PLUMA_PRINT_JOB_STATUS_PAGINATING; job->priv->progress = 0.0; - + g_signal_emit (job, print_job_signals[PRINTING], 0, job->priv->status); } @@ -589,7 +589,7 @@ preview_destroyed (GtkWidget *preview, gtk_print_operation_preview_end_preview (gtk_preview); } -static gboolean +static gboolean preview_cb (GtkPrintOperation *op, GtkPrintOperationPreview *gtk_preview, GtkPrintContext *context, @@ -613,16 +613,16 @@ preview_cb (GtkPrintOperation *op, } static gboolean -paginate_cb (GtkPrintOperation *operation, +paginate_cb (GtkPrintOperation *operation, GtkPrintContext *context, PlumaPrintJob *job) { - gboolean res; - + gboolean res; + job->priv->status = PLUMA_PRINT_JOB_STATUS_PAGINATING; - + res = gtk_source_print_compositor_paginate (job->priv->compositor, context); - + if (res) { gint n_pages; @@ -656,25 +656,25 @@ draw_page_cb (GtkPrintOperation *operation, if (!job->priv->is_preview) { g_free (job->priv->status_string); - + n_pages = gtk_source_print_compositor_get_n_pages (job->priv->compositor); - + job->priv->status = PLUMA_PRINT_JOB_STATUS_DRAWING; - - job->priv->status_string = g_strdup_printf ("Rendering page %d of %d...", + + job->priv->status_string = g_strdup_printf ("Rendering page %d of %d...", page_nr + 1, n_pages); - + job->priv->progress = page_nr / (2.0 * n_pages) + 0.5; g_signal_emit (job, print_job_signals[PRINTING], 0, job->priv->status); - } + } gtk_source_print_compositor_draw_page (job->priv->compositor, context, page_nr); } static void -end_print_cb (GtkPrintOperation *operation, +end_print_cb (GtkPrintOperation *operation, GtkPrintContext *context, PlumaPrintJob *job) { @@ -690,7 +690,7 @@ done_cb (GtkPrintOperation *operation, GError *error = NULL; PlumaPrintJobResult print_result; - switch (result) + switch (result) { case GTK_PRINT_OPERATION_RESULT_CANCEL: print_result = PLUMA_PRINT_JOB_RESULT_CANCEL; @@ -708,20 +708,20 @@ done_cb (GtkPrintOperation *operation, default: g_return_if_reached (); } - + /* Avoid job is destroyed in the handler of the "done" message */ g_object_ref (job); - + g_signal_emit (job, print_job_signals[DONE], 0, print_result, error); - + g_object_unref (operation); job->priv->operation = NULL; - + g_object_unref (job); } /* Note that pluma_print_job_print can can only be called once on a given PlumaPrintJob */ -GtkPrintOperationResult +GtkPrintOperationResult pluma_print_job_print (PlumaPrintJob *job, GtkPrintOperationAction action, GtkPageSetup *page_setup, @@ -762,15 +762,15 @@ pluma_print_job_print (PlumaPrintJob *job, gtk_print_operation_set_allow_async (priv->operation, TRUE); g_signal_connect (priv->operation, - "create-custom-widget", + "create-custom-widget", G_CALLBACK (create_custom_widget_cb), job); g_signal_connect (priv->operation, - "custom-widget-apply", - G_CALLBACK (custom_widget_apply_cb), + "custom-widget-apply", + G_CALLBACK (custom_widget_apply_cb), job); g_signal_connect (priv->operation, - "begin-print", + "begin-print", G_CALLBACK (begin_print_cb), job); g_signal_connect (priv->operation, @@ -778,23 +778,23 @@ pluma_print_job_print (PlumaPrintJob *job, G_CALLBACK (preview_cb), job); g_signal_connect (priv->operation, - "paginate", + "paginate", G_CALLBACK (paginate_cb), job); g_signal_connect (priv->operation, - "draw-page", + "draw-page", G_CALLBACK (draw_page_cb), job); g_signal_connect (priv->operation, - "end-print", + "end-print", G_CALLBACK (end_print_cb), job); g_signal_connect (priv->operation, - "done", + "done", G_CALLBACK (done_cb), - job); + job); - return gtk_print_operation_run (priv->operation, + return gtk_print_operation_run (priv->operation, action, parent, error); @@ -804,9 +804,9 @@ static void pluma_print_job_init (PlumaPrintJob *job) { job->priv = PLUMA_PRINT_JOB_GET_PRIVATE (job); - + job->priv->status = PLUMA_PRINT_JOB_STATUS_INIT; - + job->priv->status_string = g_strdup (_("Preparing...")); } @@ -814,9 +814,9 @@ PlumaPrintJob * pluma_print_job_new (PlumaView *view) { PlumaPrintJob *job; - + g_return_val_if_fail (PLUMA_IS_VIEW (view), NULL); - + job = PLUMA_PRINT_JOB (g_object_new (PLUMA_TYPE_PRINT_JOB, "view", view, NULL)); @@ -837,7 +837,7 @@ pluma_print_job_get_status_string (PlumaPrintJob *job) { g_return_val_if_fail (PLUMA_IS_PRINT_JOB (job), NULL); g_return_val_if_fail (job->priv->status_string != NULL, NULL); - + return job->priv->status_string; } diff --git a/pluma/pluma-print-job.h b/pluma/pluma-print-job.h index e79eab00..c0ecaa8e 100644 --- a/pluma/pluma-print-job.h +++ b/pluma/pluma-print-job.h @@ -3,7 +3,7 @@ * This file is part of pluma * * Copyright (C) 2000-2001 Chema Celorio, Paolo Maggi - * Copyright (C) 2002-2008 Paolo Maggi + * Copyright (C) 2002-2008 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, 1998-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, 1998-2005. See the AUTHORS file for a + * list of people on the pluma Team. + * See the ChangeLog files for a list of changes. * * $Id$ */ @@ -60,7 +60,7 @@ typedef enum { PLUMA_PRINT_JOB_RESULT_OK, PLUMA_PRINT_JOB_RESULT_CANCEL, - PLUMA_PRINT_JOB_RESULT_ERROR + PLUMA_PRINT_JOB_RESULT_ERROR } PlumaPrintJobResult; /* Private structure type */ @@ -72,10 +72,10 @@ typedef struct _PlumaPrintJobPrivate PlumaPrintJobPrivate; typedef struct _PlumaPrintJob PlumaPrintJob; -struct _PlumaPrintJob +struct _PlumaPrintJob { GObject parent; - + /* <private> */ PlumaPrintJobPrivate *priv; }; @@ -85,7 +85,7 @@ struct _PlumaPrintJob */ typedef struct _PlumaPrintJobClass PlumaPrintJobClass; -struct _PlumaPrintJobClass +struct _PlumaPrintJobClass { GObjectClass parent_class; diff --git a/pluma/pluma-print-preview.c b/pluma/pluma-print-preview.c index bf8f8c40..4fb7c561 100644 --- a/pluma/pluma-print-preview.c +++ b/pluma/pluma-print-preview.c @@ -85,14 +85,14 @@ struct _PlumaPrintPreviewPrivate G_DEFINE_TYPE (PlumaPrintPreview, pluma_print_preview, GTK_TYPE_BOX) -static void +static void pluma_print_preview_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { //PlumaPrintPreview *preview = PLUMA_PRINT_PREVIEW (object); - + switch (prop_id) { default: @@ -101,14 +101,14 @@ pluma_print_preview_get_property (GObject *object, } } -static void +static void pluma_print_preview_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { //PlumaPrintPreview *preview = PLUMA_PRINT_PREVIEW (object); - + switch (prop_id) { default: @@ -135,7 +135,7 @@ pluma_print_preview_grab_focus (GtkWidget *widget) gtk_widget_grab_focus (GTK_WIDGET (preview->priv->layout)); } -static void +static void pluma_print_preview_class_init (PlumaPrintPreviewClass *klass) { GObjectClass *object_class; @@ -150,7 +150,7 @@ pluma_print_preview_class_init (PlumaPrintPreviewClass *klass) widget_class->grab_focus = pluma_print_preview_grab_focus; - g_type_class_add_private (object_class, sizeof(PlumaPrintPreviewPrivate)); + g_type_class_add_private (object_class, sizeof(PlumaPrintPreviewPrivate)); } static void @@ -196,7 +196,7 @@ get_paper_height (PlumaPrintPreview *preview) } #define PAGE_PAD 12 -#define PAGE_SHADOW_OFFSET 5 +#define PAGE_SHADOW_OFFSET 5 /* The tile size is the size of the area where a page * will be drawn including the padding and idependent @@ -206,7 +206,7 @@ get_paper_height (PlumaPrintPreview *preview) static void update_tile_size (PlumaPrintPreview *preview) { - PlumaPrintPreviewPrivate *priv; + PlumaPrintPreviewPrivate *priv; gint w, h; priv = preview->priv; @@ -223,7 +223,7 @@ update_tile_size (PlumaPrintPreview *preview) else { priv->tile_w = w; - priv->tile_h = h; + priv->tile_h = h; } } @@ -234,7 +234,7 @@ static void set_zoom_factor (PlumaPrintPreview *preview, double zoom) { - PlumaPrintPreviewPrivate *priv; + PlumaPrintPreviewPrivate *priv; priv = preview->priv; @@ -247,7 +247,7 @@ set_zoom_factor (PlumaPrintPreview *preview, static void set_zoom_fit_to_size (PlumaPrintPreview *preview) { - PlumaPrintPreviewPrivate *priv; + PlumaPrintPreviewPrivate *priv; double width, height; double p_width, p_height; double zoomx, zoomy; @@ -417,7 +417,7 @@ page_entry_insert_text (GtkEditable *editable, } } -static gboolean +static gboolean page_entry_focus_out (GtkWidget *widget, GdkEventFocus *event, PlumaPrintPreview *preview) @@ -600,15 +600,15 @@ create_bar (PlumaPrintPreview *preview) gtk_widget_set_tooltip_text (priv->page_entry, _("Current page (Alt+P)")); g_signal_connect (priv->page_entry, - "activate", + "activate", G_CALLBACK (page_entry_activated), preview); g_signal_connect (priv->page_entry, - "insert-text", + "insert-text", G_CALLBACK (page_entry_insert_text), NULL); g_signal_connect (priv->page_entry, - "focus-out-event", + "focus-out-event", G_CALLBACK (page_entry_focus_out), preview); @@ -763,7 +763,7 @@ get_page_at_coords (PlumaPrintPreview *preview, /* FIXME: we could try to be picky and check * if we actually are inside the page */ - return pg; + return pg; } static gboolean @@ -1006,8 +1006,8 @@ static void pluma_print_preview_init (PlumaPrintPreview *preview) { PlumaPrintPreviewPrivate *priv; - - priv = G_TYPE_INSTANCE_GET_PRIVATE (preview, + + priv = G_TYPE_INSTANCE_GET_PRIVATE (preview, PLUMA_TYPE_PRINT_PREVIEW, PlumaPrintPreviewPrivate); @@ -1187,7 +1187,7 @@ get_screen_dpi (PlumaPrintPreview *preview) GdkScreen *screen; double dpi; - screen = gtk_widget_get_screen (GTK_WIDGET (preview)); + screen = gtk_widget_get_screen (GTK_WIDGET (preview)); dpi = gdk_screen_get_resolution (screen); if (dpi < 30. || 600. < dpi) @@ -1254,7 +1254,7 @@ update_paper_size (PlumaPrintPreview *preview, } static void -preview_got_page_size (GtkPrintOperationPreview *gtk_preview, +preview_got_page_size (GtkPrintOperationPreview *gtk_preview, GtkPrintContext *context, GtkPageSetup *page_setup, PlumaPrintPreview *preview) @@ -1339,7 +1339,7 @@ pluma_print_preview_new (GtkPrintOperation *op, update_paper_size (preview, page_setup); /* FIXME: we need a cr to paginate... but we can't get the drawing - * area surface because it's not there yet... for now I create + * area surface because it's not there yet... for now I create * a dummy pdf surface */ surface = create_preview_surface (preview, &dpi_x, &dpi_y); diff --git a/pluma/pluma-progress-message-area.c b/pluma/pluma-progress-message-area.c index 91acdf38..88b1525e 100644 --- a/pluma/pluma-progress-message-area.c +++ b/pluma/pluma-progress-message-area.c @@ -2,7 +2,7 @@ * pluma-progress-message-area.c * 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,20 +16,20 @@ * * 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$ */ - + /* TODO: add properties */ - + #ifdef HAVE_CONFIG_H #include <config.h> #endif @@ -106,7 +106,7 @@ pluma_progress_message_area_get_property (GObject *object, } } -static void +static void pluma_progress_message_area_class_init (PlumaProgressMessageAreaClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); @@ -132,9 +132,9 @@ pluma_progress_message_area_init (PlumaProgressMessageArea *area) { GtkWidget *vbox; GtkWidget *hbox; - + area->priv = PLUMA_PROGRESS_MESSAGE_AREA_GET_PRIVATE (area); - + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_widget_show (vbox); @@ -142,19 +142,19 @@ pluma_progress_message_area_init (PlumaProgressMessageArea *area) gtk_widget_show (hbox); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); - area->priv->image = gtk_image_new_from_icon_name ("image-missing", + area->priv->image = gtk_image_new_from_icon_name ("image-missing", GTK_ICON_SIZE_SMALL_TOOLBAR); gtk_widget_show (area->priv->image); gtk_widget_set_halign (area->priv->image, GTK_ALIGN_CENTER); gtk_widget_set_valign (area->priv->image, GTK_ALIGN_CENTER); gtk_box_pack_start (GTK_BOX (hbox), area->priv->image, FALSE, FALSE, 4); - + area->priv->label = gtk_label_new (""); gtk_widget_show (area->priv->label); gtk_box_pack_start (GTK_BOX (hbox), area->priv->label, TRUE, TRUE, 0); gtk_label_set_use_markup (GTK_LABEL (area->priv->label), TRUE); gtk_label_set_xalign (GTK_LABEL (area->priv->label), 0.0); - gtk_label_set_ellipsize (GTK_LABEL (area->priv->label), + gtk_label_set_ellipsize (GTK_LABEL (area->priv->label), PANGO_ELLIPSIZE_END); area->priv->progress = gtk_progress_bar_new (); @@ -163,7 +163,7 @@ pluma_progress_message_area_init (PlumaProgressMessageArea *area) gtk_widget_set_size_request (area->priv->progress, -1, 15); GtkWidget *content; - + content = gtk_info_bar_get_content_area (GTK_INFO_BAR (area)); gtk_container_add (GTK_CONTAINER (content), vbox); } @@ -188,7 +188,7 @@ pluma_progress_message_area_new (const gchar *image_id, pluma_progress_message_area_set_markup (area, markup); - return GTK_WIDGET (area); + return GTK_WIDGET (area); } void @@ -197,7 +197,7 @@ pluma_progress_message_area_set_image (PlumaProgressMessageArea *area, { g_return_if_fail (PLUMA_IS_PROGRESS_MESSAGE_AREA (area)); g_return_if_fail (image_id != NULL); - + gtk_image_set_from_icon_name (GTK_IMAGE (area->priv->image), image_id, GTK_ICON_SIZE_SMALL_TOOLBAR); diff --git a/pluma/pluma-progress-message-area.h b/pluma/pluma-progress-message-area.h index 508472d1..9d92abbe 100644 --- a/pluma/pluma-progress-message-area.h +++ b/pluma/pluma-progress-message-area.h @@ -2,7 +2,7 @@ * pluma-progress-message-area.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$ */ @@ -53,7 +53,7 @@ typedef struct _PlumaProgressMessageAreaPrivate PlumaProgressMessageAreaPrivate; */ typedef struct _PlumaProgressMessageArea PlumaProgressMessageArea; -struct _PlumaProgressMessageArea +struct _PlumaProgressMessageArea { GtkInfoBar parent; @@ -66,7 +66,7 @@ struct _PlumaProgressMessageArea */ typedef struct _PlumaProgressMessageAreaClass PlumaProgressMessageAreaClass; -struct _PlumaProgressMessageAreaClass +struct _PlumaProgressMessageAreaClass { GtkInfoBarClass parent_class; }; @@ -93,7 +93,7 @@ void pluma_progress_message_area_set_fraction (PlumaProgressMessageArea *area, gdouble fraction); void pluma_progress_message_area_pulse (PlumaProgressMessageArea *area); - + G_END_DECLS diff --git a/pluma/pluma-session.c b/pluma/pluma-session.c index 628f4ef5..7d793b4d 100644 --- a/pluma/pluma-session.c +++ b/pluma/pluma-session.c @@ -3,7 +3,7 @@ * This file is part of pluma * * Copyright (C) 2002 Ximian, Inc. - * Copyright (C) 2005 - Paolo Maggi + * Copyright (C) 2005 - Paolo Maggi * * Author: Federico Mena-Quintero <[email protected]> * @@ -19,13 +19,13 @@ * * 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. + * 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$ @@ -110,14 +110,14 @@ save_window_session (GKeyFile *state_file, if (uri != NULL) g_ptr_array_add (doc_array, uri); - + } - g_list_free (docs); + g_list_free (docs); if (doc_array->len) { guint i; - + g_key_file_set_string_list (state_file, group_name, "documents", (const char **)doc_array->pdata, @@ -147,7 +147,7 @@ client_save_state_cb (EggSMClient *client, group_name, PLUMA_WINDOW (windows->data)); g_free (group_name); - + windows = g_list_next (windows); n++; } @@ -376,9 +376,9 @@ client_quit_cb (EggSMClient *client, gpointer data) pluma_file_close_all (); pluma_debug_message (DEBUG_FILE, "All files closed."); - + matecomponent_mdi_destroy (MATECOMPONENT_MDI (pluma_mdi)); - + pluma_debug_message (DEBUG_FILE, "Unref pluma_mdi."); g_object_unref (G_OBJECT (pluma_mdi)); @@ -397,7 +397,7 @@ client_quit_cb (EggSMClient *client, gpointer data) /** * pluma_session_init: - * + * * Initializes session management support. This function should be called near * the beginning of the program. **/ @@ -405,7 +405,7 @@ void pluma_session_init (void) { pluma_debug (DEBUG_SESSION); - + if (master_client) return; @@ -421,14 +421,14 @@ pluma_session_init (void) g_signal_connect (master_client, "quit", G_CALLBACK (client_quit_cb), - NULL); + NULL); } /** * pluma_session_is_restored: - * + * * Returns whether this pluma is running from a restarted session. - * + * * Return value: TRUE if the session manager restarted us, FALSE otherwise. * This should be used to determine whether to pay attention to command line * arguments in case the session was not restored. @@ -459,7 +459,7 @@ parse_window (GKeyFile *state_file, const char *group_name) gboolean visible; PlumaPanel *panel; GError *error = NULL; - + role = g_key_file_get_string (state_file, group_name, "role", NULL); pluma_debug_message (DEBUG_SESSION, "Window role: %s", role); @@ -488,8 +488,8 @@ parse_window (GKeyFile *state_file, const char *group_name) height = -1; } gtk_window_set_default_size (GTK_WINDOW (window), width, height); - - + + visible = g_key_file_get_boolean (state_file, group_name, "side-panel-visible", &error); if (error) @@ -497,9 +497,9 @@ parse_window (GKeyFile *state_file, const char *group_name) g_clear_error (&error); visible = FALSE; } - + panel = pluma_window_get_side_panel (window); - + if (visible) { pluma_debug_message (DEBUG_SESSION, "Side panel visible"); @@ -510,7 +510,7 @@ parse_window (GKeyFile *state_file, const char *group_name) pluma_debug_message (DEBUG_SESSION, "Side panel _NOT_ visible"); gtk_widget_hide (GTK_WIDGET (panel)); } - + visible = g_key_file_get_boolean (state_file, group_name, "bottom-panel-visible", &error); if (error) @@ -518,7 +518,7 @@ parse_window (GKeyFile *state_file, const char *group_name) g_clear_error (&error); visible = FALSE; } - + panel = pluma_window_get_bottom_panel (window); if (visible) { @@ -539,13 +539,13 @@ parse_window (GKeyFile *state_file, const char *group_name) { int i; gboolean jump_to = FALSE; - + for (i = 0; documents[i]; i++) { if (active_document != NULL) jump_to = strcmp (active_document, documents[i]) == 0; - + pluma_debug_message (DEBUG_SESSION, "URI: %s (%s)", documents[i], @@ -559,18 +559,18 @@ parse_window (GKeyFile *state_file, const char *group_name) } g_strfreev (documents); } - + g_free (active_document); - + gtk_widget_show (GTK_WIDGET (window)); } /** * pluma_session_load: - * + * * Loads the session by fetching the necessary information from the session * manager and opening files. - * + * * Return value: TRUE if the session was loaded successfully, FALSE otherwise. **/ gboolean diff --git a/pluma/pluma-session.h b/pluma/pluma-session.h index 202d6298..bc376cb8 100644 --- a/pluma/pluma-session.h +++ b/pluma/pluma-session.h @@ -3,7 +3,7 @@ * This file is part of pluma * * Copyright (C) 2002 Ximian, Inc. - * Copyright (C) 2005 - Paolo Maggi + * Copyright (C) 2005 - Paolo Maggi * * Author: Federico Mena-Quintero <[email protected]> * @@ -19,16 +19,16 @@ * * 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. + * 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 + * $Id */ #ifndef __PLUMA_SESSION_H__ diff --git a/pluma/pluma-smart-charset-converter.c b/pluma/pluma-smart-charset-converter.c index 2d4c27b6..f65daae2 100644 --- a/pluma/pluma-smart-charset-converter.c +++ b/pluma/pluma-smart-charset-converter.c @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with pluma; 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 */ @@ -242,7 +242,7 @@ guess_encoding (PlumaSmartCharsetConverter *smart, { gsize remainder; const gchar *end; - + if (g_utf8_validate (inbuf, inbuf_size, &end) || smart->priv->use_first) { diff --git a/pluma/pluma-smart-charset-converter.h b/pluma/pluma-smart-charset-converter.h index 3f6e74e8..7e95179d 100644 --- a/pluma/pluma-smart-charset-converter.h +++ b/pluma/pluma-smart-charset-converter.h @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with pluma; 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 */ @@ -44,7 +44,7 @@ typedef struct _PlumaSmartCharsetConverterPrivate PlumaSmartCharsetConverterPriv struct _PlumaSmartCharsetConverter { GObject parent; - + PlumaSmartCharsetConverterPrivate *priv; }; diff --git a/pluma/pluma-status-combo-box.c b/pluma/pluma-status-combo-box.c index d5c8eaec..70c800f6 100644 --- a/pluma/pluma-status-combo-box.c +++ b/pluma/pluma-status-combo-box.c @@ -34,7 +34,7 @@ struct _PlumaStatusComboBoxPrivate GtkWidget *label; GtkWidget *item; GtkWidget *arrow; - + GtkWidget *menu; GtkWidget *current_item; }; @@ -47,10 +47,10 @@ enum }; /* Properties */ -enum +enum { PROP_0, - + PROP_LABEL }; @@ -134,7 +134,7 @@ pluma_status_combo_box_changed (PlumaStatusComboBox *combo, GtkMenuItem *item) { const gchar *text; - + text = g_object_get_data (G_OBJECT (item), COMBO_BOX_TEXT_DATA); if (text != NULL) @@ -148,12 +148,12 @@ static void pluma_status_combo_box_class_init (PlumaStatusComboBoxClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - + object_class->finalize = pluma_status_combo_box_finalize; object_class->get_property = pluma_status_combo_box_get_property; object_class->set_property = pluma_status_combo_box_set_property; object_class->constructed = pluma_status_combo_box_constructed; - + klass->changed = pluma_status_combo_box_changed; signals[CHANGED] = @@ -164,7 +164,7 @@ pluma_status_combo_box_class_init (PlumaStatusComboBoxClass *klass) changed), NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GTK_TYPE_MENU_ITEM); - + g_object_class_install_property (object_class, PROP_LABEL, g_param_spec_string ("label", "LABEL", @@ -196,13 +196,13 @@ button_press_event (GtkWidget *widget, /* do something relative to our own height here, maybe we can do better */ max_height = allocation.height * 20; - + if (request.height > max_height) { gtk_widget_set_size_request (combo->priv->menu, -1, max_height); gtk_widget_set_size_request (gtk_widget_get_toplevel (combo->priv->menu), -1, max_height); } - + gtk_menu_popup_at_widget (GTK_MENU (combo->priv->menu), gtk_widget_get_parent (widget), GDK_GRAVITY_NORTH_WEST, @@ -213,7 +213,7 @@ button_press_event (GtkWidget *widget, if (combo->priv->current_item) { - gtk_menu_shell_select_item (GTK_MENU_SHELL (combo->priv->menu), + gtk_menu_shell_select_item (GTK_MENU_SHELL (combo->priv->menu), combo->priv->current_item); } } @@ -239,12 +239,12 @@ static void pluma_status_combo_box_init (PlumaStatusComboBox *self) { self->priv = PLUMA_STATUS_COMBO_BOX_GET_PRIVATE (self); - + gtk_event_box_set_visible_window (GTK_EVENT_BOX (self), TRUE); self->priv->frame = gtk_frame_new (NULL); gtk_widget_show (self->priv->frame); - + self->priv->button = gtk_toggle_button_new (); gtk_widget_set_name (self->priv->button, "pluma-status-combo-button"); gtk_button_set_relief (GTK_BUTTON (self->priv->button), GTK_RELIEF_NONE); @@ -254,40 +254,40 @@ pluma_status_combo_box_init (PlumaStatusComboBox *self) self->priv->hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3); gtk_widget_show (self->priv->hbox); - + gtk_container_add (GTK_CONTAINER (self), self->priv->frame); gtk_container_add (GTK_CONTAINER (self->priv->frame), self->priv->button); gtk_container_add (GTK_CONTAINER (self->priv->button), self->priv->hbox); - + self->priv->label = gtk_label_new (""); gtk_widget_show (self->priv->label); - + gtk_label_set_single_line_mode (GTK_LABEL (self->priv->label), TRUE); gtk_label_set_xalign (GTK_LABEL (self->priv->label), 0.0); - + gtk_box_pack_start (GTK_BOX (self->priv->hbox), self->priv->label, FALSE, TRUE, 0); - + self->priv->item = gtk_label_new (""); gtk_widget_show (self->priv->item); - + gtk_label_set_single_line_mode (GTK_LABEL (self->priv->item), TRUE); gtk_widget_set_halign (self->priv->item, GTK_ALIGN_START); - + gtk_box_pack_start (GTK_BOX (self->priv->hbox), self->priv->item, TRUE, TRUE, 0); self->priv->arrow = gtk_image_new_from_icon_name ("pan-down-symbolic", GTK_ICON_SIZE_BUTTON); gtk_widget_show (self->priv->arrow); gtk_widget_set_halign (self->priv->arrow, GTK_ALIGN_CENTER); gtk_widget_set_valign (self->priv->arrow, GTK_ALIGN_CENTER); - + gtk_box_pack_start (GTK_BOX (self->priv->hbox), self->priv->arrow, FALSE, TRUE, 0); - + self->priv->menu = gtk_menu_new (); g_object_ref_sink (self->priv->menu); - g_signal_connect (self->priv->button, - "button-press-event", - G_CALLBACK (button_press_event), + g_signal_connect (self->priv->button, + "button-press-event", + G_CALLBACK (button_press_event), self); g_signal_connect (self->priv->menu, "deactivate", @@ -313,13 +313,13 @@ pluma_status_combo_box_new (const gchar *label) * @label: (allow-none): */ void -pluma_status_combo_box_set_label (PlumaStatusComboBox *combo, +pluma_status_combo_box_set_label (PlumaStatusComboBox *combo, const gchar *label) { gchar *text; g_return_if_fail (PLUMA_IS_STATUS_COMBO_BOX (combo)); - + text = g_strconcat (" ", label, ": ", NULL); gtk_label_set_markup (GTK_LABEL (combo->priv->label), text); g_free (text); @@ -355,7 +355,7 @@ pluma_status_combo_box_add_item (PlumaStatusComboBox *combo, g_return_if_fail (GTK_IS_MENU_ITEM (item)); gtk_menu_shell_append (GTK_MENU_SHELL (combo->priv->menu), GTK_WIDGET (item)); - + pluma_status_combo_box_set_item_text (combo, item, text); g_signal_connect (item, "activate", G_CALLBACK (item_activated), combo); } @@ -390,12 +390,12 @@ pluma_status_combo_box_get_item_text (PlumaStatusComboBox *combo, GtkMenuItem *item) { const gchar *ret = NULL; - + g_return_val_if_fail (PLUMA_IS_STATUS_COMBO_BOX (combo), NULL); g_return_val_if_fail (GTK_IS_MENU_ITEM (item), NULL); - + ret = g_object_get_data (G_OBJECT (item), COMBO_BOX_TEXT_DATA); - + return ret; } @@ -405,7 +405,7 @@ pluma_status_combo_box_get_item_text (PlumaStatusComboBox *combo, * @item: * @text: (allow-none): */ -void +void pluma_status_combo_box_set_item_text (PlumaStatusComboBox *combo, GtkMenuItem *item, const gchar *text) @@ -413,7 +413,7 @@ pluma_status_combo_box_set_item_text (PlumaStatusComboBox *combo, g_return_if_fail (PLUMA_IS_STATUS_COMBO_BOX (combo)); g_return_if_fail (GTK_IS_MENU_ITEM (item)); - g_object_set_data_full (G_OBJECT (item), + g_object_set_data_full (G_OBJECT (item), COMBO_BOX_TEXT_DATA, g_strdup (text), (GDestroyNotify)g_free); @@ -433,7 +433,7 @@ GtkLabel * pluma_status_combo_box_get_item_label (PlumaStatusComboBox *combo) { g_return_val_if_fail (PLUMA_IS_STATUS_COMBO_BOX (combo), NULL); - + return GTK_LABEL (combo->priv->item); } diff --git a/pluma/pluma-status-combo-box.h b/pluma/pluma-status-combo-box.h index e7355250..34448623 100644 --- a/pluma/pluma-status-combo-box.h +++ b/pluma/pluma-status-combo-box.h @@ -41,13 +41,13 @@ typedef struct _PlumaStatusComboBoxPrivate PlumaStatusComboBoxPrivate; struct _PlumaStatusComboBox { GtkEventBox parent; - + PlumaStatusComboBoxPrivate *priv; }; struct _PlumaStatusComboBoxClass { GtkEventBoxClass parent_class; - + void (*changed) (PlumaStatusComboBox *combo, GtkMenuItem *item); }; diff --git a/pluma/pluma-statusbar.h b/pluma/pluma-statusbar.h index b41233cb..b8e1a7a7 100644 --- a/pluma/pluma-statusbar.h +++ b/pluma/pluma-statusbar.h @@ -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. */ #ifndef PLUMA_STATUSBAR_H diff --git a/pluma/pluma-style-scheme-manager.c b/pluma/pluma-style-scheme-manager.c index 5d898551..f002b88b 100644 --- a/pluma/pluma-style-scheme-manager.c +++ b/pluma/pluma-style-scheme-manager.c @@ -61,7 +61,7 @@ get_pluma_styles_path (void) NULL); g_free (config_dir); } - + return dir; } @@ -76,7 +76,7 @@ add_pluma_styles_path (GtkSourceStyleSchemeManager *mgr) { gtk_source_style_scheme_manager_append_search_path (mgr, dir); g_free (dir); - } + } } GtkSourceStyleSchemeManager * @@ -112,12 +112,12 @@ pluma_style_scheme_manager_list_schemes_sorted (GtkSourceStyleSchemeManager *man g_return_val_if_fail (GTK_SOURCE_IS_STYLE_SCHEME_MANAGER (manager), NULL); scheme_ids = gtk_source_style_scheme_manager_get_scheme_ids (manager); - + while (*scheme_ids != NULL) { GtkSourceStyleScheme *scheme; - scheme = gtk_source_style_scheme_manager_get_scheme (manager, + scheme = gtk_source_style_scheme_manager_get_scheme (manager, *scheme_ids); schemes = g_slist_prepend (schemes, scheme); @@ -364,9 +364,9 @@ _pluma_style_scheme_manager_uninstall_scheme (GtkSourceStyleSchemeManager *manag if (g_unlink (filename) == -1) return FALSE; - + /* Reload the available style schemes */ gtk_source_style_scheme_manager_force_rescan (manager); - - return TRUE; + + return TRUE; } diff --git a/pluma/pluma-style-scheme-manager.h b/pluma/pluma-style-scheme-manager.h index 8b0071a9..12da81b5 100644 --- a/pluma/pluma-style-scheme-manager.h +++ b/pluma/pluma-style-scheme-manager.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. * * $Id: pluma-source-style-manager.h 5598 2007-04-15 13:16:24Z pborelli $ diff --git a/pluma/pluma-tab-label.c b/pluma/pluma-tab-label.c index 5130507c..44adac4a 100644 --- a/pluma/pluma-tab-label.c +++ b/pluma/pluma-tab-label.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. */ @@ -108,7 +108,7 @@ pluma_tab_label_get_property (GObject *object, } static void -close_button_clicked_cb (GtkWidget *widget, +close_button_clicked_cb (GtkWidget *widget, PlumaTabLabel *tab_label) { g_signal_emit (tab_label, signals[CLOSE_CLICKED], 0, NULL); @@ -218,7 +218,7 @@ static void pluma_tab_label_class_init (PlumaTabLabelClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - + object_class->finalize = pluma_tab_label_finalize; object_class->set_property = pluma_tab_label_set_property; object_class->get_property = pluma_tab_label_get_property; @@ -283,7 +283,7 @@ pluma_tab_label_init (PlumaTabLabel *tab_label) "clicked", G_CALLBACK (close_button_clicked_cb), tab_label); - + spinner = gtk_spinner_new (); gtk_box_pack_start (GTK_BOX (hbox), spinner, FALSE, FALSE, 0); tab_label->priv->spinner = spinner; @@ -330,7 +330,7 @@ pluma_tab_label_set_close_button_sensitive (PlumaTabLabel *tab_label, state = pluma_tab_get_state (tab_label->priv->tab); - gtk_widget_set_sensitive (tab_label->priv->close_button, + gtk_widget_set_sensitive (tab_label->priv->close_button, tab_label->priv->close_button_sensitive && (state != PLUMA_TAB_STATE_CLOSING) && (state != PLUMA_TAB_STATE_SAVING) && diff --git a/pluma/pluma-tab-label.h b/pluma/pluma-tab-label.h index e29fad23..2ad835fa 100644 --- a/pluma/pluma-tab-label.h +++ b/pluma/pluma-tab-label.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. */ @@ -42,7 +42,7 @@ typedef struct _PlumaTabLabelPrivate PlumaTabLabelPrivate; struct _PlumaTabLabel { GtkBox parent; - + PlumaTabLabelPrivate *priv; }; diff --git a/pluma/pluma-tab.c b/pluma/pluma-tab.c index d9b8a165..d98fce29 100644 --- a/pluma/pluma-tab.c +++ b/pluma/pluma-tab.c @@ -2,7 +2,7 @@ * pluma-tab.c * 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. */ #ifdef HAVE_CONFIG_H @@ -52,7 +52,7 @@ struct _PlumaTabPrivate { PlumaTabState state; - + GtkWidget *view; GtkWidget *view_scrolled_window; @@ -67,7 +67,7 @@ struct _PlumaTabPrivate /* tmp data for loading */ gint tmp_line_pos; const PlumaEncoding *tmp_encoding; - + GTimer *timer; guint times_called; @@ -75,7 +75,7 @@ struct _PlumaTabPrivate gint auto_save_interval; guint auto_save_timeout; - + gint not_editable : 1; gint auto_save : 1; @@ -107,7 +107,7 @@ install_auto_save_timeout (PlumaTab *tab) g_return_if_fail (tab->priv->auto_save_timeout <= 0); g_return_if_fail (tab->priv->auto_save); g_return_if_fail (tab->priv->auto_save_interval > 0); - + g_return_if_fail (tab->priv->state != PLUMA_TAB_STATE_LOADING); g_return_if_fail (tab->priv->state != PLUMA_TAB_STATE_SAVING); g_return_if_fail (tab->priv->state != PLUMA_TAB_STATE_REVERTING); @@ -130,7 +130,7 @@ install_auto_save_timeout_if_needed (PlumaTab *tab) PlumaDocument *doc; pluma_debug (DEBUG_TAB); - + g_return_val_if_fail (tab->priv->auto_save_timeout <= 0, FALSE); g_return_val_if_fail ((tab->priv->state == PLUMA_TAB_STATE_NORMAL) || (tab->priv->state == PLUMA_TAB_STATE_SHOWING_PRINT_PREVIEW) || @@ -141,15 +141,15 @@ install_auto_save_timeout_if_needed (PlumaTab *tab) doc = pluma_tab_get_document (tab); - if (tab->priv->auto_save && + if (tab->priv->auto_save && !pluma_document_is_untitled (doc) && !pluma_document_get_readonly (doc)) - { + { install_auto_save_timeout (tab); - + return TRUE; } - + return FALSE; } @@ -159,9 +159,9 @@ remove_auto_save_timeout (PlumaTab *tab) pluma_debug (DEBUG_TAB); /* FIXME: check sugli stati */ - + g_return_if_fail (tab->priv->auto_save_timeout > 0); - + g_source_remove (tab->priv->auto_save_timeout); tab->priv->auto_save_timeout = 0; } @@ -183,7 +183,7 @@ pluma_tab_get_property (GObject *object, case PROP_STATE: g_value_set_enum (value, pluma_tab_get_state (tab)); - break; + break; case PROP_AUTO_SAVE: g_value_set_boolean (value, pluma_tab_get_auto_save_enabled (tab)); @@ -194,7 +194,7 @@ pluma_tab_get_property (GObject *object, break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; + break; } } @@ -218,7 +218,7 @@ pluma_tab_set_property (GObject *object, break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; + break; } } @@ -244,7 +244,7 @@ pluma_tab_finalize (GObject *object) G_OBJECT_CLASS (pluma_tab_parent_class)->finalize (object); } -static void +static void pluma_tab_class_init (PlumaTabClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); @@ -252,7 +252,7 @@ pluma_tab_class_init (PlumaTabClass *klass) object_class->finalize = pluma_tab_finalize; object_class->get_property = pluma_tab_get_property; object_class->set_property = pluma_tab_set_property; - + g_object_class_install_property (object_class, PROP_NAME, g_param_spec_string ("name", @@ -307,7 +307,7 @@ PlumaTabState pluma_tab_get_state (PlumaTab *tab) { g_return_val_if_fail (PLUMA_IS_TAB (tab), PLUMA_TAB_STATE_NORMAL); - + return tab->priv->state; } @@ -411,27 +411,27 @@ pluma_tab_set_state (PlumaTab *tab, set_cursor_according_to_state (GTK_TEXT_VIEW (tab->priv->view), state); - g_object_notify (G_OBJECT (tab), "state"); + g_object_notify (G_OBJECT (tab), "state"); } -static void +static void document_uri_notify_handler (PlumaDocument *document, GParamSpec *pspec, PlumaTab *tab) { pluma_debug (DEBUG_TAB); - + /* Notify the change in the URI */ g_object_notify (G_OBJECT (tab), "name"); } -static void +static void document_shortname_notify_handler (PlumaDocument *document, GParamSpec *pspec, PlumaTab *tab) { pluma_debug (DEBUG_TAB); - + /* Notify the change in the shortname */ g_object_notify (G_OBJECT (tab), "name"); } @@ -462,9 +462,9 @@ set_message_area (PlumaTab *tab, tab->priv->message_area, FALSE, FALSE, - 0); + 0); - g_object_add_weak_pointer (G_OBJECT (tab->priv->message_area), + g_object_add_weak_pointer (G_OBJECT (tab->priv->message_area), (gpointer *)&tab->priv->message_area); } @@ -478,7 +478,7 @@ remove_tab (PlumaTab *tab) pluma_notebook_remove_tab (notebook, tab); } -static void +static void io_loading_error_message_area_response (GtkWidget *message_area, gint response_id, PlumaTab *tab) @@ -538,26 +538,26 @@ io_loading_error_message_area_response (GtkWidget *message_area, g_free (uri); } -static void +static void file_already_open_warning_message_area_response (GtkWidget *message_area, gint response_id, PlumaTab *tab) { PlumaView *view; - + view = pluma_tab_get_view (tab); - + if (response_id == GTK_RESPONSE_YES) { tab->priv->not_editable = FALSE; - + gtk_text_view_set_editable (GTK_TEXT_VIEW (view), TRUE); } gtk_widget_destroy (message_area); - gtk_widget_grab_focus (GTK_WIDGET (view)); + gtk_widget_grab_focus (GTK_WIDGET (view)); } static void @@ -566,10 +566,10 @@ load_cancelled (GtkWidget *area, PlumaTab *tab) { g_return_if_fail (PLUMA_IS_PROGRESS_MESSAGE_AREA (tab->priv->message_area)); - + g_object_ref (tab); pluma_document_load_cancel (pluma_tab_get_document (tab)); - g_object_unref (tab); + g_object_unref (tab); } static gboolean @@ -580,13 +580,13 @@ scroll_to_cursor (PlumaTab *tab) return FALSE; } -static void +static void unrecoverable_reverting_error_message_area_response (GtkWidget *message_area, gint response_id, PlumaTab *tab) { PlumaView *view; - + pluma_tab_set_state (tab, PLUMA_TAB_STATE_NORMAL); @@ -595,8 +595,8 @@ unrecoverable_reverting_error_message_area_response (GtkWidget *message_a view = pluma_tab_get_view (tab); gtk_widget_grab_focus (GTK_WIDGET (view)); - - install_auto_save_timeout_if_needed (tab); + + install_auto_save_timeout_if_needed (tab); } #define MAX_MSG_LENGTH 100 @@ -617,7 +617,7 @@ show_loading_message_area (PlumaTab *tab) return; pluma_debug (DEBUG_TAB); - + doc = pluma_tab_get_document (tab); g_return_if_fail (doc != NULL); @@ -653,7 +653,7 @@ show_loading_message_area (PlumaTab *tab) * we have a title long 99 + 20, but I think it's a rare enough * case to be acceptable. It's justa darn title afterall :) */ - dirname = pluma_utils_str_middle_truncate (str, + dirname = pluma_utils_str_middle_truncate (str, MAX (20, MAX_MSG_LENGTH - len)); g_free (str); } @@ -676,10 +676,10 @@ show_loading_message_area (PlumaTab *tab) } else { - msg = g_strdup_printf (_("Reverting %s"), + msg = g_strdup_printf (_("Reverting %s"), name_markup); } - + area = pluma_progress_message_area_new ("document-revert", msg, TRUE); @@ -699,7 +699,7 @@ show_loading_message_area (PlumaTab *tab) } else { - msg = g_strdup_printf (_("Loading %s"), + msg = g_strdup_printf (_("Loading %s"), name_markup); } @@ -712,7 +712,7 @@ show_loading_message_area (PlumaTab *tab) "response", G_CALLBACK (load_cancelled), tab); - + gtk_widget_show (area); set_message_area (tab, area); @@ -737,12 +737,12 @@ show_saving_message_area (PlumaTab *tab) gint len; g_return_if_fail (tab->priv->tmp_save_uri != NULL); - + if (tab->priv->message_area != NULL) return; - + pluma_debug (DEBUG_TAB); - + doc = pluma_tab_get_document (tab); g_return_if_fail (doc != NULL); @@ -755,7 +755,7 @@ show_saving_message_area (PlumaTab *tab) */ if (len > MAX_MSG_LENGTH) { - from = pluma_utils_str_middle_truncate (short_name, + from = pluma_utils_str_middle_truncate (short_name, MAX_MSG_LENGTH); g_free (short_name); } @@ -767,10 +767,10 @@ show_saving_message_area (PlumaTab *tab) to = pluma_utils_uri_for_display (tab->priv->tmp_save_uri); - str = pluma_utils_str_middle_truncate (to, + str = pluma_utils_str_middle_truncate (to, MAX (20, MAX_MSG_LENGTH - len)); g_free (to); - + to = str; } @@ -817,12 +817,12 @@ message_area_set_progress (PlumaTab *tab, pluma_debug_message (DEBUG_TAB, "%" G_GUINT64_FORMAT "/%" G_GUINT64_FORMAT, size, total_size); g_return_if_fail (PLUMA_IS_PROGRESS_MESSAGE_AREA (tab->priv->message_area)); - + if (total_size == 0) { if (size != 0) pluma_progress_message_area_pulse ( - PLUMA_PROGRESS_MESSAGE_AREA (tab->priv->message_area)); + PLUMA_PROGRESS_MESSAGE_AREA (tab->priv->message_area)); else pluma_progress_message_area_set_fraction ( PLUMA_PROGRESS_MESSAGE_AREA (tab->priv->message_area), @@ -836,7 +836,7 @@ message_area_set_progress (PlumaTab *tab, pluma_progress_message_area_set_fraction ( PLUMA_PROGRESS_MESSAGE_AREA (tab->priv->message_area), - frac); + frac); } } @@ -919,7 +919,7 @@ document_loaded (PlumaDocument *document, error->code == G_IO_ERROR_CANCELLED) { /* remove the tab, but in an idle handler, since - * we are in the handler of doc loaded and we + * we are in the handler of doc loaded and we * don't want doc and tab to be finalized now. */ g_idle_add ((GSourceFunc) remove_tab_idle, tab); @@ -943,7 +943,7 @@ document_loaded (PlumaDocument *document, else { g_return_if_fail (tab->priv->state == PLUMA_TAB_STATE_REVERTING_ERROR); - + emsg = pluma_unrecoverable_reverting_error_message_area_new (uri, error); @@ -1019,7 +1019,7 @@ document_loaded (PlumaDocument *document, for (l = all_documents; l != NULL; l = g_list_next (l)) { PlumaDocument *d = PLUMA_DOCUMENT (l->data); - + if (d != document) { GFile *loc; @@ -1050,7 +1050,7 @@ document_loaded (PlumaDocument *document, g_object_unref (loc); break; } - + if (loc != NULL) g_object_unref (loc); } @@ -1059,7 +1059,7 @@ document_loaded (PlumaDocument *document, g_list_free (all_documents); pluma_tab_set_state (tab, PLUMA_TAB_STATE_NORMAL); - + install_auto_save_timeout_if_needed (tab); tab->priv->ask_if_externally_modified = TRUE; @@ -1115,32 +1115,32 @@ end_saving (PlumaTab *tab) g_free (tab->priv->tmp_save_uri); tab->priv->tmp_save_uri = NULL; tab->priv->tmp_encoding = NULL; - + install_auto_save_timeout_if_needed (tab); } -static void +static void unrecoverable_saving_error_message_area_response (GtkWidget *message_area, gint response_id, PlumaTab *tab) { PlumaView *view; - + if (tab->priv->print_preview != NULL) pluma_tab_set_state (tab, PLUMA_TAB_STATE_SHOWING_PRINT_PREVIEW); else pluma_tab_set_state (tab, PLUMA_TAB_STATE_NORMAL); end_saving (tab); - + set_message_area (tab, NULL); view = pluma_tab_get_view (tab); - gtk_widget_grab_focus (GTK_WIDGET (view)); + gtk_widget_grab_focus (GTK_WIDGET (view)); } -static void +static void no_backup_error_message_area_response (GtkWidget *message_area, gint response_id, PlumaTab *tab) @@ -1163,7 +1163,7 @@ no_backup_error_message_area_response (GtkWidget *message_area, tab->priv->save_flags |= PLUMA_DOCUMENT_SAVE_IGNORE_BACKUP; g_return_if_fail (tab->priv->auto_save_timeout <= 0); - + /* Force saving */ pluma_document_save (doc, tab->priv->save_flags); } @@ -1186,7 +1186,7 @@ externally_modified_error_message_area_response (GtkWidget *message_area, doc = pluma_tab_get_document (tab); g_return_if_fail (PLUMA_IS_DOCUMENT (doc)); - + set_message_area (tab, NULL); g_return_if_fail (tab->priv->tmp_save_uri != NULL); @@ -1195,21 +1195,21 @@ externally_modified_error_message_area_response (GtkWidget *message_area, pluma_tab_set_state (tab, PLUMA_TAB_STATE_SAVING); g_return_if_fail (tab->priv->auto_save_timeout <= 0); - + /* ignore mtime should not be persisted in save flags across saves */ /* Force saving */ pluma_document_save (doc, tab->priv->save_flags | PLUMA_DOCUMENT_SAVE_IGNORE_MTIME); } else - { + { unrecoverable_saving_error_message_area_response (message_area, response_id, tab); } } -static void +static void recoverable_saving_error_message_area_response (GtkWidget *message_area, gint response_id, PlumaTab *tab) @@ -1218,11 +1218,11 @@ recoverable_saving_error_message_area_response (GtkWidget *message_area, doc = pluma_tab_get_document (tab); g_return_if_fail (PLUMA_IS_DOCUMENT (doc)); - + if (response_id == GTK_RESPONSE_OK) { const PlumaEncoding *encoding; - + encoding = pluma_conversion_error_message_area_get_encoding ( GTK_WIDGET (message_area)); @@ -1231,22 +1231,22 @@ recoverable_saving_error_message_area_response (GtkWidget *message_area, set_message_area (tab, NULL); g_return_if_fail (tab->priv->tmp_save_uri != NULL); - + pluma_tab_set_state (tab, PLUMA_TAB_STATE_SAVING); - + tab->priv->tmp_encoding = encoding; pluma_debug_message (DEBUG_TAB, "Force saving with URI '%s'", tab->priv->tmp_save_uri); - + g_return_if_fail (tab->priv->auto_save_timeout <= 0); - + pluma_document_save_as (doc, tab->priv->tmp_save_uri, tab->priv->tmp_encoding, tab->priv->save_flags); } else - { + { unrecoverable_saving_error_message_area_response (message_area, response_id, tab); @@ -1263,25 +1263,25 @@ document_saved (PlumaDocument *document, g_return_if_fail (tab->priv->state == PLUMA_TAB_STATE_SAVING); g_return_if_fail (tab->priv->tmp_save_uri != NULL); - g_return_if_fail (tab->priv->tmp_encoding != NULL); + g_return_if_fail (tab->priv->tmp_encoding != NULL); g_return_if_fail (tab->priv->auto_save_timeout <= 0); - + g_timer_destroy (tab->priv->timer); tab->priv->timer = NULL; tab->priv->times_called = 0; - + set_message_area (tab, NULL); - + if (error != NULL) { pluma_tab_set_state (tab, PLUMA_TAB_STATE_SAVING_ERROR); - + if (error->domain == PLUMA_DOCUMENT_ERROR && error->code == PLUMA_DOCUMENT_ERROR_EXTERNALLY_MODIFIED) { /* This error is recoverable */ emsg = pluma_externally_modified_saving_error_message_area_new ( - tab->priv->tmp_save_uri, + tab->priv->tmp_save_uri, error); g_return_if_fail (emsg != NULL); @@ -1299,7 +1299,7 @@ document_saved (PlumaDocument *document, { /* This error is recoverable */ emsg = pluma_no_backup_saving_error_message_area_new ( - tab->priv->tmp_save_uri, + tab->priv->tmp_save_uri, error); g_return_if_fail (emsg != NULL); @@ -1319,10 +1319,10 @@ document_saved (PlumaDocument *document, _pluma_recent_remove (PLUMA_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tab))), tab->priv->tmp_save_uri); - emsg = pluma_unrecoverable_saving_error_message_area_new (tab->priv->tmp_save_uri, + emsg = pluma_unrecoverable_saving_error_message_area_new (tab->priv->tmp_save_uri, error); g_return_if_fail (emsg != NULL); - + set_message_area (tab, emsg); g_signal_connect (emsg, @@ -1369,12 +1369,12 @@ document_saved (PlumaDocument *document, pluma_tab_set_state (tab, PLUMA_TAB_STATE_NORMAL); tab->priv->ask_if_externally_modified = TRUE; - + end_saving (tab); } } -static void +static void externally_modified_notification_message_area_response (GtkWidget *message_area, gint response_id, PlumaTab *tab) @@ -1500,7 +1500,7 @@ pluma_tab_init (PlumaTab *tab) gtk_orientable_set_orientation (GTK_ORIENTABLE (tab), GTK_ORIENTATION_VERTICAL); - + /* Create the scrolled window */ sw = gtk_scrolled_window_new (NULL, NULL); tab->priv->view_scrolled_window = sw; @@ -1535,7 +1535,7 @@ pluma_tab_init (PlumaTab *tab) gtk_box_pack_end (GTK_BOX (tab), sw, TRUE, TRUE, 0); gtk_container_add (GTK_CONTAINER (sw), tab->priv->view); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), - GTK_SHADOW_IN); + GTK_SHADOW_IN); gtk_widget_show (sw); g_signal_connect (doc, @@ -1584,12 +1584,12 @@ _pluma_tab_new (void) return GTK_WIDGET (g_object_new (PLUMA_TYPE_TAB, NULL)); } -/* Whether create is TRUE, creates a new empty document if location does +/* Whether create is TRUE, creates a new empty document if location does not refer to an existing file */ GtkWidget * _pluma_tab_new_from_uri (const gchar *uri, const PlumaEncoding *encoding, - gint line_pos, + gint line_pos, gboolean create) { PlumaTab *tab; @@ -1605,7 +1605,7 @@ _pluma_tab_new_from_uri (const gchar *uri, create); return GTK_WIDGET (tab); -} +} /** * pluma_tab_get_view: @@ -1658,23 +1658,23 @@ _pluma_tab_get_name (PlumaTab *tab) if (gtk_text_buffer_get_modified (GTK_TEXT_BUFFER (doc))) { tab_name = g_strdup_printf ("*%s", docname); - } - else + } + else { - #if 0 - if (pluma_document_get_readonly (doc)) + #if 0 + if (pluma_document_get_readonly (doc)) { - tab_name = g_strdup_printf ("%s [%s]", docname, + tab_name = g_strdup_printf ("%s [%s]", docname, /*Read only*/ _("RO")); - } - else + } + else { tab_name = g_strdup_printf ("%s", docname); } #endif tab_name = g_strdup (docname); } - + g_free (docname); g_free (name); @@ -1707,7 +1707,7 @@ _pluma_tab_get_tooltips (PlumaTab *tab) gchar *content_type; gchar *mime_type; gchar *content_description; - gchar *content_full_description; + gchar *content_full_description; gchar *encoding; const PlumaEncoding *enc; @@ -1719,12 +1719,12 @@ _pluma_tab_get_tooltips (PlumaTab *tab) case PLUMA_TAB_STATE_REVERTING_ERROR: tip = g_strdup_printf (_("Error reverting file %s"), ruri_markup); - break; + break; case PLUMA_TAB_STATE_SAVING_ERROR: tip = g_strdup_printf (_("Error saving file %s"), ruri_markup); - break; + break; default: content_type = pluma_document_get_content_type (doc); mime_type = pluma_document_get_mime_type (doc); @@ -1733,7 +1733,7 @@ _pluma_tab_get_tooltips (PlumaTab *tab) if (content_description == NULL) content_full_description = g_strdup (mime_type); else - content_full_description = g_strdup_printf ("%s (%s)", + content_full_description = g_strdup_printf ("%s (%s)", content_description, mime_type); g_free (content_type); @@ -1760,9 +1760,9 @@ _pluma_tab_get_tooltips (PlumaTab *tab) break; } - g_free (ruri); + g_free (ruri); g_free (ruri_markup); - + return tip; } @@ -1772,28 +1772,28 @@ resize_icon (GdkPixbuf *pixbuf, { gint width, height; - width = gdk_pixbuf_get_width (pixbuf); + width = gdk_pixbuf_get_width (pixbuf); height = gdk_pixbuf_get_height (pixbuf); /* if the icon is larger than the nominal size, scale down */ - if (MAX (width, height) > size) + if (MAX (width, height) > size) { GdkPixbuf *scaled_pixbuf; - - if (width > height) + + if (width > height) { height = height * size / width; width = size; - } - else + } + else { width = width * size / height; height = size; } - - scaled_pixbuf = gdk_pixbuf_scale_simple (pixbuf, - width, - height, + + scaled_pixbuf = gdk_pixbuf_scale_simple (pixbuf, + width, + height, GDK_INTERP_BILINEAR); g_object_unref (pixbuf); pixbuf = scaled_pixbuf; @@ -1803,21 +1803,21 @@ resize_icon (GdkPixbuf *pixbuf, } static GdkPixbuf * -get_stock_icon (GtkIconTheme *theme, +get_stock_icon (GtkIconTheme *theme, const gchar *icon_name, gint size) { GdkPixbuf *pixbuf; - + pixbuf = gtk_icon_theme_load_icon (theme, icon_name, size, 0, NULL); if (pixbuf == NULL) return NULL; - + return resize_icon (pixbuf, size); } static GdkPixbuf * -get_icon (GtkIconTheme *theme, +get_icon (GtkIconTheme *theme, GFile *location, gint size) { @@ -1830,10 +1830,10 @@ get_icon (GtkIconTheme *theme, return get_stock_icon (theme, "text-x-generic", size); /* FIXME: Doing a sync stat is bad, this should be fixed */ - info = g_file_query_info (location, - G_FILE_ATTRIBUTE_STANDARD_ICON, - G_FILE_QUERY_INFO_NONE, - NULL, + info = g_file_query_info (location, + G_FILE_ATTRIBUTE_STANDARD_ICON, + G_FILE_QUERY_INFO_NONE, + NULL, NULL); if (info == NULL) return get_stock_icon (theme, "text-x-generic", size); @@ -1847,17 +1847,17 @@ get_icon (GtkIconTheme *theme, } icon_info = gtk_icon_theme_lookup_by_gicon (theme, gicon, size, 0); - g_object_unref (info); - + g_object_unref (info); + if (icon_info == NULL) return get_stock_icon (theme, "text-x-generic", size); - + pixbuf = gtk_icon_info_load_icon (icon_info, NULL); g_object_unref (icon_info); - + if (pixbuf == NULL) return get_stock_icon (theme, "text-x-generic", size); - + return resize_icon (pixbuf, size); } @@ -1883,33 +1883,33 @@ _pluma_tab_get_icon (PlumaTab *tab) switch (tab->priv->state) { case PLUMA_TAB_STATE_LOADING: - pixbuf = get_stock_icon (theme, - "document-open", + pixbuf = get_stock_icon (theme, + "document-open", icon_size); break; case PLUMA_TAB_STATE_REVERTING: - pixbuf = get_stock_icon (theme, - "document-revert", - icon_size); + pixbuf = get_stock_icon (theme, + "document-revert", + icon_size); break; case PLUMA_TAB_STATE_SAVING: - pixbuf = get_stock_icon (theme, - "document-save", + pixbuf = get_stock_icon (theme, + "document-save", icon_size); break; case PLUMA_TAB_STATE_PRINTING: - pixbuf = get_stock_icon (theme, - "document-print", + pixbuf = get_stock_icon (theme, + "document-print", icon_size); break; case PLUMA_TAB_STATE_PRINT_PREVIEWING: - case PLUMA_TAB_STATE_SHOWING_PRINT_PREVIEW: - pixbuf = get_stock_icon (theme, - "gtk-print-preview", + case PLUMA_TAB_STATE_SHOWING_PRINT_PREVIEW: + pixbuf = get_stock_icon (theme, + "gtk-print-preview", icon_size); break; @@ -1917,8 +1917,8 @@ _pluma_tab_get_icon (PlumaTab *tab) case PLUMA_TAB_STATE_REVERTING_ERROR: case PLUMA_TAB_STATE_SAVING_ERROR: case PLUMA_TAB_STATE_GENERIC_ERROR: - pixbuf = get_stock_icon (theme, - "dialog-error", + pixbuf = get_stock_icon (theme, + "dialog-error", icon_size); break; @@ -1958,11 +1958,11 @@ PlumaTab * pluma_tab_get_from_document (PlumaDocument *doc) { gpointer res; - + g_return_val_if_fail (PLUMA_IS_DOCUMENT (doc), NULL); - + res = g_object_get_data (G_OBJECT (doc), PLUMA_TAB_KEY); - + return (res != NULL) ? PLUMA_TAB (res) : NULL; } @@ -2070,11 +2070,11 @@ _pluma_tab_save (PlumaTab *tab) /* uri used in error messages, will be freed in document_saved */ tab->priv->tmp_save_uri = pluma_document_get_uri (doc); - tab->priv->tmp_encoding = pluma_document_get_encoding (doc); + tab->priv->tmp_encoding = pluma_document_get_encoding (doc); if (tab->priv->auto_save_timeout > 0) remove_auto_save_timeout (tab); - + pluma_document_save (doc, save_flags); } @@ -2084,12 +2084,12 @@ pluma_tab_auto_save (PlumaTab *tab) PlumaDocument *doc; pluma_debug (DEBUG_TAB); - + g_return_val_if_fail (tab->priv->tmp_save_uri == NULL, FALSE); g_return_val_if_fail (tab->priv->tmp_encoding == NULL, FALSE); - + doc = pluma_tab_get_document (tab); - + g_return_val_if_fail (!pluma_document_is_untitled (doc), FALSE); g_return_val_if_fail (!pluma_document_get_readonly (doc), FALSE); @@ -2103,7 +2103,7 @@ pluma_tab_auto_save (PlumaTab *tab) return TRUE; } - + if ((tab->priv->state != PLUMA_TAB_STATE_NORMAL) && (tab->priv->state != PLUMA_TAB_STATE_SHOWING_PRINT_PREVIEW)) { @@ -2122,12 +2122,12 @@ pluma_tab_auto_save (PlumaTab *tab) /* Returns FALSE so the old timeout is "destroyed" */ return FALSE; } - + pluma_tab_set_state (tab, PLUMA_TAB_STATE_SAVING); /* uri used in error messages, will be freed in document_saved */ tab->priv->tmp_save_uri = pluma_document_get_uri (doc); - tab->priv->tmp_encoding = pluma_document_get_encoding (doc); + tab->priv->tmp_encoding = pluma_document_get_encoding (doc); /* Set auto_save_timeout to 0 since the timeout is going to be destroyed */ tab->priv->auto_save_timeout = 0; @@ -2137,9 +2137,9 @@ pluma_tab_auto_save (PlumaTab *tab) error happens while saving, the last backup is not preserved since the user expressed his willing of saving the file */ pluma_document_save (doc, tab->priv->save_flags | PLUMA_DOCUMENT_SAVE_PRESERVE_BACKUP); - + pluma_debug_message (DEBUG_TAB, "Done"); - + /* Returns FALSE so the old timeout is "destroyed" */ return FALSE; } @@ -2260,7 +2260,7 @@ printing_cb (PlumaPrintJob *job, PlumaPrintJobStatus status, PlumaTab *tab) { - g_return_if_fail (PLUMA_IS_PROGRESS_MESSAGE_AREA (tab->priv->message_area)); + g_return_if_fail (PLUMA_IS_PROGRESS_MESSAGE_AREA (tab->priv->message_area)); gtk_widget_show (tab->priv->message_area); @@ -2383,9 +2383,9 @@ print_preview_destroyed (GtkWidget *preview, * preview. In this case let us continue whithout changing * the state and show the document. See bug #352658 */ gtk_widget_show (tab->priv->view_scrolled_window); - + g_return_if_fail (tab->priv->state == PLUMA_TAB_STATE_PRINTING); - } + } } #endif @@ -2412,7 +2412,7 @@ show_preview_cb (PlumaPrintJob *job, g_signal_connect (tab->priv->print_preview, "destroy", G_CALLBACK (print_preview_destroyed), - tab); + tab); */ pluma_tab_set_state (tab, PLUMA_TAB_STATE_SHOWING_PRINT_PREVIEW); } @@ -2425,7 +2425,7 @@ set_print_preview (PlumaTab *tab, { if (tab->priv->print_preview == print_preview) return; - + if (tab->priv->print_preview != NULL) gtk_widget_destroy (tab->priv->print_preview); @@ -2435,7 +2435,7 @@ set_print_preview (PlumaTab *tab, tab->priv->print_preview, TRUE, TRUE, - 0); + 0); gtk_widget_grab_focus (tab->priv->print_preview); @@ -2453,17 +2453,17 @@ preview_finished_cb (GtkSourcePrintJob *pjob, PlumaTab *tab) g_return_if_fail (PLUMA_IS_PROGRESS_MESSAGE_AREA (tab->priv->message_area)); set_message_area (tab, NULL); /* destroy the message area */ - + gjob = gtk_source_print_job_get_print_job (pjob); - preview = pluma_print_job_preview_new (gjob); + preview = pluma_print_job_preview_new (gjob); g_object_unref (gjob); - + set_print_preview (tab, preview); - + gtk_widget_show (preview); g_object_unref (pjob); - + pluma_tab_set_state (tab, PLUMA_TAB_STATE_SHOWING_PRINT_PREVIEW); } @@ -2500,7 +2500,7 @@ show_printing_message_area (PlumaTab *tab, gboolean preview) "response", G_CALLBACK (print_cancelled), tab); - + set_message_area (tab, area); } @@ -2523,7 +2523,7 @@ pluma_tab_print_or_print_preview (PlumaTab *tab, is_preview = (print_action == GTK_PRINT_OPERATION_ACTION_PREVIEW); tab->priv->print_job = pluma_print_job_new (view); - g_object_add_weak_pointer (G_OBJECT (tab->priv->print_job), + g_object_add_weak_pointer (G_OBJECT (tab->priv->print_job), (gpointer *) &tab->priv->print_job); show_printing_message_area (tab, is_preview); @@ -2567,7 +2567,7 @@ pluma_tab_print_or_print_preview (PlumaTab *tab, } } -void +void _pluma_tab_print (PlumaTab *tab) { g_return_if_fail (PLUMA_IS_TAB (tab)); @@ -2593,12 +2593,12 @@ _pluma_tab_print_preview (PlumaTab *tab) GTK_PRINT_OPERATION_ACTION_PREVIEW); } -void +void _pluma_tab_mark_for_closing (PlumaTab *tab) { g_return_if_fail (PLUMA_IS_TAB (tab)); g_return_if_fail (tab->priv->state == PLUMA_TAB_STATE_NORMAL); - + pluma_tab_set_state (tab, PLUMA_TAB_STATE_CLOSING); } @@ -2629,7 +2629,7 @@ _pluma_tab_can_close (PlumaTab *tab) /* Do not close tab with saving errors */ if (ts == PLUMA_TAB_STATE_SAVING_ERROR) return FALSE; - + /* TODO: we need to save the file also if it has been externally modified - Paolo (Oct 10, 2005) */ @@ -2640,9 +2640,9 @@ _pluma_tab_can_close (PlumaTab *tab) /** * pluma_tab_get_auto_save_enabled: * @tab: a #PlumaTab - * + * * Gets the current state for the autosave feature - * + * * Return value: %TRUE if the autosave is enabled, else %FALSE **/ gboolean @@ -2659,17 +2659,17 @@ pluma_tab_get_auto_save_enabled (PlumaTab *tab) * pluma_tab_set_auto_save_enabled: * @tab: a #PlumaTab * @enable: enable (%TRUE) or disable (%FALSE) auto save - * + * * Enables or disables the autosave feature. It does not install an * autosave timeout if the document is new or is read-only **/ void -pluma_tab_set_auto_save_enabled (PlumaTab *tab, +pluma_tab_set_auto_save_enabled (PlumaTab *tab, gboolean enable) { PlumaDocument *doc = NULL; PlumaLockdownMask lockdown; - + pluma_debug (DEBUG_TAB); g_return_if_fail (PLUMA_IS_TAB (tab)); @@ -2678,7 +2678,7 @@ pluma_tab_set_auto_save_enabled (PlumaTab *tab, lockdown = pluma_app_get_lockdown (pluma_app_get_default()); if (lockdown & PLUMA_LOCKDOWN_SAVE_TO_DISK) enable = FALSE; - + doc = pluma_tab_get_document (tab); if (tab->priv->auto_save == enable) @@ -2686,7 +2686,7 @@ pluma_tab_set_auto_save_enabled (PlumaTab *tab, tab->priv->auto_save = enable; - if (enable && + if (enable && (tab->priv->auto_save_timeout <=0) && !pluma_document_is_untitled (doc) && !pluma_document_get_readonly (doc)) @@ -2702,30 +2702,30 @@ pluma_tab_set_auto_save_enabled (PlumaTab *tab, } /* else: the timeout will be installed when loading/saving/reverting will terminate */ - + return; } - + if (!enable && (tab->priv->auto_save_timeout > 0)) { remove_auto_save_timeout (tab); - - return; - } - g_return_if_fail ((!enable && (tab->priv->auto_save_timeout <= 0)) || - pluma_document_is_untitled (doc) || pluma_document_get_readonly (doc)); + return; + } + + g_return_if_fail ((!enable && (tab->priv->auto_save_timeout <= 0)) || + pluma_document_is_untitled (doc) || pluma_document_get_readonly (doc)); } /** * pluma_tab_get_auto_save_interval: * @tab: a #PlumaTab - * + * * Gets the current interval for the autosaves - * + * * Return value: the value of the autosave **/ -gint +gint pluma_tab_get_auto_save_interval (PlumaTab *tab) { pluma_debug (DEBUG_TAB); @@ -2739,20 +2739,20 @@ pluma_tab_get_auto_save_interval (PlumaTab *tab) * pluma_tab_set_auto_save_interval: * @tab: a #PlumaTab * @interval: the new interval - * + * * Sets the interval for the autosave feature. It does nothing if the * interval is the same as the one already present. It removes the old * interval timeout and adds a new one with the autosave passed as * argument. **/ -void -pluma_tab_set_auto_save_interval (PlumaTab *tab, +void +pluma_tab_set_auto_save_interval (PlumaTab *tab, gint interval) { PlumaDocument *doc = NULL; - + pluma_debug (DEBUG_TAB); - + g_return_if_fail (PLUMA_IS_TAB (tab)); doc = pluma_tab_get_document(tab); @@ -2764,7 +2764,7 @@ pluma_tab_set_auto_save_interval (PlumaTab *tab, return; tab->priv->auto_save_interval = interval; - + if (!tab->priv->auto_save) return; diff --git a/pluma/pluma-tab.h b/pluma/pluma-tab.h index 55c820b1..b648a078 100644 --- a/pluma/pluma-tab.h +++ b/pluma/pluma-tab.h @@ -2,7 +2,7 @@ * pluma-tab.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$ */ @@ -43,13 +43,13 @@ typedef enum PLUMA_TAB_STATE_NORMAL = 0, PLUMA_TAB_STATE_LOADING, PLUMA_TAB_STATE_REVERTING, - PLUMA_TAB_STATE_SAVING, + PLUMA_TAB_STATE_SAVING, PLUMA_TAB_STATE_PRINTING, PLUMA_TAB_STATE_PRINT_PREVIEWING, PLUMA_TAB_STATE_SHOWING_PRINT_PREVIEW, PLUMA_TAB_STATE_GENERIC_NOT_EDITABLE, PLUMA_TAB_STATE_LOADING_ERROR, - PLUMA_TAB_STATE_REVERTING_ERROR, + PLUMA_TAB_STATE_REVERTING_ERROR, PLUMA_TAB_STATE_SAVING_ERROR, PLUMA_TAB_STATE_GENERIC_ERROR, PLUMA_TAB_STATE_CLOSING, @@ -75,7 +75,7 @@ typedef struct _PlumaTabPrivate PlumaTabPrivate; */ typedef struct _PlumaTab PlumaTab; -struct _PlumaTab +struct _PlumaTab { GtkBox vbox; @@ -88,7 +88,7 @@ struct _PlumaTab */ typedef struct _PlumaTabClass PlumaTabClass; -struct _PlumaTabClass +struct _PlumaTabClass { GtkBoxClass parent_class; }; @@ -107,18 +107,18 @@ PlumaTab *pluma_tab_get_from_document (PlumaDocument *doc); PlumaTabState pluma_tab_get_state (PlumaTab *tab); -gboolean pluma_tab_get_auto_save_enabled - (PlumaTab *tab); +gboolean pluma_tab_get_auto_save_enabled + (PlumaTab *tab); -void pluma_tab_set_auto_save_enabled - (PlumaTab *tab, +void pluma_tab_set_auto_save_enabled + (PlumaTab *tab, gboolean enable); -gint pluma_tab_get_auto_save_interval +gint pluma_tab_get_auto_save_interval (PlumaTab *tab); -void pluma_tab_set_auto_save_interval - (PlumaTab *tab, +void pluma_tab_set_auto_save_interval + (PlumaTab *tab, gint interval); void pluma_tab_set_info_bar (PlumaTab *tab, @@ -128,7 +128,7 @@ void pluma_tab_set_info_bar (PlumaTab *tab, */ GtkWidget *_pluma_tab_new (void); -/* Whether create is TRUE, creates a new empty document if location does +/* Whether create is TRUE, creates a new empty document if location does not refer to an existing file */ GtkWidget *_pluma_tab_new_from_uri (const gchar *uri, const PlumaEncoding *encoding, diff --git a/pluma/pluma-ui.h b/pluma/pluma-ui.h index 45b4d2a9..824e1e32 100644 --- a/pluma/pluma-ui.h +++ b/pluma/pluma-ui.h @@ -2,7 +2,7 @@ * pluma-ui.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$ */ @@ -67,7 +67,7 @@ static const GtkActionEntry pluma_always_sensitive_menu_entries[] = N_("Open the pluma manual"), G_CALLBACK (_pluma_cmd_help_contents) }, { "HelpAbout", "help-about", N_("_About"), NULL, N_("About this application"), G_CALLBACK (_pluma_cmd_help_about) }, - + /* Fullscreen toolbar */ { "LeaveFullscreen", "view-restore", N_("_Leave Fullscreen"), NULL, N_("Leave fullscreen mode"), diff --git a/pluma/pluma-utils.c b/pluma/pluma-utils.c index a7216955..905b8f53 100644 --- a/pluma/pluma-utils.c +++ b/pluma/pluma-utils.c @@ -3,8 +3,8 @@ * This file is part of pluma * * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence - * Copyright (C) 2000, 2002 Chema Celorio, Paolo Maggi - * Copyright (C) 2003-2005 Paolo Maggi + * Copyright (C) 2000, 2002 Chema Celorio, Paolo Maggi + * Copyright (C) 2003-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 @@ -18,14 +18,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, 1998-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, 1998-2005. See the AUTHORS file for a + * list of people on the pluma Team. + * See the ChangeLog files for a list of changes. * * $Id$ */ @@ -74,7 +74,7 @@ pluma_utils_uri_has_file_scheme (const gchar *uri) gfile = g_file_new_for_uri (uri); res = g_file_has_uri_scheme (gfile, "file"); - + g_object_unref (gfile); return res; } @@ -227,7 +227,7 @@ pluma_dialog_add_button (GtkDialog *dialog, gtk_widget_show (button); - gtk_dialog_add_action_widget (dialog, button, response_id); + gtk_dialog_add_action_widget (dialog, button, response_id); return button; } @@ -235,7 +235,7 @@ pluma_dialog_add_button (GtkDialog *dialog, /* * n: len of the string in bytes */ -gboolean +gboolean g_utf8_caselessnmatch (const char *s1, const char *s2, gssize n1, gssize n2) { gchar *casefold; @@ -265,10 +265,10 @@ g_utf8_caselessnmatch (const char *s1, const char *s2, gssize n1, gssize n2) goto finally_2; ret = (strncmp (normalized_s1, normalized_s2, len_s2) == 0); - + finally_2: g_free (normalized_s1); - g_free (normalized_s2); + g_free (normalized_s2); return ret; } @@ -283,7 +283,7 @@ finally_2: * for a specified gtk widget. */ void -pluma_utils_set_atk_name_description (GtkWidget *widget, +pluma_utils_set_atk_name_description (GtkWidget *widget, const gchar *name, const gchar *description) { @@ -311,8 +311,8 @@ pluma_utils_set_atk_name_description (GtkWidget *widget, * between 2 specified widgets. */ void -pluma_utils_set_atk_relation (GtkWidget *obj1, - GtkWidget *obj2, +pluma_utils_set_atk_relation (GtkWidget *obj1, + GtkWidget *obj2, AtkRelationType rel_type ) { AtkObject *atk_obj1, *atk_obj2; @@ -340,9 +340,9 @@ pluma_utils_uri_exists (const gchar* text_uri) { GFile *gfile; gboolean res; - + g_return_val_if_fail (text_uri != NULL, FALSE); - + pluma_debug_message (DEBUG_UTILS, "text_uri: %s", text_uri); gfile = g_file_new_for_uri (text_uri); @@ -420,7 +420,7 @@ pluma_utils_unescape_search_text (const gchar *text) const gchar *cur; const gchar *end; const gchar *prev; - + if (text == NULL) return NULL; @@ -431,15 +431,15 @@ pluma_utils_unescape_search_text (const gchar *text) cur = text; end = text + length; prev = NULL; - - while (cur != end) + + while (cur != end) { const gchar *next; next = g_utf8_next_char (cur); - if (prev && (*prev == '\\')) + if (prev && (*prev == '\\')) { - switch (*cur) + switch (*cur) { case 'n': str = g_string_append (str, "\n"); @@ -459,21 +459,21 @@ pluma_utils_unescape_search_text (const gchar *text) str = g_string_append_len (str, cur, next - cur); break; } - } - else if (*cur != '\\') + } + else if (*cur != '\\') { str = g_string_append_len (str, cur, next - cur); - } - else if ((next == end) && (*cur == '\\')) + } + else if ((next == end) && (*cur == '\\')) { str = g_string_append (str, "\\"); } - + if (!drop_prev) { prev = cur; } - else + else { prev = NULL; drop_prev = FALSE; @@ -485,19 +485,19 @@ pluma_utils_unescape_search_text (const gchar *text) return g_string_free (str, FALSE); } -void +void pluma_warning (GtkWindow *parent, const gchar *format, ...) { va_list args; gchar *str; GtkWidget *dialog; GtkWindowGroup *wg = NULL; - + g_return_if_fail (format != NULL); if (parent != NULL) wg = gtk_window_get_group (parent); - + va_start (args, format); str = g_strdup_vprintf (format, args); va_end (args); @@ -513,7 +513,7 @@ pluma_warning (GtkWindow *parent, const gchar *format, ...) if (wg != NULL) gtk_window_group_add_window (wg, GTK_WINDOW (dialog)); - + gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); @@ -522,14 +522,14 @@ pluma_warning (GtkWindow *parent, const gchar *format, ...) "response", G_CALLBACK (gtk_widget_destroy), NULL); - + gtk_widget_show (dialog); } /* * Doubles underscore to avoid spurious menu accels. */ -gchar * +gchar * pluma_utils_escape_underscores (const gchar* text, gssize length) { @@ -623,7 +623,7 @@ pluma_utils_str_truncate (const gchar *string, g_utf8_offset_to_pointer (string, num_left_chars) - string); g_string_append (truncated, delimiter); } - + return g_string_free (truncated, FALSE); } @@ -676,7 +676,7 @@ pluma_utils_make_valid_utf8 (const char *name) } g_string_append (string, remainder); - + g_assert (g_utf8_validate (string->str, -1, NULL)); return g_string_free (string, FALSE); @@ -702,14 +702,14 @@ pluma_utils_uri_get_dirname (const gchar *uri) if ((strlen (str) == 1) && (*str == '.')) { g_free (str); - + return NULL; } res = pluma_utils_replace_home_dir_with_tilde (str); g_free (str); - + return res; } @@ -808,7 +808,7 @@ pluma_utils_replace_home_dir_with_tilde (const gchar *uri) if (strcmp (uri, home) == 0) { g_free (home); - + return g_strdup ("~"); } @@ -823,8 +823,8 @@ pluma_utils_replace_home_dir_with_tilde (const gchar *uri) res = g_strdup_printf ("~/%s", uri + strlen (home)); g_free (home); - - return res; + + return res; } g_free (home); @@ -1040,7 +1040,7 @@ pluma_utils_is_valid_uri (const gchar *uri) if (!g_ascii_isxdigit (*p)) return FALSE; - ++p; + ++p; if (!g_ascii_isxdigit (*p)) return FALSE; } @@ -1127,12 +1127,12 @@ pluma_utils_get_ui_objects (const gchar *filename, *error_widget = NULL; builder = gtk_builder_new (); - + if (root_objects != NULL) { - gtk_builder_add_objects_from_file (builder, - filename, - root_objects, + gtk_builder_add_objects_from_file (builder, + filename, + root_objects, &error); } else @@ -1164,8 +1164,8 @@ pluma_utils_get_ui_objects (const gchar *filename, if (!*gobj) { - *error_widget = handle_builder_error (_("Unable to find the object '%s' inside file %s."), - name, + *error_widget = handle_builder_error (_("Unable to find the object '%s' inside file %s."), + name, filename_markup), ret = FALSE; break; @@ -1196,25 +1196,25 @@ pluma_utils_get_ui_objects (const gchar *filename, gchar * pluma_utils_make_canonical_uri_from_shell_arg (const gchar *str) -{ +{ GFile *gfile; gchar *uri; g_return_val_if_fail (str != NULL, NULL); g_return_val_if_fail (*str != '\0', NULL); - - /* Note for the future: + + /* Note for the future: * FIXME: is still still relevant? * - * <federico> paolo: and flame whoever tells - * you that file:///mate/test_files/hëllò + * <federico> paolo: and flame whoever tells + * you that file:///mate/test_files/hëllò * doesn't work --- that's not a valid URI * - * <paolo> federico: well, another solution that - * does not requires patch to _from_shell_args - * is to check that the string returned by it + * <paolo> federico: well, another solution that + * does not requires patch to _from_shell_args + * is to check that the string returned by it * contains only ASCII chars - * <federico> paolo: hmmmm, isn't there + * <federico> paolo: hmmmm, isn't there * mate_vfs_is_uri_valid() or something? * <paolo>: I will use pluma_utils_is_valid_uri () * @@ -1226,7 +1226,7 @@ pluma_utils_make_canonical_uri_from_shell_arg (const gchar *str) if (pluma_utils_is_valid_uri (uri)) return uri; - + g_free (uri); return NULL; } @@ -1243,13 +1243,13 @@ pluma_utils_file_has_parent (GFile *gfile) { GFile *parent; gboolean ret; - + parent = g_file_get_parent (gfile); ret = parent != NULL; - + if (parent) g_object_unref (parent); - + return ret; } @@ -1275,9 +1275,9 @@ pluma_utils_basename_for_display (gchar const *uri) { GFileInfo *info; info = g_file_query_info (gfile, - G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME, - G_FILE_QUERY_INFO_NONE, - NULL, + G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME, + G_FILE_QUERY_INFO_NONE, + NULL, NULL); if (info) @@ -1291,7 +1291,7 @@ pluma_utils_basename_for_display (gchar const *uri) /* This is a local file, and therefore we will use * g_filename_display_basename on the local path */ gchar *local_path; - + local_path = g_file_get_path (gfile); name = g_filename_display_basename (local_path); g_free (local_path); @@ -1308,8 +1308,8 @@ pluma_utils_basename_for_display (gchar const *uri) parse_name = g_file_get_parse_name (gfile); base = g_filename_display_basename (parse_name); name = g_uri_unescape_string (base, NULL); - - g_free (base); + + g_free (base); g_free (parse_name); } else @@ -1341,7 +1341,7 @@ pluma_utils_basename_for_display (gchar const *uri) * * Filter, modify, unescape and change @uri to make it appropriate * for display to users. - * + * * This function is a convenient wrapper for g_file_get_parse_name * * Return value: a string which represents @uri and can be displayed. @@ -1364,9 +1364,9 @@ pluma_utils_uri_for_display (const gchar *uri) * @selection_data: the #GtkSelectionData from drag_data_received * * Create a list of valid uri's from a uri-list drop. - * + * * Return value: (transfer full): a string array which will hold the uris or %NULL if there - * were no valid uris. g_strfreev should be used when the + * were no valid uris. g_strfreev should be used when the * string array is no longer used */ gchar ** @@ -1383,9 +1383,9 @@ pluma_utils_drop_get_uris (GtkSelectionData *selection_data) for (i = 0; uris[i] != NULL; i++) { gchar *uri; - + uri = pluma_utils_make_canonical_uri_from_shell_arg (uris[i]); - + /* Silently ignore malformed URI/filename */ if (uri != NULL) uri_list[p++] = uri; @@ -1423,7 +1423,7 @@ null_ptr (gchar **ptr) * scheme, user info, port, host and path. The return value pointer can be * %NULL to ignore certain parts of the uri. If the function returns %TRUE, then * all return value pointers should be freed using g_free - * + * * Return value: %TRUE if the uri could be properly decoded, %FALSE otherwise. */ gboolean @@ -1435,7 +1435,7 @@ pluma_utils_decode_uri (const gchar *uri, gchar **path ) { - /* Largely copied from glib/gio/gdummyfile.c:_g_decode_uri. This + /* Largely copied from glib/gio/gdummyfile.c:_g_decode_uri. This * functionality should be in glib/gio, but for now we implement it * ourselves (see bug #546182) */ @@ -1445,10 +1445,10 @@ pluma_utils_decode_uri (const gchar *uri, /* From RFC 3986 Decodes: * URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] - */ + */ p = uri; - + null_ptr (scheme); null_ptr (user); null_ptr (port); @@ -1475,32 +1475,32 @@ pluma_utils_decode_uri (const gchar *uri, c == '.')) return FALSE; } - + if (scheme) { *scheme = g_malloc (p - uri); out = *scheme; - + for (in = uri; in < p - 1; in++) *out++ = g_ascii_tolower (*in); - + *out = '\0'; } - + hier_part_start = p; hier_part_end = p + strlen (p); - + if (hier_part_start[0] == '/' && hier_part_start[1] == '/') { const char *authority_start, *authority_end; const char *userinfo_start, *userinfo_end; const char *host_start, *host_end; const char *port_start; - + authority_start = hier_part_start + 2; /* authority is always followed by / or nothing */ authority_end = memchr (authority_start, '/', hier_part_end - authority_start); - + if (authority_end == NULL) authority_end = hier_part_end; @@ -1509,14 +1509,14 @@ pluma_utils_decode_uri (const gchar *uri, */ userinfo_end = memchr (authority_start, '@', authority_end - authority_start); - + if (userinfo_end) { userinfo_start = authority_start; - + if (user) *user = g_uri_unescape_segment (userinfo_start, userinfo_end, NULL); - + if (user && *user == NULL) { if (scheme) @@ -1524,7 +1524,7 @@ pluma_utils_decode_uri (const gchar *uri, return FALSE; } - + host_start = userinfo_end + 1; } else @@ -1550,7 +1550,7 @@ pluma_utils_decode_uri (const gchar *uri, if (path) *path = g_uri_unescape_segment (hier_part_start, hier_part_end, "/"); - + return TRUE; } diff --git a/pluma/pluma-utils.h b/pluma/pluma-utils.h index 7695ee5c..c62c223b 100644 --- a/pluma/pluma-utils.h +++ b/pluma/pluma-utils.h @@ -18,14 +18,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, 1998-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, 1998-2005. See the AUTHORS file for a + * list of people on the pluma Team. + * See the ChangeLog files for a list of changes. * * $Id$ */ @@ -65,13 +65,13 @@ GtkWidget *pluma_gtk_button_new_with_icon (const gchar *label, GtkWidget *pluma_dialog_add_button (GtkDialog *dialog, const gchar *text, - const gchar *icon_name, + const gchar *icon_name, gint response_id); gchar *pluma_utils_escape_underscores (const gchar *text, gssize length); -gchar *pluma_utils_str_middle_truncate (const gchar *string, +gchar *pluma_utils_str_middle_truncate (const gchar *string, guint truncate_length); gchar *pluma_utils_str_end_truncate (const gchar *string, @@ -131,7 +131,7 @@ gboolean pluma_utils_file_has_parent (GFile *gfile); /* Return NULL if str is not a valid URI and/or filename */ gchar *pluma_utils_make_canonical_uri_from_shell_arg (const gchar *str); - + gchar *pluma_utils_uri_for_display (const gchar *uri); gchar *pluma_utils_basename_for_display (const gchar *uri); gboolean pluma_utils_decode_uri (const gchar *uri, diff --git a/pluma/pluma-view.c b/pluma/pluma-view.c index 835c0764..cb115574 100644 --- a/pluma/pluma-view.c +++ b/pluma/pluma-view.c @@ -3,8 +3,8 @@ * This file is part of pluma * * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence - * Copyright (C) 2000, 2002 Chema Celorio, Paolo Maggi - * Copyright (C) 2003-2005 Paolo Maggi + * Copyright (C) 2000, 2002 Chema Celorio, Paolo Maggi + * Copyright (C) 2003-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 @@ -18,16 +18,16 @@ * * 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, 1998-2005. See the AUTHORS file for a - * list of people on the pluma Team. + * Modified by the pluma Team, 1998-2005. See the AUTHORS file for a + * list of people on the pluma Team. * See the ChangeLog files for a list of changes. * - * $Id$ + * $Id$ */ #ifdef HAVE_CONFIG_H @@ -73,7 +73,7 @@ enum struct _PlumaViewPrivate { SearchMode search_mode; - + GtkTextIter start_search_iter; /* used to restore the search state if an @@ -94,9 +94,9 @@ struct _PlumaViewPrivate guint typeselect_flush_timeout; guint search_entry_changed_id; - + gboolean disable_popdown; - + GtkTextBuffer *current_buffer; }; @@ -173,13 +173,13 @@ typedef enum } PlumaSearchEntryState; static void -document_read_only_notify_handler (PlumaDocument *document, +document_read_only_notify_handler (PlumaDocument *document, GParamSpec *pspec, PlumaView *view) { pluma_debug (DEBUG_VIEW); - gtk_text_view_set_editable (GTK_TEXT_VIEW (view), + gtk_text_view_set_editable (GTK_TEXT_VIEW (view), !pluma_document_get_readonly (document)); } @@ -219,7 +219,7 @@ pluma_view_class_init (PlumaViewClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); GtkTextViewClass *text_view_class = GTK_TEXT_VIEW_CLASS (klass); - + GtkBindingSet *binding_set; object_class->dispose = pluma_view_dispose; @@ -228,7 +228,7 @@ pluma_view_class_init (PlumaViewClass *klass) widget_class->focus_out_event = pluma_view_focus_out; widget_class->draw = pluma_view_draw; widget_class->scroll_event = pluma_view_scroll_event; - + /* * Override the gtk_text_view_drag_motion and drag_drop * functions to get URIs @@ -251,10 +251,10 @@ pluma_view_class_init (PlumaViewClass *klass) text_view_class->populate_popup = pluma_view_populate_popup; klass->start_interactive_search = start_interactive_search; klass->start_interactive_goto_line = start_interactive_goto_line; - klass->reset_searched_text = reset_searched_text; + klass->reset_searched_text = reset_searched_text; text_view_class->delete_from_cursor = pluma_view_delete_from_cursor; - + view_signals[START_INTERACTIVE_SEARCH] = g_signal_new ("start_interactive_search", G_TYPE_FROM_CLASS (object_class), @@ -262,7 +262,7 @@ pluma_view_class_init (PlumaViewClass *klass) G_STRUCT_OFFSET (PlumaViewClass, start_interactive_search), NULL, NULL, pluma_marshal_BOOLEAN__VOID, - G_TYPE_BOOLEAN, 0); + G_TYPE_BOOLEAN, 0); view_signals[START_INTERACTIVE_GOTO_LINE] = g_signal_new ("start_interactive_goto_line", @@ -280,14 +280,14 @@ pluma_view_class_init (PlumaViewClass *klass) G_STRUCT_OFFSET (PlumaViewClass, reset_searched_text), NULL, NULL, pluma_marshal_BOOLEAN__VOID, - G_TYPE_BOOLEAN, 0); + G_TYPE_BOOLEAN, 0); /* A new signal DROP_URIS has been added to allow plugins to intercept * the default dnd behaviour of 'text/uri-list'. PlumaView now handles - * dnd in the default handlers of drag_drop, drag_motion and + * dnd in the default handlers of drag_drop, drag_motion and * drag_data_received. The view emits drop_uris from drag_data_received - * if valid uris have been dropped. Plugins should connect to - * drag_motion, drag_drop and drag_data_received to change this + * if valid uris have been dropped. Plugins should connect to + * drag_motion, drag_drop and drag_data_received to change this * default behaviour. They should _NOT_ use this signal because this * will not prevent pluma from loading the uri */ @@ -299,27 +299,27 @@ pluma_view_class_init (PlumaViewClass *klass) NULL, NULL, g_cclosure_marshal_VOID__BOXED, G_TYPE_NONE, 1, G_TYPE_STRV); - + g_type_class_add_private (klass, sizeof (PlumaViewPrivate)); - + binding_set = gtk_binding_set_by_class (klass); - + gtk_binding_entry_add_signal (binding_set, GDK_KEY_k, GDK_CONTROL_MASK, "start_interactive_search", 0); - + gtk_binding_entry_add_signal (binding_set, GDK_KEY_i, GDK_CONTROL_MASK, "start_interactive_goto_line", 0); - + gtk_binding_entry_add_signal (binding_set, GDK_KEY_k, GDK_CONTROL_MASK | GDK_SHIFT_MASK, "reset_searched_text", 0); - gtk_binding_entry_add_signal (binding_set, + gtk_binding_entry_add_signal (binding_set, GDK_KEY_d, GDK_CONTROL_MASK, "delete_from_cursor", 2, @@ -338,7 +338,7 @@ current_buffer_removed (PlumaView *view) g_signal_handlers_disconnect_by_func (view->priv->current_buffer, search_highlight_updated_cb, view); - + g_object_unref (view->priv->current_buffer); view->priv->current_buffer = NULL; } @@ -350,10 +350,10 @@ on_notify_buffer_cb (PlumaView *view, gpointer userdata) { GtkTextBuffer *buffer; - + current_buffer_removed (view); buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); - + if (buffer == NULL || !PLUMA_IS_DOCUMENT (buffer)) return; @@ -363,7 +363,7 @@ on_notify_buffer_cb (PlumaView *view, G_CALLBACK (document_read_only_notify_handler), view); - gtk_text_view_set_editable (GTK_TEXT_VIEW (view), + gtk_text_view_set_editable (GTK_TEXT_VIEW (view), !pluma_document_get_readonly (PLUMA_DOCUMENT (buffer))); g_signal_connect (buffer, @@ -453,18 +453,18 @@ pluma_set_source_space_drawer (GtkSourceView *view) } #endif -static void +static void pluma_view_init (PlumaView *view) { GtkTargetList *tl; - + pluma_debug (DEBUG_VIEW); - + view->priv = PLUMA_VIEW_GET_PRIVATE (view); /* * Set tab, fonts, wrap mode, colors, etc. according - * to preferences + * to preferences */ if (!pluma_prefs_manager_get_use_default_font ()) { @@ -481,13 +481,13 @@ pluma_view_init (PlumaView *view) pluma_view_set_font (view, TRUE, NULL); } - g_object_set (G_OBJECT (view), + g_object_set (G_OBJECT (view), "wrap_mode", pluma_prefs_manager_get_wrap_mode (), "show_line_numbers", pluma_prefs_manager_get_display_line_numbers (), "auto_indent", pluma_prefs_manager_get_auto_indent (), "tab_width", pluma_prefs_manager_get_tabs_size (), "insert_spaces_instead_of_tabs", pluma_prefs_manager_get_insert_spaces (), - "show_right_margin", pluma_prefs_manager_get_display_right_margin (), + "show_right_margin", pluma_prefs_manager_get_display_right_margin (), "right_margin_position", pluma_prefs_manager_get_right_margin_position (), "highlight_current_line", pluma_prefs_manager_get_highlight_current_line (), "smart_home_end", pluma_prefs_manager_get_smart_home_end (), @@ -499,15 +499,15 @@ pluma_view_init (PlumaView *view) view->priv->typeselect_flush_timeout = 0; view->priv->wrap_around = TRUE; - /* Drag and drop support */ + /* Drag and drop support */ tl = gtk_drag_dest_get_target_list (GTK_WIDGET (view)); if (tl != NULL) gtk_target_list_add_uri_targets (tl, TARGET_URI_LIST); - + /* Act on buffer change */ - g_signal_connect (view, - "notify::buffer", + g_signal_connect (view, + "notify::buffer", G_CALLBACK (on_notify_buffer_cb), NULL); } @@ -524,20 +524,20 @@ pluma_view_dispose (GObject *object) gtk_widget_destroy (view->priv->search_window); view->priv->search_window = NULL; view->priv->search_entry = NULL; - + if (view->priv->typeselect_flush_timeout != 0) { g_source_remove (view->priv->typeselect_flush_timeout); view->priv->typeselect_flush_timeout = 0; } } - + /* Disconnect notify buffer because the destroy of the textview will set the buffer to NULL, and we call get_buffer in the notify which would reinstate a GtkTextBuffer which we don't want */ current_buffer_removed (view); g_signal_handlers_disconnect_by_func (view, on_notify_buffer_cb, NULL); - + (* G_OBJECT_CLASS (pluma_view_parent_class)->dispose) (object); } @@ -559,23 +559,23 @@ static gint pluma_view_focus_out (GtkWidget *widget, GdkEventFocus *event) { PlumaView *view = PLUMA_VIEW (widget); - + gtk_widget_queue_draw (widget); - + /* hide interactive search dialog */ if (view->priv->search_window != NULL) hide_search_window (view, FALSE); - + (* GTK_WIDGET_CLASS (pluma_view_parent_class)->focus_out_event) (widget, event); - + return FALSE; } /** * pluma_view_new: * @doc: a #PlumaDocument - * - * Creates a new #PlumaView object displaying the @doc document. + * + * Creates a new #PlumaView object displaying the @doc document. * @doc cannot be %NULL. * * Return value: a new #PlumaView @@ -619,7 +619,7 @@ pluma_view_cut_clipboard (PlumaView *view) clipboard, !pluma_document_get_readonly ( PLUMA_DOCUMENT (buffer))); - + gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (view), gtk_text_buffer_get_insert (buffer), PLUMA_VIEW_SCROLL_MARGIN, @@ -683,7 +683,7 @@ pluma_view_paste_clipboard (PlumaView *view) /** * pluma_view_delete_selection: * @view: a #PlumaView - * + * * Deletes the text currently selected in the #GtkTextBuffer associated * to the view and scroll to the cursor position. **/ @@ -704,7 +704,7 @@ pluma_view_delete_selection (PlumaView *view) TRUE, !pluma_document_get_readonly ( PLUMA_DOCUMENT (buffer))); - + gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (view), gtk_text_buffer_get_insert (buffer), PLUMA_VIEW_SCROLL_MARGIN, @@ -716,7 +716,7 @@ pluma_view_delete_selection (PlumaView *view) /** * pluma_view_select_all: * @view: a #PlumaView - * + * * Selects all the text displayed in the @view. **/ void @@ -739,7 +739,7 @@ pluma_view_select_all (PlumaView *view) /** * pluma_view_scroll_to_cursor: * @view: a #PlumaView - * + * * Scrolls the @view to the cursor position. **/ void @@ -750,7 +750,7 @@ pluma_view_scroll_to_cursor (PlumaView *view) pluma_debug (DEBUG_VIEW); g_return_if_fail (PLUMA_IS_VIEW (view)); - + buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); g_return_if_fail (buffer != NULL); @@ -874,13 +874,13 @@ pluma_override_font (const gchar *item, * @view: a #PlumaView * @def: whether to reset the default font * @font_name: the name of the font to use - * + * * If @def is #TRUE, resets the font of the @view to the default font * otherwise sets it to @font_name. **/ void -pluma_view_set_font (PlumaView *view, - gboolean def, +pluma_view_set_font (PlumaView *view, + gboolean def, const gchar *font_name) { PangoFontDescription *font_desc = NULL; @@ -915,7 +915,7 @@ pluma_view_set_font (PlumaView *view, pango_font_description_free (sys_font_desc); } - pango_font_description_free (font_desc); + pango_font_description_free (font_desc); } static void @@ -939,7 +939,7 @@ add_search_completion_entry (const gchar *str) g_return_if_fail (GTK_IS_TREE_MODEL (search_completion_model)); - model = GTK_TREE_MODEL (search_completion_model); + model = GTK_TREE_MODEL (search_completion_model); /* Get the first iter in the list */ valid = gtk_tree_model_get_iter_first (model, &iter); @@ -949,9 +949,9 @@ add_search_completion_entry (const gchar *str) /* Walk through the list, reading each row */ gchar *str_data; - gtk_tree_model_get (model, - &iter, - 0, + gtk_tree_model_get (model, + &iter, + 0, &str_data, -1); @@ -1006,18 +1006,18 @@ run_search (PlumaView *view, { GtkTextIter start_iter; GtkTextIter match_start; - GtkTextIter match_end; + GtkTextIter match_end; gboolean found = FALSE; PlumaDocument *doc; g_return_val_if_fail (view->priv->search_mode == SEARCH, FALSE); doc = PLUMA_DOCUMENT (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view))); - + start_iter = view->priv->start_search_iter; - + if (*entry_text != '\0') - { + { if (!search_backward) { if (!typing) @@ -1026,38 +1026,38 @@ run_search (PlumaView *view, gtk_text_buffer_get_selection_bounds (GTK_TEXT_BUFFER (doc), &start_iter, &match_end); - + gtk_text_iter_order (&match_end, &start_iter); } - + /* run search */ found = pluma_document_search_forward (doc, &start_iter, NULL, &match_start, &match_end); - } + } else if (!typing) { /* backward and not typing */ gtk_text_buffer_get_selection_bounds (GTK_TEXT_BUFFER (doc), &start_iter, &match_end); - + /* run search */ found = pluma_document_search_backward (doc, NULL, &start_iter, &match_start, &match_end); - } + } else { /* backward (while typing) */ g_return_val_if_reached (FALSE); } - + if (!found && wrap_around) { if (!search_backward) @@ -1069,7 +1069,7 @@ run_search (PlumaView *view, else found = pluma_document_search_backward (doc, NULL, /* FIXME: set the start_inter */ - NULL, + NULL, &match_start, &match_end); } @@ -1077,10 +1077,10 @@ run_search (PlumaView *view, else { gtk_text_buffer_get_selection_bounds (GTK_TEXT_BUFFER (doc), - &start_iter, - NULL); - } - + &start_iter, + NULL); + } + if (found) { gtk_text_buffer_place_cursor (GTK_TEXT_BUFFER (doc), @@ -1097,9 +1097,9 @@ run_search (PlumaView *view, &view->priv->start_search_iter); } } - + if (found || (*entry_text == '\0')) - { + { pluma_view_scroll_to_cursor (view); set_entry_state (view->priv->search_entry, @@ -1126,9 +1126,9 @@ send_focus_change (GtkWidget *widget, fevent->focus_change.type = GDK_FOCUS_CHANGE; fevent->focus_change.window = g_object_ref (gtk_widget_get_window (widget)); fevent->focus_change.in = in; - + gtk_widget_event (widget, fevent); - + g_object_notify (G_OBJECT (widget), "has-focus"); g_object_unref (widget); @@ -1158,14 +1158,14 @@ hide_search_window (PlumaView *view, gboolean cancel) send_focus_change (GTK_WIDGET (view->priv->search_entry), FALSE); gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), TRUE); gtk_widget_hide (view->priv->search_window); - + if (cancel) { GtkTextBuffer *buffer; - + buffer = GTK_TEXT_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view))); gtk_text_buffer_place_cursor (buffer, &view->priv->start_search_iter); - + pluma_view_scroll_to_cursor (view); } @@ -1192,10 +1192,10 @@ update_search_window_position (PlumaView *view) gtk_widget_realize (view->priv->search_window); gdk_window_get_origin (view_window, &view_x, &view_y); - + x = MAX (12, view_x + 12); y = MAX (12, view_y - 12); - + gtk_window_move (GTK_WINDOW (view->priv->search_window), x, y); } @@ -1215,7 +1215,7 @@ search_window_button_press_event (GtkWidget *widget, PlumaView *view) { hide_search_window (view, FALSE); - + gtk_propagate_event (GTK_WIDGET (view), (GdkEvent *)event); return FALSE; @@ -1228,8 +1228,8 @@ search_again (PlumaView *view, const gchar *entry_text; g_return_if_fail (view->priv->search_mode == SEARCH); - - /* SEARCH mode */ + + /* SEARCH mode */ /* renew the flush timeout */ if (view->priv->typeselect_flush_timeout != 0) { @@ -1239,11 +1239,11 @@ search_again (PlumaView *view, (GSourceFunc)search_entry_flush_timeout, view); } - + entry_text = gtk_entry_get_text (GTK_ENTRY (view->priv->search_entry)); - + add_search_completion_entry (entry_text); - + run_search (view, entry_text, search_backward, @@ -1260,8 +1260,8 @@ search_window_scroll_event (GtkWidget *widget, if (view->priv->search_mode == GOTO_LINE) return retval; - - /* SEARCH mode */ + + /* SEARCH mode */ if (event->direction == GDK_SCROLL_UP) { search_again (view, TRUE); @@ -1302,19 +1302,19 @@ search_window_key_press_event (GtkWidget *widget, /* restore document search so that Find Next does the right thing */ doc = PLUMA_DOCUMENT (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view))); - pluma_document_set_search_text (doc, + pluma_document_set_search_text (doc, view->priv->old_search_text, view->priv->old_search_flags); - + } - + hide_search_window (view, TRUE); retval = TRUE; } - + if (view->priv->search_mode == GOTO_LINE) return retval; - + /* SEARCH mode */ /* select previous matching iter */ @@ -1324,7 +1324,7 @@ search_window_key_press_event (GtkWidget *widget, retval = TRUE; } - if (((event->state & modifiers) == (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) && + if (((event->state & modifiers) == (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) && (event->keyval == GDK_KEY_g || event->keyval == GDK_KEY_G)) { search_again (view, TRUE); @@ -1338,7 +1338,7 @@ search_window_key_press_event (GtkWidget *widget, retval = TRUE; } - if (((event->state & modifiers) == GDK_CONTROL_MASK) && + if (((event->state & modifiers) == GDK_CONTROL_MASK) && (event->keyval == GDK_KEY_g || event->keyval == GDK_KEY_G)) { search_again (view, FALSE); @@ -1358,7 +1358,7 @@ search_entry_activate (GtkEntry *entry, static void wrap_around_menu_item_toggled (GtkCheckMenuItem *checkmenuitem, PlumaView *view) -{ +{ view->priv->wrap_around = gtk_check_menu_item_get_active (checkmenuitem); } @@ -1401,7 +1401,7 @@ search_enable_popdown (GtkWidget *widget, PlumaView *view) { g_timeout_add (200, real_search_enable_popdown, view); - + /* renew the flush timeout */ if (view->priv->typeselect_flush_timeout != 0) g_source_remove (view->priv->typeselect_flush_timeout); @@ -1434,7 +1434,7 @@ search_entry_populate_popup (GtkEntry *entry, /* create "Wrap Around" menu item. */ menu_item = gtk_check_menu_item_new_with_mnemonic (_("_Wrap Around")); g_signal_connect (G_OBJECT (menu_item), "toggled", - G_CALLBACK (wrap_around_menu_item_toggled), + G_CALLBACK (wrap_around_menu_item_toggled), view); gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), @@ -1444,7 +1444,7 @@ search_entry_populate_popup (GtkEntry *entry, /* create "Match Entire Word Only" menu item. */ menu_item = gtk_check_menu_item_new_with_mnemonic (_("Match _Entire Word Only")); g_signal_connect (G_OBJECT (menu_item), "toggled", - G_CALLBACK (match_entire_word_menu_item_toggled), + G_CALLBACK (match_entire_word_menu_item_toggled), view); gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), @@ -1454,7 +1454,7 @@ search_entry_populate_popup (GtkEntry *entry, /* create "Match Case" menu item. */ menu_item = gtk_check_menu_item_new_with_mnemonic (_("_Match Case")); g_signal_connect (G_OBJECT (menu_item), "toggled", - G_CALLBACK (match_case_menu_item_toggled), + G_CALLBACK (match_case_menu_item_toggled), view); gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), @@ -1464,7 +1464,7 @@ search_entry_populate_popup (GtkEntry *entry, /* create "Parse escapes" menu item. */ menu_item = gtk_check_menu_item_new_with_mnemonic (_("_Parse escape sequences (e.g. \n)")); g_signal_connect (G_OBJECT (menu_item), "toggled", - G_CALLBACK (parse_escapes_menu_item_toggled), + G_CALLBACK (parse_escapes_menu_item_toggled), view); gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), @@ -1473,9 +1473,9 @@ search_entry_populate_popup (GtkEntry *entry, } static void -search_entry_insert_text (GtkEditable *editable, - const gchar *text, - gint length, +search_entry_insert_text (GtkEditable *editable, + const gchar *text, + gint length, gint *position, PlumaView *view) { @@ -1493,24 +1493,24 @@ search_entry_insert_text (GtkEditable *editable, return; c = g_utf8_get_char (p); - + if (((c == '-' || c == '+') && *position == 0) || (c == ':' && *position != 0)) { gchar *s = NULL; - + if (c == ':') { s = gtk_editable_get_chars (editable, 0, -1); s = g_utf8_strchr (s, -1, ':'); } - + if (s == NULL || s == p) { next = g_utf8_next_char (p); p = next; } - + g_free (s); } @@ -1557,7 +1557,7 @@ search_entry_insert_text (GtkEditable *editable, insert_text = TRUE; g_signal_stop_emission_by_name (editable, "insert_text"); - + gtk_editable_insert_text (editable, escaped_text, new_len, position); insert_text = FALSE; @@ -1574,7 +1574,7 @@ customize_for_search_mode (PlumaView *view) gtk_entry_set_icon_from_icon_name (GTK_ENTRY (view->priv->search_entry), GTK_ENTRY_ICON_PRIMARY, "edit-find"); - + gtk_widget_set_tooltip_text (view->priv->search_entry, _("String you want to search for")); } @@ -1583,7 +1583,7 @@ customize_for_search_mode (PlumaView *view) gtk_entry_set_icon_from_icon_name (GTK_ENTRY (view->priv->search_entry), GTK_ENTRY_ICON_PRIMARY, "go-jump"); - + gtk_widget_set_tooltip_text (view->priv->search_entry, _("Line you want to move the cursor to")); } @@ -1600,30 +1600,30 @@ completion_func (GtkEntryCompletion *completion, GtkTreeModel *model; PlumaViewPrivate *priv = (PlumaViewPrivate *)data; const gchar *real_key; - + if (priv->search_mode == GOTO_LINE) return FALSE; - + real_key = gtk_entry_get_text (GTK_ENTRY (gtk_entry_completion_get_entry (completion))); - + if (g_utf8_strlen (real_key, -1) <= MIN_SEARCH_COMPLETION_KEY_LEN) return FALSE; - + model = gtk_entry_completion_get_model (completion); - g_return_val_if_fail (gtk_tree_model_get_column_type (model, 0) == G_TYPE_STRING, + g_return_val_if_fail (gtk_tree_model_get_column_type (model, 0) == G_TYPE_STRING, FALSE); - - gtk_tree_model_get (model, + + gtk_tree_model_get (model, iter, - 0, + 0, &item, -1); - + if (item == NULL) return FALSE; - + if (PLUMA_SEARCH_IS_CASE_SENSITIVE (priv->search_flags)) - { + { if (!strncmp (real_key, item, strlen (real_key))) ret = TRUE; } @@ -1631,33 +1631,33 @@ completion_func (GtkEntryCompletion *completion, { gchar *normalized_string; gchar *case_normalized_string; - + normalized_string = g_utf8_normalize (item, -1, G_NORMALIZE_ALL); case_normalized_string = g_utf8_casefold (normalized_string, -1); - + if (!strncmp (key, case_normalized_string, strlen (key))) ret = TRUE; - + g_free (normalized_string); g_free (case_normalized_string); - + } - + g_free (item); - - return ret; + + return ret; } static void ensure_search_window (PlumaView *view) -{ +{ GtkWidget *frame; GtkWidget *vbox; GtkWidget *toplevel; GtkEntryCompletion *completion; GtkWindowGroup *group; GtkWindowGroup *search_group; - + toplevel = gtk_widget_get_toplevel (GTK_WIDGET (view)); group = gtk_window_get_group (GTK_WINDOW (toplevel)); if (view->priv->search_window != NULL) @@ -1671,20 +1671,20 @@ ensure_search_window (PlumaView *view) else if (search_group) gtk_window_group_remove_window (search_group, GTK_WINDOW (view->priv->search_window)); - + customize_for_search_mode (view); - + return; } - + view->priv->search_window = gtk_window_new (GTK_WINDOW_POPUP); if (group) gtk_window_group_add_window (group, GTK_WINDOW (view->priv->search_window)); - + gtk_window_set_modal (GTK_WINDOW (view->priv->search_window), TRUE); - + g_signal_connect (view->priv->search_window, "delete_event", G_CALLBACK (search_window_delete_event), view); @@ -1711,18 +1711,18 @@ ensure_search_window (PlumaView *view) /* add entry */ view->priv->search_entry = gtk_entry_new (); gtk_widget_show (view->priv->search_entry); - + g_signal_connect (view->priv->search_entry, "populate_popup", G_CALLBACK (search_entry_populate_popup), view); - g_signal_connect (view->priv->search_entry, "activate", + g_signal_connect (view->priv->search_entry, "activate", G_CALLBACK (search_entry_activate), view); - g_signal_connect (view->priv->search_entry, + g_signal_connect (view->priv->search_entry, "insert_text", - G_CALLBACK (search_entry_insert_text), - view); - + G_CALLBACK (search_entry_insert_text), + view); + gtk_container_add (GTK_CONTAINER (vbox), view->priv->search_entry); @@ -1731,12 +1731,12 @@ ensure_search_window (PlumaView *view) /* Create a tree model and use it as the completion model */ search_completion_model = gtk_list_store_new (1, G_TYPE_STRING); } - + /* Create the completion object for the search entry */ completion = gtk_entry_completion_new (); - gtk_entry_completion_set_model (completion, + gtk_entry_completion_set_model (completion, GTK_TREE_MODEL (search_completion_model)); - + /* Use model column 0 as the text column */ gtk_entry_completion_set_text_column (completion, 0); @@ -1745,20 +1745,20 @@ ensure_search_window (PlumaView *view) gtk_entry_completion_set_popup_completion (completion, FALSE); gtk_entry_completion_set_inline_completion (completion, TRUE); - - gtk_entry_completion_set_match_func (completion, + + gtk_entry_completion_set_match_func (completion, completion_func, view->priv, NULL); /* Assign the completion to the entry */ - gtk_entry_set_completion (GTK_ENTRY (view->priv->search_entry), + gtk_entry_set_completion (GTK_ENTRY (view->priv->search_entry), completion); g_object_unref (completion); gtk_widget_realize (view->priv->search_entry); - customize_for_search_mode (view); + customize_for_search_mode (view); } static gboolean @@ -1789,23 +1789,23 @@ static void init_search_entry (PlumaView *view) { GtkTextBuffer *buffer; - + buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); - + if (view->priv->search_mode == GOTO_LINE) - { + { gint line; gchar *line_str; - + line = gtk_text_iter_get_line (&view->priv->start_search_iter); - + line_str = g_strdup_printf ("%d", line + 1); - - gtk_entry_set_text (GTK_ENTRY (view->priv->search_entry), + + gtk_entry_set_text (GTK_ENTRY (view->priv->search_entry), line_str); - + g_free (line_str); - + return; } else @@ -1817,7 +1817,7 @@ init_search_entry (PlumaView *view) guint old_find_flags = 0; gint sel_len = 0; - old_find_text = pluma_document_get_search_text (PLUMA_DOCUMENT (buffer), + old_find_text = pluma_document_get_search_text (PLUMA_DOCUMENT (buffer), &old_find_flags); if (old_find_text != NULL) { @@ -1831,21 +1831,21 @@ init_search_entry (PlumaView *view) view->priv->old_search_flags = old_find_flags; } - selection_exists = get_selected_text (buffer, - &find_text, + selection_exists = get_selected_text (buffer, + &find_text, &sel_len); - + if (selection_exists && (find_text != NULL) && (sel_len <= 160)) { - gtk_entry_set_text (GTK_ENTRY (view->priv->search_entry), - find_text); + gtk_entry_set_text (GTK_ENTRY (view->priv->search_entry), + find_text); } else { - gtk_entry_set_text (GTK_ENTRY (view->priv->search_entry), + gtk_entry_set_text (GTK_ENTRY (view->priv->search_entry), ""); } - + g_free (find_text); } } @@ -1866,11 +1866,11 @@ search_init (GtkWidget *entry, (GSourceFunc)search_entry_flush_timeout, view); } - + doc = PLUMA_DOCUMENT (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view))); - + entry_text = gtk_entry_get_text (GTK_ENTRY (entry)); - + if (view->priv->search_mode == SEARCH) { gchar *search_text; @@ -1882,7 +1882,7 @@ search_init (GtkWidget *entry, (strcmp (search_text, entry_text) != 0) || search_flags != view->priv->search_flags) { - pluma_document_set_search_text (doc, + pluma_document_set_search_text (doc, entry_text, view->priv->search_flags); } @@ -1905,9 +1905,9 @@ search_init (GtkWidget *entry, gint line_offset = 0; gchar **split_text = NULL; const gchar *text; - + split_text = g_strsplit (entry_text, ":", -1); - + if (g_strv_length (split_text) > 1) { text = split_text[0]; @@ -1916,41 +1916,41 @@ search_init (GtkWidget *entry, { text = entry_text; } - + if (*text == '-') { gint cur_line = gtk_text_iter_get_line (&view->priv->start_search_iter); - + if (*(text + 1) != '\0') offset_line = MAX (atoi (text + 1), 0); - + line = MAX (cur_line - offset_line, 0); } else if (*entry_text == '+') { gint cur_line = gtk_text_iter_get_line (&view->priv->start_search_iter); - + if (*(text + 1) != '\0') offset_line = MAX (atoi (text + 1), 0); - + line = cur_line + offset_line; } else { line = MAX (atoi (text) - 1, 0); } - + if (split_text[1] != NULL) { line_offset = atoi (split_text[1]); } - + g_strfreev (split_text); - + moved = pluma_document_goto_line (doc, line); moved_offset = pluma_document_goto_line_offset (doc, line, line_offset); - + pluma_view_scroll_to_cursor (view); if (!moved || !moved_offset) @@ -1965,9 +1965,9 @@ search_init (GtkWidget *entry, static gboolean start_interactive_search_real (PlumaView *view) -{ +{ GtkTextBuffer *buffer; - + if ((view->priv->search_window != NULL) && gtk_widget_get_visible (view->priv->search_window)) return TRUE; @@ -2001,44 +2001,44 @@ start_interactive_search_real (PlumaView *view) init_search_entry (view); - view->priv->typeselect_flush_timeout = + view->priv->typeselect_flush_timeout = g_timeout_add (PLUMA_VIEW_SEARCH_DIALOG_TIMEOUT, (GSourceFunc) search_entry_flush_timeout, view); gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE); gtk_widget_grab_focus (view->priv->search_entry); - + send_focus_change (view->priv->search_entry, TRUE); - + return TRUE; } static gboolean reset_searched_text (PlumaView *view) -{ +{ PlumaDocument *doc; doc = PLUMA_DOCUMENT (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view))); - + pluma_document_set_search_text (doc, "", PLUMA_SEARCH_DONT_SET_FLAGS); - + return TRUE; } static gboolean start_interactive_search (PlumaView *view) -{ +{ view->priv->search_mode = SEARCH; - + return start_interactive_search_real (view); } -static gboolean +static gboolean start_interactive_goto_line (PlumaView *view) { view->priv->search_mode = GOTO_LINE; - + return start_interactive_search_real (view); } @@ -2049,9 +2049,9 @@ pluma_view_draw (GtkWidget *widget, GtkTextView *text_view; PlumaDocument *doc; GdkWindow *window; - + text_view = GTK_TEXT_VIEW (widget); - + doc = PLUMA_DOCUMENT (gtk_text_view_get_buffer (text_view)); window = gtk_text_view_get_window (text_view, GTK_TEXT_WINDOW_TEXT); if (gtk_cairo_should_draw_window (cr, window) && @@ -2059,7 +2059,7 @@ pluma_view_draw (GtkWidget *widget, { GdkRectangle visible_rect; GtkTextIter iter1, iter2; - + gtk_text_view_get_visible_rect (text_view, &visible_rect); gtk_text_view_get_line_at_y (text_view, &iter1, visible_rect.y, NULL); @@ -2067,7 +2067,7 @@ pluma_view_draw (GtkWidget *widget, visible_rect.y + visible_rect.height, NULL); gtk_text_iter_forward_line (&iter2); - + _pluma_document_search_region (doc, &iter1, &iter2); @@ -2082,14 +2082,14 @@ drag_get_uri_target (GtkWidget *widget, { GdkAtom target; GtkTargetList *tl; - + tl = gtk_target_list_new (NULL, 0); gtk_target_list_add_uri_targets (tl, 0); - + target = gtk_drag_dest_find_target (widget, context, tl); gtk_target_list_unref (tl); - - return target; + + return target; } static gboolean @@ -2101,13 +2101,13 @@ pluma_view_drag_motion (GtkWidget *widget, { gboolean result; - /* Chain up to allow textview to scroll and position dnd mark, note + /* Chain up to allow textview to scroll and position dnd mark, note * that this needs to be checked if gtksourceview or gtktextview * changes drag_motion behaviour */ result = GTK_WIDGET_CLASS (pluma_view_parent_class)->drag_motion (widget, context, x, y, timestamp); /* If this is a URL, deal with it here */ - if (drag_get_uri_target (widget, context) != GDK_NONE) + if (drag_get_uri_target (widget, context) != GDK_NONE) { gdk_drag_status (context, gdk_drag_context_get_suggested_action (context), @@ -2128,17 +2128,17 @@ pluma_view_drag_data_received (GtkWidget *widget, guint timestamp) { gchar **uri_list; - + /* If this is an URL emit DROP_URIS, otherwise chain up the signal */ if (info == TARGET_URI_LIST) { uri_list = pluma_utils_drop_get_uris (selection_data); - + if (uri_list != NULL) { g_signal_emit (widget, view_signals[DROP_URIS], 0, uri_list); g_strfreev (uri_list); - + gtk_drag_finish (context, TRUE, FALSE, timestamp); } } @@ -2200,9 +2200,9 @@ create_line_numbers_menu (GtkWidget *view) g_signal_connect (item, "toggled", G_CALLBACK (show_line_numbers_toggled), view); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); - + gtk_widget_show_all (menu); - + return menu; } @@ -2232,7 +2232,7 @@ pluma_view_button_press_event (GtkWidget *widget, GdkEventButton *event) else gtk_clipboard_set_text (gtk_clipboard_get (GDK_SELECTION_PRIMARY), primtxt, strlen (primtxt)); - if ((event->type == GDK_BUTTON_PRESS) && + if ((event->type == GDK_BUTTON_PRESS) && (event->window == gtk_text_view_get_window (GTK_TEXT_VIEW (widget), GTK_TEXT_WINDOW_LEFT))) { @@ -2275,27 +2275,27 @@ pluma_view_populate_popup (GtkTextView *text_view, GtkWidget *widget) middle_or_right_down = FALSE; } -static void +static void search_highlight_updated_cb (PlumaDocument *doc, GtkTextIter *start, GtkTextIter *end, PlumaView *view) { GdkRectangle visible_rect; - GdkRectangle updated_rect; + GdkRectangle updated_rect; GdkRectangle redraw_rect; gint y; gint height; GtkTextView *text_view; - + text_view = GTK_TEXT_VIEW (view); g_return_if_fail (pluma_document_get_enable_search_highlighting ( PLUMA_DOCUMENT (gtk_text_view_get_buffer (text_view)))); - + /* get visible area */ gtk_text_view_get_visible_rect (text_view, &visible_rect); - + /* get updated rectangle */ gtk_text_view_get_line_yrange (text_view, start, &y, &height); updated_rect.y = y; @@ -2305,20 +2305,20 @@ search_highlight_updated_cb (PlumaDocument *doc, updated_rect.width = visible_rect.width; /* intersect both rectangles to see whether we need to queue a redraw */ - if (gdk_rectangle_intersect (&updated_rect, &visible_rect, &redraw_rect)) + if (gdk_rectangle_intersect (&updated_rect, &visible_rect, &redraw_rect)) { GdkRectangle widget_rect; - + gtk_text_view_buffer_to_window_coords (text_view, GTK_TEXT_WINDOW_WIDGET, redraw_rect.x, redraw_rect.y, &widget_rect.x, &widget_rect.y); - + widget_rect.width = redraw_rect.width; widget_rect.height = redraw_rect.height; - + gtk_widget_queue_draw_area (GTK_WIDGET (text_view), widget_rect.x, widget_rect.y, @@ -2344,39 +2344,39 @@ delete_line (GtkTextView *text_view, if (gtk_text_buffer_get_selection_bounds (buffer, &start, &end)) { gtk_text_iter_order (&start, &end); - + if (gtk_text_iter_starts_line (&end)) { /* Do no delete the line with the cursor if the cursor * is at the beginning of the line */ count = 0; } - else + else count = 1; } - + gtk_text_iter_set_line_offset (&start, 0); if (count > 0) - { + { gtk_text_iter_forward_lines (&end, count); if (gtk_text_iter_is_end (&end)) - { + { if (gtk_text_iter_backward_line (&start) && !gtk_text_iter_ends_line (&start)) gtk_text_iter_forward_to_line_end (&start); } } - else if (count < 0) + else if (count < 0) { if (!gtk_text_iter_ends_line (&end)) gtk_text_iter_forward_to_line_end (&end); - while (count < 0) + while (count < 0) { if (!gtk_text_iter_backward_line (&start)) break; - + ++count; } @@ -2393,12 +2393,12 @@ delete_line (GtkTextView *text_view, { GtkTextIter cur = start; gtk_text_iter_set_line_offset (&cur, 0); - + gtk_text_buffer_begin_user_action (buffer); gtk_text_buffer_place_cursor (buffer, &cur); - gtk_text_buffer_delete_interactive (buffer, + gtk_text_buffer_delete_interactive (buffer, &start, &end, gtk_text_view_get_editable (text_view)); diff --git a/pluma/pluma-view.h b/pluma/pluma-view.h index c259f394..4caf2af2 100644 --- a/pluma/pluma-view.h +++ b/pluma/pluma-view.h @@ -4,7 +4,7 @@ * * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi - * 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 @@ -18,14 +18,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, 1998-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, 1998-2005. See the AUTHORS file for a + * list of people on the pluma Team. + * See the ChangeLog files for a list of changes. */ #ifndef __PLUMA_VIEW_H__ diff --git a/pluma/pluma-window-private.h b/pluma/pluma-window-private.h index 3c36a499..3d983008 100644 --- a/pluma/pluma-window-private.h +++ b/pluma/pluma-window-private.h @@ -2,7 +2,7 @@ * pluma-window-private.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$ */ @@ -50,7 +50,7 @@ struct _PlumaWindowPrivate GtkWidget *hpaned; GtkWidget *vpaned; - + GtkWidget *tab_width_combo; GtkWidget *language_combo; diff --git a/pluma/pluma-window.c b/pluma/pluma-window.c index 718a507e..d336df98 100644 --- a/pluma/pluma-window.c +++ b/pluma/pluma-window.c @@ -2,7 +2,7 @@ * pluma-window.c * 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$ */ @@ -117,10 +117,10 @@ pluma_window_get_property (GObject *object, case PROP_STATE: g_value_set_enum (value, pluma_window_get_state (window)); - break; + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; + break; } } @@ -148,7 +148,7 @@ save_panes_state (PlumaWindow *window) pluma_prefs_manager_side_panel_active_page_can_set ()) pluma_prefs_manager_set_side_panel_active_page (pane_page); - if ((window->priv->bottom_panel_size > 0) && + if ((window->priv->bottom_panel_size > 0) && pluma_prefs_manager_bottom_panel_size_can_set ()) pluma_prefs_manager_set_bottom_panel_size ( window->priv->bottom_panel_size); @@ -207,7 +207,7 @@ pluma_window_dispose (GObject *object) if (window->priv->fullscreen_controls != NULL) { gtk_widget_destroy (window->priv->fullscreen_controls); - + window->priv->fullscreen_controls = NULL; } @@ -238,7 +238,7 @@ pluma_window_dispose (GObject *object) g_object_unref (window->priv->window_group); window->priv->window_group = NULL; } - + /* Now that there have broken some reference loops, * force collection again. */ @@ -250,7 +250,7 @@ pluma_window_dispose (GObject *object) static void pluma_window_finalize (GObject *object) { - PlumaWindow *window; + PlumaWindow *window; pluma_debug (DEBUG_WINDOW); @@ -273,7 +273,7 @@ pluma_window_window_state_event (GtkWidget *widget, return FALSE; } -static gboolean +static gboolean pluma_window_configure_event (GtkWidget *widget, GdkEventConfigure *event) { @@ -397,7 +397,7 @@ pluma_window_key_press_event (GtkWidget *widget, static void pluma_window_tab_removed (PlumaWindow *window, - PlumaTab *tab) + PlumaTab *tab) { peas_engine_garbage_collect (PEAS_ENGINE (pluma_plugins_engine_get_default ())); } @@ -465,7 +465,7 @@ pluma_window_class_init (PlumaWindowClass *klass) NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, - 0); + 0); g_object_class_install_property (object_class, PROP_STATE, @@ -580,12 +580,12 @@ set_toolbar_style (PlumaWindow *window, gboolean visible; PlumaToolbarSetting style; GtkAction *action; - + if (origin == NULL) visible = pluma_prefs_manager_get_toolbar_visible (); else visible = gtk_widget_get_visible (origin->priv->toolbar); - + /* Set visibility */ if (visible) gtk_widget_show (window->priv->toolbar); @@ -603,11 +603,11 @@ set_toolbar_style (PlumaWindow *window, style = pluma_prefs_manager_get_toolbar_buttons_style (); else style = origin->priv->toolbar_style; - + window->priv->toolbar_style = style; - + apply_toolbar_style (window, window->priv->toolbar); - + return visible; } @@ -618,21 +618,21 @@ update_next_prev_doc_sensitivity (PlumaWindow *window, gint tab_number; GtkNotebook *notebook; GtkAction *action; - + pluma_debug (DEBUG_WINDOW); - + notebook = GTK_NOTEBOOK (_pluma_window_get_notebook (window)); - + tab_number = gtk_notebook_page_num (notebook, GTK_WIDGET (tab)); g_return_if_fail (tab_number >= 0); - + action = gtk_action_group_get_action (window->priv->action_group, "DocumentsPreviousDocument"); gtk_action_set_sensitive (action, tab_number != 0); - + action = gtk_action_group_get_action (window->priv->action_group, "DocumentsNextDocument"); - gtk_action_set_sensitive (action, + gtk_action_set_sensitive (action, tab_number < gtk_notebook_get_n_pages (notebook) - 1); } @@ -641,25 +641,25 @@ update_next_prev_doc_sensitivity_per_window (PlumaWindow *window) { PlumaTab *tab; GtkAction *action; - + pluma_debug (DEBUG_WINDOW); - + tab = pluma_window_get_active_tab (window); if (tab != NULL) { update_next_prev_doc_sensitivity (window, tab); - + return; } - + action = gtk_action_group_get_action (window->priv->action_group, "DocumentsPreviousDocument"); gtk_action_set_sensitive (action, FALSE); - + action = gtk_action_group_get_action (window->priv->action_group, "DocumentsNextDocument"); gtk_action_set_sensitive (action, FALSE); - + } static void @@ -800,7 +800,7 @@ set_sensitivity_according_to_tab (PlumaWindow *window, (state_normal || (state == PLUMA_TAB_STATE_SHOWING_PRINT_PREVIEW)) && !(lockdown & PLUMA_LOCKDOWN_PRINTING)); - + action = gtk_action_group_get_action (window->priv->close_action_group, "FileClose"); @@ -814,13 +814,13 @@ set_sensitivity_according_to_tab (PlumaWindow *window, action = gtk_action_group_get_action (window->priv->action_group, "EditUndo"); - gtk_action_set_sensitive (action, + gtk_action_set_sensitive (action, state_normal && gtk_source_buffer_can_undo (GTK_SOURCE_BUFFER (doc))); action = gtk_action_group_get_action (window->priv->action_group, "EditRedo"); - gtk_action_set_sensitive (action, + gtk_action_set_sensitive (action, state_normal && gtk_source_buffer_can_redo (GTK_SOURCE_BUFFER (doc))); @@ -837,7 +837,7 @@ set_sensitivity_according_to_tab (PlumaWindow *window, (state_normal || state == PLUMA_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION) && gtk_text_buffer_get_has_selection (GTK_TEXT_BUFFER (doc))); - + action = gtk_action_group_get_action (window->priv->action_group, "EditPaste"); if (state_normal && editable) @@ -899,10 +899,10 @@ set_sensitivity_according_to_tab (PlumaWindow *window, gtk_action_set_sensitive (action, (state_normal || state == PLUMA_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION)); - + action = gtk_action_group_get_action (window->priv->action_group, "ViewHighlightMode"); - gtk_action_set_sensitive (action, + gtk_action_set_sensitive (action, (state != PLUMA_TAB_STATE_CLOSING) && pluma_prefs_manager_get_enable_syntax_highlighting ()); @@ -927,7 +927,7 @@ language_toggled (GtkToggleAction *action, return; lang_id = gtk_action_get_name (GTK_ACTION (action)); - + if (strcmp (lang_id, LANGUAGE_NONE) == 0) { /* Normal (no highlighting) */ @@ -988,14 +988,14 @@ create_language_menu_item (GtkSourceLanguage *lang, if (section_action == NULL) { gchar *section_name; - + section_name = pluma_utils_escape_underscores (section, -1); - + section_action = gtk_action_new (escaped_section, section_name, NULL, NULL); - + g_free (section_name); gtk_action_group_add_action (window->priv->languages_action_group, @@ -1014,9 +1014,9 @@ create_language_menu_item (GtkSourceLanguage *lang, /* now add the language item to the section */ lang_name = gtk_source_language_get_name (lang); lang_id = gtk_source_language_get_id (lang); - + escaped_lang_name = pluma_utils_escape_underscores (lang_name, -1); - + tip = g_strdup_printf (_("Use %s highlight mode"), lang_name); path = g_strdup_printf ("/MenuBar/ViewMenu/ViewHighlightModeMenu/LanguagesMenuPlaceholder/%s", escaped_section); @@ -1049,7 +1049,7 @@ create_language_menu_item (GtkSourceLanguage *lang, gtk_ui_manager_add_ui (window->priv->manager, ui_id, path, - lang_id, + lang_id, lang_id, GTK_UI_MANAGER_MENUITEM, FALSE); @@ -1071,8 +1071,8 @@ create_languages_menu (PlumaWindow *window) pluma_debug (DEBUG_WINDOW); /* add the "Plain Text" item before all the others */ - - /* Translators: "Plain Text" means that no highlight mode is selected in the + + /* Translators: "Plain Text" means that no highlight mode is selected in the * "View->Highlight Mode" submenu and so syntax highlighting is disabled */ action_none = gtk_radio_action_new (LANGUAGE_NONE, _("Plain Text"), _("Disable syntax highlighting"), @@ -1093,7 +1093,7 @@ create_languages_menu (PlumaWindow *window) gtk_ui_manager_add_ui (window->priv->manager, id, "/MenuBar/ViewMenu/ViewHighlightModeMenu/LanguagesMenuPlaceholder", - LANGUAGE_NONE, + LANGUAGE_NONE, LANGUAGE_NONE, GTK_UI_MANAGER_MENUITEM, TRUE); @@ -1342,11 +1342,11 @@ update_recent_files_menu (PlumaWindow *window) escaped = pluma_utils_escape_underscores (display_name, -1); if (i >= 10) label = g_strdup_printf ("%d. %s", - i, + i, escaped); else label = g_strdup_printf ("_%d. %s", - i, + i, escaped); g_free (escaped); @@ -1454,7 +1454,7 @@ setup_toolbar_open_button (PlumaWindow *window, "item_activated", G_CALLBACK (recent_chooser_item_activated), window); - + /* add the custom Open button to the toolbar */ open_button = gtk_menu_tool_button_new (gtk_image_new_from_icon_name ("document-open", GTK_ICON_SIZE_MENU), @@ -1478,12 +1478,12 @@ setup_toolbar_open_button (PlumaWindow *window, gtk_toolbar_insert (GTK_TOOLBAR (toolbar), open_button, 1); - + return toolbar_recent_menu; } static void -create_menu_bar_and_toolbar (PlumaWindow *window, +create_menu_bar_and_toolbar (PlumaWindow *window, GtkWidget *main_box) { GtkActionGroup *action_group; @@ -1625,10 +1625,10 @@ create_menu_bar_and_toolbar (PlumaWindow *window, g_object_unref (action_group); window->priv->menubar = gtk_ui_manager_get_widget (manager, "/MenuBar"); - gtk_box_pack_start (GTK_BOX (main_box), + gtk_box_pack_start (GTK_BOX (main_box), window->priv->menubar, - FALSE, - FALSE, + FALSE, + FALSE, 0); window->priv->toolbar = gtk_ui_manager_get_widget (manager, "/ToolBar"); @@ -1641,7 +1641,7 @@ create_menu_bar_and_toolbar (PlumaWindow *window, 0); set_toolbar_style (window, NULL); - + window->priv->toolbar_recent_menu = setup_toolbar_open_button (window, window->priv->toolbar); @@ -1689,7 +1689,7 @@ get_menu_tip_for_tab (PlumaTab *tab) /* Translators: %s is a URI */ tip = g_strdup_printf (_("Activate '%s'"), ruri); g_free (ruri); - + return tip; } @@ -1801,7 +1801,7 @@ set_statusbar_style (PlumaWindow *window, PlumaWindow *origin) { GtkAction *action; - + gboolean visible; if (origin == NULL) @@ -1816,10 +1816,10 @@ set_statusbar_style (PlumaWindow *window, action = gtk_action_group_get_action (window->priv->always_sensitive_action_group, "ViewStatusbar"); - + if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)) != visible) gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), visible); - + return visible; } @@ -1849,17 +1849,17 @@ tab_width_combo_changed (PlumaStatusComboBox *combo, { PlumaView *view; guint width_data = 0; - + view = pluma_window_get_active_view (window); - + if (!view) return; - + width_data = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (item), TAB_WIDTH_DATA)); - + if (width_data == 0) return; - + g_signal_handler_block (view, window->priv->tab_width_id); gtk_source_view_set_tab_width (GTK_SOURCE_VIEW (view), width_data); g_signal_handler_unblock (view, window->priv->tab_width_id); @@ -1870,9 +1870,9 @@ use_spaces_toggled (GtkCheckMenuItem *item, PlumaWindow *window) { PlumaView *view; - + view = pluma_window_get_active_view (window); - + g_signal_handler_block (view, window->priv->spaces_instead_of_tabs_id); gtk_source_view_set_insert_spaces_instead_of_tabs ( GTK_SOURCE_VIEW (view), @@ -1887,14 +1887,14 @@ language_combo_changed (PlumaStatusComboBox *combo, { PlumaDocument *doc; GtkSourceLanguage *language; - + doc = pluma_window_get_active_document (window); - + if (!doc) return; - + language = GTK_SOURCE_LANGUAGE (g_object_get_data (G_OBJECT (item), LANGUAGE_DATA)); - + g_signal_handler_block (doc, window->priv->language_changed_id); pluma_document_set_language (doc, language); g_signal_handler_unblock (doc, window->priv->language_changed_id); @@ -1905,7 +1905,7 @@ typedef struct const gchar *label; guint width; } TabWidthDefinition; - + static void fill_tab_width_combo (PlumaWindow *window) { @@ -1916,16 +1916,16 @@ fill_tab_width_combo (PlumaWindow *window) {"", 0}, /* custom size */ {NULL, 0} }; - + PlumaStatusComboBox *combo = PLUMA_STATUS_COMBO_BOX (window->priv->tab_width_combo); guint i = 0; GtkWidget *item; - + while (defs[i].label != NULL) { item = gtk_menu_item_new_with_label (defs[i].label); g_object_set_data (G_OBJECT (item), TAB_WIDTH_DATA, GINT_TO_POINTER (defs[i].width)); - + pluma_status_combo_box_add_item (combo, GTK_MENU_ITEM (item), defs[i].label); @@ -1935,18 +1935,18 @@ fill_tab_width_combo (PlumaWindow *window) ++i; } - + item = gtk_separator_menu_item_new (); pluma_status_combo_box_add_item (combo, GTK_MENU_ITEM (item), NULL); gtk_widget_show (item); - + item = gtk_check_menu_item_new_with_label (_("Use Spaces")); pluma_status_combo_box_add_item (combo, GTK_MENU_ITEM (item), NULL); gtk_widget_show (item); - - g_signal_connect (item, - "toggled", - G_CALLBACK (use_spaces_toggled), + + g_signal_connect (item, + "toggled", + G_CALLBACK (use_spaces_toggled), window); } @@ -1958,14 +1958,14 @@ fill_language_combo (PlumaWindow *window) GSList *item; GtkWidget *menu_item; const gchar *name; - + manager = pluma_get_language_manager (); languages = pluma_language_manager_list_languages_sorted (manager, FALSE); name = _("Plain Text"); menu_item = gtk_menu_item_new_with_label (name); gtk_widget_show (menu_item); - + g_object_set_data (G_OBJECT (menu_item), LANGUAGE_DATA, NULL); pluma_status_combo_box_add_item (PLUMA_STATUS_COMBO_BOX (window->priv->language_combo), GTK_MENU_ITEM (menu_item), @@ -1974,13 +1974,13 @@ fill_language_combo (PlumaWindow *window) for (item = languages; item; item = item->next) { GtkSourceLanguage *lang = GTK_SOURCE_LANGUAGE (item->data); - + name = gtk_source_language_get_name (lang); menu_item = gtk_menu_item_new_with_label (name); gtk_widget_show (menu_item); - + g_object_set_data_full (G_OBJECT (menu_item), - LANGUAGE_DATA, + LANGUAGE_DATA, g_object_ref (lang), (GDestroyNotify)g_object_unref); @@ -1988,12 +1988,12 @@ fill_language_combo (PlumaWindow *window) GTK_MENU_ITEM (menu_item), name); } - + g_slist_free (languages); } static void -create_statusbar (PlumaWindow *window, +create_statusbar (PlumaWindow *window, GtkWidget *main_box) { pluma_debug (DEBUG_WINDOW); @@ -2007,8 +2007,8 @@ create_statusbar (PlumaWindow *window, gtk_box_pack_end (GTK_BOX (main_box), window->priv->statusbar, - FALSE, - TRUE, + FALSE, + TRUE, 0); window->priv->tab_width_combo = pluma_status_combo_box_new (_("Tab Width")); @@ -2025,7 +2025,7 @@ create_statusbar (PlumaWindow *window, "changed", G_CALLBACK (tab_width_combo_changed), window); - + window->priv->language_combo = pluma_status_combo_box_new (NULL); gtk_widget_show (window->priv->language_combo); gtk_box_pack_end (GTK_BOX (window->priv->statusbar), @@ -2061,7 +2061,7 @@ clone_window (PlumaWindow *origin) PlumaApp *app; gint panel_page; - pluma_debug (DEBUG_WINDOW); + pluma_debug (DEBUG_WINDOW); app = pluma_app_get_default (); @@ -2083,7 +2083,7 @@ clone_window (PlumaWindow *origin) origin->priv->height); gtk_window_unmaximize (GTK_WINDOW (window)); - } + } if ((origin->priv->window_state & GDK_WINDOW_STATE_STICKY ) != 0) gtk_window_stick (GTK_WINDOW (window)); @@ -2091,7 +2091,7 @@ clone_window (PlumaWindow *origin) gtk_window_unstick (GTK_WINDOW (window)); /* set the panes size, the paned position will be set when - * they are mapped */ + * they are mapped */ window->priv->side_panel_size = origin->priv->side_panel_size; window->priv->bottom_panel_size = origin->priv->bottom_panel_size; @@ -2120,7 +2120,7 @@ clone_window (PlumaWindow *origin) } static void -update_cursor_position_statusbar (GtkTextBuffer *buffer, +update_cursor_position_statusbar (GtkTextBuffer *buffer, PlumaWindow *window) { gint row, col; @@ -2130,18 +2130,18 @@ update_cursor_position_statusbar (GtkTextBuffer *buffer, PlumaView *view; pluma_debug (DEBUG_WINDOW); - + if (buffer != GTK_TEXT_BUFFER (pluma_window_get_active_document (window))) return; - + view = pluma_window_get_active_view (window); - + gtk_text_buffer_get_iter_at_mark (buffer, &iter, gtk_text_buffer_get_insert (buffer)); - + row = gtk_text_iter_get_line (&iter); - + start = iter; gtk_text_iter_set_line_offset (&start, 0); col = 0; @@ -2152,14 +2152,14 @@ update_cursor_position_statusbar (GtkTextBuffer *buffer, { /* FIXME: Are we Unicode compliant here? */ if (gtk_text_iter_get_char (&start) == '\t') - + col += (tab_size - (col % tab_size)); else ++col; gtk_text_iter_forward_char (&start); } - + pluma_statusbar_set_cursor_position ( PLUMA_STATUSBAR (window->priv->statusbar), row + 1, @@ -2167,12 +2167,12 @@ update_cursor_position_statusbar (GtkTextBuffer *buffer, } static void -update_overwrite_mode_statusbar (GtkTextView *view, +update_overwrite_mode_statusbar (GtkTextView *view, PlumaWindow *window) { if (view != GTK_TEXT_VIEW (pluma_window_get_active_view (window))) return; - + /* Note that we have to use !gtk_text_view_get_overwrite since we are in the in the signal handler of "toggle overwrite" that is G_SIGNAL_RUN_LAST @@ -2184,7 +2184,7 @@ update_overwrite_mode_statusbar (GtkTextView *view, #define MAX_TITLE_LENGTH 100 -static void +static void set_title (PlumaWindow *window) { PlumaDocument *doc = NULL; @@ -2237,7 +2237,7 @@ set_title (PlumaWindow *window) * we have a title long 99 + 20, but I think it's a rare enough * case to be acceptable. It's justa darn title afterall :) */ - dirname = pluma_utils_str_middle_truncate (str, + dirname = pluma_utils_str_middle_truncate (str, MAX (20, MAX_TITLE_LENGTH - len)); g_free (str); } @@ -2246,33 +2246,33 @@ set_title (PlumaWindow *window) if (gtk_text_buffer_get_modified (GTK_TEXT_BUFFER (doc))) { gchar *tmp_name; - + tmp_name = g_strdup_printf ("*%s", name); g_free (name); - + name = tmp_name; cansave = TRUE; } else cansave = FALSE; - if (pluma_document_get_readonly (doc)) + if (pluma_document_get_readonly (doc)) { if (dirname != NULL) title = g_strdup_printf ("%s [%s] (%s) - Pluma", - name, - _("Read-Only"), + name, + _("Read-Only"), dirname); else title = g_strdup_printf ("%s [%s] - Pluma", - name, + name, _("Read-Only")); - } - else + } + else { if (dirname != NULL) title = g_strdup_printf ("%s (%s) - Pluma", - name, + name, dirname); else title = g_strdup_printf ("%s - Pluma", @@ -2296,15 +2296,15 @@ static void set_tab_width_item_blocked (PlumaWindow *window, GtkMenuItem *item) { - g_signal_handlers_block_by_func (window->priv->tab_width_combo, - tab_width_combo_changed, + g_signal_handlers_block_by_func (window->priv->tab_width_combo, + tab_width_combo_changed, window); - + pluma_status_combo_box_set_item (PLUMA_STATUS_COMBO_BOX (window->priv->tab_width_combo), item); - - g_signal_handlers_unblock_by_func (window->priv->tab_width_combo, - tab_width_combo_changed, + + g_signal_handlers_unblock_by_func (window->priv->tab_width_combo, + tab_width_combo_changed, window); } @@ -2319,12 +2319,12 @@ spaces_instead_of_tabs_changed (GObject *object, GList *children = pluma_status_combo_box_get_items ( PLUMA_STATUS_COMBO_BOX (window->priv->tab_width_combo)); GtkCheckMenuItem *item; - + item = GTK_CHECK_MENU_ITEM (g_list_last (children)->data); - + gtk_check_menu_item_set_active (item, active); - - g_list_free (children); + + g_list_free (children); } static void @@ -2341,32 +2341,32 @@ tab_width_changed (GObject *object, items = pluma_status_combo_box_get_items (combo); new_tab_width = gtk_source_view_get_tab_width (GTK_SOURCE_VIEW (object)); - + for (item = items; item; item = item->next) { guint tab_width = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (item->data), TAB_WIDTH_DATA)); - + if (tab_width == new_tab_width) { set_tab_width_item_blocked (window, GTK_MENU_ITEM (item->data)); found = TRUE; } - + if (GTK_IS_SEPARATOR_MENU_ITEM (item->next->data)) { if (!found) { /* Set for the last item the custom thing */ gchar *text; - + text = g_strdup_printf ("%u", new_tab_width); - pluma_status_combo_box_set_item_text (combo, + pluma_status_combo_box_set_item_text (combo, GTK_MENU_ITEM (item->data), text); gtk_label_set_text (GTK_LABEL (gtk_bin_get_child (GTK_BIN (item->data))), text); - + set_tab_width_item_blocked (window, GTK_MENU_ITEM (item->data)); gtk_widget_show (GTK_WIDGET (item->data)); } @@ -2374,11 +2374,11 @@ tab_width_changed (GObject *object, { gtk_widget_hide (GTK_WIDGET (item->data)); } - + break; } } - + g_list_free (items); } @@ -2392,33 +2392,33 @@ language_changed (GObject *object, PlumaStatusComboBox *combo = PLUMA_STATUS_COMBO_BOX (window->priv->language_combo); GtkSourceLanguage *new_language; const gchar *new_id; - + items = pluma_status_combo_box_get_items (combo); new_language = gtk_source_buffer_get_language (GTK_SOURCE_BUFFER (object)); - + if (new_language) new_id = gtk_source_language_get_id (new_language); else new_id = NULL; - + for (item = items; item; item = item->next) { GtkSourceLanguage *lang = g_object_get_data (G_OBJECT (item->data), LANGUAGE_DATA); - - if ((new_id == NULL && lang == NULL) || + + if ((new_id == NULL && lang == NULL) || (new_id != NULL && lang != NULL && strcmp (gtk_source_language_get_id (lang), new_id) == 0)) { - g_signal_handlers_block_by_func (window->priv->language_combo, - language_combo_changed, + g_signal_handlers_block_by_func (window->priv->language_combo, + language_combo_changed, window); - + pluma_status_combo_box_set_item (PLUMA_STATUS_COMBO_BOX (window->priv->language_combo), GTK_MENU_ITEM (item->data)); - g_signal_handlers_unblock_by_func (window->priv->language_combo, - language_combo_changed, + g_signal_handlers_unblock_by_func (window->priv->language_combo, + language_combo_changed, window); } } @@ -2426,44 +2426,44 @@ language_changed (GObject *object, g_list_free (items); } -static void +static void notebook_switch_page (GtkNotebook *book, GtkWidget *pg, - gint page_num, + gint page_num, PlumaWindow *window) { PlumaView *view; PlumaTab *tab; GtkAction *action; gchar *action_name; - + /* CHECK: I don't know why but it seems notebook_switch_page is called two times every time the user change the active tab */ - + tab = PLUMA_TAB (gtk_notebook_get_nth_page (book, page_num)); if (tab == window->priv->active_tab) return; - + if (window->priv->active_tab) { if (window->priv->tab_width_id) { - g_signal_handler_disconnect (pluma_tab_get_view (window->priv->active_tab), + g_signal_handler_disconnect (pluma_tab_get_view (window->priv->active_tab), window->priv->tab_width_id); - + window->priv->tab_width_id = 0; } - + if (window->priv->spaces_instead_of_tabs_id) { - g_signal_handler_disconnect (pluma_tab_get_view (window->priv->active_tab), + g_signal_handler_disconnect (pluma_tab_get_view (window->priv->active_tab), window->priv->spaces_instead_of_tabs_id); - + window->priv->spaces_instead_of_tabs_id = 0; } } - - /* set the active tab */ + + /* set the active tab */ window->priv->active_tab = tab; set_title (window); @@ -2497,12 +2497,12 @@ notebook_switch_page (GtkNotebook *book, gtk_widget_show (window->priv->tab_width_combo); gtk_widget_show (window->priv->language_combo); - window->priv->tab_width_id = g_signal_connect (view, - "notify::tab-width", + window->priv->tab_width_id = g_signal_connect (view, + "notify::tab-width", G_CALLBACK (tab_width_changed), window); - window->priv->spaces_instead_of_tabs_id = g_signal_connect (view, - "notify::insert-spaces-instead-of-tabs", + window->priv->spaces_instead_of_tabs_id = g_signal_connect (view, + "notify::insert-spaces-instead-of-tabs", G_CALLBACK (spaces_instead_of_tabs_changed), window); @@ -2516,10 +2516,10 @@ notebook_switch_page (GtkNotebook *book, spaces_instead_of_tabs_changed (G_OBJECT (view), NULL, window); language_changed (G_OBJECT (pluma_tab_get_document (tab)), NULL, window); - g_signal_emit (G_OBJECT (window), - signals[ACTIVE_TAB_CHANGED], - 0, - window->priv->active_tab); + g_signal_emit (G_OBJECT (window), + signals[ACTIVE_TAB_CHANGED], + 0, + window->priv->active_tab); } static void @@ -2541,24 +2541,24 @@ set_sensitivity_according_to_window_state (PlumaWindow *window) action = gtk_action_group_get_action (window->priv->action_group, "FileCloseAll"); - gtk_action_set_sensitive (action, + gtk_action_set_sensitive (action, !(window->priv->state & PLUMA_WINDOW_STATE_SAVING) && !(window->priv->state & PLUMA_WINDOW_STATE_PRINTING)); action = gtk_action_group_get_action (window->priv->action_group, "FileSaveAll"); - gtk_action_set_sensitive (action, + gtk_action_set_sensitive (action, !(window->priv->state & PLUMA_WINDOW_STATE_PRINTING) && !(lockdown & PLUMA_LOCKDOWN_SAVE_TO_DISK)); - + action = gtk_action_group_get_action (window->priv->always_sensitive_action_group, "FileNew"); - gtk_action_set_sensitive (action, + gtk_action_set_sensitive (action, !(window->priv->state & PLUMA_WINDOW_STATE_SAVING_SESSION)); - + action = gtk_action_group_get_action (window->priv->always_sensitive_action_group, "FileOpen"); - gtk_action_set_sensitive (action, + gtk_action_set_sensitive (action, !(window->priv->state & PLUMA_WINDOW_STATE_SAVING_SESSION)); gtk_action_group_set_sensitive (window->priv->recents_action_group, @@ -2566,7 +2566,7 @@ set_sensitivity_according_to_window_state (PlumaWindow *window) pluma_notebook_set_close_buttons_sensitive (PLUMA_NOTEBOOK (window->priv->notebook), !(window->priv->state & PLUMA_WINDOW_STATE_SAVING_SESSION)); - + pluma_notebook_set_tab_drag_and_drop_enabled (PLUMA_NOTEBOOK (window->priv->notebook), !(window->priv->state & PLUMA_WINDOW_STATE_SAVING_SESSION)); @@ -2625,43 +2625,43 @@ _pluma_window_set_lockdown (PlumaWindow *window, update_tab_autosave, &autosave); - /* update menues wrt the current active tab */ + /* update menues wrt the current active tab */ tab = pluma_window_get_active_tab (window); set_sensitivity_according_to_tab (window, tab); action = gtk_action_group_get_action (window->priv->action_group, "FileSaveAll"); - gtk_action_set_sensitive (action, + gtk_action_set_sensitive (action, !(window->priv->state & PLUMA_WINDOW_STATE_PRINTING) && !(lockdown & PLUMA_LOCKDOWN_SAVE_TO_DISK)); } static void -analyze_tab_state (PlumaTab *tab, +analyze_tab_state (PlumaTab *tab, PlumaWindow *window) { PlumaTabState ts; - + ts = pluma_tab_get_state (tab); - + switch (ts) { case PLUMA_TAB_STATE_LOADING: case PLUMA_TAB_STATE_REVERTING: window->priv->state |= PLUMA_WINDOW_STATE_LOADING; break; - + case PLUMA_TAB_STATE_SAVING: window->priv->state |= PLUMA_WINDOW_STATE_SAVING; break; - + case PLUMA_TAB_STATE_PRINTING: case PLUMA_TAB_STATE_PRINT_PREVIEWING: window->priv->state |= PLUMA_WINDOW_STATE_PRINTING; break; - + case PLUMA_TAB_STATE_LOADING_ERROR: case PLUMA_TAB_STATE_REVERTING_ERROR: case PLUMA_TAB_STATE_SAVING_ERROR: @@ -2670,7 +2670,7 @@ analyze_tab_state (PlumaTab *tab, ++window->priv->num_tabs_with_error; default: /* NOP */ - break; + break; } } @@ -2679,22 +2679,22 @@ update_window_state (PlumaWindow *window) { PlumaWindowState old_ws; gint old_num_of_errors; - + pluma_debug_message (DEBUG_WINDOW, "Old state: %x", window->priv->state); - + old_ws = window->priv->state; old_num_of_errors = window->priv->num_tabs_with_error; - + window->priv->state = old_ws & PLUMA_WINDOW_STATE_SAVING_SESSION; - + window->priv->num_tabs_with_error = 0; gtk_container_foreach (GTK_CONTAINER (window->priv->notebook), (GtkCallback)analyze_tab_state, window); - - pluma_debug_message (DEBUG_WINDOW, "New state: %x", window->priv->state); - + + pluma_debug_message (DEBUG_WINDOW, "New state: %x", window->priv->state); + if (old_ws != window->priv->state) { set_sensitivity_according_to_window_state (window); @@ -2702,14 +2702,14 @@ update_window_state (PlumaWindow *window) pluma_statusbar_set_window_state (PLUMA_STATUSBAR (window->priv->statusbar), window->priv->state, window->priv->num_tabs_with_error); - + g_object_notify (G_OBJECT (window), "state"); } else if (old_num_of_errors != window->priv->num_tabs_with_error) { pluma_statusbar_set_window_state (PLUMA_STATUSBAR (window->priv->statusbar), window->priv->state, - window->priv->num_tabs_with_error); + window->priv->num_tabs_with_error); } } @@ -2719,15 +2719,15 @@ sync_state (PlumaTab *tab, PlumaWindow *window) { pluma_debug (DEBUG_WINDOW); - + update_window_state (window); - + if (tab != window->priv->active_tab) return; set_sensitivity_according_to_tab (window, tab); - g_signal_emit (G_OBJECT (window), signals[ACTIVE_TAB_STATE_CHANGED], 0); + g_signal_emit (G_OBJECT (window), signals[ACTIVE_TAB_STATE_CHANGED], 0); } static void @@ -2787,7 +2787,7 @@ get_drop_window (GtkWidget *widget) if ((PLUMA_WINDOW(target_window)->priv->state & PLUMA_WINDOW_STATE_SAVING_SESSION) != 0) return NULL; - + return PLUMA_WINDOW (target_window); } @@ -2797,10 +2797,10 @@ load_uris_from_drop (PlumaWindow *window, { GSList *uris = NULL; gint i; - + if (uri_list == NULL) return; - + for (i = 0; uri_list[i] != NULL; ++i) { uris = g_slist_prepend (uris, uri_list[i]); @@ -2830,7 +2830,7 @@ drag_data_received_cb (GtkWidget *widget, gchar **uri_list; window = get_drop_window (widget); - + if (window == NULL) return; @@ -2850,7 +2850,7 @@ drop_uris_cb (GtkWidget *widget, PlumaWindow *window; window = get_drop_window (widget); - + if (window == NULL) return; @@ -2891,17 +2891,17 @@ run_fullscreen_animation (gpointer data) GdkDisplay *display; GdkRectangle fs_rect; gint x, y; - + screen = gtk_window_get_screen (GTK_WINDOW (window)); display = gdk_screen_get_display (screen); gdk_monitor_get_geometry (gdk_display_get_monitor_at_window (display, gtk_widget_get_window (GTK_WIDGET (window))), &fs_rect); - + gtk_window_get_position (GTK_WINDOW (window->priv->fullscreen_controls), &x, &y); - + if (window->priv->fullscreen_animation_enter) { if (y == fs_rect.y) @@ -2919,10 +2919,10 @@ run_fullscreen_animation (gpointer data) else { gint w, h; - + gtk_window_get_size (GTK_WINDOW (window->priv->fullscreen_controls), &w, &h); - + if (y == fs_rect.y - h + 1) { window->priv->fullscreen_animation_timeout_id = 0; @@ -3009,7 +3009,7 @@ on_fullscreen_controls_leave_notify_event (GtkWidget *widget, gtk_window_get_size (GTK_WINDOW (window->priv->fullscreen_controls), &w, &h); gdk_device_get_position (device, NULL, &x, &y); - + /* gtk seems to emit leave notify when clicking on tool items, * work around it by checking the coordinates */ @@ -3030,17 +3030,17 @@ fullscreen_controls_build (PlumaWindow *window) if (priv->fullscreen_controls != NULL) return; - + priv->fullscreen_controls = gtk_window_new (GTK_WINDOW_POPUP); gtk_window_set_transient_for (GTK_WINDOW (priv->fullscreen_controls), &window->window); - + /* popup toolbar */ toolbar = gtk_ui_manager_get_widget (priv->manager, "/FullscreenToolBar"); gtk_container_add (GTK_CONTAINER (priv->fullscreen_controls), toolbar); - + action = gtk_action_group_get_action (priv->always_sensitive_action_group, "LeaveFullscreen"); g_object_set (action, "is-important", TRUE, NULL); @@ -3231,7 +3231,7 @@ notebook_tab_added (PlumaNotebook *notebook, pluma_debug (DEBUG_WINDOW); g_return_if_fail ((window->priv->state & PLUMA_WINDOW_STATE_SAVING_SESSION) == 0); - + ++window->priv->num_tabs; update_sensitivity_according_to_open_tabs (window); @@ -3242,13 +3242,13 @@ notebook_tab_added (PlumaNotebook *notebook, /* IMPORTANT: remember to disconnect the signal in notebook_tab_removed * if a new signal is connected here */ - g_signal_connect (tab, + g_signal_connect (tab, "notify::name", - G_CALLBACK (sync_name), + G_CALLBACK (sync_name), window); - g_signal_connect (tab, + g_signal_connect (tab, "notify::state", - G_CALLBACK (sync_state), + G_CALLBACK (sync_state), window); g_signal_connect (doc, @@ -3289,10 +3289,10 @@ notebook_tab_added (PlumaNotebook *notebook, window); update_documents_list_menu (window); - + g_signal_connect (view, "drop_uris", - G_CALLBACK (drop_uris_cb), + G_CALLBACK (drop_uris_cb), NULL); update_window_state (window); @@ -3318,21 +3318,21 @@ notebook_tab_removed (PlumaNotebook *notebook, doc = pluma_tab_get_document (tab); g_signal_handlers_disconnect_by_func (tab, - G_CALLBACK (sync_name), + G_CALLBACK (sync_name), window); g_signal_handlers_disconnect_by_func (tab, - G_CALLBACK (sync_state), + G_CALLBACK (sync_state), window); g_signal_handlers_disconnect_by_func (doc, - G_CALLBACK (update_cursor_position_statusbar), + G_CALLBACK (update_cursor_position_statusbar), window); - g_signal_handlers_disconnect_by_func (doc, + g_signal_handlers_disconnect_by_func (doc, G_CALLBACK (can_search_again), window); - g_signal_handlers_disconnect_by_func (doc, + g_signal_handlers_disconnect_by_func (doc, G_CALLBACK (can_undo), window); - g_signal_handlers_disconnect_by_func (doc, + g_signal_handlers_disconnect_by_func (doc, G_CALLBACK (can_redo), window); g_signal_handlers_disconnect_by_func (doc, @@ -3344,13 +3344,13 @@ notebook_tab_removed (PlumaNotebook *notebook, g_signal_handlers_disconnect_by_func (doc, G_CALLBACK (readonly_changed), window); - g_signal_handlers_disconnect_by_func (view, + g_signal_handlers_disconnect_by_func (view, G_CALLBACK (update_overwrite_mode_statusbar), window); - g_signal_handlers_disconnect_by_func (view, + g_signal_handlers_disconnect_by_func (view, G_CALLBACK (editable_changed), window); - g_signal_handlers_disconnect_by_func (view, + g_signal_handlers_disconnect_by_func (view, G_CALLBACK (drop_uris_cb), NULL); @@ -3359,13 +3359,13 @@ notebook_tab_removed (PlumaNotebook *notebook, g_signal_handler_disconnect (view, window->priv->tab_width_id); window->priv->tab_width_id = 0; } - + if (window->priv->spaces_instead_of_tabs_id && tab == pluma_window_get_active_tab (window)) { g_signal_handler_disconnect (view, window->priv->spaces_instead_of_tabs_id); window->priv->spaces_instead_of_tabs_id = 0; } - + if (window->priv->language_changed_id && tab == pluma_window_get_active_tab (window)) { g_signal_handler_disconnect (doc, window->priv->language_changed_id); @@ -3376,15 +3376,15 @@ notebook_tab_removed (PlumaNotebook *notebook, if (window->priv->num_tabs == 0) { window->priv->active_tab = NULL; - + set_title (window); - + /* Remove line and col info */ pluma_statusbar_set_cursor_position ( PLUMA_STATUSBAR (window->priv->statusbar), -1, -1); - + pluma_statusbar_clear_overwrite ( PLUMA_STATUSBAR (window->priv->statusbar)); @@ -3416,7 +3416,7 @@ notebook_tab_removed (PlumaNotebook *notebook, update_window_state (window); - g_signal_emit (G_OBJECT (window), signals[TAB_REMOVED], 0, tab); + g_signal_emit (G_OBJECT (window), signals[TAB_REMOVED], 0, tab); } static void @@ -3425,7 +3425,7 @@ notebook_tabs_reordered (PlumaNotebook *notebook, { update_documents_list_menu (window); update_next_prev_doc_sensitivity_per_window (window); - + g_signal_emit (G_OBJECT (window), signals[TABS_REORDERED], 0); } @@ -3435,20 +3435,20 @@ notebook_tab_detached (PlumaNotebook *notebook, PlumaWindow *window) { PlumaWindow *new_window; - + new_window = clone_window (window); - + pluma_notebook_move_tab (notebook, PLUMA_NOTEBOOK (_pluma_window_get_notebook (new_window)), tab, 0); - - gtk_window_set_position (GTK_WINDOW (new_window), + + gtk_window_set_position (GTK_WINDOW (new_window), GTK_WIN_POS_MOUSE); - + gtk_widget_show (GTK_WIDGET (new_window)); -} +} -static void +static void notebook_tab_close_request (PlumaNotebook *notebook, PlumaTab *tab, GtkWindow *window) @@ -3504,7 +3504,7 @@ notebook_button_press_event (GtkNotebook *notebook, { if (event->type == GDK_BUTTON_PRESS) { - if (event->button == 3) + if (event->button == 3) return show_notebook_popup_menu (notebook, window, event); else if (event->button == 2) @@ -3535,7 +3535,7 @@ notebook_scroll_event (GtkNotebook *notebook, { gtk_notebook_next_page (notebook); } - + return FALSE; } @@ -3670,9 +3670,9 @@ create_side_panel (PlumaWindow *window) window->priv->side_panel = pluma_panel_new (GTK_ORIENTATION_VERTICAL); - gtk_paned_pack1 (GTK_PANED (window->priv->hpaned), - window->priv->side_panel, - FALSE, + gtk_paned_pack1 (GTK_PANED (window->priv->hpaned), + window->priv->side_panel, + FALSE, FALSE); g_signal_connect_after (window->priv->side_panel, @@ -3755,14 +3755,14 @@ bottom_panel_item_added (PlumaPanel *panel, } static void -create_bottom_panel (PlumaWindow *window) +create_bottom_panel (PlumaWindow *window) { pluma_debug (DEBUG_WINDOW); window->priv->bottom_panel = pluma_panel_new (GTK_ORIENTATION_HORIZONTAL); - gtk_paned_pack2 (GTK_PANED (window->priv->vpaned), - window->priv->bottom_panel, + gtk_paned_pack2 (GTK_PANED (window->priv->vpaned), + window->priv->bottom_panel, FALSE, FALSE); @@ -3934,7 +3934,7 @@ add_notebook (PlumaWindow *window, TRUE); gtk_widget_show (notebook); - + gtk_widget_add_events (notebook, GDK_SCROLL_MASK); connect_notebook_signals (window, notebook); } @@ -4003,18 +4003,18 @@ pluma_window_init (PlumaWindow *window) /* Add the main area */ pluma_debug_message (DEBUG_WINDOW, "Add main area"); window->priv->hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); - gtk_box_pack_start (GTK_BOX (main_box), - window->priv->hpaned, - TRUE, - TRUE, + gtk_box_pack_start (GTK_BOX (main_box), + window->priv->hpaned, + TRUE, + TRUE, 0); window->priv->vpaned = gtk_paned_new (GTK_ORIENTATION_VERTICAL); - gtk_paned_pack2 (GTK_PANED (window->priv->hpaned), - window->priv->vpaned, - TRUE, + gtk_paned_pack2 (GTK_PANED (window->priv->hpaned), + window->priv->vpaned, + TRUE, FALSE); - + pluma_debug_message (DEBUG_WINDOW, "Create pluma notebook"); window->priv->notebook = pluma_notebook_new (); add_notebook (window, window->priv->notebook); @@ -4052,21 +4052,21 @@ pluma_window_init (PlumaWindow *window) /* Add uri targets */ tl = gtk_drag_dest_get_target_list (GTK_WIDGET (window)); - + if (tl == NULL) { tl = gtk_target_list_new (NULL, 0); gtk_drag_dest_set_target_list (GTK_WIDGET (window), tl); gtk_target_list_unref (tl); } - + gtk_target_list_add_uri_targets (tl, TARGET_URI_LIST); /* connect instead of override, so that we can * share the cb code with the view */ g_signal_connect (window, "drag_data_received", - G_CALLBACK (drag_data_received_cb), + G_CALLBACK (drag_data_received_cb), NULL); /* we can get the clipboard only after the widget @@ -4087,7 +4087,7 @@ pluma_window_init (PlumaWindow *window) NULL); pluma_debug_message (DEBUG_WINDOW, "Update plugins ui"); - + window->priv->extensions = peas_extension_set_new (PEAS_ENGINE (pluma_plugins_engine_get_default ()), PEAS_TYPE_ACTIVATABLE, "object", window, NULL); @@ -4139,7 +4139,7 @@ pluma_window_get_active_view (PlumaWindow *window) * @window: a #PlumaWindow * * Gets the active #PlumaDocument. - * + * * Returns: (transfer none): the active #PlumaDocument */ PlumaDocument * @@ -4182,8 +4182,8 @@ pluma_window_create_tab (PlumaWindow *window, g_return_val_if_fail (PLUMA_IS_WINDOW (window), NULL); - tab = PLUMA_TAB (_pluma_tab_new ()); - gtk_widget_show (GTK_WIDGET (tab)); + tab = PLUMA_TAB (_pluma_tab_new ()); + gtk_widget_show (GTK_WIDGET (tab)); pluma_notebook_add_tab (PLUMA_NOTEBOOK (window->priv->notebook), tab, @@ -4209,7 +4209,7 @@ pluma_window_create_tab (PlumaWindow *window, * * Creates a new #PlumaTab loading the document specified by @uri. * In case @jump_to is %TRUE the #PlumaNotebook swithes to that new #PlumaTab. - * Whether @create is %TRUE, creates a new empty document if location does + * Whether @create is %TRUE, creates a new empty document if location does * not refer to an existing file * * Returns: (transfer none): a new #PlumaTab @@ -4230,12 +4230,12 @@ pluma_window_create_tab_from_uri (PlumaWindow *window, tab = _pluma_tab_new_from_uri (uri, encoding, line_pos, - create); + create); if (tab == NULL) return NULL; - gtk_widget_show (tab); - + gtk_widget_show (tab); + pluma_notebook_add_tab (PLUMA_NOTEBOOK (window->priv->notebook), PLUMA_TAB (tab), -1, @@ -4248,7 +4248,7 @@ pluma_window_create_tab_from_uri (PlumaWindow *window, } return PLUMA_TAB (tab); -} +} /** * pluma_window_get_active_tab: @@ -4262,8 +4262,8 @@ PlumaTab * pluma_window_get_active_tab (PlumaWindow *window) { g_return_val_if_fail (PLUMA_IS_WINDOW (window), NULL); - - return (window->priv->active_tab == NULL) ? + + return (window->priv->active_tab == NULL) ? NULL : PLUMA_TAB (window->priv->active_tab); } @@ -4271,9 +4271,9 @@ static void add_document (PlumaTab *tab, GList **res) { PlumaDocument *doc; - + doc = pluma_tab_get_document (tab); - + *res = g_list_prepend (*res, doc); } @@ -4293,13 +4293,13 @@ pluma_window_get_documents (PlumaWindow *window) GList *res = NULL; g_return_val_if_fail (PLUMA_IS_WINDOW (window), NULL); - + gtk_container_foreach (GTK_CONTAINER (window->priv->notebook), (GtkCallback)add_document, &res); - + res = g_list_reverse (res); - + return res; } @@ -4307,9 +4307,9 @@ static void add_view (PlumaTab *tab, GList **res) { PlumaView *view; - + view = pluma_tab_get_view (tab); - + *res = g_list_prepend (*res, view); } @@ -4328,13 +4328,13 @@ pluma_window_get_views (PlumaWindow *window) GList *res = NULL; g_return_val_if_fail (PLUMA_IS_WINDOW (window), NULL); - + gtk_container_foreach (GTK_CONTAINER (window->priv->notebook), (GtkCallback)add_view, &res); - + res = g_list_reverse (res); - + return res; } @@ -4353,7 +4353,7 @@ pluma_window_close_tab (PlumaWindow *window, g_return_if_fail (PLUMA_IS_TAB (tab)); g_return_if_fail ((pluma_tab_get_state (tab) != PLUMA_TAB_STATE_SAVING) && (pluma_tab_get_state (tab) != PLUMA_TAB_STATE_SHOWING_PRINT_PREVIEW)); - + pluma_notebook_remove_tab (PLUMA_NOTEBOOK (window->priv->notebook), tab); } @@ -4421,20 +4421,20 @@ _pluma_window_move_tab_to_new_window (PlumaWindow *window, g_return_val_if_fail (PLUMA_IS_WINDOW (window), NULL); g_return_val_if_fail (PLUMA_IS_TAB (tab), NULL); g_return_val_if_fail (gtk_notebook_get_n_pages ( - GTK_NOTEBOOK (window->priv->notebook)) > 1, + GTK_NOTEBOOK (window->priv->notebook)) > 1, NULL); - + new_window = clone_window (window); pluma_notebook_move_tab (PLUMA_NOTEBOOK (window->priv->notebook), PLUMA_NOTEBOOK (new_window->priv->notebook), tab, -1); - + gtk_widget_show (GTK_WIDGET (new_window)); - + return new_window; -} +} /** * pluma_window_set_active_tab: @@ -4448,14 +4448,14 @@ pluma_window_set_active_tab (PlumaWindow *window, PlumaTab *tab) { gint page_num; - + g_return_if_fail (PLUMA_IS_WINDOW (window)); g_return_if_fail (PLUMA_IS_TAB (tab)); - + page_num = gtk_notebook_page_num (GTK_NOTEBOOK (window->priv->notebook), GTK_WIDGET (tab)); g_return_if_fail (page_num != -1); - + gtk_notebook_set_current_page (GTK_NOTEBOOK (window->priv->notebook), page_num); } @@ -4472,7 +4472,7 @@ GtkWindowGroup * pluma_window_get_group (PlumaWindow *window) { g_return_val_if_fail (PLUMA_IS_WINDOW (window), NULL); - + return window->priv->window_group; } @@ -4480,7 +4480,7 @@ gboolean _pluma_window_is_removing_tabs (PlumaWindow *window) { g_return_val_if_fail (PLUMA_IS_WINDOW (window), FALSE); - + return window->priv->removing_tabs; } @@ -4608,40 +4608,40 @@ pluma_window_get_unsaved_documents (PlumaWindow *window) GList *l; g_return_val_if_fail (PLUMA_IS_WINDOW (window), NULL); - + tabs = gtk_container_get_children (GTK_CONTAINER (window->priv->notebook)); - + l = tabs; while (l != NULL) { PlumaTab *tab; tab = PLUMA_TAB (l->data); - + if (!_pluma_tab_can_close (tab)) { PlumaDocument *doc; - + doc = pluma_tab_get_document (tab); unsaved_docs = g_list_prepend (unsaved_docs, doc); - } - + } + l = g_list_next (l); } - + g_list_free (tabs); return g_list_reverse (unsaved_docs); } -void +void _pluma_window_set_saving_session_state (PlumaWindow *window, gboolean saving_session) { PlumaWindowState old_state; g_return_if_fail (PLUMA_IS_WINDOW (window)); - + old_state = window->priv->state; if (saving_session) @@ -4658,7 +4658,7 @@ _pluma_window_set_saving_session_state (PlumaWindow *window, } static void -hide_notebook_tabs_on_fullscreen (GtkNotebook *notebook, +hide_notebook_tabs_on_fullscreen (GtkNotebook *notebook, GParamSpec *pspec, PlumaWindow *window) { @@ -4678,14 +4678,14 @@ _pluma_window_fullscreen (PlumaWindow *window) gtk_notebook_set_show_tabs (GTK_NOTEBOOK (window->priv->notebook), FALSE); g_signal_connect (window->priv->notebook, "notify::show-tabs", G_CALLBACK (hide_notebook_tabs_on_fullscreen), window); - + gtk_widget_hide (window->priv->menubar); - + g_signal_handlers_block_by_func (window->priv->toolbar, toolbar_visibility_changed, window); gtk_widget_hide (window->priv->toolbar); - + g_signal_handlers_block_by_func (window->priv->statusbar, statusbar_visibility_changed, window); @@ -4713,7 +4713,7 @@ _pluma_window_unfullscreen (PlumaWindow *window) window); gtk_notebook_set_show_tabs (GTK_NOTEBOOK (window->priv->notebook), TRUE); gtk_widget_show (window->priv->menubar); - + action = gtk_action_group_get_action (window->priv->always_sensitive_action_group, "ViewToolbar"); visible = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); @@ -4722,7 +4722,7 @@ _pluma_window_unfullscreen (PlumaWindow *window) g_signal_handlers_unblock_by_func (window->priv->toolbar, toolbar_visibility_changed, window); - + action = gtk_action_group_get_action (window->priv->always_sensitive_action_group, "ViewStatusbar"); visible = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); @@ -4764,7 +4764,7 @@ pluma_window_get_tab_from_location (PlumaWindow *window, g_return_val_if_fail (G_IS_FILE (location), NULL); tabs = gtk_container_get_children (GTK_CONTAINER (window->priv->notebook)); - + for (l = tabs; l != NULL; l = g_list_next (l)) { PlumaDocument *d; @@ -4789,9 +4789,9 @@ pluma_window_get_tab_from_location (PlumaWindow *window, } } } - + g_list_free (tabs); - + return ret; } @@ -4808,6 +4808,6 @@ PlumaMessageBus * pluma_window_get_message_bus (PlumaWindow *window) { g_return_val_if_fail (PLUMA_IS_WINDOW (window), NULL); - + return window->priv->message_bus; } diff --git a/pluma/pluma-window.h b/pluma/pluma-window.h index b90baa32..ebd2c814 100644 --- a/pluma/pluma-window.h +++ b/pluma/pluma-window.h @@ -2,7 +2,7 @@ * pluma-window.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$ */ @@ -49,7 +49,7 @@ typedef enum PLUMA_WINDOW_STATE_ERROR = 1 << 4, PLUMA_WINDOW_STATE_SAVING_SESSION = 1 << 5 } PlumaWindowState; - + /* * Type checking and casting macros */ @@ -68,7 +68,7 @@ typedef struct _PlumaWindowPrivate PlumaWindowPrivate; */ typedef struct _PlumaWindow PlumaWindow; -struct _PlumaWindow +struct _PlumaWindow { GtkWindow window; @@ -81,10 +81,10 @@ struct _PlumaWindow */ typedef struct _PlumaWindowClass PlumaWindowClass; -struct _PlumaWindowClass +struct _PlumaWindowClass { GtkWindowClass parent_class; - + /* Signals */ void (* tab_added) (PlumaWindow *window, PlumaTab *tab); @@ -93,7 +93,7 @@ struct _PlumaWindowClass void (* tabs_reordered) (PlumaWindow *window); void (* active_tab_changed) (PlumaWindow *window, PlumaTab *tab); - void (* active_tab_state_changed) + void (* active_tab_state_changed) (PlumaWindow *window); }; @@ -104,22 +104,22 @@ GType pluma_window_get_type (void) G_GNUC_CONST; PlumaTab *pluma_window_create_tab (PlumaWindow *window, gboolean jump_to); - + PlumaTab *pluma_window_create_tab_from_uri (PlumaWindow *window, const gchar *uri, const PlumaEncoding *encoding, gint line_pos, gboolean create, gboolean jump_to); - + void pluma_window_close_tab (PlumaWindow *window, PlumaTab *tab); - + void pluma_window_close_all_tabs (PlumaWindow *window); void pluma_window_close_tabs (PlumaWindow *window, const GList *tabs); - + PlumaTab *pluma_window_get_active_tab (PlumaWindow *window); void pluma_window_set_active_tab (PlumaWindow *window, @@ -132,7 +132,7 @@ PlumaDocument *pluma_window_get_active_document (PlumaWindow *window); /* Returns a newly allocated list with all the documents in the window */ GList *pluma_window_get_documents (PlumaWindow *window); -/* Returns a newly allocated list with all the documents that need to be +/* Returns a newly allocated list with all the documents that need to be saved before closing the window */ GList *pluma_window_get_unsaved_documents (PlumaWindow *window); diff --git a/pluma/plumatextregion.c b/pluma/plumatextregion.c index a4920743..8b5b5ec4 100644 --- a/pluma/plumatextregion.c +++ b/pluma/plumatextregion.c @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- * * plumatextregion.h - GtkTextMark based region utility functions * @@ -19,7 +19,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, - * Boston, MA 02110-1301, USA. + * Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H @@ -71,7 +71,7 @@ struct _PlumaTextRegionIteratorReal { iter. If left_side is TRUE, return the subregion which contains the text iter or which is the leftmost; else return the rightmost subregion */ -static GList * +static GList * find_nearest_subregion (PlumaTextRegion *region, const GtkTextIter *iter, GList *begin, @@ -134,7 +134,7 @@ pluma_text_region_new (GtkTextBuffer *buffer) return region; } -void +void pluma_text_region_destroy (PlumaTextRegion *region, gboolean delete_marks) { g_return_if_fail (region != NULL); @@ -192,7 +192,7 @@ pluma_text_region_clear_zero_length_subregions (PlumaTextRegion *region) } } -void +void pluma_text_region_add (PlumaTextRegion *region, const GtkTextIter *_start, const GtkTextIter *_end) @@ -277,7 +277,7 @@ pluma_text_region_add (PlumaTextRegion *region, DEBUG (pluma_text_region_debug_print (region)); } -void +void pluma_text_region_subtract (PlumaTextRegion *region, const GtkTextIter *_start, const GtkTextIter *_end) @@ -402,7 +402,7 @@ pluma_text_region_subtract (PlumaTextRegion *region, DEBUG (pluma_text_region_debug_print (region)); } -gint +gint pluma_text_region_subregions (PlumaTextRegion *region) { g_return_val_if_fail (region != NULL, 0); @@ -410,7 +410,7 @@ pluma_text_region_subregions (PlumaTextRegion *region) return g_list_length (region->subregions); } -gboolean +gboolean pluma_text_region_nth_subregion (PlumaTextRegion *region, guint subregion, GtkTextIter *start, @@ -432,7 +432,7 @@ pluma_text_region_nth_subregion (PlumaTextRegion *region, return TRUE; } -PlumaTextRegion * +PlumaTextRegion * pluma_text_region_intersect (PlumaTextRegion *region, const GtkTextIter *_start, const GtkTextIter *_end) @@ -534,7 +534,7 @@ pluma_text_region_intersect (PlumaTextRegion *region, return new_region; } -static gboolean +static gboolean check_iterator (PlumaTextRegionIteratorReal *real) { if ((real->region == NULL) || @@ -544,14 +544,14 @@ check_iterator (PlumaTextRegionIteratorReal *real) "is uninitialized, or the region " "has been modified since the iterator " "was created."); - + return FALSE; } return TRUE; } -void +void pluma_text_region_get_iterator (PlumaTextRegion *region, PlumaTextRegionIterator *iter, guint start) @@ -559,7 +559,7 @@ pluma_text_region_get_iterator (PlumaTextRegion *region, PlumaTextRegionIteratorReal *real; g_return_if_fail (region != NULL); - g_return_if_fail (iter != NULL); + g_return_if_fail (iter != NULL); real = (PlumaTextRegionIteratorReal *)iter; @@ -575,7 +575,7 @@ pluma_text_region_iterator_is_end (PlumaTextRegionIterator *iter) { PlumaTextRegionIteratorReal *real; - g_return_val_if_fail (iter != NULL, FALSE); + g_return_val_if_fail (iter != NULL, FALSE); real = (PlumaTextRegionIteratorReal *)iter; g_return_val_if_fail (check_iterator (real), FALSE); @@ -588,7 +588,7 @@ pluma_text_region_iterator_next (PlumaTextRegionIterator *iter) { PlumaTextRegionIteratorReal *real; - g_return_val_if_fail (iter != NULL, FALSE); + g_return_val_if_fail (iter != NULL, FALSE); real = (PlumaTextRegionIteratorReal *)iter; g_return_val_if_fail (check_iterator (real), FALSE); @@ -601,7 +601,7 @@ pluma_text_region_iterator_next (PlumaTextRegionIterator *iter) return FALSE; } -void +void pluma_text_region_iterator_get_subregion (PlumaTextRegionIterator *iter, GtkTextIter *start, GtkTextIter *end) @@ -624,7 +624,7 @@ pluma_text_region_iterator_get_subregion (PlumaTextRegionIterator *iter, gtk_text_buffer_get_iter_at_mark (real->region->buffer, end, sr->end); } -void +void pluma_text_region_debug_print (PlumaTextRegion *region) { GList *l; diff --git a/pluma/plumatextregion.h b/pluma/plumatextregion.h index 159726e3..eebbb62b 100644 --- a/pluma/plumatextregion.h +++ b/pluma/plumatextregion.h @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- * * plumatextregion.h - GtkTextMark based region utility functions * @@ -19,7 +19,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, - * Boston, MA 02110-1301, USA. + * Boston, MA 02110-1301, USA. */ #ifndef __PLUMA_TEXT_REGION_H__ @@ -40,7 +40,7 @@ struct _PlumaTextRegionIterator { /*< private >*/ gpointer dummy1; guint32 dummy2; - gpointer dummy3; + gpointer dummy3; }; PlumaTextRegion *pluma_text_region_new (GtkTextBuffer *buffer); diff --git a/pluma/smclient/eggsmclient-xsmp.c b/pluma/smclient/eggsmclient-xsmp.c index 3c9b309d..017ab819 100644 --- a/pluma/smclient/eggsmclient-xsmp.c +++ b/pluma/smclient/eggsmclient-xsmp.c @@ -227,7 +227,7 @@ sm_client_xsmp_set_initial_properties (gpointer user_data) if (xsmp->restart_style == SmRestartIfRunning) { - if (egg_desktop_file_get_boolean (desktop_file, + if (egg_desktop_file_get_boolean (desktop_file, "X-MATE-AutoRestart", NULL)) xsmp->restart_style = SmRestartImmediately; } @@ -1127,7 +1127,7 @@ delete_properties (EggSMClientXSMP *xsmp, ...) * until you're done with the SmProp. */ static SmProp * -array_prop (const char *name, ...) +array_prop (const char *name, ...) { SmProp *prop; SmPropValue pv; @@ -1344,13 +1344,13 @@ ice_error_handler (IceConn ice_conn, IcePointer values) { /* Do nothing */ -} +} static void ice_io_error_handler (IceConn ice_conn) { /* Do nothing */ -} +} static void smc_error_handler (SmcConn smc_conn, diff --git a/pluma/smclient/eggsmclient.c b/pluma/smclient/eggsmclient.c index e854f992..11c1ccf8 100644 --- a/pluma/smclient/eggsmclient.c +++ b/pluma/smclient/eggsmclient.c @@ -112,7 +112,7 @@ egg_sm_client_class_init (EggSMClientClass *klass) * handling this signal; if the user has requested that the session * be saved when logging out, then ::save_state will be emitted * separately. - * + * * If the application agrees to quit, it should then wait for either * the ::quit_cancelled or ::quit signals to be emitted. **/ diff --git a/tests/document-input-stream.c b/tests/document-input-stream.c index 2da42d9b..410b6a05 100644 --- a/tests/document-input-stream.c +++ b/tests/document-input-stream.c @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with pluma; 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/tests/document-loader.c b/tests/document-loader.c index d828af1c..bdb36525 100644 --- a/tests/document-loader.c +++ b/tests/document-loader.c @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with pluma; 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/tests/document-output-stream.c b/tests/document-output-stream.c index 03df8aa3..05d14ff2 100644 --- a/tests/document-output-stream.c +++ b/tests/document-output-stream.c @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with pluma; 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/tests/document-saver.c b/tests/document-saver.c index c67d1e02..0706fef2 100644 --- a/tests/document-saver.c +++ b/tests/document-saver.c @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with pluma; 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 */ @@ -706,7 +706,7 @@ int main (int argc, g_test_add_func ("/document-saver/remote", test_remote); g_test_add_func ("/document-saver/remote-new-line", test_remote_newline); - + if (have_unowned) { diff --git a/tests/smart-converter.c b/tests/smart-converter.c index 722edddc..44466f0e 100644 --- a/tests/smart-converter.c +++ b/tests/smart-converter.c @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with pluma; 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/tools/plugin_template/pluma-plugin.c b/tools/plugin_template/pluma-plugin.c index 4974f121..7fdd6d55 100644 --- a/tools/plugin_template/pluma-plugin.c +++ b/tools/plugin_template/pluma-plugin.c @@ -7,7 +7,7 @@ * 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 @@ -40,7 +40,7 @@ PLUMA_PLUGIN_REGISTER_TYPE (##(PLUGIN_ID.camel)Plugin, ##(PLUGIN_ID.lower)_plugi ##ifdef WITH_MENU /* UI string. See pluma-ui.xml for reference */ -static const gchar ui_str = +static const gchar ui_str = "<ui>" " <menubar name='MenuBar'>" " <!-- Put your menu entries here -->" @@ -96,7 +96,7 @@ impl_activate (PlumaPlugin *plugin, ##ifdef WITH_MENU GtkUIManager *manager; WindowData *data; -##endif +##endif pluma_debug (DEBUG_PLUGINS); @@ -117,11 +117,11 @@ impl_activate (PlumaPlugin *plugin, data->ui_id = gtk_ui_manager_add_ui_from_string (manager, ui_str, -1, NULL); - g_object_set_data_full (G_OBJECT (window), - WINDOW_DATA_KEY, + g_object_set_data_full (G_OBJECT (window), + WINDOW_DATA_KEY, data, (GDestroyNotify) free_window_data); -##endif +##endif } static void @@ -179,6 +179,6 @@ static void plugin_class->create_configure_dialog = impl_create_configure_dialog; ##endif - g_type_class_add_private (object_class, + g_type_class_add_private (object_class, sizeof (##(PLUGIN_ID.camel)PluginPrivate)); } |