/* Object initialization
 * Create private structure and set up default values
 */
static void xfdashboard_applications_menu_model_init(XfdashboardApplicationsMenuModel *self)
{
	XfdashboardApplicationsMenuModelPrivate	*priv;
	GType									columnTypes[]=	{
																G_TYPE_UINT, /* XFDASHBOARD_APPLICATIONS_MENU_MODEL_COLUMN_SEQUENCE_ID */
																GARCON_TYPE_MENU_ELEMENT, /* XFDASHBOARD_APPLICATIONS_MENU_MODEL_COLUMN_MENU_ELEMENT */
																GARCON_TYPE_MENU, /* XFDASHBOARD_APPLICATIONS_MENU_MODEL_COLUMN_PARENT_MENU */
																GARCON_TYPE_MENU, /* XFDASHBOARD_APPLICATIONS_MENU_MODEL_COLUMN_SECTION */
																G_TYPE_STRING, /* XFDASHBOARD_APPLICATIONS_MENU_MODEL_COLUMN_TITLE */
																G_TYPE_STRING /* XFDASHBOARD_APPLICATIONS_MENU_MODEL_COLUMN_DESCRIPTION */
															};
	const gchar*							columnNames[]=	{
																_("ID"), /* XFDASHBOARD_APPLICATIONS_MENU_MODEL_COLUMN_SEQUENCE_ID */
																_("Menu item"), /* XFDASHBOARD_APPLICATIONS_MENU_MODEL_COLUMN_MENU_ELEMENT */
																_("Parent menu"), /* XFDASHBOARD_APPLICATIONS_MENU_MODEL_COLUMN_PARENT_MENU */
																_("Section"), /* XFDASHBOARD_APPLICATIONS_MENU_MODEL_COLUMN_SECTION */
																_("Title"), /* XFDASHBOARD_APPLICATIONS_MENU_MODEL_COLUMN_TITLE */
																_("Description"), /* XFDASHBOARD_APPLICATIONS_MENU_MODEL_COLUMN_DESCRIPTION */
															};

	priv=self->priv=XFDASHBOARD_APPLICATIONS_MENU_MODEL_GET_PRIVATE(self);

	/* Set up default values */
	priv->rootMenu=NULL;

	/* Set up model */
	clutter_model_set_types(CLUTTER_MODEL(self), XFDASHBOARD_APPLICATIONS_MENU_MODEL_COLUMN_LAST, columnTypes);
	clutter_model_set_names(CLUTTER_MODEL(self), XFDASHBOARD_APPLICATIONS_MENU_MODEL_COLUMN_LAST, columnNames);

	/* Defer filling model */
	clutter_threads_add_idle(_xfdashboard_applications_menu_model_init_idle, self);
}
Пример #2
0
static void
gmc_video_model_init (GmcVideoModel *self)
{
  clutter_model_set_names (CLUTTER_MODEL (self),
                           G_N_ELEMENTS (names),
                           names);
  clutter_model_set_types (CLUTTER_MODEL (self),
                           G_N_ELEMENTS (types),
                           types);
}
Пример #3
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);
}
Пример #4
0
static VALUE
rbclt_model_filter_iter (VALUE self, VALUE iter)
{
    return clutter_model_filter_iter (CLUTTER_MODEL (RVAL2GOBJ (self)),
                                      CLUTTER_MODEL_ITER (RVAL2GOBJ (iter)))
           ? Qtrue : Qfalse;
}
Пример #5
0
static VALUE
rbclt_model_get_iter_at_row (VALUE self, VALUE row)
{
    ClutterModel *model = CLUTTER_MODEL (RVAL2GOBJ (self));

    return GOBJ2RVALU (clutter_model_get_iter_at_row (model, NUM2UINT (row)));
}
Пример #6
0
static VALUE
rbclt_model_get_sorting_column (VALUE self)
{
    ClutterModel *model = CLUTTER_MODEL (RVAL2GOBJ (self));

    return INT2NUM (clutter_model_get_sorting_column (model));
}
Пример #7
0
static VALUE
rbclt_model_get_last_iter (VALUE self)
{
    ClutterModel *model = CLUTTER_MODEL (RVAL2GOBJ (self));

    return GOBJ2RVALU (clutter_model_get_last_iter (model));
}
Пример #8
0
static VALUE
rbclt_model_get_column_type (VALUE self, VALUE colnum)
{
    ClutterModel *model = CLUTTER_MODEL (RVAL2GOBJ (self));

    return GTYPE2CLASS (clutter_model_get_column_type (model, NUM2UINT (colnum)));
}
Пример #9
0
static VALUE
rbclt_model_get_n_rows (VALUE self)
{
    ClutterModel *model = CLUTTER_MODEL (RVAL2GOBJ (self));

    return UINT2NUM (clutter_model_get_n_rows (model));
}
Пример #10
0
static void
mtn_service_model_add_or_update (MtnServiceModel *model,
                                 const char      *path,
                                 guint            index)
{
    ClutterModelIter *model_iter;

    if (!path)
        return;

    model_iter = mtn_service_model_lookup (model, path);
    if (!model_iter) {
g_debug ("add service %d: %s", index, path);
        clutter_model_insert (CLUTTER_MODEL (model), index,
                              MTN_SERVICE_MODEL_COL_INDEX, index,
                              MTN_SERVICE_MODEL_COL_PRESENT, TRUE,
                              MTN_SERVICE_MODEL_COL_HIDDEN, FALSE,
                              MTN_SERVICE_MODEL_COL_OBJECT_PATH, path,
                              MTN_SERVICE_MODEL_COL_WIDGET, mtn_service_tile_new (path),
                              -1);
    } else {
g_debug ("update service %d: %s", index, path);
        clutter_model_iter_set (model_iter,
                                MTN_SERVICE_MODEL_COL_INDEX, index,
                                MTN_SERVICE_MODEL_COL_PRESENT, TRUE,
                                -1);
        g_object_unref (model_iter);
    }
}
Пример #11
0
static ClutterModelIter*
mtn_service_model_lookup (MtnServiceModel *model,
                          const char      *object_path)
{
    ClutterModelIter *iter;
    char *row_path;
    /* NOTE could have internal hashtable, but that's not totally trivial.
     * TODO if needed... */

    iter = clutter_model_get_first_iter (CLUTTER_MODEL (model));
    if (!iter) {
        return NULL;
    }

    while (!clutter_model_iter_is_last (iter)) {
        clutter_model_iter_get (iter,
                                MTN_SERVICE_MODEL_COL_OBJECT_PATH, &row_path,
                                -1);
        if (g_strcmp0 (row_path, object_path) == 0) {
            break;
        }
        iter = clutter_model_iter_next (iter);
    }

    if (clutter_model_iter_is_last (iter)) {
        g_object_unref (iter);
        iter = NULL;
    }

    return iter;
}
Пример #12
0
static VALUE
rbclt_model_filter_row (VALUE self, VALUE row)
{
    return clutter_model_filter_row (CLUTTER_MODEL (RVAL2GOBJ (self)),
                                     NUM2UINT (row))
           ? Qtrue : Qfalse;
}
static void
am_ready_cb (GObject      *source_object,
             GAsyncResult *result,
             gpointer      userdata)

{
  TpAccountManager *account_manager = TP_ACCOUNT_MANAGER (source_object);
  AnerleyFeed *feed;
  ClutterActor *stage;
  ClutterActor *scroll_view;
  ClutterActor *icon_view;
  ClutterModel *model;
  GError *error = NULL;

  if (!tp_account_manager_prepare_finish (account_manager, result, &error))
  {
    g_warning ("Failed to make account manager ready: %s", error->message);
    g_error_free (error);
    return;
  }

  feed = ANERLEY_FEED (anerley_aggregate_tp_feed_new ());
  model = CLUTTER_MODEL (anerley_feed_model_new (feed));
  stage = clutter_stage_get_default ();
  icon_view = anerley_tile_view_new (ANERLEY_FEED_MODEL (model));

  scroll_view = mx_scroll_view_new ();
  clutter_container_add_actor (CLUTTER_CONTAINER (stage),
                               CLUTTER_ACTOR (scroll_view));
  clutter_container_add_actor (CLUTTER_CONTAINER (scroll_view),
                               CLUTTER_ACTOR (icon_view));
  clutter_actor_set_size (CLUTTER_ACTOR (scroll_view), 640, 480);
  clutter_actor_show_all (stage);
}
Пример #14
0
/* Clear all data in model and also release all allocated resources needed for this model */
static void _xfdashboard_applications_menu_model_clear(XfdashboardApplicationsMenuModel *self)
{
	XfdashboardApplicationsMenuModelPrivate		*priv;
	ClutterModelIter							*iterator;
	GarconMenuElement							*menuElement;

	g_return_if_fail(XFDASHBOARD_IS_APPLICATIONS_MENU_MODEL(self));

	priv=self->priv;

	/* Unset filter (forces all rows being accessible and not being skipped/filtered) */
	clutter_model_set_filter(CLUTTER_MODEL(self), NULL, NULL, NULL);

	/* Clean up and remove all rows */
	while(clutter_model_get_n_rows(CLUTTER_MODEL(self)))
	{
		/* Get data from model for clean up */
		menuElement=NULL;

		iterator=clutter_model_get_iter_at_row(CLUTTER_MODEL(self), 0);
		clutter_model_iter_get(iterator,
								XFDASHBOARD_APPLICATIONS_MENU_MODEL_COLUMN_MENU_ELEMENT, &menuElement,
								-1);

		/* Remove signal handler from menu element */
		if(menuElement)
		{
			g_signal_handlers_disconnect_by_func(menuElement, G_CALLBACK(_xfdashboard_applications_menu_model_on_reload_required), self);
		}

		/* Remove row */
		clutter_model_remove(CLUTTER_MODEL(self), 0);

		/* Release iterator */
		if(menuElement) g_object_unref(menuElement);
		g_object_unref(iterator);
	}

	/* Destroy root menu */
	if(priv->rootMenu)
	{
		g_object_unref(priv->rootMenu);
		priv->rootMenu=NULL;
	}
}
Пример #15
0
static VALUE
rbclt_model_set_sorting_column (VALUE self, VALUE column)
{
    ClutterModel *model = CLUTTER_MODEL (RVAL2GOBJ (self));

    clutter_model_set_sorting_column (model, NUM2UINT (column));

    return self;
}
Пример #16
0
static VALUE
rbclt_model_remove (VALUE self, VALUE row)
{
    ClutterModel *model = CLUTTER_MODEL (RVAL2GOBJ (self));

    clutter_model_remove (model, NUM2UINT (row));

    return self;
}
static void
_update_placeholder_state (MnbPeoplePanel *self)
{
  MnbPeoplePanelPrivate *priv = GET_PRIVATE (self);
  gint accounts_available, accounts_online;

  g_object_get (priv->tp_feed,
                "accounts-available", &accounts_available,
                "accounts-online", &accounts_online,
                NULL);

  clutter_actor_set_name (priv->content_table, "people-panel-content-box");

  /* There is something in the model, hide all placeholders */
  if (clutter_model_get_first_iter (CLUTTER_MODEL (priv->model)))
  {
    clutter_actor_hide (priv->no_people_tile);
    clutter_actor_hide (priv->everybody_offline_tile);

    /* Ensure content stuff is visible */
    clutter_actor_show (priv->main_scroll_view);
    clutter_actor_show (priv->me_table);

    if (accounts_available > 0 && accounts_online == 0)
    {
      clutter_actor_show (priv->offline_banner);
    } else {
      clutter_actor_hide (priv->offline_banner);
    }
  } else {
    /* Hide real content stuff */
    clutter_actor_hide (priv->main_scroll_view);

    if (accounts_online == 0)
    {
      if (accounts_available == 0)
      {
        clutter_actor_set_name (priv->content_table,
                                "no-people-panel-content-box");
        clutter_actor_show (priv->no_people_tile);
        clutter_actor_hide (priv->me_table);
        clutter_actor_hide (priv->everybody_offline_tile);
        clutter_actor_hide (priv->offline_banner);
      } else {
        clutter_actor_show (priv->me_table);
        clutter_actor_show (priv->offline_banner);
        clutter_actor_hide (priv->no_people_tile);
        clutter_actor_hide (priv->everybody_offline_tile);
      }
    } else {
      clutter_actor_show (priv->me_table);
      clutter_actor_show (priv->everybody_offline_tile);
      clutter_actor_hide (priv->no_people_tile);
      clutter_actor_hide (priv->offline_banner);
    }
  }
}
Пример #18
0
static VALUE
rbclt_model_resort (VALUE self)
{
    ClutterModel *model = CLUTTER_MODEL (RVAL2GOBJ (self));

    clutter_model_resort (model);

    return self;
}
Пример #19
0
static VALUE
rbclt_model_get_column_name (VALUE self, VALUE column)
{
    ClutterModel *model = CLUTTER_MODEL (RVAL2GOBJ (self));
    const gchar *name;

    name = clutter_model_get_column_name (model, NUM2UINT (column));

    return name ? rb_str_new2 (name) : Qnil;
}
Пример #20
0
static void
mtn_service_model_update (MtnServiceModel *model, GVariant *services)
{
    ClutterModelIter *model_iter;
    GVariantIter *iter;
    char *path;
    guint index;

    if (services) {
        index = 0;
        g_variant_get (services, "ao", &iter);
        while (g_variant_iter_next (iter, "&o", &path)) {
            mtn_service_model_add_or_update (model, path, index);
            index++;
        }
    }

    /* remove the rows that were not present in the Services list */
    index = 0;
    while ((model_iter = clutter_model_get_iter_at_row (CLUTTER_MODEL (model),
                                                        index))) {
        gboolean present, hidden;

        clutter_model_iter_get (model_iter,
                                MTN_SERVICE_MODEL_COL_PRESENT, &present,
                                MTN_SERVICE_MODEL_COL_HIDDEN, &hidden,
                                -1);
        if (present) {
            /* initialize to present=FALSE for next _services_changed() call */
            if (!hidden) {
                clutter_model_iter_set (model_iter,
                                        MTN_SERVICE_MODEL_COL_PRESENT, FALSE,
                                        -1);              
            }
            index++;
        } else {
            clutter_model_remove (CLUTTER_MODEL (model), index);
        }

        g_object_unref (model_iter);
    }
}
Пример #21
0
ClutterModel *
gmc_video_model_new (const gchar *filename)
{
  GObject *self;

  self = g_object_new (GMC_TYPE_VIDEO_MODEL,
                       "filename", filename,
                       NULL);

  return CLUTTER_MODEL (self);
}
Пример #22
0
static VALUE
rbclt_model_do_set_types (VALUE arg)
{
    SetColumnsData *data = (SetColumnsData *) arg;
    ClutterModel *model = CLUTTER_MODEL (RVAL2GOBJ (data->self));
    int i;

    for (i = 0; i < data->argc; i++)
        data->types[i] = CLASS2GTYPE (data->argv[i]);

    clutter_model_set_types (model, data->argc, data->types);

    return data->self;
}
Пример #23
0
/* Filter menu items being an indirect child item of requested section */
void xfdashboard_applications_menu_model_filter_by_section(XfdashboardApplicationsMenuModel *self, GarconMenu *inSection)
{
	XfdashboardApplicationsMenuModelPrivate		*priv;

	g_return_if_fail(XFDASHBOARD_IS_APPLICATIONS_MENU_MODEL(self));
	g_return_if_fail(inSection==NULL || GARCON_IS_MENU(inSection));

	priv=self->priv;

	/* If requested section is NULL filter root menu */
	if(inSection==NULL) inSection=priv->rootMenu;

	/* Filter model data */
	clutter_model_set_filter(CLUTTER_MODEL(self), _xfdashboard_applications_menu_model_filter_by_section, g_object_ref(inSection), (GDestroyNotify)g_object_unref);
}
Пример #24
0
static void
_active_model_bulk_change_end_cb (AnerleyFeedModel *model,
                                  gpointer          userdata)
{
  MnbPeoplePanelPrivate *priv = GET_PRIVATE (userdata);
  gint number_active_people;
  gchar *tooltip;

  if (clutter_model_get_first_iter ((ClutterModel *)model))
  {
//    mx_table_set_row_spacing (MX_TABLE (priv->content_table), 6);

    if (priv->panel_client)
    {
      mpl_panel_client_request_button_style (priv->panel_client,
                                             "people-button-active");
      number_active_people = clutter_model_get_n_rows (CLUTTER_MODEL (priv->active_model));

      if (number_active_people > 1)
      {
        tooltip = g_strdup_printf (_("people - you are chatting with %d people"),
                                   number_active_people);
        mpl_panel_client_request_tooltip (priv->panel_client,
                                          tooltip);
        g_free (tooltip);
      } else {
        mpl_panel_client_request_tooltip (priv->panel_client,
                                          _("people - you are chatting with someone"));
      }
    }
  } else {
 //   mx_table_set_row_spacing (MX_TABLE (priv->content_table), 0);

    if (priv->panel_client)
    {
      mpl_panel_client_request_button_style (priv->panel_client,
                                             "people-button");
      mpl_panel_client_request_tooltip (priv->panel_client,
                                        _("people"));
    }
  }

  /* Workaround for MB#6690 */
  clutter_actor_queue_relayout (CLUTTER_ACTOR (priv->content_table));
}
Пример #25
0
static VALUE
rbclt_model_set_filter (VALUE self)
{
    ClutterModel *model = CLUTTER_MODEL (RVAL2GOBJ (self));
    RBCLTCallbackFunc *func;

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

        clutter_model_set_filter (model, rbclt_model_call_filter_func, func,
                                  (GDestroyNotify) rbclt_callback_func_destroy);
    }
    else
        clutter_model_set_filter (model, NULL, NULL, NULL);

    return self;
}
Пример #26
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;
}
Пример #27
0
static VALUE
rbclt_model_do_action (VALUE arg)
{
    ActionData *data = (ActionData *) arg;
    ClutterModel *model = CLUTTER_MODEL (RVAL2GOBJ (data->self));
    int i;

    for (i = 0; i < data->argc / 2; i++)
    {
        data->colnums[i] = NUM2UINT (data->argv[i * 2]);
        g_value_init (data->gvalues + i, RVAL2GTYPE (data->argv[i * 2 + 1]));
        data->gvalues_inited++;
        rbgobj_rvalue_to_gvalue (data->argv[i * 2 + 1], data->gvalues + i);
    }

    switch (data->action)
    {
    case RBCLT_MODEL_APPEND:
        clutter_model_appendv (model, data->argc / 2, data->colnums,
                               data->gvalues);
        break;

    case RBCLT_MODEL_PREPEND:
        clutter_model_prependv (model, data->argc / 2, data->colnums,
                                data->gvalues);
        break;

    case RBCLT_MODEL_INSERT:
        clutter_model_insertv (model, data->row, data->argc / 2, data->colnums,
                               data->gvalues);
        break;

    case RBCLT_MODEL_INSERT_VALUE:
        clutter_model_insert_value (model, data->row, data->colnums[0],
                                    data->gvalues);
        break;
    }

    return data->self;
}
Пример #28
0
static gboolean
refresh_timeout (gpointer data)
{
  TweetWindow *window = data;
  TweetWindowPrivate *priv = window->priv;

  tidy_list_view_set_model (TIDY_LIST_VIEW (priv->status_view), NULL);
  g_object_unref (priv->status_model);

  priv->status_model = TWEET_STATUS_MODEL (tweet_status_model_new ());
  tidy_list_view_set_model (TIDY_LIST_VIEW (priv->status_view),
                            CLUTTER_MODEL (priv->status_model));

  clutter_actor_show (window->priv->spinner);
  tweet_spinner_start (TWEET_SPINNER (window->priv->spinner));
  tweet_actor_animate (priv->spinner, TWEET_LINEAR, 500,
                       "opacity", tweet_interval_new (G_TYPE_UCHAR, 0, 127),
                       NULL);

  twitter_client_get_user_timeline (window->priv->client, NULL, 0, NULL);

  return TRUE;
}
Пример #29
0
static gboolean
on_status_view_button_release (ClutterActor       *actor,
                               ClutterButtonEvent *event,
                               TweetWindow        *window)
{
  TweetWindowPrivate *priv = window->priv;

#define JITTER  5

  if (priv->in_press)
    {
      TwitterStatus *status;
      ClutterModelIter *iter;
      ClutterGeometry geometry = { 0, };
      ClutterActor *stage, *info;

      priv->in_press = FALSE;

      if (abs (priv->press_y - event->y) > JITTER)
        return FALSE;

      iter = clutter_model_get_iter_at_row (CLUTTER_MODEL (priv->status_model),
                                            priv->press_row);
      if (!iter)
        return FALSE;

      status = tweet_status_model_get_status (priv->status_model, iter);
      if (!status)
        {
          g_object_unref (iter);
          return FALSE;
        }

      /* FIXME - abstract this call into a TweetStatusModel method */
      tidy_list_view_get_cell_geometry (TIDY_LIST_VIEW (priv->status_view),
                                        priv->press_row, 0,
                                        TRUE,
                                        &geometry);

      stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (priv->canvas));

      info = tweet_status_info_new (status);
      g_signal_connect (info,
                        "button-press-event", G_CALLBACK (on_info_button_press),
                        window);
      g_signal_connect (info,
                        "star-clicked", G_CALLBACK (on_star_clicked),
                        window);
      g_signal_connect (info,
                        "reply-clicked", G_CALLBACK (on_reply_clicked),
                        window);
                                
      clutter_container_add_actor (CLUTTER_CONTAINER (stage), info);
      clutter_actor_set_position (info,
                                  geometry.x + CANVAS_PADDING,
                                  geometry.y + CANVAS_PADDING);
      clutter_actor_set_size (info, geometry.width, 16);
      clutter_actor_set_opacity (info, 0);
      clutter_actor_set_reactive (info, TRUE);
      clutter_actor_show (info);

      tweet_actor_animate (info, TWEET_LINEAR, 250,
                           "y", tweet_interval_new (G_TYPE_INT, geometry.y + CANVAS_PADDING, 100 + CANVAS_PADDING),
                           "height", tweet_interval_new (G_TYPE_INT, 16, (CANVAS_HEIGHT - (100 * 2))),
                           "opacity", tweet_interval_new (G_TYPE_UCHAR, 0, 196),
                           NULL);

      clutter_actor_set_reactive (priv->status_view, FALSE);
      tweet_actor_animate (priv->status_view, TWEET_LINEAR, 250,
                           "opacity", tweet_interval_new (G_TYPE_UCHAR, 255, 128),
                           NULL);

      g_object_unref (status);
      g_object_unref (iter);
    }

#undef JITTER

  return FALSE;
}
Пример #30
0
ClutterModel* xfdashboard_applications_menu_model_new(void)
{
	return(CLUTTER_MODEL(g_object_new(XFDASHBOARD_TYPE_APPLICATIONS_MENU_MODEL, NULL)));
}