Exemplo n.º 1
0
int
main(int argc,
     char **argv)
{
    XfconfChannel *channel;
    SignalTestData std = { NULL, FALSE };
    
    std.mloop = g_main_loop_new(NULL, FALSE);

    if(!xfconf_tests_start())
        return 2;
    
    channel = xfconf_channel_new(TEST_CHANNEL_NAME);
    xfconf_channel_reset_property (channel, test_string_property, FALSE);

    g_signal_connect(G_OBJECT(channel), "property-changed",
                     G_CALLBACK(test_signal_changed), &std);
    
    TEST_OPERATION(xfconf_channel_set_string(channel, test_string_property, test_string));
    
    g_timeout_add(1500, test_watchdog, &std);
    g_main_loop_run(std.mloop);

    g_main_loop_unref(std.mloop);
    g_object_unref(G_OBJECT(channel));
    
    xfconf_tests_end();
    
    return std.got_signal ? 0 : 1;
}
Exemplo n.º 2
0
gboolean
migrate_46 (const gchar  *filename,
            GError      **error)
{
  gsize                length;
  gchar               *contents;
  GMarkupParseContext *context;
  ConfigParser        *parser;
  gboolean             succeed = FALSE;

  g_return_val_if_fail (filename != NULL, FALSE);
  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);

  if (!g_file_get_contents (filename, &contents, &length, error))
    return FALSE;

  parser = g_slice_new0 (ConfigParser);
  parser->state = START;
  parser->plugin_id_counter = 0;
  parser->panel_id_counter = 0;
  parser->channel = xfconf_channel_new (XFCE_PANEL_CHANNEL_NAME);

  context = g_markup_parse_context_new (&markup_parser, 0, parser, NULL);

  if (g_markup_parse_context_parse (context, contents, length, error))
    {
      /* check if the entire file is parsed */
      if (g_markup_parse_context_end_parse (context, error))
        succeed = TRUE;
    }

  /* if parsing failed somehow, empty the channel so no broken config is left */
  if (!succeed)
    xfconf_channel_reset_property (parser->channel, "/", TRUE);

  g_free (contents);
  g_markup_parse_context_free (context);
  g_object_unref (G_OBJECT (parser->channel));
  g_slice_free (ConfigParser, parser);

  return succeed;
}
Exemplo n.º 3
0
int
main(int argc,
     char **argv)
{
    XfconfChannel *channel;
    
    if(!xfconf_tests_start())
        return 1;
    
    channel = xfconf_channel_new(TEST_CHANNEL_NAME);
    
    TEST_OPERATION(xfconf_channel_has_property(channel, test_strlist_property));
    xfconf_channel_reset_property(channel, test_strlist_property, FALSE);
    TEST_OPERATION(!xfconf_channel_has_property(channel, test_strlist_property));
    
    g_object_unref(G_OBJECT(channel));
    
    xfconf_tests_end();
    
    return 0;
}