anjuta r3816 - in trunk: . plugins/sourceview



Author: jhs
Date: Fri Apr  4 11:34:00 2008
New Revision: 3816
URL: http://svn.gnome.org/viewvc/anjuta?rev=3816&view=rev

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

	* plugins/sourceview/anjuta-view.c:
	* plugins/sourceview/anjuta-view.h:
	* plugins/sourceview/sourceview-prefs.c (init_fonts),
	(sourceview_prefs_init):
	Removed unused color management code
	
	* plugins/sourceview/anjuta-editor-sourceview.glade:
	* plugins/sourceview/plugin.c (ieditor_factory_new_editor),
	(create_style_model), (on_style_changed), (ipreferences_merge),
	(ipreferences_unmerge):
	* plugins/sourceview/plugin.h:
	
	Added style chooser for sourceview editor (#522

Modified:
   trunk/ChangeLog
   trunk/plugins/sourceview/anjuta-editor-sourceview.glade
   trunk/plugins/sourceview/anjuta-view.c
   trunk/plugins/sourceview/anjuta-view.h
   trunk/plugins/sourceview/plugin.c
   trunk/plugins/sourceview/plugin.h
   trunk/plugins/sourceview/sourceview-prefs.c

Modified: trunk/plugins/sourceview/anjuta-editor-sourceview.glade
==============================================================================
--- trunk/plugins/sourceview/anjuta-editor-sourceview.glade	(original)
+++ trunk/plugins/sourceview/anjuta-editor-sourceview.glade	Fri Apr  4 11:34:00 2008
@@ -14,6 +14,151 @@
             <property name="n_rows">2</property>
             <property name="n_columns">2</property>
             <child>
+              <widget class="GtkFrame" id="page2">
+                <property name="visible">True</property>
+                <property name="border_width">5</property>
+                <property name="label_xalign">0</property>
+                <property name="label_yalign">0</property>
+                <property name="shadow_type">GTK_SHADOW_NONE</property>
+                <child>
+                  <widget class="GtkVBox" id="vbox1111">
+                    <property name="visible">True</property>
+                    <child>
+                      <widget class="GtkTable" id="table15">
+                        <property name="visible">True</property>
+                        <property name="border_width">10</property>
+                        <property name="n_rows">5</property>
+                        <property name="n_columns">4</property>
+                        <property name="column_spacing">5</property>
+                        <property name="row_spacing">5</property>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <widget class="GtkCheckButton" id="preferences_toggle:bool:1:0:use.tabs">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="label" translatable="yes">Use tabs for indentation</property>
+                            <property name="use_underline">True</property>
+                            <property name="response_id">0</property>
+                            <property name="draw_indicator">True</property>
+                          </widget>
+                          <packing>
+                            <property name="right_attach">3</property>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">3</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkSpinButton" id="preferences_spin:int:4:1:indent.size">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="adjustment">4 1 100 1 10 10</property>
+                            <property name="climb_rate">1</property>
+                            <property name="numeric">True</property>
+                          </widget>
+                          <packing>
+                            <property name="left_attach">3</property>
+                            <property name="right_attach">4</property>
+                            <property name="top_attach">1</property>
+                            <property name="bottom_attach">2</property>
+                            <property name="x_options"></property>
+                            <property name="y_options"></property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkSpinButton" id="preferences_spin:int:4:1:tabsize">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="adjustment">4 1 100 1 10 10</property>
+                            <property name="climb_rate">1</property>
+                            <property name="numeric">True</property>
+                          </widget>
+                          <packing>
+                            <property name="left_attach">3</property>
+                            <property name="right_attach">4</property>
+                            <property name="x_options"></property>
+                            <property name="y_options"></property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkLabel" id="label123">
+                            <property name="visible">True</property>
+                            <property name="xalign">0</property>
+                            <property name="yalign">0</property>
+                            <property name="label" translatable="yes">Indentation size in spaces:</property>
+                          </widget>
+                          <packing>
+                            <property name="right_attach">3</property>
+                            <property name="top_attach">1</property>
+                            <property name="bottom_attach">2</property>
+                            <property name="y_options">GTK_EXPAND</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkLabel" id="label122">
+                            <property name="visible">True</property>
+                            <property name="xalign">0</property>
+                            <property name="yalign">0</property>
+                            <property name="label" translatable="yes">Tab size in spaces:</property>
+                          </widget>
+                          <packing>
+                            <property name="right_attach">3</property>
+                            <property name="y_options">GTK_EXPAND</property>
+                          </packing>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                      </packing>
+                    </child>
+                  </widget>
+                </child>
+                <child>
+                  <widget class="GtkLabel" id="label12321">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                    <property name="yalign">0</property>
+                    <property name="label" translatable="yes">&lt;b&gt;Indentation and auto-format options&lt;/b&gt;</property>
+                    <property name="use_markup">True</property>
+                  </widget>
+                  <packing>
+                    <property name="type">label_item</property>
+                  </packing>
+                </child>
+              </widget>
+              <packing>
+                <property name="right_attach">2</property>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+              </packing>
+            </child>
+            <child>
               <widget class="GtkHBox" id="page1">
                 <property name="visible">True</property>
                 <property name="border_width">5</property>
@@ -195,27 +340,27 @@
                                   <placeholder/>
                                 </child>
                                 <child>
-                                  <widget class="GtkSpinButton" id="preferences_spin:int:80:0:sourceview.rightmargin.position">
+                                  <widget class="GtkLabel" id="label19">
                                     <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="adjustment">80 0 200 1 10 10</property>
-                                    <property name="climb_rate">1</property>
-                                    <property name="numeric">True</property>
+                                    <property name="xalign">0</property>
+                                    <property name="label" translatable="yes">Right margin position in characters</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="label19">
+                                  <widget class="GtkSpinButton" id="preferences_spin:int:80:0:sourceview.rightmargin.position">
                                     <property name="visible">True</property>
-                                    <property name="xalign">0</property>
-                                    <property name="label" translatable="yes">Right margin position in characters</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="adjustment">80 0 200 1 10 10</property>
+                                    <property name="climb_rate">1</property>
+                                    <property name="numeric">True</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>
@@ -254,151 +399,6 @@
                 <property name="right_attach">2</property>
               </packing>
             </child>
-            <child>
-              <widget class="GtkFrame" id="page2">
-                <property name="visible">True</property>
-                <property name="border_width">5</property>
-                <property name="label_xalign">0</property>
-                <property name="label_yalign">0</property>
-                <property name="shadow_type">GTK_SHADOW_NONE</property>
-                <child>
-                  <widget class="GtkVBox" id="vbox1111">
-                    <property name="visible">True</property>
-                    <child>
-                      <widget class="GtkTable" id="table15">
-                        <property name="visible">True</property>
-                        <property name="border_width">10</property>
-                        <property name="n_rows">5</property>
-                        <property name="n_columns">4</property>
-                        <property name="column_spacing">5</property>
-                        <property name="row_spacing">5</property>
-                        <child>
-                          <placeholder/>
-                        </child>
-                        <child>
-                          <placeholder/>
-                        </child>
-                        <child>
-                          <placeholder/>
-                        </child>
-                        <child>
-                          <placeholder/>
-                        </child>
-                        <child>
-                          <placeholder/>
-                        </child>
-                        <child>
-                          <placeholder/>
-                        </child>
-                        <child>
-                          <placeholder/>
-                        </child>
-                        <child>
-                          <placeholder/>
-                        </child>
-                        <child>
-                          <placeholder/>
-                        </child>
-                        <child>
-                          <widget class="GtkLabel" id="label122">
-                            <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="yalign">0</property>
-                            <property name="label" translatable="yes">Tab size in spaces:</property>
-                          </widget>
-                          <packing>
-                            <property name="right_attach">3</property>
-                            <property name="y_options">GTK_EXPAND</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkLabel" id="label123">
-                            <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="yalign">0</property>
-                            <property name="label" translatable="yes">Indentation size in spaces:</property>
-                          </widget>
-                          <packing>
-                            <property name="right_attach">3</property>
-                            <property name="top_attach">1</property>
-                            <property name="bottom_attach">2</property>
-                            <property name="y_options">GTK_EXPAND</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkSpinButton" id="preferences_spin:int:4:1:tabsize">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="adjustment">4 1 100 1 10 10</property>
-                            <property name="climb_rate">1</property>
-                            <property name="numeric">True</property>
-                          </widget>
-                          <packing>
-                            <property name="left_attach">3</property>
-                            <property name="right_attach">4</property>
-                            <property name="x_options"></property>
-                            <property name="y_options"></property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkSpinButton" id="preferences_spin:int:4:1:indent.size">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="adjustment">4 1 100 1 10 10</property>
-                            <property name="climb_rate">1</property>
-                            <property name="numeric">True</property>
-                          </widget>
-                          <packing>
-                            <property name="left_attach">3</property>
-                            <property name="right_attach">4</property>
-                            <property name="top_attach">1</property>
-                            <property name="bottom_attach">2</property>
-                            <property name="x_options"></property>
-                            <property name="y_options"></property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkCheckButton" id="preferences_toggle:bool:1:0:use.tabs">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="label" translatable="yes">Use tabs for indentation</property>
-                            <property name="use_underline">True</property>
-                            <property name="response_id">0</property>
-                            <property name="draw_indicator">True</property>
-                          </widget>
-                          <packing>
-                            <property name="right_attach">3</property>
-                            <property name="top_attach">2</property>
-                            <property name="bottom_attach">3</property>
-                          </packing>
-                        </child>
-                      </widget>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">False</property>
-                      </packing>
-                    </child>
-                  </widget>
-                </child>
-                <child>
-                  <widget class="GtkLabel" id="label12321">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="yalign">0</property>
-                    <property name="label" translatable="yes">&lt;b&gt;Indentation and auto-format options&lt;/b&gt;</property>
-                    <property name="use_markup">True</property>
-                  </widget>
-                  <packing>
-                    <property name="type">label_item</property>
-                  </packing>
-                </child>
-              </widget>
-              <packing>
-                <property name="right_attach">2</property>
-                <property name="top_attach">1</property>
-                <property name="bottom_attach">2</property>
-              </packing>
-            </child>
           </widget>
         </child>
         <child>
@@ -419,160 +419,50 @@
             <property name="n_rows">3</property>
             <property name="n_columns">2</property>
             <child>
-              <widget class="GtkFrame" id="frame48">
+              <widget class="GtkFrame" id="frame49">
                 <property name="visible">True</property>
                 <property name="label_xalign">0</property>
                 <property name="label_yalign">0</property>
                 <property name="shadow_type">GTK_SHADOW_NONE</property>
                 <child>
-                  <widget class="GtkAlignment" id="alignment1">
+                  <widget class="GtkAlignment" id="alignment2">
                     <property name="visible">True</property>
                     <property name="xalign">0</property>
                     <property name="yalign">0</property>
                     <property name="left_padding">12</property>
                     <child>
-                      <widget class="GtkTable" id="table19">
+                      <widget class="GtkTable" id="table20">
                         <property name="visible">True</property>
-                        <property name="n_rows">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="GtkLabel" id="label12357">
-                            <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="yalign">0</property>
-                            <property name="label" translatable="yes">Background:</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="x_padding">5</property>
-                            <property name="y_padding">5</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkLabel" id="label12356">
-                            <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="yalign">0</property>
-                            <property name="label" translatable="yes">Text:</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="x_padding">5</property>
-                            <property name="y_padding">5</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkLabel" id="label12358">
-                            <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="yalign">0</property>
-                            <property name="label" translatable="yes">Selected text:</property>
-                          </widget>
-                          <packing>
-                            <property name="top_attach">3</property>
-                            <property name="bottom_attach">4</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options"></property>
-                            <property name="x_padding">5</property>
-                            <property name="y_padding">5</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkLabel" id="label12359">
-                            <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="yalign">0</property>
-                            <property name="label" translatable="yes">Selection:</property>
-                          </widget>
-                          <packing>
-                            <property name="top_attach">4</property>
-                            <property name="bottom_attach">5</property>
-                            <property name="x_options">GTK_FILL</property>
-                            <property name="y_options"></property>
-                            <property name="x_padding">5</property>
-                            <property name="y_padding">5</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkColorButton" id="preferences_color:color:#000000:0:sourceview.color.background">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="response_id">0</property>
-                          </widget>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">2</property>
-                            <property name="bottom_attach">3</property>
-                            <property name="x_options"></property>
-                            <property name="y_options"></property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkColorButton" id="preferences_color:color:#000000:0:sourceview.color.selected_text">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="response_id">0</property>
-                          </widget>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">3</property>
-                            <property name="bottom_attach">4</property>
-                            <property name="x_options"></property>
-                            <property name="y_options"></property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkColorButton" id="preferences_color:color:#0000FF:0:sourceview.color.selection">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="response_id">0</property>
-                          </widget>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">4</property>
-                            <property name="bottom_attach">5</property>
-                            <property name="x_options"></property>
-                            <property name="y_options"></property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkColorButton" id="preferences_color:color:#FFFFFF:0:sourceview.color.text">
+                          <widget class="GtkFontButton" id="preferences_font:font:Monospace 12:0:sourceview.font">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="response_id">0</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"></property>
                             <property name="y_options"></property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkCheckButton" id="preferences_toggle:bool:1:0:sourceview.color.use_theme">
+                          <widget class="GtkCheckButton" id="preferences_toggle:bool:1:0:sourceview.font.use_theme">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
-                            <property name="label" translatable="yes">Use theme colors</property>
+                            <property name="label" translatable="yes">Use theme font</property>
                             <property name="use_underline">True</property>
                             <property name="response_id">0</property>
                             <property name="draw_indicator">True</property>
                           </widget>
                           <packing>
                             <property name="right_attach">2</property>
-                            <property name="y_options">GTK_EXPAND</property>
-                            <property name="x_padding">5</property>
-                            <property name="y_padding">5</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options"></property>
                           </packing>
                         </child>
                       </widget>
@@ -580,11 +470,11 @@
                   </widget>
                 </child>
                 <child>
-                  <widget class="GtkLabel" id="label12355">
+                  <widget class="GtkLabel" id="label">
                     <property name="visible">True</property>
                     <property name="xalign">0</property>
                     <property name="yalign">0</property>
-                    <property name="label" translatable="yes">&lt;b&gt;Colors:&lt;/b&gt;</property>
+                    <property name="label" translatable="yes">&lt;b&gt;Font:&lt;/b&gt;</property>
                     <property name="use_markup">True</property>
                   </widget>
                   <packing>
@@ -594,69 +484,33 @@
               </widget>
               <packing>
                 <property name="right_attach">2</property>
-                <property name="top_attach">1</property>
-                <property name="bottom_attach">3</property>
                 <property name="x_padding">5</property>
                 <property name="y_padding">5</property>
               </packing>
             </child>
             <child>
-              <widget class="GtkFrame" id="frame49">
+              <widget class="GtkFrame" id="frame48">
                 <property name="visible">True</property>
                 <property name="label_xalign">0</property>
                 <property name="label_yalign">0</property>
                 <property name="shadow_type">GTK_SHADOW_NONE</property>
                 <child>
-                  <widget class="GtkAlignment" id="alignment2">
+                  <widget class="GtkAlignment" id="alignment1">
                     <property name="visible">True</property>
                     <property name="xalign">0</property>
                     <property name="yalign">0</property>
                     <property name="left_padding">12</property>
                     <child>
-                      <widget class="GtkTable" id="table20">
+                      <widget class="GtkVBox" id="vbox1">
                         <property name="visible">True</property>
-                        <property name="n_rows">2</property>
-                        <property name="n_columns">2</property>
-                        <child>
-                          <widget class="GtkCheckButton" id="preferences_toggle:bool:1:0:sourceview.font.use_theme">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="label" translatable="yes">Use theme font</property>
-                            <property name="use_underline">True</property>
-                            <property name="response_id">0</property>
-                            <property name="draw_indicator">True</property>
-                          </widget>
-                          <packing>
-                            <property name="right_attach">2</property>
-                            <property name="y_options">GTK_EXPAND</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkLabel" id="label12361">
-                            <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="yalign">0</property>
-                            <property name="label" translatable="yes">Font:</property>
-                          </widget>
-                          <packing>
-                            <property name="top_attach">1</property>
-                            <property name="bottom_attach">2</property>
-                            <property name="x_options"></property>
-                            <property name="y_options"></property>
-                          </packing>
-                        </child>
+                        <property name="border_width">5</property>
                         <child>
-                          <widget class="GtkFontButton" id="preferences_font:font:Monospace 12:0:sourceview.font">
+                          <widget class="GtkComboBox" id="combo_styles">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="response_id">0</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="y_options">GTK_EXPAND</property>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
                           </packing>
                         </child>
                       </widget>
@@ -664,11 +518,11 @@
                   </widget>
                 </child>
                 <child>
-                  <widget class="GtkLabel" id="label">
+                  <widget class="GtkLabel" id="label12355">
                     <property name="visible">True</property>
                     <property name="xalign">0</property>
                     <property name="yalign">0</property>
-                    <property name="label" translatable="yes">&lt;b&gt;Font:&lt;/b&gt;</property>
+                    <property name="label" translatable="yes">&lt;b&gt;Color scheme:&lt;/b&gt;</property>
                     <property name="use_markup">True</property>
                   </widget>
                   <packing>
@@ -678,6 +532,8 @@
               </widget>
               <packing>
                 <property name="right_attach">2</property>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">3</property>
                 <property name="x_padding">5</property>
                 <property name="y_padding">5</property>
               </packing>
@@ -719,33 +575,31 @@
                   <placeholder/>
                 </child>
                 <child>
-                  <widget class="GtkCheckButton" id="preferences_toggle:bool:1:0:print.linewrap">
+                  <widget class="GtkCheckButton" id="preferences_toggle:bool:1:0:print.header">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
-                    <property name="label" translatable="yes">Wrap long lines to fit on paper</property>
+                    <property name="label" translatable="yes">Print page header</property>
                     <property name="use_underline">True</property>
                     <property name="response_id">0</property>
                     <property name="draw_indicator">True</property>
                   </widget>
                   <packing>
-                    <property name="top_attach">4</property>
-                    <property name="bottom_attach">5</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="GtkCheckButton" id="preferences_toggle:bool:1:0:print.highlight">
+                  <widget class="GtkCheckButton" id="preferences_toggle:bool:1:0:print.footer">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
-                    <property name="label" translatable="yes">Highlight syntax</property>
+                    <property name="label" translatable="yes">Print page footer</property>
                     <property name="use_underline">True</property>
                     <property name="response_id">0</property>
                     <property name="draw_indicator">True</property>
                   </widget>
                   <packing>
-                    <property name="top_attach">3</property>
-                    <property name="bottom_attach">4</property>
                     <property name="x_options">GTK_FILL</property>
                     <property name="y_options"></property>
                   </packing>
@@ -767,31 +621,33 @@
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkCheckButton" id="preferences_toggle:bool:1:0:print.footer">
+                  <widget class="GtkCheckButton" id="preferences_toggle:bool:1:0:print.highlight">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
-                    <property name="label" translatable="yes">Print page footer</property>
+                    <property name="label" translatable="yes">Highlight syntax</property>
                     <property name="use_underline">True</property>
                     <property name="response_id">0</property>
                     <property name="draw_indicator">True</property>
                   </widget>
                   <packing>
+                    <property name="top_attach">3</property>
+                    <property name="bottom_attach">4</property>
                     <property name="x_options">GTK_FILL</property>
                     <property name="y_options"></property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkCheckButton" id="preferences_toggle:bool:1:0:print.header">
+                  <widget class="GtkCheckButton" id="preferences_toggle:bool:1:0:print.linewrap">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
-                    <property name="label" translatable="yes">Print page header</property>
+                    <property name="label" translatable="yes">Wrap long lines to fit on paper</property>
                     <property name="use_underline">True</property>
                     <property name="response_id">0</property>
                     <property name="draw_indicator">True</property>
                   </widget>
                   <packing>
-                    <property name="top_attach">1</property>
-                    <property name="bottom_attach">2</property>
+                    <property name="top_attach">4</property>
+                    <property name="bottom_attach">5</property>
                     <property name="x_options">GTK_FILL</property>
                     <property name="y_options"></property>
                   </packing>

Modified: trunk/plugins/sourceview/anjuta-view.c
==============================================================================
--- trunk/plugins/sourceview/anjuta-view.c	(original)
+++ trunk/plugins/sourceview/anjuta-view.c	Fri Apr  4 11:34:00 2008
@@ -528,137 +528,6 @@
 	view->priv->scroll_idle = g_idle_add ((GSourceFunc) scroll_to_cursor_real, view);
 }
 
-/* assign a unique name */
-static G_CONST_RETURN gchar *
-get_widget_name (GtkWidget *w)
-{
-	const gchar *name;	
-
-	name = gtk_widget_get_name (w);
-	g_return_val_if_fail (name != NULL, NULL);
-
-	if (strcmp (name, g_type_name (GTK_WIDGET_TYPE (w))) == 0)
-	{
-		static guint d = 0;
-		gchar *n;
-
-		n = g_strdup_printf ("%s_%u_%u", name, d, (guint) g_random_int);
-		d++;
-
-		gtk_widget_set_name (w, n);
-		g_free (n);
-
-		name = gtk_widget_get_name (w);
-	}
-
-	return name;
-}
-
-/* There is no clean way to set the cursor-color, so we are stuck
- * with the following hack: set the name of each widget and parse
- * a gtkrc string.
- */
-static void 
-modify_cursor_color (GtkWidget *textview, 
-		     GdkColor  *color)
-{
-	static const char cursor_color_rc[] =
-		"style \"svs-cc\"\n"
-		"{\n"
-			"GtkSourceView::cursor-color=\"#%04x%04x%04x\"\n"
-		"}\n"
-		"widget \"*.%s\" style : application \"svs-cc\"\n";
-
-	const gchar *name;
-	gchar *rc_temp;
-
-	name = get_widget_name (textview);
-	g_return_if_fail (name != NULL);
-
-	if (color != NULL)
-	{
-		rc_temp = g_strdup_printf (cursor_color_rc,
-					   color->red, 
-					   color->green, 
-					   color->blue,
-					   name);
-	}
-	else
-	{
-		GtkRcStyle *rc_style;
-
- 		rc_style = gtk_widget_get_modifier_style (textview);
-
-		rc_temp = g_strdup_printf (cursor_color_rc,
-					   rc_style->text [GTK_STATE_NORMAL].red,
-					   rc_style->text [GTK_STATE_NORMAL].green,
-					   rc_style->text [GTK_STATE_NORMAL].blue,
-					   name);
-	}
-
-	gtk_rc_parse_string (rc_temp);
-	gtk_widget_reset_rc_styles (textview);
-
-	g_free (rc_temp);
-}
-
-void
-anjuta_view_set_colors (AnjutaView *view,
-		       gboolean   def,
-		       GdkColor  *backgroud,
-		       GdkColor  *text,
-		       GdkColor  *selection,
-		       GdkColor  *sel_text)
-{
-
-	g_return_if_fail (ANJUTA_IS_VIEW (view));
-
-	/* just a bit of paranoia */
-	gtk_widget_ensure_style (GTK_WIDGET (view));
-
-	if (!def)
-	{
-		if (backgroud != NULL)
-			gtk_widget_modify_base (GTK_WIDGET (view), 
-						GTK_STATE_NORMAL, backgroud);
-
-		if (selection != NULL)
-		{
-			gtk_widget_modify_base (GTK_WIDGET (view), 
-						GTK_STATE_SELECTED, selection);
-			gtk_widget_modify_base (GTK_WIDGET (view), 
-						GTK_STATE_ACTIVE, selection);
-		}
-
-		if (sel_text != NULL)
-		{
-			gtk_widget_modify_text (GTK_WIDGET (view), 
-						GTK_STATE_SELECTED, sel_text);		
-			gtk_widget_modify_text (GTK_WIDGET (view), 
-						GTK_STATE_ACTIVE, sel_text);		
-		}
-
-		if (text != NULL)
-		{
-			gtk_widget_modify_text (GTK_WIDGET (view), 
-						GTK_STATE_NORMAL, text);
-			modify_cursor_color (GTK_WIDGET (view), text);
-		}
-	}
-	else
-	{
-		GtkRcStyle *rc_style;
-
-		rc_style = gtk_widget_get_modifier_style (GTK_WIDGET (view));
-
-		rc_style->color_flags [GTK_STATE_NORMAL] = 0;
-		rc_style->color_flags [GTK_STATE_SELECTED] = 0;
-		rc_style->color_flags [GTK_STATE_ACTIVE] = 0;
-
-		gtk_widget_modify_style (GTK_WIDGET (view), rc_style);
-	}
-}
-
 void
 anjuta_view_set_font (AnjutaView   *view, 
 		     gboolean     def, 

Modified: trunk/plugins/sourceview/anjuta-view.h
==============================================================================
--- trunk/plugins/sourceview/anjuta-view.h	(original)
+++ trunk/plugins/sourceview/anjuta-view.h	Fri Apr  4 11:34:00 2008
@@ -94,13 +94,6 @@
 
 void		 anjuta_view_scroll_to_cursor 	(AnjutaView       *view);
 
-void 		 anjuta_view_set_colors 		(AnjutaView       *view, 
-						 gboolean         def,
-						 GdkColor        *backgroud, 
-						 GdkColor        *text,
-						 GdkColor        *selection, 
-						 GdkColor        *sel_text);
-
 void 		 anjuta_view_set_font		(AnjutaView       *view,
 						 gboolean         def,
 						 const gchar     *font_name);

Modified: trunk/plugins/sourceview/plugin.c
==============================================================================
--- trunk/plugins/sourceview/plugin.c	(original)
+++ trunk/plugins/sourceview/plugin.c	Fri Apr  4 11:34:00 2008
@@ -31,44 +31,28 @@
 #include <libanjuta/interfaces/ianjuta-editor-factory.h>
 #include <libanjuta/interfaces/ianjuta-editor.h>
 #include <libanjuta/interfaces/ianjuta-preferences.h>
+#include <gtksourceview/gtksourceview.h>
+#include <gtksourceview/gtksourcestyleschememanager.h>
 
 #include "plugin.h"
 #include "sourceview.h"
+#include "sourceview-private.h"
 
 #define PREFS_GLADE PACKAGE_DATA_DIR"/glade/anjuta-editor-sourceview.glade"
 #define ICON_FILE "anjuta-editor-sourceview-plugin-48.png"
 
-#define COLOR_USE_THEME_BUTTON "preferences_toggle:bool:1:0:sourceview.color.use_theme"
-#define COLOR_TEXT "preferences_color:color:#FFFFFF:0:sourceview.color.text"
-#define COLOR_BACKGROUND "preferences_color:color:#000000:0:sourceview.color.background"
-#define COLOR_SELECTED_TEXT "preferences_color:color:#000000:0:sourceview.color.selected_text"
-#define COLOR_SELECTION "preferences_color:color:#0000FF:0:sourceview.color.selection"
+#define COMBO_STYLES "combo_styles"
+#define SOURCEVIEW_STYLE "sourceview.style"
+#define SOURCEVIEW_DEFAULT_STYLE "classic"
 
 #define FONT_USE_THEME_BUTTON "preferences_toggle:bool:1:0:sourceview.font.use_theme"
-#define FONT_BUTTON "preferences_font:font:Sans:0:sourceview.font"
+#define FONT_BUTTON "preferences_font:font:Monospace 12:0:sourceview.font"
 
 static gpointer parent_class;
 
 static GladeXML* gxml = NULL;
 
 static void
-on_color_check_toggled(GtkToggleButton* button, GladeXML* gxml)
-{
-	GtkWidget* color_button;
-	color_button = glade_xml_get_widget(gxml, COLOR_TEXT);
-	gtk_widget_set_sensitive(color_button, !gtk_toggle_button_get_active(button));
-
-	color_button = glade_xml_get_widget(gxml, COLOR_BACKGROUND);
-	gtk_widget_set_sensitive(color_button, !gtk_toggle_button_get_active(button));
-
-	color_button = glade_xml_get_widget(gxml, COLOR_SELECTED_TEXT);
-	gtk_widget_set_sensitive(color_button, !gtk_toggle_button_get_active(button));
-
-	color_button = glade_xml_get_widget(gxml, COLOR_SELECTION);
-	gtk_widget_set_sensitive(color_button, !gtk_toggle_button_get_active(button));
-}	
-
-static void
 on_font_check_toggled(GtkToggleButton* button, GladeXML* gxml)
 {
 	GtkWidget* font_button;
@@ -132,8 +116,20 @@
 								GError** error)
 {
 	AnjutaPlugin* plugin = ANJUTA_PLUGIN(factory);
-	IAnjutaEditor* editor = IANJUTA_EDITOR(sourceview_new(uri, filename, plugin));	return editor;
-	return editor;
+	AnjutaPreferences* prefs = anjuta_shell_get_preferences (plugin->shell, NULL);
+	gchar* current_style = anjuta_preferences_get (prefs, SOURCEVIEW_STYLE);
+	GtkSourceStyleSchemeManager* manager = gtk_source_style_scheme_manager_get_default();
+	Sourceview* sv;
+	if (!current_style)
+	{
+		current_style = g_strdup (SOURCEVIEW_DEFAULT_STYLE);
+	}
+	sv = sourceview_new(uri, filename, plugin);
+	gtk_source_buffer_set_style_scheme (GTK_SOURCE_BUFFER (sv->priv->document),
+										gtk_source_style_scheme_manager_get_scheme (manager,
+																					current_style));
+	g_free (current_style);
+	return IANJUTA_EDITOR (sv);
 }
 
 static void
@@ -142,29 +138,132 @@
 	iface->new_editor = ieditor_factory_new_editor;
 }
 
+enum 
+{
+	COLUMN_NAME = 0,
+	COLUMN_DESC,
+	COLUMN_ID
+};
+
+static GtkTreeModel*
+create_style_model (AnjutaPreferences* prefs, GtkTreeIter** current)
+{
+	GtkListStore* model = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING,
+											  G_TYPE_STRING);
+	GtkSourceStyleSchemeManager* manager = gtk_source_style_scheme_manager_get_default();
+	const gchar* const *styles = gtk_source_style_scheme_manager_get_scheme_ids (manager);
+	const gchar* const *style;
+	gchar* current_style = anjuta_preferences_get (prefs, SOURCEVIEW_STYLE);
+	if (!current_style)
+	{
+		current_style = g_strdup (SOURCEVIEW_DEFAULT_STYLE);
+	}
+	for (style = styles; *style != NULL; style++)
+	{
+		GtkTreeIter iter;
+		GtkSourceStyleScheme* scheme = 
+			gtk_source_style_scheme_manager_get_scheme (manager, *style);
+		const gchar* id = gtk_source_style_scheme_get_id (scheme);
+		gtk_list_store_append (model, &iter);
+		gtk_list_store_set (model, &iter,
+							COLUMN_NAME, gtk_source_style_scheme_get_name (scheme),
+							COLUMN_DESC, gtk_source_style_scheme_get_description (scheme),
+							COLUMN_ID, id, -1);
+		if (g_str_equal (id, current_style))
+		{
+			*current = gtk_tree_iter_copy (&iter);
+		}
+	}
+	g_free (current_style);
+	return GTK_TREE_MODEL (model);
+}					
+	
+static void
+on_style_changed (GtkComboBox* combo, SourceviewPlugin* plugin)
+{
+	GtkTreeIter iter;
+	gchar* id;
+	GtkSourceStyleSchemeManager* manager = gtk_source_style_scheme_manager_get_default();
+	GtkSourceStyleScheme* scheme;
+	IAnjutaDocumentManager* docman;
+	AnjutaShell* shell = ANJUTA_PLUGIN (plugin)->shell;
+	gtk_combo_box_get_active_iter (combo, &iter);
+	gtk_tree_model_get (gtk_combo_box_get_model(combo), &iter,
+						COLUMN_ID, &id, -1);
+	scheme = gtk_source_style_scheme_manager_get_scheme (manager, id);
+
+	anjuta_preferences_set (anjuta_shell_get_preferences (shell, NULL),
+							SOURCEVIEW_STYLE,
+							id);
+	g_free (id);
+	
+	
+	docman = anjuta_shell_get_interface (shell,
+										 IAnjutaDocumentManager, NULL);
+	if (docman)
+	{
+		GList* editors = ianjuta_document_manager_get_doc_widgets (docman, NULL);
+		GList* node;
+		for (node = editors; node != NULL; node = g_list_next (node))
+		{
+			IAnjutaDocument* editor = IANJUTA_DOCUMENT (node->data);
+			if (ANJUTA_IS_SOURCEVIEW (editor))
+			{
+				Sourceview* sv = ANJUTA_SOURCEVIEW (editor);
+				gtk_source_buffer_set_style_scheme (GTK_SOURCE_BUFFER (sv->priv->document),
+													scheme);
+			}
+		}
+	}
+}
+
 static void
 ipreferences_merge(IAnjutaPreferences* ipref, AnjutaPreferences* prefs, GError** e)
 {
 	/* Add preferences */
 	SourceviewPlugin* plugin = ANJUTA_PLUGIN_SOURCEVIEW (ipref);
+	GtkCellRenderer* renderer_name = gtk_cell_renderer_text_new ();
+	GtkCellRenderer* renderer_desc = gtk_cell_renderer_text_new ();
+	GtkTreeIter* iter = NULL;
 	gxml = glade_xml_new (PREFS_GLADE, "preferences_dialog", NULL);
 	anjuta_preferences_add_page (prefs,
 								 gxml, "Editor", _("GtkSourceView Editor"), ICON_FILE);
 	
-	plugin->check_color = glade_xml_get_widget(gxml, COLOR_USE_THEME_BUTTON);
-	g_signal_connect(G_OBJECT(plugin->check_color), "toggled", G_CALLBACK(on_color_check_toggled), gxml);
 	plugin->check_font = glade_xml_get_widget(gxml, FONT_USE_THEME_BUTTON);
 	g_signal_connect(G_OBJECT(plugin->check_font), "toggled", G_CALLBACK(on_font_check_toggled), gxml);
+	on_font_check_toggled (GTK_TOGGLE_BUTTON (plugin->check_font), gxml);
+	
+	/* Init styles combo */
+	plugin->combo_styles = glade_xml_get_widget (gxml, COMBO_STYLES);
+	gtk_combo_box_set_model (GTK_COMBO_BOX (plugin->combo_styles),
+							 create_style_model(prefs, &iter));
+	g_signal_connect (plugin->combo_styles, "changed", G_CALLBACK (on_style_changed), plugin);
+	
+	gtk_cell_layout_clear (GTK_CELL_LAYOUT(plugin->combo_styles));
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT(plugin->combo_styles), renderer_name, TRUE);
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT(plugin->combo_styles), renderer_desc, FALSE);
+	gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT(plugin->combo_styles), renderer_name,
+								   "text", COLUMN_NAME);
+	gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT(plugin->combo_styles), renderer_desc,
+								   "text", COLUMN_DESC);
+	g_object_set (renderer_desc,
+				  "style", PANGO_STYLE_ITALIC, NULL);
+	if (iter)
+	{
+		gtk_combo_box_set_active_iter (GTK_COMBO_BOX (plugin->combo_styles),
+									   iter);
+		gtk_tree_iter_free (iter);
+	}
 }
 
 static void
 ipreferences_unmerge(IAnjutaPreferences* ipref, AnjutaPreferences* prefs, GError** e)
 {
 	SourceviewPlugin* plugin = ANJUTA_PLUGIN_SOURCEVIEW (ipref);
-	g_signal_handlers_disconnect_by_func(G_OBJECT(plugin->check_color), 
-		G_CALLBACK(on_color_check_toggled), gxml);
 	g_signal_handlers_disconnect_by_func(G_OBJECT(plugin->check_font), 
 		G_CALLBACK(on_font_check_toggled), gxml);
+	g_signal_handlers_disconnect_by_func(G_OBJECT(plugin->combo_styles), 
+		G_CALLBACK(on_style_changed), gxml);
 	
 	anjuta_preferences_remove_page(prefs, _("GtkSourceView Editor"));
 	g_object_unref(gxml);

Modified: trunk/plugins/sourceview/plugin.h
==============================================================================
--- trunk/plugins/sourceview/plugin.h	(original)
+++ trunk/plugins/sourceview/plugin.h	Fri Apr  4 11:34:00 2008
@@ -41,7 +41,7 @@
 struct _SourceviewPlugin{
 	AnjutaPlugin parent;
 	
-	GtkWidget* check_color;
+	GtkWidget* combo_styles;
 	GtkWidget* check_font;
 };
 

Modified: trunk/plugins/sourceview/sourceview-prefs.c
==============================================================================
--- trunk/plugins/sourceview/sourceview-prefs.c	(original)
+++ trunk/plugins/sourceview/sourceview-prefs.c	Fri Apr  4 11:34:00 2008
@@ -40,12 +40,6 @@
 #define VIEW_RIGHTMARGIN           "sourceview.rightmargin.visible"
 #define RIGHTMARGIN_POSITION       "sourceview.rightmargin.position"
 
-#define COLOR_THEME "sourceview.color.use_theme"
-#define COLOR_TEXT	"sourceview.color.text"
-#define COLOR_BACKGROUND	"sourceview.color.background"
-#define COLOR_SELECTED_TEXT	"sourceview.color.selected_text"
-#define COLOR_SELECTION	"sourceview.color.selection"
-
 #define FONT_THEME "sourceview.font.use_theme"
 #define FONT "sourceview.font"
 #define DESKTOP_FIXED_FONT "/desktop/gnome/interface/monospace_font_name"
@@ -199,41 +193,6 @@
 }
 
 static void
-on_gconf_notify_color (GConfClient *gclient, guint cnxn_id,
-											 GConfEntry *entry, gpointer user_data)
-{
-	Sourceview *sv;
-	GdkColor *text, *background, *selected_text, *selection;
-	AnjutaPreferences* prefs = sourceview_get_prefs();
-	sv = ANJUTA_SOURCEVIEW(user_data);
-	
-  if (!anjuta_preferences_get_int (prefs, COLOR_THEME))
-  {
-    text = anjuta_util_convert_color(prefs, COLOR_TEXT);
-    background = anjuta_util_convert_color(prefs, COLOR_BACKGROUND);
-    selected_text = anjuta_util_convert_color(prefs, COLOR_SELECTED_TEXT);
-    selection = anjuta_util_convert_color(prefs, COLOR_SELECTION);
-    anjuta_view_set_colors(sv->priv->view, FALSE, background, text, selection, selected_text);
-  }
-}
-
-static void
-on_gconf_notify_color_theme (GConfClient *gclient, guint cnxn_id,
-														 GConfEntry *entry, gpointer user_data)
-{
-	Sourceview *sv;
-	gboolean use_theme = get_bool(entry);
-	sv = ANJUTA_SOURCEVIEW(user_data);
-	
-	if (use_theme)
-	{
-		anjuta_view_set_colors(sv->priv->view, TRUE, NULL, NULL, NULL, NULL);
-	}
-	else
-		on_gconf_notify_color(NULL, 0, NULL, sv);
-}
-
-static void
 on_gconf_notify_font (GConfClient *gclient, guint cnxn_id,
 											GConfEntry *entry, gpointer user_data)
 {
@@ -272,13 +231,11 @@
 }
 
 static void
-init_colors_and_fonts(Sourceview* sv)
+init_fonts(Sourceview* sv)
 {
 	gboolean font_theme;
-	gboolean color_theme;
 	
 	font_theme = anjuta_preferences_get_int(prefs, FONT_THEME);
-	color_theme = anjuta_preferences_get_int(prefs, COLOR_THEME);
 	
 	if (!font_theme)
 	{
@@ -299,10 +256,6 @@
 		g_free (desktop_fixed_font);
 		g_object_unref (gclient);
 	}
- 	if (!color_theme)
-  		on_gconf_notify_color (NULL, 0, NULL, sv);
-	else
-		anjuta_view_set_colors(sv->priv->view, TRUE, NULL, NULL, NULL, NULL);
 }
 
 static int
@@ -338,7 +291,7 @@
 																						get_key(sv, RIGHTMARGIN_POSITION));
 	
 	
-	init_colors_and_fonts(sv);
+	init_fonts(sv);
 	
 	/* Register gconf notifications */
 	REGISTER_NOTIFY (TAB_SIZE, on_gconf_notify_tab_size);
@@ -351,11 +304,6 @@
 	REGISTER_NOTIFY (VIEW_LINENUMBERS, on_gconf_notify_view_linenums);
 	REGISTER_NOTIFY (VIEW_RIGHTMARGIN, on_gconf_notify_view_right_margin);
 	REGISTER_NOTIFY (RIGHTMARGIN_POSITION, on_gconf_notify_right_margin_position);
-	REGISTER_NOTIFY (COLOR_THEME, on_gconf_notify_color_theme);
-	REGISTER_NOTIFY (COLOR_TEXT, on_gconf_notify_color);
-	REGISTER_NOTIFY (COLOR_BACKGROUND, on_gconf_notify_color);
-	REGISTER_NOTIFY (COLOR_SELECTED_TEXT, on_gconf_notify_color);
-	REGISTER_NOTIFY (COLOR_SELECTION, on_gconf_notify_color);
 	REGISTER_NOTIFY (FONT_THEME, on_gconf_notify_font_theme);
 	REGISTER_NOTIFY (FONT, on_gconf_notify_font);	
 	



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