Пример #1
0
static VALUE
rbclt_model_set_sort (VALUE self, VALUE column_arg)
{
    ClutterModel *model = CLUTTER_MODEL (RVAL2GOBJ (self));
    RBCLTCallbackFunc *func;
    guint column = NUM2UINT (column_arg);

    if (rb_block_given_p ())
    {
        func = rbclt_callback_func_new (rb_block_proc ());

        clutter_model_set_sort (model, column,
                                rbclt_model_call_sort_func, func,
                                (GDestroyNotify) rbclt_callback_func_destroy);
    }
    else
        clutter_model_set_sort (model, column, NULL, NULL, NULL);

    return self;
}
Пример #2
0
static void
mtn_service_model_init (MtnServiceModel *model)
{
    model->priv = GET_PRIVATE (model);

    clutter_model_set_types (CLUTTER_MODEL (model),
                             MTN_SERVICE_MODEL_COUNT_COLS,
                             MTN_SERVICE_MODEL_COLUMN_TYPES);
    clutter_model_set_sort (CLUTTER_MODEL (model),
                            MTN_SERVICE_MODEL_COL_INDEX,
                            _sort_by_index,
                            NULL, NULL);
}
ClutterModel *
mnp_get_world_timezones (void)
{
	GWeatherLocation *world;
	ClutterModel *store;

	world = gweather_location_new_world (FALSE);
	if (!world)
		return NULL;

	store = clutter_list_model_new (4, G_TYPE_STRING, "DisplayName",
                                  	G_TYPE_POINTER, "location",
					G_TYPE_STRING, "CompareName",
					G_TYPE_STRING, "SortName");


	fill_location_entry_model(store, world, NULL, NULL, NULL);
    	/* gweather_location_unref (world); */

	clutter_model_set_sort (store, 3, sort_weather_model, NULL, NULL);
	return (ClutterModel *)store;
}
Пример #4
0
static void
filter_model (ClutterModel *model)
{
  ClutterModelIter *iter;

  g_print ("\n* Filter function: even rows\n");
  clutter_model_set_filter (model, filter_func, NULL, NULL);

  iter = clutter_model_get_first_iter (model);
  while (!clutter_model_iter_is_last (iter))
    {
      print_iter (iter, "Filtered Forward Iteration");

      iter = clutter_model_iter_next (iter);
    }
  g_object_unref (iter);

  g_print ("\n* Sorting function: reverse alpha\n");
  clutter_model_set_sort (model, COLUMN_BAR, sort_func, NULL, NULL);

  g_signal_connect (model, "row-changed", G_CALLBACK (on_row_changed), NULL);
  
  iter = clutter_model_get_iter_at_row (model, 0);
  clutter_model_iter_set (iter, COLUMN_BAR, "Changed string of 0th row, "
                                            "automatically gets sorted",
                                -1);
  g_object_unref (iter);

  clutter_model_foreach (model, foreach_func, NULL);

  g_print ("\n* Unset filter\n");
  clutter_model_set_filter (model, NULL, NULL, NULL);

  while (clutter_model_get_n_rows (model))
    clutter_model_remove (model, 0);
  
  clutter_main_quit ();
}