gnome-terminal r2351 - in trunk: . src



Author: chpe
Date: Sun Jan 20 21:39:49 2008
New Revision: 2351
URL: http://svn.gnome.org/viewvc/gnome-terminal?rev=2351&view=rev

Log:
2008-01-20  Christian Persch  <chpe gnome org>

	* src/gnome-terminal.glade2:
	* src/gnome-terminal.schemas.in:
	* src/profile-editor.c: (profile_changed), (terminal_profile_edit),
	(profile_editor_update_sensitivity):
	* src/terminal-profile.c: (terminal_profile_init),
	(terminal_profile_update), (profile_change_notify),
	(terminal_profile_create):
	* src/terminal-profile.h:
	* src/terminal-screen.c: (terminal_screen_sync_settings),
	(terminal_screen_screen_changed), (terminal_screen_class_init),
	(terminal_screen_finalize), (terminal_screen_reread_profile): Use the
	gtk-cursor-blink setting, and remove the profile option. Bug #342921,
	based on a patch by Mariano SuÃrez-Alvarez.

Modified:
   trunk/ChangeLog
   trunk/src/gnome-terminal.glade2
   trunk/src/gnome-terminal.schemas.in
   trunk/src/profile-editor.c
   trunk/src/terminal-profile.c
   trunk/src/terminal-profile.h
   trunk/src/terminal-screen.c

Modified: trunk/src/gnome-terminal.glade2
==============================================================================
--- trunk/src/gnome-terminal.glade2	(original)
+++ trunk/src/gnome-terminal.glade2	Sun Jan 20 21:39:49 2008
@@ -1251,7 +1251,7 @@
 		      <child>
 			<widget class="GtkTable" id="table19">
 			  <property name="visible">True</property>
-			  <property name="n_rows">5</property>
+			  <property name="n_rows">4</property>
 			  <property name="n_columns">2</property>
 			  <property name="homogeneous">False</property>
 			  <property name="row_spacing">6</property>
@@ -1279,8 +1279,8 @@
 			    <packing>
 			      <property name="left_attach">0</property>
 			      <property name="right_attach">1</property>
-			      <property name="top_attach">4</property>
-			      <property name="bottom_attach">5</property>
+			      <property name="top_attach">3</property>
+			      <property name="bottom_attach">4</property>
 			      <property name="x_options">fill</property>
 			      <property name="y_options"></property>
 			    </packing>
@@ -1300,8 +1300,8 @@
 			    <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="top_attach">3</property>
+			      <property name="bottom_attach">4</property>
 			      <property name="y_options"></property>
 			    </packing>
 			  </child>
@@ -1342,41 +1342,6 @@
 			  </child>
 
 			  <child>
-			    <widget class="GtkAlignment" id="alignment11">
-			      <property name="visible">True</property>
-			      <property name="xalign">1.49012002737e-08</property>
-			      <property name="yalign">0.5</property>
-			      <property name="xscale">0</property>
-			      <property name="yscale">1</property>
-			      <property name="top_padding">0</property>
-			      <property name="bottom_padding">0</property>
-			      <property name="left_padding">0</property>
-			      <property name="right_padding">0</property>
-
-			      <child>
-				<widget class="GtkCheckButton" id="blink-cursor-checkbutton">
-				  <property name="visible">True</property>
-				  <property name="can_focus">True</property>
-				  <property name="label" translatable="yes">Cursor blin_ks</property>
-				  <property name="use_underline">True</property>
-				  <property name="relief">GTK_RELIEF_NORMAL</property>
-				  <property name="focus_on_click">True</property>
-				  <property name="active">False</property>
-				  <property name="inconsistent">False</property>
-				  <property name="draw_indicator">True</property>
-				</widget>
-			      </child>
-			    </widget>
-			    <packing>
-			      <property name="left_attach">0</property>
-			      <property name="right_attach">2</property>
-			      <property name="top_attach">1</property>
-			      <property name="bottom_attach">2</property>
-			      <property name="x_options">fill</property>
-			    </packing>
-			  </child>
-
-			  <child>
 			    <widget class="GtkCheckButton" id="show-menubar-checkbutton">
 			      <property name="visible">True</property>
 			      <property name="can_focus">True</property>
@@ -1391,8 +1356,8 @@
 			    <packing>
 			      <property name="left_attach">0</property>
 			      <property name="right_attach">2</property>
-			      <property name="top_attach">2</property>
-			      <property name="bottom_attach">3</property>
+			      <property name="top_attach">1</property>
+			      <property name="bottom_attach">2</property>
 			      <property name="x_options">fill</property>
 			      <property name="y_options"></property>
 			    </packing>
@@ -1413,8 +1378,8 @@
 			    <packing>
 			      <property name="left_attach">0</property>
 			      <property name="right_attach">2</property>
-			      <property name="top_attach">3</property>
-			      <property name="bottom_attach">4</property>
+			      <property name="top_attach">2</property>
+			      <property name="bottom_attach">3</property>
 			      <property name="x_options">fill</property>
 			      <property name="y_options"></property>
 			    </packing>

Modified: trunk/src/gnome-terminal.schemas.in
==============================================================================
--- trunk/src/gnome-terminal.schemas.in	(original)
+++ trunk/src/gnome-terminal.schemas.in	Sun Jan 20 21:39:49 2008
@@ -134,22 +134,6 @@
     </schema>
 
     <schema>
-      <key>/schemas/apps/gnome-terminal/profiles/Default/cursor_blink</key>
-      <applyto>/apps/gnome-terminal/profiles/Default/cursor_blink</applyto>
-      <owner>gnome-terminal</owner>
-      <type>bool</type>
-      <default>true</default>
-      <locale name="C">
-         <short>Whether to blink the cursor</short>
-         <long>
-           True if the cursor should blink when the terminal has focus, 
-           for windows/tabs with this profile.
-         </long>
-      </locale>
-    </schema>
-
-
-    <schema>
       <key>/schemas/apps/gnome-terminal/profiles/Default/default_show_menubar</key>
       <applyto>/apps/gnome-terminal/profiles/Default/default_show_menubar</applyto>
       <owner>gnome-terminal</owner>

Modified: trunk/src/profile-editor.c
==============================================================================
--- trunk/src/profile-editor.c	(original)
+++ trunk/src/profile-editor.c	Sun Jan 20 21:39:49 2008
@@ -80,8 +80,6 @@
                                                               TerminalProfile *profile);
 static void       profile_editor_update_icon                 (GtkWidget       *editor,
                                                               TerminalProfile *profile);
-static void       profile_editor_update_cursor_blink         (GtkWidget       *editor,
-                                                              TerminalProfile *profile);
 static void       profile_editor_update_default_show_menubar (GtkWidget       *editor,
                                                               TerminalProfile *profile);
 static void       profile_editor_update_color_pickers        (GtkWidget       *editor,
@@ -252,9 +250,6 @@
   if (mask->icon_file)
     profile_editor_update_icon (editor, profile);
   
-  if (mask->cursor_blink)
-    profile_editor_update_cursor_blink (editor, profile);
-
   if (mask->default_show_menubar)
     profile_editor_update_default_show_menubar (editor, profile);
 
@@ -372,14 +367,6 @@
 }
 
 static void
-cursor_blink_toggled (GtkWidget       *checkbutton,
-                      TerminalProfile *profile)
-{
-  terminal_profile_set_cursor_blink (profile,
-                                     gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbutton)));
-}
-
-static void
 show_menubar_toggled (GtkWidget       *checkbutton,
                       TerminalProfile *profile)
 {
@@ -984,12 +971,6 @@
                         G_CALLBACK (icon_changed),
                         profile);
       
-      w = glade_xml_get_widget (xml, "blink-cursor-checkbutton");
-      profile_editor_update_cursor_blink (editor, profile);
-      g_signal_connect (G_OBJECT (w), "toggled",
-                        G_CALLBACK (cursor_blink_toggled),
-                        profile);
-
       w = glade_xml_get_widget (xml, "show-menubar-checkbutton");
       profile_editor_update_default_show_menubar (editor, profile);
       g_signal_connect (G_OBJECT (w), "toggled",
@@ -1412,9 +1393,6 @@
   set_insensitive (editor, "profile-icon-entry",
                    mask->icon_file);
   
-  set_insensitive (editor, "blink-cursor-checkbutton",
-                   mask->cursor_blink);
-
   set_insensitive (editor, "show-menubar-checkbutton",
                    mask->default_show_menubar);
 
@@ -1544,18 +1522,6 @@
 }
 
 static void
-profile_editor_update_cursor_blink (GtkWidget       *editor,
-                                    TerminalProfile *profile)
-{
-  GtkWidget *w;
-
-  w = profile_editor_get_widget (editor, "blink-cursor-checkbutton");
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w),
-                                terminal_profile_get_cursor_blink (profile));
-}
-
-
-static void
 profile_editor_update_default_show_menubar (GtkWidget       *editor,
                                             TerminalProfile *profile)
 {

Modified: trunk/src/terminal-profile.c
==============================================================================
--- trunk/src/terminal-profile.c	(original)
+++ trunk/src/terminal-profile.c	Sun Jan 20 21:39:49 2008
@@ -39,7 +39,6 @@
  * This sucks. ;-)
  */
 #define KEY_VISIBLE_NAME "visible_name"
-#define KEY_CURSOR_BLINK "cursor_blink"
 #define KEY_DEFAULT_SHOW_MENUBAR "default_show_menubar"
 #define KEY_FOREGROUND_COLOR "foreground_color"
 #define KEY_BACKGROUND_COLOR "background_color"
@@ -114,7 +113,6 @@
   guint icon_load_failed : 1;
   guint background_load_failed : 1;
   
-  guint cursor_blink : 1;
   guint default_show_menubar : 1;
   guint allow_bold : 1;
   guint silent_bell : 1;
@@ -261,7 +259,6 @@
   
   profile->priv = g_new0 (TerminalProfilePrivate, 1);
   terminal_setting_mask_clear (&profile->priv->locked);
-  profile->priv->cursor_blink = FALSE;
   profile->priv->default_show_menubar = TRUE;
   profile->priv->visible_name = g_strdup ("<not named>");
   profile->priv->foreground.red = 0;
@@ -486,33 +483,6 @@
 }
 
 gboolean
-terminal_profile_get_cursor_blink (TerminalProfile  *profile)
-{
-  g_return_val_if_fail (TERMINAL_IS_PROFILE (profile), FALSE);
-  
-  return profile->priv->cursor_blink;
-}
-
-void
-terminal_profile_set_cursor_blink (TerminalProfile *profile,
-                                   gboolean         setting)
-{
-  char *key;
-
-  RETURN_IF_NOTIFYING (profile);
-  
-  key = gconf_concat_dir_and_key (profile->priv->profile_dir,
-                                  KEY_CURSOR_BLINK);
-  
-  gconf_client_set_bool (profile->priv->conf,
-                         key,
-                         setting,
-                         NULL);
-
-  g_free (key);
-}
-
-gboolean
 terminal_profile_get_scroll_on_keystroke (TerminalProfile  *profile)
 {
     g_return_val_if_fail (TERMINAL_IS_PROFILE (profile), FALSE);
@@ -1936,7 +1906,6 @@
     g_free (key);                                                               \
   }
 
-  UPDATE_BOOLEAN (KEY_CURSOR_BLINK,         cursor_blink);
   UPDATE_BOOLEAN (KEY_DEFAULT_SHOW_MENUBAR, default_show_menubar);
   UPDATE_STRING  (KEY_VISIBLE_NAME,         visible_name);
   UPDATE_STRING  (KEY_FOREGROUND_COLOR,     foreground_color);
@@ -2082,7 +2051,6 @@
  if (0)
    {
      ;
-     UPDATE_BOOLEAN (KEY_CURSOR_BLINK,           cursor_blink,           FALSE);
      UPDATE_BOOLEAN (KEY_DEFAULT_SHOW_MENUBAR,   default_show_menubar,   FALSE);
      UPDATE_STRING  (KEY_VISIBLE_NAME,           visible_name,           NULL);
      UPDATE_STRING  (KEY_FOREGROUND_COLOR,       foreground_color,       NULL);
@@ -2573,16 +2541,6 @@
 
   g_free (key);
   key = gconf_concat_dir_and_key (profile_dir,
-                                  KEY_CURSOR_BLINK);
-
-  gconf_client_set_bool (base_profile->priv->conf,
-                         key,
-                         base_profile->priv->cursor_blink,
-                         &err);
-  BAIL_OUT_CHECK ();
-
-  g_free (key);
-  key = gconf_concat_dir_and_key (profile_dir,
                                   KEY_DEFAULT_SHOW_MENUBAR);
 
   gconf_client_set_bool (base_profile->priv->conf,

Modified: trunk/src/terminal-profile.h
==============================================================================
--- trunk/src/terminal-profile.h	(original)
+++ trunk/src/terminal-profile.h	Sun Jan 20 21:39:49 2008
@@ -35,7 +35,6 @@
 typedef struct
 {
   unsigned int visible_name : 1;
-  unsigned int cursor_blink : 1;
   unsigned int default_show_menubar : 1;
   unsigned int foreground_color : 1;
   unsigned int background_color : 1;
@@ -145,7 +144,6 @@
 
 const char*               terminal_profile_get_name                 (TerminalProfile *profile);
 const char*               terminal_profile_get_visible_name         (TerminalProfile *profile);
-gboolean                  terminal_profile_get_cursor_blink         (TerminalProfile *profile);
 gboolean                  terminal_profile_get_allow_bold           (TerminalProfile *profile);
 gboolean                  terminal_profile_get_silent_bell          (TerminalProfile *profile);
 TerminalScrollbarPosition terminal_profile_get_scrollbar_position   (TerminalProfile *profile);
@@ -187,8 +185,6 @@
 gboolean               terminal_profile_get_use_skey              (TerminalProfile *profile);
 const PangoFontDescription* terminal_profile_get_font             (TerminalProfile *profile);
 
-void terminal_profile_set_cursor_blink         (TerminalProfile           *profile,
-                                                gboolean                   setting);
 void terminal_profile_set_visible_name         (TerminalProfile           *profile,
                                                 const char                *name);
 void terminal_profile_set_allow_bold           (TerminalProfile           *profile,

Modified: trunk/src/terminal-screen.c
==============================================================================
--- trunk/src/terminal-screen.c	(original)
+++ trunk/src/terminal-screen.c	Sun Jan 20 21:39:49 2008
@@ -242,6 +242,48 @@
 }
 
 static void
+terminal_screen_sync_settings (GtkSettings *settings,
+                               GParamSpec *pspec,
+                               TerminalScreen *screen)
+{
+  gboolean blink;
+
+  g_object_get (G_OBJECT (settings),
+                "gtk-cursor-blink", &blink,
+                NULL);
+
+  terminal_widget_set_cursor_blinks (screen->priv->term, blink);
+}
+
+static void
+terminal_screen_screen_changed (GtkWidget *widget, GdkScreen *previous_screen)
+{
+  GdkScreen *screen;
+  GtkSettings *settings;
+
+  screen = gtk_widget_get_screen (widget);
+  if (previous_screen != NULL &&
+      (screen != previous_screen || screen == NULL)) {
+    settings = gtk_settings_get_for_screen (previous_screen);
+    g_signal_handlers_disconnect_matched (settings, G_SIGNAL_MATCH_DATA,
+                                          0, 0, NULL, NULL,
+                                          widget);
+  }
+
+  if (GTK_WIDGET_CLASS (terminal_screen_parent_class)->screen_changed) {
+    GTK_WIDGET_CLASS (terminal_screen_parent_class)->screen_changed (widget, previous_screen);
+  }
+
+  if (screen == previous_screen)
+    return;
+
+  settings = gtk_widget_get_settings (widget);
+  terminal_screen_sync_settings (settings, NULL, TERMINAL_SCREEN (widget));
+  g_signal_connect (settings, "notify::gtk-cursor-blink",
+                    G_CALLBACK (terminal_screen_sync_settings), widget);
+}
+
+static void
 terminal_screen_grab_focus (GtkWidget *widget)
 {
   TerminalScreen *screen = TERMINAL_SCREEN (widget);
@@ -369,6 +411,7 @@
 
   widget_class->unrealize = terminal_screen_unrealize;
   widget_class->size_allocate = terminal_screen_size_allocate;
+  widget_class->screen_changed = terminal_screen_screen_changed;
   widget_class->size_request = terminal_screen_size_request;
   widget_class->map = terminal_screen_map;
   widget_class->grab_focus = terminal_screen_grab_focus;
@@ -441,10 +484,16 @@
 terminal_screen_finalize (GObject *object)
 {
   TerminalScreen *screen;
+  GtkSettings *settings;
   GConfClient *conf;
 
   screen = TERMINAL_SCREEN (object);
 
+  settings = gtk_widget_get_settings (GTK_WIDGET (screen));
+  g_signal_handlers_disconnect_matched (settings, G_SIGNAL_MATCH_DATA,
+                                        0, 0, NULL, NULL,
+                                        screen);
+
   conf = gconf_client_get_default ();
   
   if (screen->priv->gconf_connection_id)
@@ -572,9 +621,6 @@
 
   update_color_scheme (screen);
 
-  terminal_widget_set_cursor_blinks (term,
-                                     terminal_profile_get_cursor_blink (profile));
-
   terminal_widget_set_audible_bell (term,
                                     !terminal_profile_get_silent_bell (profile));
 



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