gdk_settings()



hey owen,

haven't looked at the gdk_settings code yet, but i don#t particularly like:

static void
gtk_settings_get_property (GObject     *object,
                           guint        property_id,
                           GValue      *value,
                           GParamSpec  *pspec)
{
  GtkSettings *settings = GTK_SETTINGS (object);

  if (!gdk_setting_get (pspec->name, value))
    g_value_copy (settings->property_values + property_id - 1, value);
}


void
_gtk_settings_handle_event (GdkEventSetting *event)
{
  GtkSettings *settings = gtk_settings_get_global ();

  if (g_object_class_find_property (G_OBJECT_GET_CLASS (settings), event->name))
    g_object_notify (G_OBJECT (settings), event->name);
}


gtk_settings_get_property() should furtherly retrive values
only from its local copy, and _gtk_settings_handle_event() should
simply get the new value from gdk and set it on gtksettings, i.e.:

static void
gtk_settings_get_property (GObject     *object,
                           guint        property_id,
                           GValue      *value,
                           GParamSpec  *pspec)
{
  GtkSettings *settings = GTK_SETTINGS (object);

  g_value_copy (settings->property_values + property_id - 1, value);
}


void
_gtk_settings_handle_event (GdkEventSetting *event)
{
  GtkSettings *settings = gtk_settings_get_global ();
  GParamSpec *pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (settings), event->name);

  if (pspec)
    {
      GValue tmp_value = { 0, };
      
      g_value_init (&tmp_value, G_PARAM_SPEC_VALUE_TYPE (pspec));
      gdk_setting_get (pspec->name, &tmp_value);
      g_object_set_property (G_OBJECT (settings), pspec->name, &tmp_value);
      g_value_unset (&tmp_value);
    }
}


is there any reason you didn't do things this way?
(though i suspect, if there is, the gdk settings implementation
is hosed)

---
ciaoTJ





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