anjuta r3848 - in trunk: . libanjuta plugins/document-manager plugins/editor plugins/search plugins/sourceview



Author: jhs
Date: Sat Apr 12 15:13:44 2008
New Revision: 3848
URL: http://svn.gnome.org/viewvc/anjuta?rev=3848&view=rev

Log:
2008-04-12  Johannes Schmid  <jhs gnome org>

	* libanjuta/Makefile.am:
	* libanjuta/libanjuta.h:
	* plugins/document-manager/anjuta-document-manager.glade:
	* plugins/document-manager/plugin.c:
	* plugins/editor/text_editor.c (text_editor_finalize),
	(convert_to_utf8), (load_from_file), (save_to_file):
	* plugins/editor/text_editor.h:
	* plugins/sourceview/Makefile.am:
	* plugins/sourceview/anjuta-convert.c:
	* plugins/sourceview/anjuta-convert.h:
	* plugins/sourceview/anjuta-document-loader.c:
	* plugins/sourceview/anjuta-document-saver.c:
	* plugins/sourceview/anjuta-document.c:
	* plugins/sourceview/anjuta-encodings.c:
	* plugins/sourceview/anjuta-encodings.h:
	* plugins/sourceview/anjuta-utils.c:
	* plugins/sourceview/anjuta-utils.h:
	* plugins/sourceview/anjuta-view.c:
	* plugins/sourceview/sourceview.c:
	
	Move the encoding conversion infrastrcute to libanjuta and update all
	users. Test all available encodings by default in scintilla editor
	like sourceview is doing and removed encoding preferences

	* plugins/search/search-replace_backend.c
	(file_buffer_new_from_uri):
	Fixed crasher

Added:
   trunk/libanjuta/anjuta-convert.c
      - copied unchanged from r3838, /trunk/plugins/sourceview/anjuta-convert.c
   trunk/libanjuta/anjuta-convert.h
      - copied unchanged from r3838, /trunk/plugins/sourceview/anjuta-convert.h
Removed:
   trunk/plugins/sourceview/anjuta-convert.c
   trunk/plugins/sourceview/anjuta-convert.h
   trunk/plugins/sourceview/anjuta-encodings.c
   trunk/plugins/sourceview/anjuta-encodings.h
Modified:
   trunk/ChangeLog
   trunk/libanjuta/Makefile.am
   trunk/libanjuta/libanjuta.h
   trunk/plugins/document-manager/anjuta-document-manager.glade
   trunk/plugins/document-manager/plugin.c
   trunk/plugins/editor/text_editor.c
   trunk/plugins/editor/text_editor.h
   trunk/plugins/search/search-replace.c
   trunk/plugins/search/search-replace_backend.c
   trunk/plugins/sourceview/Makefile.am
   trunk/plugins/sourceview/anjuta-document-loader.c
   trunk/plugins/sourceview/anjuta-document-saver.c
   trunk/plugins/sourceview/anjuta-document.c
   trunk/plugins/sourceview/anjuta-utils.c
   trunk/plugins/sourceview/anjuta-utils.h
   trunk/plugins/sourceview/anjuta-view.c
   trunk/plugins/sourceview/sourceview.c

Modified: trunk/libanjuta/Makefile.am
==============================================================================
--- trunk/libanjuta/Makefile.am	(original)
+++ trunk/libanjuta/Makefile.am	Sat Apr 12 15:13:44 2008
@@ -30,6 +30,7 @@
 	anjuta-shell.c \
 	anjuta-status.c \
 	anjuta-encodings.c \
+	anjuta-convert.c \
 	anjuta-preferences-dialog.c \
 	anjuta-preferences.c \
 	anjuta-plugin.c \
@@ -97,6 +98,7 @@
 	anjuta-shell.h \
 	anjuta-status.h \
 	anjuta-encodings.h \
+	anjuta-convert.h \
 	anjuta-plugin.h \
 	anjuta-plugin-description.h \
 	anjuta-plugin-manager.h \

Modified: trunk/libanjuta/libanjuta.h
==============================================================================
--- trunk/libanjuta/libanjuta.h	(original)
+++ trunk/libanjuta/libanjuta.h	Sat Apr 12 15:13:44 2008
@@ -23,6 +23,7 @@
 /* FIXME: Update required */
 #include <libanjuta/anjuta-debug.h>
 #include <libanjuta/anjuta-encodings.h>
+#include <libanjuta/anjuta-convert.h>
 #include <libanjuta/anjuta-enum-types.h>
 #include <libanjuta/anjuta-launcher.h>
 #include <libanjuta/anjuta-marshal.h>

Modified: trunk/plugins/document-manager/anjuta-document-manager.glade
==============================================================================
--- trunk/plugins/document-manager/anjuta-document-manager.glade	(original)
+++ trunk/plugins/document-manager/anjuta-document-manager.glade	Sat Apr 12 15:13:44 2008
@@ -5,407 +5,222 @@
   <widget class="GtkWindow" id="preferences_dialog">
     <property name="title" translatable="yes">window1</property>
     <child>
-      <widget class="GtkNotebook" id="Documents">
+      <widget class="GtkHBox" id="Documents">
         <property name="visible">True</property>
-        <property name="can_focus">True</property>
+        <property name="border_width">5</property>
+        <property name="spacing">5</property>
         <child>
-          <widget class="GtkHBox" id="page1">
+          <widget class="GtkVBox" id="vbox31">
             <property name="visible">True</property>
-            <property name="border_width">5</property>
             <property name="spacing">5</property>
             <child>
-              <widget class="GtkVBox" id="vbox31">
+              <widget class="GtkFrame" id="frame46">
                 <property name="visible">True</property>
-                <property name="spacing">5</property>
+                <property name="label_xalign">0</property>
+                <property name="shadow_type">GTK_SHADOW_NONE</property>
                 <child>
-                  <widget class="GtkFrame" id="frame46">
+                  <widget class="GtkVBox" id="vbox1119">
                     <property name="visible">True</property>
-                    <property name="label_xalign">0</property>
-                    <property name="shadow_type">GTK_SHADOW_NONE</property>
-                    <child>
-                      <widget class="GtkVBox" id="vbox1119">
-                        <property name="visible">True</property>
-                        <property name="border_width">5</property>
-                        <property name="spacing">5</property>
-                        <child>
-                          <widget class="GtkCheckButton" id="preferences_toggle:bool:1:0:save.automatic">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="label" translatable="yes">Enable files autosave</property>
-                            <property name="use_underline">True</property>
-                            <property name="response_id">0</property>
-                            <property name="draw_indicator">True</property>
-                          </widget>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkTable" id="table28">
-                            <property name="visible">True</property>
-                            <property name="n_rows">2</property>
-                            <property name="n_columns">2</property>
-                            <property name="column_spacing">5</property>
-                            <property name="row_spacing">5</property>
-                            <child>
-                              <widget class="GtkLabel" id="label115">
-                                <property name="visible">True</property>
-                                <property name="xalign">0</property>
-                                <property name="label" translatable="yes">Save files interval in minutes</property>
-                              </widget>
-                              <packing>
-                                <property name="left_attach">1</property>
-                                <property name="right_attach">2</property>
-                                <property name="x_options">GTK_FILL</property>
-                                <property name="y_options"></property>
-                              </packing>
-                            </child>
-                            <child>
-                              <widget class="GtkLabel" id="label116">
-                                <property name="xalign">0</property>
-                                <property name="label" translatable="yes">Save session interval in minutes</property>
-                              </widget>
-                              <packing>
-                                <property name="left_attach">1</property>
-                                <property name="right_attach">2</property>
-                                <property name="top_attach">1</property>
-                                <property name="bottom_attach">2</property>
-                                <property name="x_options">GTK_FILL</property>
-                                <property name="y_options"></property>
-                              </packing>
-                            </child>
-                            <child>
-                              <widget class="GtkSpinButton" id="preferences_spin:int:10:0:autosave.timer">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="adjustment">10 1 1000 1 10 10</property>
-                                <property name="climb_rate">1</property>
-                                <property name="numeric">True</property>
-                              </widget>
-                              <packing>
-                                <property name="x_options">GTK_FILL</property>
-                                <property name="y_options"></property>
-                              </packing>
-                            </child>
-                            <child>
-                              <widget class="GtkSpinButton" id="preferences_spin:int:10:0:save.session.timer">
-                                <property name="can_focus">True</property>
-                                <property name="adjustment">10 0 1000 1 10 10</property>
-                                <property name="climb_rate">1</property>
-                                <property name="numeric">True</property>
-                              </widget>
-                              <packing>
-                                <property name="top_attach">1</property>
-                                <property name="bottom_attach">2</property>
-                                <property name="x_options">GTK_FILL</property>
-                                <property name="y_options"></property>
-                              </packing>
-                            </child>
-                          </widget>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
-                      </widget>
-                    </child>
+                    <property name="border_width">5</property>
+                    <property name="spacing">5</property>
                     <child>
-                      <widget class="GtkLabel" id="label12335">
+                      <widget class="GtkCheckButton" id="preferences_toggle:bool:1:0:save.automatic">
                         <property name="visible">True</property>
-                        <property name="label" translatable="yes">&lt;b&gt;Autosave&lt;/b&gt;</property>
-                        <property name="use_markup">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="label" translatable="yes">Enable files autosave</property>
+                        <property name="use_underline">True</property>
+                        <property name="response_id">0</property>
+                        <property name="draw_indicator">True</property>
                       </widget>
                       <packing>
-                        <property name="type">label_item</property>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
                       </packing>
                     </child>
-                  </widget>
-                  <packing>
-                    <property name="expand">False</property>
-                  </packing>
-                </child>
-                <child>
-                  <placeholder/>
-                </child>
-                <child>
-                  <placeholder/>
-                </child>
-              </widget>
-              <packing>
-                <property name="expand">False</property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkVBox" id="vbox32">
-                <property name="visible">True</property>
-                <property name="spacing">5</property>
-                <child>
-                  <placeholder/>
-                </child>
-                <child>
-                  <widget class="GtkFrame" id="frame31">
-                    <property name="visible">True</property>
-                    <property name="label_xalign">0</property>
-                    <property name="shadow_type">GTK_SHADOW_NONE</property>
                     <child>
-                      <widget class="GtkVBox" id="vbox33">
+                      <widget class="GtkTable" id="table28">
                         <property name="visible">True</property>
-                        <property name="border_width">5</property>
-                        <property name="spacing">5</property>
+                        <property name="n_rows">2</property>
+                        <property name="n_columns">2</property>
+                        <property name="column_spacing">5</property>
+                        <property name="row_spacing">5</property>
                         <child>
-                          <widget class="GtkRadioButton" id="radiobutton9">
+                          <widget class="GtkLabel" id="label115">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="label" translatable="yes">Sorted in opening order</property>
-                            <property name="use_underline">True</property>
-                            <property name="response_id">0</property>
-                            <property name="active">True</property>
-                            <property name="draw_indicator">True</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Save files interval in minutes</property>
                           </widget>
                           <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options"></property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkRadioButton" id="preferences_toggle:bool:0:0:editor.tabs.recent.first">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="label" translatable="yes">Sorted by most recent use</property>
-                            <property name="use_underline">True</property>
-                            <property name="response_id">0</property>
-                            <property name="draw_indicator">True</property>
-                            <property name="group">radiobutton9</property>
+                          <widget class="GtkLabel" id="label116">
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Save session interval in minutes</property>
                           </widget>
                           <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">1</property>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">1</property>
+                            <property name="bottom_attach">2</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options"></property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkRadioButton" id="preferences_toggle:bool:0:0:editor.tabs.ordering">
+                          <widget class="GtkSpinButton" id="preferences_spin:int:10:0:autosave.timer">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
-                            <property name="label" translatable="yes">Sorted in alphabetical order</property>
-                            <property name="use_underline">True</property>
-                            <property name="response_id">0</property>
-                            <property name="draw_indicator">True</property>
-                            <property name="group">radiobutton9</property>
+                            <property name="adjustment">10 1 1000 1 10 10</property>
+                            <property name="climb_rate">1</property>
+                            <property name="numeric">True</property>
                           </widget>
                           <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">2</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options"></property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkRadioButton" id="preferences_toggle:bool:0:0:editor.tabs.hide">
-                            <property name="visible">True</property>
+                          <widget class="GtkSpinButton" id="preferences_spin:int:10:0:save.session.timer">
                             <property name="can_focus">True</property>
-                            <property name="label" translatable="yes">Do not show tabs</property>
-                            <property name="use_underline">True</property>
-                            <property name="response_id">0</property>
-                            <property name="draw_indicator">True</property>
-                            <property name="group">radiobutton9</property>
-                          </widget>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">3</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkHBox" id="hbox27">
-                            <property name="visible">True</property>
-                            <property name="border_width">5</property>
-                            <property name="spacing">5</property>
-                            <child>
-                              <widget class="GtkLabel" id="label117">
-                                <property name="visible">True</property>
-                                <property name="label" translatable="yes">Position:</property>
-                              </widget>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">False</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <widget class="GtkComboBox" id="preferences_combo:text:Top,Bottom,Left,Right:0:editor.tabs.pos">
-                                <property name="visible">True</property>
-                                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                <property name="items" translatable="yes">Top
-Bottom
-Left
-Right</property>
-                              </widget>
-                              <packing>
-                                <property name="position">1</property>
-                              </packing>
-                            </child>
+                            <property name="adjustment">10 0 1000 1 10 10</property>
+                            <property name="climb_rate">1</property>
+                            <property name="numeric">True</property>
                           </widget>
                           <packing>
-                            <property name="position">4</property>
+                            <property name="top_attach">1</property>
+                            <property name="bottom_attach">2</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options"></property>
                           </packing>
                         </child>
-                        <child>
-                          <placeholder/>
-                        </child>
-                      </widget>
-                    </child>
-                    <child>
-                      <widget class="GtkLabel" id="label113">
-                        <property name="visible">True</property>
-                        <property name="label" translatable="yes">&lt;b&gt;Editor tabs&lt;/b&gt;</property>
-                        <property name="use_markup">True</property>
                       </widget>
                       <packing>
-                        <property name="type">label_item</property>
+                        <property name="expand">False</property>
+                        <property name="position">1</property>
                       </packing>
                     </child>
                   </widget>
+                </child>
+                <child>
+                  <widget class="GtkLabel" id="label12335">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">&lt;b&gt;Autosave&lt;/b&gt;</property>
+                    <property name="use_markup">True</property>
+                  </widget>
                   <packing>
-                    <property name="expand">False</property>
-                    <property name="position">1</property>
+                    <property name="type">label_item</property>
                   </packing>
                 </child>
               </widget>
               <packing>
-                <property name="position">1</property>
+                <property name="expand">False</property>
               </packing>
             </child>
-          </widget>
-        </child>
-        <child>
-          <widget class="GtkLabel" id="label12350">
-            <property name="visible">True</property>
-            <property name="label" translatable="yes">Documents</property>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
           </widget>
           <packing>
-            <property name="type">tab</property>
-            <property name="tab_fill">False</property>
+            <property name="expand">False</property>
           </packing>
         </child>
         <child>
-          <widget class="GtkVBox" id="page4">
+          <widget class="GtkVBox" id="vbox32">
             <property name="visible">True</property>
+            <property name="spacing">5</property>
             <child>
-              <widget class="GtkFrame" id="frame48">
+              <placeholder/>
+            </child>
+            <child>
+              <widget class="GtkFrame" id="frame31">
                 <property name="visible">True</property>
-                <property name="border_width">5</property>
                 <property name="label_xalign">0</property>
                 <property name="shadow_type">GTK_SHADOW_NONE</property>
                 <child>
-                  <widget class="GtkTable" id="table29">
+                  <widget class="GtkVBox" id="vbox33">
                     <property name="visible">True</property>
-                    <property name="border_width">10</property>
-                    <property name="n_rows">3</property>
-                    <property name="n_columns">1</property>
+                    <property name="border_width">5</property>
+                    <property name="spacing">5</property>
                     <child>
-                      <widget class="GtkRadioButton" id="preferences_toggle:bool:0:0:save.encoding.current.locale">
+                      <widget class="GtkRadioButton" id="radiobutton9">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
-                        <property name="label" translatable="yes">Try to save in current locale's encoding</property>
+                        <property name="label" translatable="yes">Sorted in opening order</property>
                         <property name="use_underline">True</property>
                         <property name="response_id">0</property>
+                        <property name="active">True</property>
                         <property name="draw_indicator">True</property>
-                        <property name="group">radiobutton10</property>
                       </widget>
                       <packing>
-                        <property name="top_attach">2</property>
-                        <property name="bottom_attach">3</property>
-                        <property name="x_options">GTK_FILL</property>
-                        <property name="y_options"></property>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkRadioButton" id="preferences_toggle:bool:1:0:save.encoding.original">
+                      <widget class="GtkRadioButton" id="preferences_toggle:bool:0:0:editor.tabs.recent.first">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
-                        <property name="label" translatable="yes">Try to save in original encoding</property>
+                        <property name="label" translatable="yes">Sorted by most recent use</property>
                         <property name="use_underline">True</property>
                         <property name="response_id">0</property>
                         <property name="draw_indicator">True</property>
-                        <property name="group">radiobutton10</property>
+                        <property name="group">radiobutton9</property>
                       </widget>
                       <packing>
-                        <property name="top_attach">1</property>
-                        <property name="bottom_attach">2</property>
-                        <property name="x_options">GTK_FILL</property>
-                        <property name="y_options"></property>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">1</property>
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkRadioButton" id="radiobutton10">
+                      <widget class="GtkRadioButton" id="preferences_toggle:bool:0:0:editor.tabs.ordering">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
-                        <property name="label" translatable="yes">Always save in UTF-8 encoding (faster)</property>
+                        <property name="label" translatable="yes">Sorted in alphabetical order</property>
                         <property name="use_underline">True</property>
                         <property name="response_id">0</property>
                         <property name="draw_indicator">True</property>
+                        <property name="group">radiobutton9</property>
                       </widget>
                       <packing>
-                        <property name="x_options">GTK_FILL</property>
-                        <property name="y_options"></property>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">2</property>
                       </packing>
                     </child>
-                  </widget>
-                </child>
-                <child>
-                  <widget class="GtkLabel" id="label12338">
-                    <property name="visible">True</property>
-                    <property name="label" translatable="yes">&lt;b&gt;Encoding to use when saving files&lt;/b&gt;</property>
-                    <property name="use_markup">True</property>
-                  </widget>
-                  <packing>
-                    <property name="type">label_item</property>
-                  </packing>
-                </child>
-              </widget>
-              <packing>
-                <property name="expand">False</property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkFrame" id="frame49">
-                <property name="visible">True</property>
-                <property name="border_width">5</property>
-                <property name="label_xalign">0</property>
-                <property name="shadow_type">GTK_SHADOW_NONE</property>
-                <child>
-                  <widget class="GtkHBox" id="hbox1123">
-                    <property name="visible">True</property>
-                    <property name="border_width">10</property>
-                    <property name="spacing">5</property>
                     <child>
-                      <widget class="GtkScrolledWindow" id="scrolledwindow25">
+                      <widget class="GtkRadioButton" id="preferences_toggle:bool:0:0:editor.tabs.hide">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
-                        <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-                        <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-                        <property name="shadow_type">GTK_SHADOW_IN</property>
-                        <child>
-                          <widget class="GtkTreeView" id="supported_treeview">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="rules_hint">True</property>
-                            <property name="enable_search">False</property>
-                          </widget>
-                        </child>
+                        <property name="label" translatable="yes">Do not show tabs</property>
+                        <property name="use_underline">True</property>
+                        <property name="response_id">0</property>
+                        <property name="draw_indicator">True</property>
+                        <property name="group">radiobutton9</property>
                       </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">3</property>
+                      </packing>
                     </child>
                     <child>
-                      <widget class="GtkVBox" id="vbox1122">
+                      <widget class="GtkHBox" id="hbox27">
                         <property name="visible">True</property>
-                        <property name="spacing">6</property>
+                        <property name="border_width">5</property>
+                        <property name="spacing">5</property>
                         <child>
-                          <widget class="GtkButton" id="add_button">
+                          <widget class="GtkLabel" id="label117">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="label">gtk-add</property>
-                            <property name="use_stock">True</property>
-                            <property name="response_id">0</property>
+                            <property name="label" translatable="yes">Position:</property>
                           </widget>
                           <packing>
                             <property name="expand">False</property>
@@ -413,80 +228,32 @@
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkButton" id="remove_button">
+                          <widget class="GtkComboBox" id="preferences_combo:text:Top,Bottom,Left,Right:0:editor.tabs.pos">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="label">gtk-remove</property>
-                            <property name="use_stock">True</property>
-                            <property name="response_id">0</property>
+                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                            <property name="items" translatable="yes">Top
+Bottom
+Left
+Right</property>
                           </widget>
                           <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
                             <property name="position">1</property>
                           </packing>
                         </child>
-                        <child>
-                          <widget class="GtkButton" id="up_button">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="label">gtk-go-up</property>
-                            <property name="use_stock">True</property>
-                            <property name="response_id">0</property>
-                          </widget>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">2</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkButton" id="down_button">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="label">gtk-go-down</property>
-                            <property name="use_stock">True</property>
-                            <property name="response_id">0</property>
-                          </widget>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">3</property>
-                          </packing>
-                        </child>
                       </widget>
                       <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">False</property>
-                        <property name="position">1</property>
+                        <property name="position">4</property>
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkScrolledWindow" id="scrolledwindow26">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-                        <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-                        <property name="shadow_type">GTK_SHADOW_IN</property>
-                        <child>
-                          <widget class="GtkTreeView" id="stock_treeview">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="rules_hint">True</property>
-                            <property name="enable_search">False</property>
-                          </widget>
-                        </child>
-                      </widget>
-                      <packing>
-                        <property name="position">2</property>
-                      </packing>
+                      <placeholder/>
                     </child>
                   </widget>
                 </child>
                 <child>
-                  <widget class="GtkLabel" id="label12339">
+                  <widget class="GtkLabel" id="label113">
                     <property name="visible">True</property>
-                    <property name="label" translatable="yes">&lt;b&gt;Supported Encodings&lt;/b&gt;</property>
+                    <property name="label" translatable="yes">&lt;b&gt;Editor tabs&lt;/b&gt;</property>
                     <property name="use_markup">True</property>
                   </widget>
                   <packing>
@@ -495,6 +262,7 @@
                 </child>
               </widget>
               <packing>
+                <property name="expand">False</property>
                 <property name="position">1</property>
               </packing>
             </child>
@@ -503,17 +271,6 @@
             <property name="position">1</property>
           </packing>
         </child>
-        <child>
-          <widget class="GtkLabel" id="label">
-            <property name="visible">True</property>
-            <property name="label" translatable="yes">Encodings</property>
-          </widget>
-          <packing>
-            <property name="type">tab</property>
-            <property name="position">1</property>
-            <property name="tab_fill">False</property>
-          </packing>
-        </child>
       </widget>
     </child>
   </widget>

Modified: trunk/plugins/document-manager/plugin.c
==============================================================================
--- trunk/plugins/document-manager/plugin.c	(original)
+++ trunk/plugins/document-manager/plugin.c	Sat Apr 12 15:13:44 2008
@@ -2103,7 +2103,6 @@
 		
 	anjuta_preferences_add_page (prefs,
 									gxml, "Documents", _("Documents"),  ICON_FILE);
-	anjuta_encodings_init (prefs, gxml);
 				
 	g_object_unref (G_OBJECT (gxml));
 }

Modified: trunk/plugins/editor/text_editor.c
==============================================================================
--- trunk/plugins/editor/text_editor.c	(original)
+++ trunk/plugins/editor/text_editor.c	Sat Apr 12 15:13:44 2008
@@ -33,6 +33,7 @@
 #include <libanjuta/resources.h>
 #include <libanjuta/anjuta-utils.h>
 #include <libanjuta/anjuta-encodings.h>
+#include <libanjuta/anjuta-convert.h>
 #include <libanjuta/anjuta-debug.h>
 #include <libanjuta/interfaces/ianjuta-editor.h>
 #include <libanjuta/interfaces/ianjuta-editor-selection.h>
@@ -547,7 +548,6 @@
 	TextEditor *te = TEXT_EDITOR (obj);
 	g_free (te->filename);
 	g_free (te->uri);
-	g_free (te->encoding);
 	g_free (te->force_hilite);
 	g_free (te->last_saved_content);
 	
@@ -1212,111 +1212,35 @@
 }
 
 static gchar *
-convert_to_utf8_from_charset (const gchar *content,
-							  gsize len,
-							  const gchar *charset)
-{
-	gchar *utf8_content = NULL;
-	GError *conv_error = NULL;
-	gchar* converted_contents = NULL;
-	gsize bytes_written;
-
-	g_return_val_if_fail (content != NULL, NULL);
-
-	/* DEBUG_PRINT ("Trying to convert from %s to UTF-8", charset); */
-
-	converted_contents = g_convert (content, len, "UTF-8",
-									charset, NULL, &bytes_written,
-									&conv_error); 
-						
-	if ((conv_error != NULL) || (converted_contents == NULL)  ||
-	    !g_utf8_validate (converted_contents, bytes_written, NULL))		
-	{
-		/* DEBUG_PRINT ("Couldn't convert from %s to UTF-8.", charset); */
-		
-		if (converted_contents != NULL)
-			g_free (converted_contents);
-
-		if (conv_error != NULL)
-		{
-			g_error_free (conv_error);
-			conv_error = NULL;
-		}
-
-		utf8_content = NULL;
-	} else {
-		/* DEBUG_PRINT ("Converted from %s to UTF-8.", charset); */
-		utf8_content = converted_contents;
-	}
-	return utf8_content;
-}
-
-static gchar *
 convert_to_utf8 (PropsID props, const gchar *content, gsize len,
-			     gchar **encoding_used)
+			     const AnjutaEncoding **encoding_used)
 {
-	GList *encodings = NULL;
-	GList *start;
-	const gchar *locale_charset;
-	GList *encoding_strings;
-	
-	g_return_val_if_fail (!g_utf8_validate (content, len, NULL), 
-			g_strndup (content, len < 0 ? strlen (content) : len));
-
-	encoding_strings = sci_prop_glist_from_data (props, SUPPORTED_ENCODINGS);
-	encodings = anjuta_encoding_get_encodings (encoding_strings);
-	anjuta_util_glist_strings_free (encoding_strings);
-	
-	if (g_get_charset (&locale_charset) == FALSE) 
-	{
-		const AnjutaEncoding *locale_encoding;
-
-		/* not using a UTF-8 locale, so try converting
-		 * from that first */
-		if (locale_charset != NULL)
-		{
-			locale_encoding = anjuta_encoding_get_from_charset (locale_charset);
-			encodings = g_list_prepend (encodings,
-						(gpointer) locale_encoding);
-			/* DEBUG_PRINT ("Current charset = %s", locale_charset); */
-		}
-	}
-
-	start = encodings;
-
-	while (encodings != NULL) 
-	{
-		AnjutaEncoding *enc;
-		const gchar *charset;
-		gchar *utf8_content;
-
-		enc = (AnjutaEncoding *) encodings->data;
-
-		charset = anjuta_encoding_get_charset (enc);
-
-		/* DEBUG_PRINT ("Trying to convert %d bytes of data into UTF-8.", len); */
-		
-		fflush (stdout);
-		utf8_content = convert_to_utf8_from_charset (content, len, charset);
-
-		if (utf8_content != NULL) {
-			if (encoding_used != NULL)
-			{
-				if (*encoding_used != NULL)
-					g_free (*encoding_used);
-				
-				*encoding_used = g_strdup (charset);
-			}
-
-			return utf8_content;
-		}
-
-		encodings = encodings->next;
+	GError* conv_error = NULL;
+	gchar* new_content;
+	gsize new_len;
+
+	new_content = anjuta_convert_to_utf8 (content, 
+										  len, 
+										  encoding_used,
+										  &new_len, 
+										  &conv_error);
+	if  (new_content == NULL)	
+	{
+		/* Last change, let's try 8859-15 */
+		*encoding_used =  
+			anjuta_encoding_get_from_charset("ISO-8859-15");
+			
+		new_content = anjuta_convert_to_utf8 (content,
+											  len,
+											  encoding_used,
+											  &new_len,
+											  &conv_error);
 	}
-
-	g_list_free (start);
 	
-	return NULL;
+	if (conv_error)
+		g_error_free (conv_error);
+	
+	return new_content;
 }
 
 static gboolean
@@ -1392,8 +1316,6 @@
 	{
 		if (g_utf8_validate (buffer, nchars, NULL))
 		{
-			if (te->encoding)
-				g_free (te->encoding);
 			te->encoding = NULL;
 		}
 		else
@@ -1402,7 +1324,7 @@
 	
 			converted_text = convert_to_utf8 (te->props_base,
 											  buffer, nchars, &te->encoding);
-
+			
 			if (converted_text == NULL)
 			{
 				/* bail out */
@@ -1460,19 +1382,22 @@
 		
 		size = strlen (data);
 		
-		/* Save according to the correct encoding */
-		if (anjuta_preferences_get_int (te->preferences,
-										SAVE_ENCODING_CURRENT_LOCALE))
+
+		/* Save in original encoding */
+		if ((te->encoding != NULL))
 		{
-			/* Save in current locate */
 			GError *conv_error = NULL;
 			gchar* converted_file_contents = NULL;
-
-			/* DEBUG_PRINT ("Using current locale's encoding"); */
-
-			converted_file_contents = g_locale_from_utf8 (data, -1, NULL,
-														  NULL, &conv_error);
-	
+			gsize new_len;
+			
+			/* DEBUG_PRINT ("Using encoding %s", te->encoding); */
+			
+			/* Try to convert it from UTF-8 to original encoding */
+			converted_file_contents = anjuta_convert_from_utf8 (data, -1, 
+																te->encoding,
+																&new_len,
+																&conv_error); 
+			
 			if (conv_error != NULL)
 			{
 				/* Conversion error */
@@ -1487,40 +1412,9 @@
 		}
 		else
 		{
-			/* Save in original encoding */
-			if ((te->encoding != NULL) &&
-				anjuta_preferences_get_int (te->preferences,
-											SAVE_ENCODING_ORIGINAL))
-			{
-				GError *conv_error = NULL;
-				gchar* converted_file_contents = NULL;
-	
-				/* DEBUG_PRINT ("Using encoding %s", te->encoding); */
-
-				/* Try to convert it from UTF-8 to original encoding */
-				converted_file_contents = g_convert (data, -1, 
-													 te->encoding,
-													 "UTF-8", NULL, NULL,
-													 &conv_error); 
-	
-				if (conv_error != NULL)
-				{
-					/* Conversion error */
-					g_error_free (conv_error);
-				}
-				else
-				{
-					g_free (data);
-					data = converted_file_contents;
-					size = strlen (converted_file_contents);
-				}
-			}
-			else
-			{
-				/* Save in utf-8 */
-				/* DEBUG_PRINT ("Using utf-8 encoding"); */
-			}				
-		}
+			/* Save in utf-8 */
+			/* DEBUG_PRINT ("Using utf-8 encoding"); */
+		}				
 		
 		/* Strip trailing spaces */
 		strip = anjuta_preferences_get_int (te->preferences,

Modified: trunk/plugins/editor/text_editor.h
==============================================================================
--- trunk/plugins/editor/text_editor.h	(original)
+++ trunk/plugins/editor/text_editor.h	Sat Apr 12 15:13:44 2008
@@ -31,6 +31,7 @@
 #include "tm_tagmanager.h"
 
 #include <libanjuta/anjuta-status.h>
+#include <libanjuta/anjuta-encodings.h>
 
 #define TEXT_EDITOR_FIND_SCOPE_WHOLE 1
 #define TEXT_EDITOR_FIND_SCOPE_CURRENT 2
@@ -88,7 +89,7 @@
 	gboolean first_time_expose;
 
 	/* File encoding */
-	gchar *encoding;
+	const AnjutaEncoding *encoding;
 	
 	/* Popup menu widget */
 	GtkWidget *popup_menu;

Modified: trunk/plugins/search/search-replace.c
==============================================================================
--- trunk/plugins/search/search-replace.c	(original)
+++ trunk/plugins/search/search-replace.c	Sat Apr 12 15:13:44 2008
@@ -419,7 +419,7 @@
 
 	for (node = s->candidates; node != NULL; node = g_list_next (node))
 	{
-		FileBuffer *fb;
+		FileBuffer *fb = NULL;
 		SearchEntry *se;
 		gboolean fresh; 	/* file was opened for this search operation */
 

Modified: trunk/plugins/search/search-replace_backend.c
==============================================================================
--- trunk/plugins/search/search-replace_backend.c	(original)
+++ trunk/plugins/search/search-replace_backend.c	Sat Apr 12 15:13:44 2008
@@ -350,7 +350,7 @@
 	GnomeVFSFileSize nchars;
 	gchar *buffer;
 	gchar *converted;
-	gchar *encoding;
+	gchar *encoding = NULL;
 
 	g_return_val_if_fail (uri, NULL);
 

Modified: trunk/plugins/sourceview/Makefile.am
==============================================================================
--- trunk/plugins/sourceview/Makefile.am	(original)
+++ trunk/plugins/sourceview/Makefile.am	Sat Apr 12 15:13:44 2008
@@ -66,10 +66,6 @@
 	anjuta-document-saver.h \
 	anjuta-document.c \
 	anjuta-document.h \
-	anjuta-encodings.h \
-	anjuta-encodings.c \
-	anjuta-convert.h \
-	anjuta-convert.c \
 	anjuta-utils.h \
 	anjuta-utils.c \
 	sourceview-prefs.h \

Modified: trunk/plugins/sourceview/anjuta-document-loader.c
==============================================================================
--- trunk/plugins/sourceview/anjuta-document-loader.c	(original)
+++ trunk/plugins/sourceview/anjuta-document-loader.c	Sat Apr 12 15:13:44 2008
@@ -43,10 +43,12 @@
 #include <glib/gstdio.h>
 #include <libgnomevfs/gnome-vfs.h>
 
-#include "anjuta-encodings.h"
+#include <libanjuta/anjuta-encodings.h>
+#include <libanjuta/anjuta-convert.h>
+
 #include "anjuta-document-loader.h"
 #include "anjuta-marshal.h"
-#include "anjuta-convert.h"
+
 
 #define READ_CHUNK_SIZE 8192
 

Modified: trunk/plugins/sourceview/anjuta-document-saver.c
==============================================================================
--- trunk/plugins/sourceview/anjuta-document-saver.c	(original)
+++ trunk/plugins/sourceview/anjuta-document-saver.c	Sat Apr 12 15:13:44 2008
@@ -43,10 +43,11 @@
 #include <glib/gfileutils.h>
 #include <libgnomevfs/gnome-vfs.h>
 
-#include "anjuta-encodings.h"
+#include <libanjuta/anjuta-encodings.h>
+#include <libanjuta/anjuta-convert.h>
+
 #include "anjuta-document-saver.h"
 #include "anjuta-marshal.h"
-#include "anjuta-convert.h"
 
 #define ANJUTA_DOCUMENT_SAVER_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), ANJUTA_TYPE_DOCUMENT_SAVER, AnjutaDocumentSaverPrivate))
 

Modified: trunk/plugins/sourceview/anjuta-document.c
==============================================================================
--- trunk/plugins/sourceview/anjuta-document.c	(original)
+++ trunk/plugins/sourceview/anjuta-document.c	Sat Apr 12 15:13:44 2008
@@ -41,7 +41,8 @@
 #include <libgnomevfs/gnome-vfs.h>
 #include <libanjuta/anjuta-debug.h>
 
-#include "anjuta-encodings.h"
+#include <libanjuta/anjuta-encodings.h>
+
 #include "anjuta-document.h"
 #include "anjuta-document-loader.h"
 #include "anjuta-document-saver.h"

Modified: trunk/plugins/sourceview/anjuta-utils.c
==============================================================================
--- trunk/plugins/sourceview/anjuta-utils.c	(original)
+++ trunk/plugins/sourceview/anjuta-utils.c	Sat Apr 12 15:13:44 2008
@@ -54,7 +54,8 @@
 #include "anjuta-utils.h"
 
 #include "anjuta-document.h"
-#include "anjuta-convert.h"
+
+#include <libanjuta/anjuta-convert.h>
 
 #define STDIN_DELAY_MICROSECONDS 100000
 

Modified: trunk/plugins/sourceview/anjuta-utils.h
==============================================================================
--- trunk/plugins/sourceview/anjuta-utils.h	(original)
+++ trunk/plugins/sourceview/anjuta-utils.h	Sat Apr 12 15:13:44 2008
@@ -40,7 +40,8 @@
 #include <gtk/gtkmenu.h>
 #include <gtk/gtktextiter.h>
 #include <atk/atk.h>
-#include "anjuta-encodings.h"
+
+#include <libanjuta/anjuta-encodings.h>
 
 G_BEGIN_DECLS
 

Modified: trunk/plugins/sourceview/anjuta-view.c
==============================================================================
--- trunk/plugins/sourceview/anjuta-view.c	(original)
+++ trunk/plugins/sourceview/anjuta-view.c	Sat Apr 12 15:13:44 2008
@@ -43,9 +43,9 @@
 #include <glib.h>
 
 #include <libanjuta/anjuta-debug.h>
+#include <libanjuta/anjuta-encodings.h>
 
 #include "anjuta-view.h"
-#include "anjuta-encodings.h"
 #include "sourceview.h"
 #include "sourceview-private.h"
 #include "anjuta-marshal.h"

Modified: trunk/plugins/sourceview/sourceview.c
==============================================================================
--- trunk/plugins/sourceview/sourceview.c	(original)
+++ trunk/plugins/sourceview/sourceview.c	Sat Apr 12 15:13:44 2008
@@ -25,6 +25,7 @@
 
 #include <libanjuta/anjuta-debug.h>
 #include <libanjuta/anjuta-preferences.h>
+#include <libanjuta/anjuta-encodings.h>
 #include <libanjuta/interfaces/ianjuta-file.h>
 #include <libanjuta/interfaces/ianjuta-file-savable.h>
 #include <libanjuta/interfaces/ianjuta-markable.h>
@@ -53,7 +54,6 @@
 #include <gtksourceview/gtksourceiter.h>
 
 #include "config.h"
-#include "anjuta-encodings.h"
 #include "anjuta-document.h"
 #include "anjuta-view.h"
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]