Index: ChangeLog =================================================================== RCS file: /cvs/gnome/gedit/ChangeLog,v retrieving revision 1.700.2.24 diff -u -p -u -p -r1.700.2.24 ChangeLog --- ChangeLog 30 Jul 2006 17:00:46 -0000 1.700.2.24 +++ ChangeLog 2 Sep 2006 15:29:44 -0000 @@ -1,3 +1,82 @@ +2006-09-02 Paolo Borelli + + Backport many bugfixes from HEAD. Original ChangeLogs entry follow: + +2006-08-25 Paolo Borelli + + * gedit/gedit-tab.c: plug tiny leak when loading remote files. + +2006-08-25 Paolo Borelli + + * gedit/gedit-document-loader.c: fix a couple of typos. + +2006-08-24 Paolo Maggi + + Fixed bug #352680 – Save on close for readonly files does not work as + expected + + * gedit/dialogs/gedit-close-confirmation-dialog.c + (set_logout_mode): add a "Save As" button instead of a "Save" one when + in single mode and the document to close is untitled or readonly + + * gedit/gedit-commands-file.c (file_save): call file_save_as for + readonly files too + +2006-08-24 Paolo Borelli + + Fixed bug #352677 – Critical warning when opening a empty remote file + + * gedit/gedit-document-loader.c: handle remote zero lenght files + correctly. + +2006-08-24 Paolo Maggi + + Fixes bug #352658 – print preview state machine issue. + + * gedit/gedit-tab.c (print_preview_destroyed): add a comment and + check that the state is "printing" in the "else" case + (print_finished_cb) (print_cancelled): If we are printing while + showing the print preview, close the print preview when done or + cancelled + +2006-08-23 Jesse van den Kieboom + + * gedit/gedit.c: initialize gnome authentication manager before + plugins (since the file browser plugin might need it). Fixes Bug + 352339 – Remote root location for filebrowser makes gedit crash on load + +2006-08-23 Paolo Borelli + + * gedit/gedit-python-plugin.c: fix a small leak. + +2006-08-21 Paolo Maggi + + * gedit/gedit-encodings.c: added support for UTF-16LE, UTF-16BE + and UTF-32 + +2006-08-17 Paolo Borelli + + * gedit/dialogs/gedit-preferences-dialog.c: do not crash if no + lang files are found. + +2006-08-17 Paolo Borelli + + * gedit/gedit-io-error-message-area.c: small memory leaks on error. + +2006-08-16 Steve Frécinaux + + * plugins/modelines/modelines.py: fix warning on activation. + +2006-08-09 Paolo Borelli + + * plugins/spell/gedit-spell-plugin.c: fix autospell state when + switching tab. + +2006-05-15 Paolo Borelli + + * plugins/sort/gedit-sort-plugin.c: handle empty lines correctly. + bug #341117. + === gedit 2.14.4 === 2006-07-30 Paolo Borelli Index: gedit/gedit-commands-file.c =================================================================== RCS file: /cvs/gnome/gedit/gedit/gedit-commands-file.c,v retrieving revision 1.6.2.2 diff -u -p -u -p -r1.6.2.2 gedit-commands-file.c --- gedit/gedit-commands-file.c 31 May 2006 07:13:46 -0000 1.6.2.2 +++ gedit/gedit-commands-file.c 2 Sep 2006 15:29:44 -0000 @@ -800,9 +800,10 @@ file_save (GeditTab *tab, doc = gedit_tab_get_document (tab); g_return_if_fail (GEDIT_IS_DOCUMENT (doc)); - if (gedit_document_is_untitled (doc)) + if (gedit_document_is_untitled (doc) || + gedit_document_get_readonly (doc)) { - gedit_debug_message (DEBUG_COMMANDS, "Untitled"); + gedit_debug_message (DEBUG_COMMANDS, "Untitled or Readonly"); file_save_as (tab, window); Index: gedit/gedit-document-loader.c =================================================================== RCS file: /cvs/gnome/gedit/gedit/gedit-document-loader.c,v retrieving revision 1.5.2.2 diff -u -p -u -p -r1.5.2.2 gedit-document-loader.c --- gedit/gedit-document-loader.c 20 Apr 2006 17:05:25 -0000 1.5.2.2 +++ gedit/gedit-document-loader.c 2 Sep 2006 15:29:44 -0000 @@ -25,7 +25,7 @@ * list of people on the gedit Team. * See the ChangeLog files for a list of changes. * - * $Id: gedit-document-loader.c,v 1.5.2.2 2006/04/20 17:05:25 pborelli Exp $ + * $Id: gedit-document-loader.c,v 1.9 2006/08/25 09:30:34 pborelli Exp $ */ #ifdef HAVE_CONFIG_H @@ -275,7 +275,7 @@ update_document_contents (GeditDocumentL gint file_size, GError **error) { - gedit_debug (DEBUG_SAVER); + gedit_debug (DEBUG_LOADER); g_return_val_if_fail (file_size > 0, FALSE); g_return_val_if_fail (file_contents != NULL, FALSE); @@ -543,7 +543,7 @@ load_local_file_real (GeditDocumentLoade if (mapped_file == MAP_FAILED) { - gedit_debug_message (DEBUG_SAVER, "mmap failed"); + gedit_debug_message (DEBUG_LOADER, "mmap failed"); result = gnome_vfs_result_from_errno (); @@ -618,7 +618,7 @@ static void load_local_file (GeditDocumentLoader *loader, const gchar *fname) { - gedit_debug (DEBUG_SAVER); + gedit_debug (DEBUG_LOADER); g_signal_emit (loader, signals[LOADING], @@ -644,10 +644,10 @@ load_local_file (GeditDocumentLoader *lo return; } - + g_free (loader->priv->local_file_name); loader->priv->local_file_name = g_strdup (fname); - + g_timeout_add_full (G_PRIORITY_HIGH, 0, (GSourceFunc) load_local_file_real, @@ -734,10 +734,18 @@ async_read_cb (GnomeVFSAsyncHandle *hand /* end of the file, we are done! */ if (bytes_read == 0 || result != GNOME_VFS_OK) { - update_document_contents (loader, - loader->priv->buffer, - loader->priv->bytes_read, - &loader->priv->error); + if (loader->priv->bytes_read == 0) + { + if (loader->priv->encoding == NULL) + loader->priv->auto_detected_encoding = gedit_encoding_get_current (); + } + else + { + update_document_contents (loader, + loader->priv->buffer, + loader->priv->bytes_read, + &loader->priv->error); + } remote_load_completed_or_failed (loader); Index: gedit/gedit-encodings.c =================================================================== RCS file: /cvs/gnome/gedit/gedit/gedit-encodings.c,v retrieving revision 1.20 diff -u -p -u -p -r1.20 gedit-encodings.c --- gedit/gedit-encodings.c 12 Dec 2005 17:27:55 -0000 1.20 +++ gedit/gedit-encodings.c 2 Sep 2006 15:29:44 -0000 @@ -25,7 +25,7 @@ * list of people on the gedit Team. * See the ChangeLog files for a list of changes. * - * $Id: gedit-encodings.c,v 1.20 2005/12/12 17:27:55 pborelli Exp $ + * $Id: gedit-encodings.c,v 1.21 2006/08/21 14:41:43 paolo Exp $ */ #ifdef HAVE_CONFIG_H @@ -73,6 +73,9 @@ typedef enum GEDIT_ENCODING_UTF_7, GEDIT_ENCODING_UTF_16, + GEDIT_ENCODING_UTF_16_BE, + GEDIT_ENCODING_UTF_16_LE, + GEDIT_ENCODING_UTF_32, GEDIT_ENCODING_UCS_2, GEDIT_ENCODING_UCS_4, @@ -182,6 +185,12 @@ static GeditEncoding encodings [] = { "UTF-7", N_("Unicode") }, { GEDIT_ENCODING_UTF_16, "UTF-16", N_("Unicode") }, + { GEDIT_ENCODING_UTF_16_BE, + "UTF-16BE", N_("Unicode") }, + { GEDIT_ENCODING_UTF_16_LE, + "UTF-16LE", N_("Unicode") }, + { GEDIT_ENCODING_UTF_32, + "UTF-32", N_("Unicode") }, { GEDIT_ENCODING_UCS_2, "UCS-2", N_("Unicode") }, { GEDIT_ENCODING_UCS_4, Index: gedit/gedit-io-error-message-area.c =================================================================== RCS file: /cvs/gnome/gedit/gedit/gedit-io-error-message-area.c,v retrieving revision 1.4.2.1 diff -u -p -u -p -r1.4.2.1 gedit-io-error-message-area.c --- gedit/gedit-io-error-message-area.c 20 Apr 2006 16:53:41 -0000 1.4.2.1 +++ gedit/gedit-io-error-message-area.c 2 Sep 2006 15:29:45 -0000 @@ -25,7 +25,7 @@ * list of people on the gedit Team. * See the ChangeLog files for a list of changes. * - * $Id: gedit-io-error-message-area.c,v 1.4.2.1 2006/04/20 16:53:41 pborelli Exp $ + * $Id: gedit-io-error-message-area.c,v 1.7 2006/08/17 19:55:29 pborelli Exp $ */ /* @@ -334,6 +334,7 @@ gedit_unrecoverable_loading_error_messag message_area = create_unrecoverable_error_message_area (error_message, message_details); + g_free (uri_for_display); g_free (error_message); g_free (message_details); @@ -554,6 +555,7 @@ gedit_unrecoverable_reverting_error_mess message_area = create_unrecoverable_error_message_area (error_message, message_details); + g_free (uri_for_display); g_free (error_message); g_free (message_details); @@ -726,6 +728,8 @@ gedit_conversion_error_while_loading_mes message_area = create_conversion_error_message_area (error_message, message_details); + g_free (uri_for_display); + g_free (encoding_name); g_free (error_message); g_free (message_details); @@ -777,6 +781,8 @@ gedit_conversion_error_while_saving_mess error_message, message_details); + g_free (uri_for_display); + g_free (encoding_name); g_free (error_message); g_free (message_details); @@ -1316,6 +1322,7 @@ gedit_unrecoverable_saving_error_message message_area = create_unrecoverable_error_message_area (error_message, message_details); + g_free (uri_for_display); g_free (error_message); g_free (message_details); Index: gedit/gedit-python-plugin.c =================================================================== RCS file: /cvs/gnome/gedit/gedit/gedit-python-plugin.c,v retrieving revision 1.3 diff -u -p -u -p -r1.3 gedit-python-plugin.c --- gedit/gedit-python-plugin.c 6 Jan 2006 16:45:20 -0000 1.3 +++ gedit/gedit-python-plugin.c 2 Sep 2006 15:29:45 -0000 @@ -254,17 +254,21 @@ GType gedit_python_object_get_type (GTypeModule *module, PyObject *type) { - GTypeInfo *info; GType gtype; gchar *type_name; - info = g_new0 (GTypeInfo, 1); + GTypeInfo info = { + sizeof (GeditPythonObjectClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gedit_python_object_class_init, + NULL, /* class_finalize */ + type, /* class_data */ + sizeof (GeditPythonObject), + 0, /* n_preallocs */ + (GInstanceInitFunc) gedit_python_object_init, + }; - info->class_size = sizeof (GeditPythonObjectClass); - info->class_init = (GClassInitFunc) gedit_python_object_class_init; - info->instance_size = sizeof (GeditPythonObject); - info->instance_init = (GInstanceInitFunc) gedit_python_object_init; - info->class_data = type; Py_INCREF (type); type_name = g_strdup_printf ("%s+GeditPythonPlugin", @@ -274,7 +278,7 @@ gedit_python_object_get_type (GTypeModul gtype = g_type_module_register_type (module, GEDIT_TYPE_PLUGIN, type_name, - info, 0); + &info, 0); g_free (type_name); return gtype; Index: gedit/gedit-tab.c =================================================================== RCS file: /cvs/gnome/gedit/gedit/gedit-tab.c,v retrieving revision 1.10.2.1 diff -u -p -u -p -r1.10.2.1 gedit-tab.c --- gedit/gedit-tab.c 20 Apr 2006 16:53:41 -0000 1.10.2.1 +++ gedit/gedit-tab.c 2 Sep 2006 15:29:45 -0000 @@ -389,7 +389,7 @@ gedit_tab_set_state (GeditTab *tab, set_view_properties_according_to_state (tab, state); - if ((state == GEDIT_TAB_STATE_LOADING_ERROR) || // FIXME: add other states if needed + if ((state == GEDIT_TAB_STATE_LOADING_ERROR) || /* FIXME: add other states if needed */ (state == GEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW)) { gtk_widget_hide (tab->priv->view_scrolled_window); @@ -475,7 +475,7 @@ recoverable_loading_error_message_area_r GeditTab *tab) { GeditDocument *doc; - const gchar *uri; + gchar *uri; doc = gedit_tab_get_document (tab); g_return_if_fail (GEDIT_IS_DOCUMENT (doc)); @@ -513,6 +513,8 @@ recoverable_loading_error_message_area_r response_id, tab); } + + g_free (uri); } static void @@ -575,41 +577,40 @@ show_loading_message_area (GeditTab *tab { GtkWidget *area; GeditDocument *doc = NULL; - const gchar *short_name; gchar *name; gchar *dirname = NULL; gchar *msg = NULL; gchar *name_markup; gchar *dirname_markup; gint len; - + if (tab->priv->message_area != NULL) return; - + gedit_debug (DEBUG_TAB); doc = gedit_tab_get_document (tab); g_return_if_fail (doc != NULL); - short_name = gedit_document_get_short_name_for_display (doc); - - len = g_utf8_strlen (short_name, -1); + name = gedit_document_get_short_name_for_display (doc); + len = g_utf8_strlen (name, -1); /* if the name is awfully long, truncate it and be done with it, * otherwise also show the directory (ellipsized if needed) */ if (len > MAX_MSG_LENGTH) { - name = gedit_utils_str_middle_truncate (short_name, - MAX_MSG_LENGTH); + gchar *str; + + str = gedit_utils_str_middle_truncate (name, MAX_MSG_LENGTH); + g_free (name); + name = str; } else { gchar *uri; gchar *str; - name = g_strdup (short_name); - uri = gedit_document_get_uri_for_display (doc); str = gedit_utils_uri_get_dirname (uri); g_free (uri); @@ -971,6 +972,7 @@ document_loaded (GeditDocument *document GTK_RESPONSE_CANCEL); gtk_widget_show (emsg); + g_free (uri); return; } @@ -1957,9 +1959,18 @@ print_preview_destroyed (GtkWidget *prev tab->priv->print_preview = NULL; if (tab->priv->state == GEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW) + { gedit_tab_set_state (tab, GEDIT_TAB_STATE_NORMAL); + } else - gtk_widget_show (tab->priv->view_scrolled_window); + { + /* This should happen only when printing while showing the print + * 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 == GEDIT_TAB_STATE_PRINTING); + } } static void @@ -1970,8 +1981,7 @@ set_print_preview (GeditTab *tab, GtkWi if (tab->priv->print_preview != NULL) gtk_widget_destroy (tab->priv->print_preview); - - + tab->priv->print_preview = print_preview; gtk_box_pack_end (GTK_BOX (tab), @@ -2056,8 +2066,16 @@ print_finished_cb (GtkSourcePrintJob *pj g_object_unref (gjob); gedit_print_job_save_config (GEDIT_PRINT_JOB (pjob)); - + g_object_unref (pjob); + + if (tab->priv->print_preview != NULL) + { + /* If we were printing while showing the print preview, + see bug #352658 */ + gtk_widget_destroy (tab->priv->print_preview); + g_return_if_fail (tab->priv->state == GEDIT_TAB_STATE_PRINTING); + } gedit_tab_set_state (tab, GEDIT_TAB_STATE_NORMAL); } @@ -2073,6 +2091,14 @@ print_cancelled (GeditMessageArea *area, g_object_unref (tab->priv->print_job); set_message_area (tab, NULL); /* destroy the message area */ + + if (tab->priv->print_preview != NULL) + { + /* If we were printing while showing the print preview, + see bug #352658 */ + gtk_widget_destroy (tab->priv->print_preview); + g_return_if_fail (tab->priv->state == GEDIT_TAB_STATE_PRINTING); + } gedit_tab_set_state (tab, GEDIT_TAB_STATE_NORMAL); } Index: gedit/gedit.c =================================================================== RCS file: /cvs/gnome/gedit/gedit/gedit.c,v retrieving revision 1.136 diff -u -p -u -p -r1.136 gedit.c --- gedit/gedit.c 19 Mar 2006 18:38:45 -0000 1.136 +++ gedit/gedit.c 2 Sep 2006 15:29:45 -0000 @@ -510,12 +510,14 @@ main (int argc, char *argv[]) gedit_debug_message (DEBUG_APP, "Init recent files"); gedit_recent_init (); + /* Initialize authentication manager */ + gedit_debug_message (DEBUG_APP, "Init authentication manager"); + gnome_authentication_manager_init (); + /* Init plugins engine */ gedit_debug_message (DEBUG_APP, "Init plugins"); gedit_plugins_engine_init (); - gedit_debug_message (DEBUG_APP, "Init authentication manager"); - gnome_authentication_manager_init (); gtk_about_dialog_set_url_hook (gedit_utils_activate_url, NULL, NULL); /* Initialize session management */ Index: gedit/dialogs/gedit-close-confirmation-dialog.c =================================================================== RCS file: /cvs/gnome/gedit/gedit/dialogs/gedit-close-confirmation-dialog.c,v retrieving revision 1.14 diff -u -p -u -p -r1.14 gedit-close-confirmation-dialog.c --- gedit/dialogs/gedit-close-confirmation-dialog.c 14 Mar 2006 10:53:12 -0000 1.14 +++ gedit/dialogs/gedit-close-confirmation-dialog.c 2 Sep 2006 15:29:45 -0000 @@ -25,7 +25,7 @@ * list of people on the gedit Team. * See the ChangeLog files for a list of changes. * - * $Id: gedit-close-confirmation-dialog.c,v 1.14 2006/03/14 10:53:12 pborelli Exp $ + * $Id: gedit-close-confirmation-dialog.c,v 1.20 2006/08/24 15:08:34 paolo Exp $ */ #ifdef HAVE_CONFIG_H @@ -38,6 +38,7 @@ #include #include + /* Properties */ enum { @@ -62,8 +63,6 @@ enum N_COLUMNS }; -typedef struct _GeditCloseConfirmationDialogPrivate GeditCloseConfirmationDialogPrivate; - struct _GeditCloseConfirmationDialogPrivate { gboolean logout_mode; @@ -75,9 +74,13 @@ struct _GeditCloseConfirmationDialogPriv GtkTreeModel *list_store; }; -#define GEDIT_CLOSE_CONFIRMATION_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEDIT_TYPE_CLOSE_CONFIRMATION_DIALOG, GeditCloseConfirmationDialogPrivate)) - -#define GET_MODE(priv) (((priv->unsaved_documents != NULL) && (priv->unsaved_documents->next == NULL)) ? SINGLE_DOC_MODE : MULTIPLE_DOCS_MODE) +#define GEDIT_CLOSE_CONFIRMATION_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \ + GEDIT_TYPE_CLOSE_CONFIRMATION_DIALOG, \ + GeditCloseConfirmationDialogPrivate)) + +#define GET_MODE(priv) (((priv->unsaved_documents != NULL) && \ + (priv->unsaved_documents->next == NULL)) ? \ + SINGLE_DOC_MODE : MULTIPLE_DOCS_MODE) G_DEFINE_TYPE(GeditCloseConfirmationDialog, gedit_close_confirmation_dialog, GTK_TYPE_DIALOG) @@ -98,20 +101,22 @@ response_cb (GeditCloseConfirmationDialo g_return_if_fail (GEDIT_IS_CLOSE_CONFIRMATION_DIALOG (dlg)); - priv = GEDIT_CLOSE_CONFIRMATION_DIALOG_GET_PRIVATE (dlg); + priv = dlg->priv; if (priv->selected_documents != NULL) g_list_free (priv->selected_documents); - + if (response_id == GTK_RESPONSE_YES) { if (GET_MODE (priv) == SINGLE_DOC_MODE) + { priv->selected_documents = g_list_copy (priv->unsaved_documents); + } else { g_return_if_fail (priv->list_store); - + priv->selected_documents = get_selected_docs (priv->list_store); } @@ -125,11 +130,12 @@ set_logout_mode (GeditCloseConfirmationD gboolean logout_mode) { GeditCloseConfirmationDialogPrivate *priv; - - priv = GEDIT_CLOSE_CONFIRMATION_DIALOG_GET_PRIVATE (dlg); + const gchar *stock_id = GTK_STOCK_SAVE; + + priv = dlg->priv; priv->logout_mode = logout_mode; - + if (logout_mode) { gtk_dialog_add_button (GTK_DIALOG (dlg), @@ -151,25 +157,38 @@ set_logout_mode (GeditCloseConfirmationD GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); } + if (GET_MODE (dlg->priv) == SINGLE_DOC_MODE) + { + GeditDocument *doc; + + doc = GEDIT_DOCUMENT (dlg->priv->unsaved_documents->data); + + if (gedit_document_get_readonly (doc) || + gedit_document_is_untitled (doc)) + stock_id = GTK_STOCK_SAVE_AS; + } + gtk_dialog_add_button (GTK_DIALOG (dlg), - GTK_STOCK_SAVE, GTK_RESPONSE_YES); + stock_id, + GTK_RESPONSE_YES); - gtk_dialog_set_default_response (GTK_DIALOG (dlg), GTK_RESPONSE_YES); + gtk_dialog_set_default_response (GTK_DIALOG (dlg), + GTK_RESPONSE_YES); } static void gedit_close_confirmation_dialog_init (GeditCloseConfirmationDialog *dlg) { - GeditCloseConfirmationDialogPrivate *priv; AtkObject *atk_obj; - priv = GEDIT_CLOSE_CONFIRMATION_DIALOG_GET_PRIVATE (dlg); + dlg->priv = GEDIT_CLOSE_CONFIRMATION_DIALOG_GET_PRIVATE (dlg); gtk_container_set_border_width (GTK_CONTAINER (dlg), 5); gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dlg)->vbox), 14); gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE); gtk_dialog_set_has_separator (GTK_DIALOG (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); @@ -190,8 +209,8 @@ gedit_close_confirmation_dialog_finalize { GeditCloseConfirmationDialogPrivate *priv; - priv = GEDIT_CLOSE_CONFIRMATION_DIALOG_GET_PRIVATE (object); - + priv = GEDIT_CLOSE_CONFIRMATION_DIALOG (object)->priv; + if (priv->unsaved_documents != NULL) g_list_free (priv->unsaved_documents); @@ -209,10 +228,8 @@ gedit_close_confirmation_dialog_set_prop GParamSpec *pspec) { GeditCloseConfirmationDialog *dlg; - GeditCloseConfirmationDialogPrivate *priv; dlg = GEDIT_CLOSE_CONFIRMATION_DIALOG (object); - priv = GEDIT_CLOSE_CONFIRMATION_DIALOG_GET_PRIVATE (object); switch (prop_id) { @@ -238,7 +255,7 @@ gedit_close_confirmation_dialog_get_prop { GeditCloseConfirmationDialogPrivate *priv; - priv = GEDIT_CLOSE_CONFIRMATION_DIALOG_GET_PRIVATE (object); + priv = GEDIT_CLOSE_CONFIRMATION_DIALOG (object)->priv; switch( prop_id ) { @@ -249,7 +266,7 @@ gedit_close_confirmation_dialog_get_prop case PROP_LOGOUT_MODE: g_value_set_boolean (value, priv->logout_mode); break; - + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -274,7 +291,7 @@ gedit_close_confirmation_dialog_class_in "List of Unsaved Documents", (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY))); - + g_object_class_install_property (gobject_class, PROP_LOGOUT_MODE, g_param_spec_boolean ("logout_mode", @@ -318,13 +335,9 @@ get_selected_docs (GtkTreeModel *store) GList * gedit_close_confirmation_dialog_get_selected_documents (GeditCloseConfirmationDialog *dlg) { - GeditCloseConfirmationDialogPrivate *priv; - g_return_val_if_fail (GEDIT_IS_CLOSE_CONFIRMATION_DIALOG (dlg), NULL); - priv = GEDIT_CLOSE_CONFIRMATION_DIALOG_GET_PRIVATE (dlg); - - return g_list_copy (priv->selected_documents); + return g_list_copy (dlg->priv->selected_documents); } GtkWidget * @@ -458,6 +471,7 @@ get_text_secondary_label (GeditDocument static void build_single_doc_dialog (GeditCloseConfirmationDialog *dlg) { + GeditCloseConfirmationDialogPrivate *priv; GtkWidget *hbox; GtkWidget *vbox; GtkWidget *primary_label; @@ -468,9 +482,7 @@ build_single_doc_dialog (GeditCloseConfi gchar *str; gchar *markup_str; - GeditCloseConfirmationDialogPrivate *priv; - - priv = GEDIT_CLOSE_CONFIRMATION_DIALOG_GET_PRIVATE (dlg); + priv = dlg->priv; g_return_if_fail (priv->unsaved_documents->data != NULL); doc = GEDIT_DOCUMENT (priv->unsaved_documents->data); @@ -622,6 +634,7 @@ create_treeview (GeditCloseConfirmationD static void build_multiple_docs_dialog (GeditCloseConfirmationDialog *dlg) { + GeditCloseConfirmationDialogPrivate *priv; GtkWidget *hbox; GtkWidget *image; GtkWidget *vbox; @@ -634,9 +647,7 @@ build_multiple_docs_dialog (GeditCloseCo gchar *str; gchar *markup_str; - GeditCloseConfirmationDialogPrivate *priv; - - priv = GEDIT_CLOSE_CONFIRMATION_DIALOG_GET_PRIVATE (dlg); + priv = dlg->priv; hbox = gtk_hbox_new (FALSE, 12); gtk_container_set_border_width (GTK_CONTAINER (hbox), 5); @@ -666,7 +677,7 @@ build_multiple_docs_dialog (GeditCloseCo "Save changes before closing?", g_list_length (priv->unsaved_documents)), g_list_length (priv->unsaved_documents)); - + markup_str = g_strconcat ("", str, "", NULL); g_free (str); @@ -711,10 +722,10 @@ set_unsaved_document (GeditCloseConfirma const GList *list) { GeditCloseConfirmationDialogPrivate *priv; - + g_return_if_fail (list != NULL); - priv = GEDIT_CLOSE_CONFIRMATION_DIALOG_GET_PRIVATE (dlg); + priv = dlg->priv; g_return_if_fail (priv->unsaved_documents == NULL); priv->unsaved_documents = g_list_copy ((GList *)list); @@ -732,11 +743,7 @@ set_unsaved_document (GeditCloseConfirma const GList * gedit_close_confirmation_dialog_get_unsaved_documents (GeditCloseConfirmationDialog *dlg) { - GeditCloseConfirmationDialogPrivate *priv; - g_return_val_if_fail (GEDIT_IS_CLOSE_CONFIRMATION_DIALOG (dlg), NULL); - priv = GEDIT_CLOSE_CONFIRMATION_DIALOG_GET_PRIVATE (dlg); - - return priv->unsaved_documents; + return dlg->priv->unsaved_documents; } Index: gedit/dialogs/gedit-close-confirmation-dialog.h =================================================================== RCS file: /cvs/gnome/gedit/gedit/dialogs/gedit-close-confirmation-dialog.h,v retrieving revision 1.3 diff -u -p -u -p -r1.3 gedit-close-confirmation-dialog.h --- gedit/dialogs/gedit-close-confirmation-dialog.h 14 Mar 2006 10:53:12 -0000 1.3 +++ gedit/dialogs/gedit-close-confirmation-dialog.h 2 Sep 2006 15:29:46 -0000 @@ -44,10 +44,14 @@ typedef struct _GeditCloseConfirmationDialog GeditCloseConfirmationDialog; typedef struct _GeditCloseConfirmationDialogClass GeditCloseConfirmationDialogClass; +typedef struct _GeditCloseConfirmationDialogPrivate GeditCloseConfirmationDialogPrivate; struct _GeditCloseConfirmationDialog { GtkDialog parent; + + /*< private > */ + GeditCloseConfirmationDialogPrivate *priv; }; struct _GeditCloseConfirmationDialogClass Index: gedit/dialogs/gedit-preferences-dialog.c =================================================================== RCS file: /cvs/gnome/gedit/gedit/dialogs/gedit-preferences-dialog.c,v retrieving revision 1.74 diff -u -p -u -p -r1.74 gedit-preferences-dialog.c --- gedit/dialogs/gedit-preferences-dialog.c 12 Dec 2005 17:27:56 -0000 1.74 +++ gedit/dialogs/gedit-preferences-dialog.c 2 Sep 2006 15:29:46 -0000 @@ -26,7 +26,7 @@ * list of people on the gedit Team. * See the ChangeLog files for a list of changes. * - * $Id: gedit-preferences-dialog.c,v 1.74 2005/12/12 17:27:56 pborelli Exp $ + * $Id: gedit-preferences-dialog.c,v 1.75 2006/08/17 21:01:17 pborelli Exp $ */ #ifdef HAVE_CONFIG_H @@ -768,10 +768,11 @@ enable_syntax_hl_button_toggled (GtkWidg } static void -language_changed_cb (GtkComboBox *combobox, +language_changed_cb (GtkComboBox *combobox, GeditPreferencesDialog *dlg) { const GSList *languages; + gint active; GSList *tags, *l; GtkSourceLanguage *lang; GtkTreeIter iter; @@ -780,7 +781,14 @@ language_changed_cb (GtkComboBox *combob languages = gedit_languages_manager_get_available_languages_sorted ( gedit_get_languages_manager ()); - lang = g_slist_nth_data ((GSList*)languages, gtk_combo_box_get_active (combobox)); + active = gtk_combo_box_get_active (combobox); + if (active < 0) + { + /* no active language: no lang files found */ + return; + } + + lang = g_slist_nth_data ((GSList*)languages, active); gtk_list_store_clear (dlg->priv->tags_treeview_model); Index: plugins/modelines/modelines.py =================================================================== RCS file: /cvs/gnome/gedit/plugins/modelines/modelines.py,v retrieving revision 1.2.2.1 diff -u -p -u -p -r1.2.2.1 modelines.py --- plugins/modelines/modelines.py 2 May 2006 14:16:14 -0000 1.2.2.1 +++ plugins/modelines/modelines.py 2 Sep 2006 15:29:46 -0000 @@ -41,7 +41,7 @@ class ModelinePlugin(gedit.Plugin): def activate(self, window): for view in window.get_views(): self.connect_handlers(view) - apply_modeline(doc, None, view) + apply_modeline(view.get_buffer(), None, view) tab_added_id = window.connect("tab_added", lambda w, t: self.connect_handlers(t.get_view())) Index: plugins/sort/gedit-sort-plugin.c =================================================================== RCS file: /cvs/gnome/gedit/plugins/sort/gedit-sort-plugin.c,v retrieving revision 1.2 diff -u -p -u -p -r1.2 gedit-sort-plugin.c --- plugins/sort/gedit-sort-plugin.c 12 Dec 2005 17:28:01 -0000 1.2 +++ plugins/sort/gedit-sort-plugin.c 2 Sep 2006 15:29:46 -0000 @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * $Id: gedit-sort-plugin.c,v 1.2 2005/12/12 17:28:01 pborelli Exp $ + * $Id: gedit-sort-plugin.c,v 1.3 2006/05/15 09:06:37 pborelli Exp $ */ #ifdef HAVE_CONFIG_H @@ -282,17 +282,39 @@ compare_algorithm (gconstpointer s1, return ret; } +static gchar * +get_line_slice (GtkTextBuffer *buf, + gint line) +{ + GtkTextIter start, end; + char *ret; + + gtk_text_buffer_get_iter_at_line (buf, &start, line); + end = start; + + if (!gtk_text_iter_ends_line (&start)) + gtk_text_iter_forward_to_line_end (&end); + + ret= gtk_text_buffer_get_slice (buf, + &start, + &end, + TRUE); + + g_assert (ret != NULL); + + return ret; +} + static void sort_real (SortDialog *dialog) { GeditDocument *doc; GtkTextIter start, end; - gchar *buffer; - gchar *p; - gunichar c; + gint start_line, end_line; + gint i; gchar *last_row = NULL; - gpointer *lines; - gint cont; + gint num_lines; + gchar **lines; SortInfo *sort_info; gedit_debug (DEBUG_PLUGINS); @@ -316,47 +338,33 @@ sort_real (SortDialog *dialog) &end); } - buffer = gtk_text_buffer_get_slice (GTK_TEXT_BUFFER (doc), - &start, - &end, - TRUE); + start_line = gtk_text_iter_get_line (&start); + end_line = gtk_text_iter_get_line (&end); - lines = g_new0 (gpointer, gtk_text_buffer_get_line_count (GTK_TEXT_BUFFER (doc)) + 1); + /* if we are at line start our last line is the previus one. + * Otherwise the last line is the current one but we try to + * move the iter after the line terminator */ + if (gtk_text_iter_get_line_offset (&end) == 0) + end_line = MAX (start_line, end_line - 1); + else + gtk_text_iter_forward_line (&end); - gedit_debug_message (DEBUG_PLUGINS, "Building list..."); + num_lines = end_line - start_line + 1; + lines = g_new0 (gchar *, num_lines + 1); - cont = 0; - p = buffer; - c = g_utf8_get_char (p); + gedit_debug_message (DEBUG_PLUGINS, "Building list..."); - while (c != '\0') + for (i = 0; i < num_lines; i++) { - if (c == '\n') - { - gchar *old_p; - - old_p = p; - p = g_utf8_next_char (p); - - *old_p = '\0'; - - lines[cont] = p; - ++cont; - } else - { - p = g_utf8_next_char (p); - } - - c = g_utf8_get_char (p); + lines[i] = get_line_slice (GTK_TEXT_BUFFER (doc), start_line + i); } - lines[cont] = buffer; - ++cont; + lines[num_lines] = NULL; gedit_debug_message (DEBUG_PLUGINS, "Sort list..."); g_qsort_with_data (lines, - cont, + num_lines, sizeof (gpointer), compare_algorithm, sort_info); @@ -369,40 +377,28 @@ sort_real (SortDialog *dialog) &start, &end); - cont = 0; - - while (lines[cont] != NULL) + for (i = 0; i < num_lines; i++) { - gchar *current_row = lines[cont]; - - /* Don't insert this row if it's the same as the last - * one and the user has specified to remove duplicates. */ - if (!sort_info->remove_duplicates || - last_row == NULL || - (strcmp (last_row, current_row) != 0)) - { - gtk_text_buffer_insert (GTK_TEXT_BUFFER (doc), - &start, - current_row, - -1); - - if (lines[cont + 1] != NULL) - { - gtk_text_buffer_insert (GTK_TEXT_BUFFER (doc), - &start, - "\n", - -1); - } - } + if (sort_info->remove_duplicates && + last_row != NULL && + (strcmp (last_row, lines[i]) == 0)) + continue; + + gtk_text_buffer_insert (GTK_TEXT_BUFFER (doc), + &start, + lines[i], + -1); + gtk_text_buffer_insert (GTK_TEXT_BUFFER (doc), + &start, + "\n", + -1); - last_row = current_row; - ++cont; + last_row = lines[i]; } gtk_source_buffer_end_not_undoable_action (GTK_SOURCE_BUFFER (doc)); - g_free (lines); - g_free (buffer); + g_strfreev (lines); g_free (sort_info); gedit_debug_message (DEBUG_PLUGINS, "Done."); Index: plugins/spell/gedit-spell-plugin.c =================================================================== RCS file: /cvs/gnome/gedit/plugins/spell/gedit-spell-plugin.c,v retrieving revision 1.5 diff -u -p -u -p -r1.5 gedit-spell-plugin.c --- plugins/spell/gedit-spell-plugin.c 19 Feb 2006 23:11:32 -0000 1.5 +++ plugins/spell/gedit-spell-plugin.c 2 Sep 2006 15:29:46 -0000 @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * $Id: gedit-spell-plugin.c,v 1.5 2006/02/19 23:11:32 pborelli Exp $ + * $Id: gedit-spell-plugin.c,v 1.6 2006/08/09 11:26:25 pborelli Exp $ */ #ifdef HAVE_CONFIG_H @@ -826,13 +826,20 @@ static void update_ui_real (GeditWindow *window, WindowData *data) { + GeditDocument *doc; GeditView *view; - + gboolean autospell; + GtkAction *action; + gedit_debug (DEBUG_PLUGINS); + doc = gedit_window_get_active_document (window); view = gedit_window_get_active_view (window); - // TODO, see old plugin + autospell = (doc != NULL && + gedit_automatic_spell_checker_get_from_document (doc) != NULL); + action = gtk_action_group_get_action (data->action_group, "AutoSpell"); + gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), autospell); gtk_action_group_set_sensitive (data->action_group, (view != NULL) &&