diff options
Diffstat (limited to 'pluma')
93 files changed, 2424 insertions, 2424 deletions
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. **/ |