Esempio n. 1
0
int
main (int    argc,
      char **argv)
{
    ClutterActor *stage;

    clutter_init (&argc, &argv);

    stage = clutter_stage_get_default ();
    clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE);
    clutter_actor_set_size (stage, 640, 480);
#if 1
    layout = penge_block_layout_new ();
    penge_block_layout_set_min_tile_size (PENGE_BLOCK_LAYOUT (layout),
                                          140,
                                          92);
    penge_block_layout_set_spacing (PENGE_BLOCK_LAYOUT (layout), 6);

#else
    layout = clutter_flow_layout_new (CLUTTER_FLOW_HORIZONTAL);
#endif

    box = clutter_box_new (layout);

    bridge = g_object_new (PENGE_TYPE_MODEL_BRIDGE, NULL);

    penge_model_bridge_set_container (bridge, CLUTTER_CONTAINER (box));
    penge_model_bridge_set_factory (bridge, factory_func);

    client = sw_client_new ();
    sw_client_get_services (client, _client_get_services_cb, NULL);

    clutter_container_add_actor (CLUTTER_CONTAINER (stage), box);

    clutter_actor_set_size (box,
                            clutter_actor_get_width (stage),
                            clutter_actor_get_height (stage));
    clutter_actor_show (stage);

    g_signal_connect (stage,
                      "allocation-changed", G_CALLBACK (stage_allocation_changed_cb),
                      box);
    clutter_main ();

    return EXIT_SUCCESS;
}
Esempio n. 2
0
int
main (int argc, char **argv)
{
  SwClient *client;
  GMainLoop *loop;

  g_type_init ();

  client = sw_client_new ();

  g_signal_connect (client, "online-changed", G_CALLBACK (online_cb), NULL);

  sw_client_is_online (client, is_online_cb, NULL);

  loop = g_main_loop_new (NULL, FALSE);

  g_main_loop_run (loop);
}
static ClutterActor *
make_status (DawatiStatusPanel *status_panel)
{
    ClutterActor *pane;
    ClutterActor *table;
    ClutterActor *label;

    status_panel->client = sw_client_new ();
#if 0
    pane = mps_feed_pane_new (status_panel->client,
                              sw_client_get_service (status_panel->client,
                                      "twitter"));
#endif

    table = mx_table_new ();
    mx_table_set_row_spacing (MX_TABLE (table), 6);
    clutter_actor_set_name (table, "status-panel");
    label = mx_label_new_with_text (_("Status"));
    clutter_actor_set_name (label, "status-panel-header-label");
    mx_table_add_actor_with_properties (MX_TABLE (table),
                                        label,
                                        0, 0,
                                        "x-expand", FALSE,
                                        "y-expand", FALSE,
                                        NULL);

    pane = mps_feed_switcher_new (status_panel->client);
    mx_table_add_actor_with_properties (MX_TABLE (table),
                                        pane,
                                        1, 0,
                                        "x-expand", TRUE,
                                        "y-expand", TRUE,
                                        "x-fill", TRUE,
                                        "y-fill", TRUE,
                                        NULL);
    return table;
}
static void
penge_everything_pane_init (PengeEverythingPane *self)
{
  PengeEverythingPanePrivate *priv = GET_PRIVATE_REAL (self);
  gfloat tile_width, tile_height;
  GError *error = NULL;

  self->priv = priv;

  /* pointer to pointer */
  priv->pointer_to_actor = g_hash_table_new (NULL, NULL);

  /* For storing sw items */
  priv->uuid_to_sw_items = g_hash_table_new_full (g_str_hash,
                                                  g_str_equal,
                                                  g_free,
                                                  (GDestroyNotify)sw_item_unref);

  priv->client = sw_client_new ();
  sw_client_get_services (priv->client,
                          (SwClientGetServicesCallback)_client_get_services_cb,
                          self);

  priv->recent_log = g_object_new (ZEITGEIST_TYPE_LOG, NULL);
  priv->recent_monitor = zeitgeist_monitor_new (
                                            zeitgeist_time_range_new_anytime (),
                                            _default_template_factory ());

  g_signal_connect (priv->recent_monitor,
                    "events-inserted",
                    (GCallback)_zeitgeist_monitor_events_inserted_signal,
                    self);

  g_signal_connect (priv->recent_monitor,
                    "events-deleted",
                    (GCallback)_zeitgeist_monitor_events_deleted_signal,
                    self);

  /* the log holds a weak ref to the monitor */
  zeitgeist_log_install_monitor (priv->recent_log, priv->recent_monitor);

  penge_block_container_set_spacing (PENGE_BLOCK_CONTAINER (self), 5);

  priv->gconf_client = gconf_client_get_default ();

  tile_width = gconf_client_get_float (priv->gconf_client,
                                       DAWATI_MYZONE_MIN_TILE_WIDTH,
                                       NULL);

  /* Returns 0.0 if unset */
  if (tile_width == 0.0)
  {
    tile_width = TILE_WIDTH;
  }

  tile_height = gconf_client_get_float (priv->gconf_client,
                                        DAWATI_MYZONE_MIN_TILE_HEIGHT,
                                        NULL);

  if (tile_height == 0.0)
  {
    tile_height = TILE_HEIGHT;
  }

  penge_block_container_set_min_tile_size (PENGE_BLOCK_CONTAINER (self),
                                           tile_width,
                                           tile_height);

  g_signal_connect (self,
                    "count-changed",
                    (GCallback)_layout_count_changed_cb,
                    self);

  priv->ratio_notify_id =
    gconf_client_notify_add (priv->gconf_client,
                             DAWATI_MYZONE_RATIO,
                             _gconf_ratio_notify_cb,
                             self,
                             NULL,
                             &error);

  if (error)
  {
    g_warning (G_STRLOC ": Error setting gconf key notification: %s",
               error->message);
    g_clear_error (&error);
  } else {
    gconf_client_notify (priv->gconf_client, DAWATI_MYZONE_RATIO);
  }

  priv->refresh_id = g_timeout_add_seconds (REFRESH_TIME, (GSourceFunc) _refresh_cb, self);
}