[Xfce4-commits] r30113 - terminal/trunk/terminal

Nick Schermer nick at xfce.org
Sun Jun 28 15:43:50 CEST 2009


Author: nick
Date: 2009-06-28 13:43:50 +0000 (Sun, 28 Jun 2009)
New Revision: 30113

Modified:
   terminal/trunk/terminal/Makefile.am
   terminal/trunk/terminal/terminal-app.c
   terminal/trunk/terminal/terminal-app.h
   terminal/trunk/terminal/terminal-dbus.c
   terminal/trunk/terminal/terminal-image-loader.c
   terminal/trunk/terminal/terminal-marshal.list
   terminal/trunk/terminal/terminal-options.h
   terminal/trunk/terminal/terminal-preferences.c
   terminal/trunk/terminal/terminal-screen.c
Log:
Bunch of small cleanups and improvements.

A couple of the changes showed up in gprof other are just
small cleanups.


Modified: terminal/trunk/terminal/Makefile.am
===================================================================
--- terminal/trunk/terminal/Makefile.am	2009-06-28 12:29:04 UTC (rev 30112)
+++ terminal/trunk/terminal/Makefile.am	2009-06-28 13:43:50 UTC (rev 30113)
@@ -132,24 +132,24 @@
 
 terminal-enum-types.h: stamp-terminal-enum-types.h
 	@true
-stamp-terminal-enum-types.h: $(Terminal_headers) Makefile
+stamp-terminal-enum-types.h: terminal-preferences.h Makefile
 	( cd $(srcdir) && glib-mkenums \
 		--fhead "#ifndef __TERMINAL_ENUM_TYPES_H__\n#define __TERMINAL_ENUM_TYPES_H__\n#include <exo/exo.h>\nG_BEGIN_DECLS\n" \
 		--fprod "/* enumerations from \"@filename@\" */\n" \
 		--vhead "GType @enum_name at _get_type (void);\n#define TERMINAL_TYPE_ at ENUMSHORT@ (@enum_name at _get_type())\n" \
 		--ftail "G_END_DECLS\n\n#endif /* !__TERMINAL_ENUM_TYPES_H__ */" \
-		$(Terminal_headers) ) >> xgen-teth \
+		terminal-preferences.h ) >> xgen-teth \
 	&& (cmp -s xgen-teth terminal-enum-types.h || cp xgen-teth terminal-enum-types.h ) \
 	&& rm -f xgen-teth \
 	&& echo timestamp > $(@F)
-terminal-enum-types.c: $(Terminal_headers) Makefile
+terminal-enum-types.c: terminal-preferences.h Makefile
 	( cd $(srcdir) && glib-mkenums \
 		--fhead "#ifdef HAVE_CONFIG_H\n#include <config.h>\n#endif\n#undef GTK_DISABLE_DEPRECATED\n#define GTK_ENABLE_BROKEN\n#include <terminal/terminal-enum-types.h>\n#include <terminal/terminal-app.h>\n#include <terminal/terminal-preferences.h>" \
 		--fprod "\n/* enumerations from \"@filename@\" */" \
 		--vhead "GType\n at enum_name@_get_type (void)\n{\n\tstatic GType type = 0;\n\tif (type == 0) {\n\tstatic const G at Type@Value values[] = {"\
 		--vprod "\t{ @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
 		--vtail "\t{ 0, NULL, NULL }\n\t};\n\ttype = g_ at type@_register_static (\"@EnumName@\", values);\n  }\n\treturn type;\n}\n" \
-		$(Terminal_headers) ) >> xgen-tetc \
+		terminal-preferences.h ) >> xgen-tetc \
 	&& cp xgen-tetc terminal-enum-types.c \
 	&& rm -f xgen-tetc
 

Modified: terminal/trunk/terminal/terminal-app.c
===================================================================
--- terminal/trunk/terminal/terminal-app.c	2009-06-28 12:29:04 UTC (rev 30112)
+++ terminal/trunk/terminal/terminal-app.c	2009-06-28 13:43:50 UTC (rev 30113)
@@ -335,7 +335,7 @@
 
   if (exo_xsession_client_get_restart_command (client, &oargv, NULL))
     {
-      g_assert (oargv[0] != NULL);
+      _terminal_assert (oargv[0] != NULL);
 
       argv[0] = oargv[0];
 

Modified: terminal/trunk/terminal/terminal-app.h
===================================================================
--- terminal/trunk/terminal/terminal-app.h	2009-06-28 12:29:04 UTC (rev 30112)
+++ terminal/trunk/terminal/terminal-app.h	2009-06-28 13:43:50 UTC (rev 30113)
@@ -31,7 +31,7 @@
 #define TERMINAL_ERROR (terminal_error_quark ())
 GQuark terminal_error_quark (void) G_GNUC_CONST;
 
-typedef enum /*< enum,prefix=TERMINAL_ERROR >*/
+enum _TerminalError
 {
   /* problem with the runtime linker */
   TERMINAL_ERROR_LINKER_FAILURE,
@@ -39,7 +39,7 @@
   TERMINAL_ERROR_USER_MISMATCH,
   /* general failure */
   TERMINAL_ERROR_FAILED,
-} TerminalError;
+};
 
 
 #define TERMINAL_TYPE_APP         (terminal_app_get_type ())
@@ -49,6 +49,7 @@
 
 typedef struct _TerminalAppClass TerminalAppClass;
 typedef struct _TerminalApp      TerminalApp;
+typedef enum   _TerminalError    TerminalError;
 
 GType        terminal_app_get_type            (void) G_GNUC_CONST;
 

Modified: terminal/trunk/terminal/terminal-dbus.c
===================================================================
--- terminal/trunk/terminal/terminal-dbus.c	2009-06-28 12:29:04 UTC (rev 30112)
+++ terminal/trunk/terminal/terminal-dbus.c	2009-06-28 13:43:50 UTC (rev 30113)
@@ -38,6 +38,7 @@
 
 #include <terminal/terminal-config.h>
 #include <terminal/terminal-dbus.h>
+#include <terminal/terminal-private.h>
 
 
 
@@ -171,7 +172,7 @@
   DBusConnection *connection;
   DBusError       derror;
 
-  g_return_val_if_fail (TERMINAL_IS_APP (app), FALSE);
+  _terminal_return_val_if_fail (TERMINAL_IS_APP (app), FALSE);
 
   /* check if the application object is already registered */
   connection = g_object_get_data (G_OBJECT (app), "terminal-dbus-connection");
@@ -235,8 +236,8 @@
   DBusMessage    *result;
   DBusError       derror;
 
-  g_return_val_if_fail (argc > 0, FALSE);
-  g_return_val_if_fail (argv != NULL, FALSE);
+  _terminal_return_val_if_fail (argc > 0, FALSE);
+  _terminal_return_val_if_fail (argv != NULL, FALSE);
 
   dbus_error_init (&derror);
 

Modified: terminal/trunk/terminal/terminal-image-loader.c
===================================================================
--- terminal/trunk/terminal/terminal-image-loader.c	2009-06-28 12:29:04 UTC (rev 30112)
+++ terminal/trunk/terminal/terminal-image-loader.c	2009-06-28 13:43:50 UTC (rev 30113)
@@ -82,8 +82,8 @@
 {
   TerminalImageLoader *loader = TERMINAL_IMAGE_LOADER (object);
 
-  g_assert (loader->cache == NULL);
-  g_assert (loader->cache_invalid == NULL);
+  _terminal_assert (loader->cache == NULL);
+  _terminal_assert (loader->cache_invalid == NULL);
 
   g_object_unref (G_OBJECT (loader->preferences));
 
@@ -187,7 +187,7 @@
   g_warning ("Pixbuf %p was freed from loader cache %p, "
              "this should not happend",
              pixbuf, loader);
-  g_assert_not_reached ();
+  _terminal_assert_not_reached ();
 #endif
 }
 
@@ -528,7 +528,7 @@
       break;
 
     default:
-      g_assert_not_reached ();
+      _terminal_assert_not_reached ();
     }
 
   terminal_image_loader_saturate (loader, pixbuf);

Modified: terminal/trunk/terminal/terminal-marshal.list
===================================================================
--- terminal/trunk/terminal/terminal-marshal.list	2009-06-28 12:29:04 UTC (rev 30112)
+++ terminal/trunk/terminal/terminal-marshal.list	2009-06-28 13:43:50 UTC (rev 30113)
@@ -1,3 +1,2 @@
 OBJECT:VOID
-VOID:STRING,ENUM
 VOID:OBJECT,INT,INT

Modified: terminal/trunk/terminal/terminal-options.h
===================================================================
--- terminal/trunk/terminal/terminal-options.h	2009-06-28 12:29:04 UTC (rev 30112)
+++ terminal/trunk/terminal/terminal-options.h	2009-06-28 13:43:50 UTC (rev 30113)
@@ -29,13 +29,14 @@
 typedef struct _TerminalOptions    TerminalOptions;
 typedef struct _TerminalTabAttr    TerminalTabAttr;
 typedef struct _TerminalWindowAttr TerminalWindowAttr;
+typedef enum   _TerminalVisibility TerminalVisibility;
 
-typedef enum /*< enum,prefix=TERMINAL_VISIBILITY >*/
+enum _TerminalVisibility
 {
   TERMINAL_VISIBILITY_DEFAULT,
   TERMINAL_VISIBILITY_SHOW,
-  TERMINAL_VISIBILITY_HIDE,
-} TerminalVisibility;
+  TERMINAL_VISIBILITY_HIDE
+};
 
 struct _TerminalOptions
 {
@@ -67,11 +68,11 @@
   gboolean             maximize;
 };
 
-gboolean  terminal_options_parse    (gint                 argc,
-                                     gchar              **argv,
-                                     GList              **attrs_return,
-                                     TerminalOptions    **options_return,
-                                     GError             **error);
+gboolean           terminal_options_parse    (gint                 argc,
+                                              gchar              **argv,
+                                              GList              **attrs_return,
+                                              TerminalOptions    **options_return,
+                                              GError             **error);
 
 void                terminal_options_free     (TerminalOptions     *options);
 

Modified: terminal/trunk/terminal/terminal-preferences.c
===================================================================
--- terminal/trunk/terminal/terminal-preferences.c	2009-06-28 12:29:04 UTC (rev 30112)
+++ terminal/trunk/terminal/terminal-preferences.c	2009-06-28 13:43:50 UTC (rev 30113)
@@ -1358,9 +1358,16 @@
 
   src = preferences->values + prop_id;
   if (G_VALUE_HOLDS (src, pspec->value_type))
-    g_value_copy (src, value);
+    {
+      if (G_LIKELY (pspec->value_type == G_TYPE_STRING))
+        g_value_set_static_string (value, g_value_get_string (src));
+      else
+        g_value_copy (src, value);
+    }
   else
-    g_param_value_set_default (pspec, value);
+    {
+      g_param_value_set_default (pspec, value);
+    }
 }
 
 
@@ -1387,7 +1394,10 @@
     {
       g_value_copy (value, dst);
       g_object_notify (object, pspec->name);
-      terminal_preferences_schedule_store (preferences);
+
+      /* don't schedule a store if loading */
+      if (!preferences->loading_in_progress)
+        terminal_preferences_schedule_store (preferences);
     }
 }
 
@@ -1470,7 +1480,7 @@
       if (!exo_str_is_equal (option, g_param_spec_get_blurb (spec)))
         {
           g_message ("Blurb does not match option name %s", spec->name);
-          g_assert_not_reached ();
+          _terminal_assert_not_reached ();
         }
       g_free (option);
 #endif
@@ -1578,7 +1588,7 @@
       /* when debugging is enabled, check if the generated option name
        * is equal to the blurp, to prevent typos */
       option = property_name_to_option_name (spec->name);
-      g_assert (exo_str_is_equal (option, g_param_spec_get_blurb (spec)));
+      _terminal_assert (exo_str_is_equal (option, g_param_spec_get_blurb (spec)));
       g_free (option);
 #endif
 

Modified: terminal/trunk/terminal/terminal-screen.c
===================================================================
--- terminal/trunk/terminal/terminal-screen.c	2009-06-28 12:29:04 UTC (rev 30112)
+++ terminal/trunk/terminal/terminal-screen.c	2009-06-28 13:43:50 UTC (rev 30113)
@@ -307,7 +307,6 @@
   /* apply current settings */
   terminal_screen_update_binding_backspace (screen);
   terminal_screen_update_binding_delete (screen);
-  terminal_screen_update_colors (screen);
   terminal_screen_update_font (screen);
   terminal_screen_update_misc_bell (screen);
   terminal_screen_update_misc_cursor_blinks (screen);
@@ -320,9 +319,8 @@
   terminal_screen_timer_background (TERMINAL_SCREEN (screen));
 
   /* Last, connect contents-changed to avoid a race with updates above */
-  g_object_connect (G_OBJECT (screen->terminal),
-                    "signal::contents-changed", G_CALLBACK (terminal_screen_vte_window_contents_changed), screen,
-                    NULL);
+  g_signal_connect (G_OBJECT (screen->terminal), "contents-changed",
+      G_CALLBACK (terminal_screen_vte_window_contents_changed), screen);
 
 }
 
@@ -606,7 +604,7 @@
       break;
 
     default:
-      g_assert_not_reached ();
+      _terminal_assert_not_reached ();
     }
 }
 
@@ -638,10 +636,12 @@
       break;
 
     default:
-      g_assert_not_reached ();
+      _terminal_assert_not_reached ();
     }
 }
 
+
+
 static void
 terminal_screen_update_colors (TerminalScreen *screen)
 {
@@ -657,8 +657,6 @@
   query_color (screen->preferences, "color-background", &bg);
   query_color (screen->preferences, "color-foreground", &fg);
   query_color (screen->preferences, "color-cursor", &cursor);
-  query_color (screen->preferences, "color-selection", &selection);
-  g_object_get (G_OBJECT (screen->preferences), "color-selection-use-default", &selection_use_default, NULL);
 
   for (n = 0; n < 16; ++n)
     {
@@ -669,6 +667,10 @@
   vte_terminal_set_colors (VTE_TERMINAL (screen->terminal), &fg, &bg, palette, 16);
   vte_terminal_set_background_tint_color (VTE_TERMINAL (screen->terminal), &bg);
   vte_terminal_set_color_cursor (VTE_TERMINAL (screen->terminal), &cursor);
+
+  g_object_get (G_OBJECT (screen->preferences), "color-selection-use-default", &selection_use_default, NULL);
+  if (!selection_use_default)
+    query_color (screen->preferences, "color-selection", &selection);
   vte_terminal_set_color_highlight (VTE_TERMINAL (screen->terminal), selection_use_default ? NULL : &selection);
 }
 
@@ -1296,7 +1298,7 @@
       break;
 
     default:
-      g_assert_not_reached ();
+      _terminal_assert_not_reached ();
       title = NULL;
     }
 
@@ -1306,6 +1308,8 @@
   return title;
 }
 
+
+
 /**
  * terminal_screen_get_working_directory:
  * @screen      : A #TerminalScreen.




More information about the Xfce4-commits mailing list