Exemplo n.º 1
0
int
main (int argc, char *argv[])
{
  gfloat height;
  ClutterActor *stage, *statusbar;
  MxStyle *style;

  if (!clutter_init (&argc, &argv))
    return -1;

  style = mx_style_get_default ();
  mx_style_load_from_file (style,
                           THEMEDIR "/mutter-dawati.css",
                           NULL);
  mx_style_load_from_file (mx_style_get_default (),
                           THEMEDIR "/shared/shared.css",
                           NULL);

  stage = clutter_stage_new ();
  clutter_actor_set_size (stage, 1024, 768);
  clutter_actor_show (stage);

  statusbar = mnb_statusbar_new (NULL);
  clutter_actor_get_preferred_height (statusbar, -1, NULL, &height);
  clutter_actor_set_size (statusbar, clutter_actor_get_width (stage), height);
  clutter_container_add_actor (CLUTTER_CONTAINER (stage), statusbar);

  clutter_main ();

  return 0;
}
Exemplo n.º 2
0
/**
 * mpl_panel_clutter_load_base_style:
 *
 * Loads the base css style for the Panel. This function is called automatically
 * when the panel is constructed, so it is rarely necessary to call this from
 * the panel application. Calling this function mutliple times is safe (nop).
 */
void
mpl_panel_clutter_load_base_style (void)
{
  static gboolean already_loaded = FALSE;

  if (!already_loaded)
    {
      GError *error = NULL;

      /* Load in a base cache and a base style */
      mx_texture_cache_load_cache (mx_texture_cache_get_default (),
                                     MX_CACHE);
#if 0
      mx_style_load_from_file (mx_style_get_default (),
                                 THEMEDIR "/theme.css", NULL);
#endif
      mx_style_load_from_file (mx_style_get_default (),
                               DAWATI_RUNTIME_THEME_DIR "/shared/shared.css",
                               &error);

      if (error)
        {
          g_warning ("Error loading Dawati style: %s", error->message);
          g_clear_error (&error);
        }

      already_loaded = TRUE;
    }
}
Exemplo n.º 3
0
void
penge_utils_load_stylesheet ()
{
  MxStyle *style;
  GError *error = NULL;
  gchar *path;

  path = g_build_filename (THEMEDIR,
                           "mutter-moblin.css",
                           NULL);

  /* register the styling */
  style = mx_style_get_default ();

  if (!mx_style_load_from_file (style,
                                path,
                                &error))
  {
    g_warning (G_STRLOC ": Error opening style: %s",
               error->message);
    g_clear_error (&error);
  }

  g_free (path);
}
Exemplo n.º 4
0
int
main (int     argc,
      char  **argv)
{
  ClutterActor *stage;
  ClutterActor *pane;
  ClutterActor *button;

  if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
    {
      g_warning ("Unable to initialise Clutter");

      return EXIT_FAILURE;
    }

  mx_style_load_from_file (mx_style_get_default (),
                           THEMEDIR "/theme.css", NULL);

  stage = clutter_stage_get_default ();

  pane = mpl_content_pane_new ("Foo");
  clutter_actor_set_size (pane, 480, 320);
  clutter_container_add_actor (CLUTTER_CONTAINER (stage), pane);

  button = mx_button_new_with_label ("Bar");
  mpl_content_pane_set_header_actor (MPL_CONTENT_PANE (pane), button);

  button = mx_button_new_with_label ("Baz");
  clutter_container_add_actor (CLUTTER_CONTAINER (pane), button);

  clutter_actor_show_all (stage);
  clutter_main ();

  return EXIT_SUCCESS;
}
Exemplo n.º 5
0
/**
 * mpl_panel_clutter_load_base_style:
 *
 * Loads the base css style for the Panel. This function is called automatically
 * when the panel is constructed, so it is rarely necessary to call this from
 * the panel application. Calling this function mutliple times is safe (nop).
 */
void
mpl_panel_clutter_load_base_style (void)
{
  static gboolean already_loaded = FALSE;

  if (!already_loaded)
    {
      GError *error = NULL;
      gboolean envset;

      /* Load in a base cache and a base style */
      mx_texture_cache_load_cache (mx_texture_cache_get_default (),
                                     MX_CACHE);
#if 0
      mx_style_load_from_file (mx_style_get_default (),
                                 THEMEDIR "/theme.css", NULL);
#endif

      /* Won't override MX_RC_FILE env if it's alread set */
      envset = g_setenv ("MX_RC_FILE", DAWATI_MX_THEME "/default.css", FALSE);

      if (!envset)
        g_message ("MX_RC_FILE not set");

      mx_style_load_from_file (mx_style_get_default (),
                               DAWATI_RUNTIME_THEME_DIR "/shared/shared.css",
                               &error);

      if (error)
        {
          g_warning ("Error loading Dawati style: %s", error->message);
          g_clear_error (&error);
        }

      already_loaded = TRUE;
    }
}
Exemplo n.º 6
0
int
main (int argc, char *argv[])
{
    GOptionContext *context;
    GError *error = NULL;

    setlocale (LC_ALL, "");
    bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
    bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
    textdomain (GETTEXT_PACKAGE);

    context = g_option_context_new ("- dawati status panel");
    g_option_context_add_main_entries (context, status_options, GETTEXT_PACKAGE);
    g_option_context_add_group (context, clutter_get_option_group_without_init ());
    g_option_context_add_group (context, cogl_get_option_group ());
    g_option_context_add_group (context, gtk_get_option_group (FALSE));

    if (!g_option_context_parse (context, &argc, &argv, &error))
    {
        g_critical (G_STRLOC ": Error parsing option: %s", error->message);
        g_clear_error (&error);
    }

    g_option_context_free (context);

    mpl_panel_clutter_init_with_gtk (&argc, &argv);

    mx_style_load_from_file (mx_style_get_default (),
                             THEMEDIR "/panel.css",
                             &error);

    if (error)
    {
        g_critical ("Unable to load style: %s", error->message);
        g_clear_error (&error);
    }

    panel = g_new0 (DawatiStatusPanel, 1);

    if (status_standalone)
        setup_standalone (panel);
    else
        setup_panel (panel);

    clutter_main ();


    return EXIT_SUCCESS;
}
int
main (int    argc,
      char **argv)
{
  TpAccountManager *account_manager;
  gchar *path;
  MxStyle *style;
  GError *error = NULL;

  clutter_init (&argc, &argv);

  path = g_build_filename (PKG_DATA_DIR,
                           "style.css",
                           NULL);

  style = mx_style_get_default ();

  if (!mx_style_load_from_file (style,
                                  path,
                                  &error))
  {
    g_warning (G_STRLOC ": Error opening style: %s",
               error->message);
    g_clear_error (&error);
  }

  g_free (path);

  account_manager = tp_account_manager_dup ();

  tp_account_manager_prepare_async (account_manager, NULL,
                                   am_ready_cb, NULL);

  clutter_main ();

  g_object_unref (account_manager);

  return 0;
}
Exemplo n.º 8
0
int
main (int    argc,
      char **argv)
{
  GError *error = NULL;
  gchar *path;
  MxStyle *style;
  ClutterActor *stage, *chooser;

  clutter_init (&argc, &argv);

  path = g_build_filename (PKG_DATA_DIR,
                           "style.css",
                           NULL);

  style = mx_style_get_default ();

  if (!mx_style_load_from_file (style,
                                  path,
                                  &error))
  {
    g_warning (G_STRLOC ": Error opening style: %s",
               error->message);
    g_clear_error (&error);
  }

  g_free (path);

  stage = clutter_stage_new ();
  chooser = anerley_presence_chooser_new ();

  clutter_container_add_actor (CLUTTER_CONTAINER (stage), chooser);
  clutter_actor_show_all (stage);

  clutter_main ();

  return 0;
}
Exemplo n.º 9
0
int
main (int argc, char *argv[])
{
  ClutterActor *stage, *box, *scrollview;

  if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
    return 1;

  mx_style_load_from_file (mx_style_get_default(), "style/default.css", NULL);

  stage = clutter_stage_get_default ();
  clutter_actor_set_size (stage, 640, 480);
  clutter_stage_set_user_resizable ((ClutterStage *) stage, TRUE);

  scrollview = mx_scroll_view_new ();
  clutter_container_add_actor (CLUTTER_CONTAINER (stage), scrollview);

  clutter_actor_set_position (scrollview, 50, 50);
  clutter_actor_set_size (scrollview, 500, 300);

  box = mx_box_layout_new ();
  clutter_container_add_actor (CLUTTER_CONTAINER (scrollview), box);

  add_actor ((ClutterContainer*) box);
  add_actor ((ClutterContainer*) box);
  add_actor ((ClutterContainer*) box);


  g_signal_connect (stage, "key-release-event", G_CALLBACK (key_release_cb),
                    box);
  g_signal_connect (stage, "notify::allocation",
                    G_CALLBACK (stage_size_changed_cb), scrollview);
  clutter_actor_show (stage);
  clutter_main ();

  return EXIT_SUCCESS;
}
Exemplo n.º 10
0
int
main (int argc, char *argv[])
{
  ClutterActor *stage;
  ClutterActor *launcher;

  gtk_init (&argc, &argv);
  clutter_init (&argc, &argv);

  mx_style_load_from_file (mx_style_get_default (),
                           "../theme/panel.css", NULL);

  stage = clutter_stage_new ();
  clutter_actor_set_size (stage, 800, 600);

  launcher = mnb_launcher_new (800, 600);
  clutter_actor_add_child (stage, launcher);

  clutter_actor_show (stage);

  clutter_main ();

  return EXIT_SUCCESS;
}
Exemplo n.º 11
0
int
main (int argc, char **argv)
{
  ClutterActor *stage = stage;
  ClutterActor *side_box;
  ClutterActor *button_box;
  ClutterActor *box;
  ClutterAnimation *anim;
  MashLightSet *light_set;
  MxStyle *style;
  GError *error = NULL;
  Data data;
  int i;

  if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
    return 1;

  style = mx_style_get_default ();
  if (!mx_style_load_from_file (style, "lights.css",
                                &error))
    {
      g_warning ("Error setting style: %s", error->message);
      g_clear_error (&error);
    }

  stage = clutter_stage_get_default ();
  clutter_actor_set_size (stage, 800, 600);

  side_box = mx_table_new ();
  clutter_actor_set_name (side_box, "side-box");
  clutter_container_add_actor (CLUTTER_CONTAINER (stage), side_box);
  clutter_actor_set_size (side_box, 300,
                          clutter_actor_get_height (stage));
  clutter_actor_set_x (side_box,
                       clutter_actor_get_width (stage)
                       - clutter_actor_get_width (side_box));

  button_box = mx_table_new ();
  mx_table_add_actor (MX_TABLE (side_box), button_box, 0, 0);

  data.notebook = mx_notebook_new ();

  mx_table_add_actor (MX_TABLE (side_box), data.notebook, 1, 0);

  data.model = mash_model_new_from_file (MASH_DATA_NONE,
                                         argc > 1
                                         ? argv[1]
                                         : "suzanne.ply",
                                         &error);
  if (data.model == NULL)
    {
      g_warning ("Error loading model: %s", error->message);
      g_clear_error (&error);
      return 1;
    }

  light_set = mash_light_set_new ();

  box = clutter_box_new (clutter_fixed_layout_new ());

  clutter_actor_set_size (data.model, 400, 400);
  clutter_actor_set_position (data.model, 50.0, 100.0);
  clutter_container_add_actor (CLUTTER_CONTAINER (box), data.model);

  clutter_container_add_actor (CLUTTER_CONTAINER (stage), box);

  g_signal_connect_swapped (box, "paint",
                            G_CALLBACK (cogl_set_depth_test_enabled),
                            GINT_TO_POINTER (TRUE));
  g_signal_connect_data (box, "paint",
                         G_CALLBACK (cogl_set_depth_test_enabled),
                         GINT_TO_POINTER (FALSE), NULL,
                         G_CONNECT_AFTER | G_CONNECT_SWAPPED);

  data.light_marker_material = cogl_material_new ();
  {
    CoglColor color;
    cogl_color_set_from_4ub (&color, 255, 0, 0, 255);
    /* Use the layer state to ignore the vertex color from the shader so
       that the light marker won't itself be lit */
    cogl_material_set_layer_combine_constant (data.light_marker_material, 0,
                                              &color);
    cogl_material_set_layer_combine (data.light_marker_material, 0,
                                     "RGBA = REPLACE(CONSTANT)",
                                     NULL);
  }

  clutter_actor_set_rotation (data.model, CLUTTER_Y_AXIS,
                              0.0f,
                              clutter_actor_get_width (data.model) / 2.0f,
                              0.0f,
                              0.0f);

  anim = clutter_actor_animate (data.model, CLUTTER_LINEAR, 3000,
                                "rotation-angle-y", 360.0f,
                                NULL);
  clutter_animation_set_loop (anim, TRUE);

  for (i = 0; i < N_LIGHTS; i++)
    {
      ClutterActor *table = mx_table_new ();
      ClutterActor *button;
      static ClutterActor *(* constructors[N_LIGHTS]) (void) =
        { mash_directional_light_new,
          mash_point_light_new,
          mash_spot_light_new };
      static const ClutterColor black = { 0, 0, 0, 255 };

      data.lights[i] = constructors[i] ();

      button = mx_button_new_with_label (G_OBJECT_TYPE_NAME (data.lights[i]));
      mx_table_add_actor (MX_TABLE (button_box), button, i, 0);

      /* Default to disable all of the lights */
      g_object_set (data.lights[i],
                    "ambient", &black,
                    "diffuse", &black,
                    "specular", &black,
                    NULL);

      data.notebook_buttons[i] = button;

      clutter_container_add_actor (CLUTTER_CONTAINER (box), data.lights[i]);
      mash_light_set_add_light (light_set, MASH_LIGHT (data.lights[i]));

      add_color_prop (table, "ambient light",
                      G_OBJECT (data.lights[i]), "ambient");
      add_color_prop (table, "diffuse light",
                      G_OBJECT (data.lights[i]), "diffuse");
      add_color_prop (table, "specular light",
                      G_OBJECT (data.lights[i]), "specular");

      if (MASH_IS_POINT_LIGHT (data.lights[i]))
        {
          add_float_prop (table, "constant attenuation",
                          G_OBJECT (data.lights[i]), "constant-attenuation",
                          0.0f, 10.0f);
          add_float_prop (table, "linear attenuation",
                          G_OBJECT (data.lights[i]), "linear-attenuation",
                          0.0f, 10.0f);
          add_float_prop (table, "quadratic attenuation",
                          G_OBJECT (data.lights[i]), "quadratic-attenuation",
                          0.0f, 10.0f);
        }

      if (MASH_IS_SPOT_LIGHT (data.lights[i]))
        {
          clutter_actor_set_x (data.lights[i], 250);

          add_float_prop (table, "spot cutoff",
                          G_OBJECT (data.lights[i]), "spot-cutoff",
                          0.0f, 90.0f);
          add_float_prop (table, "spot exponent",
                          G_OBJECT (data.lights[i]), "spot-exponent",
                          0.0f, 128.0f);
        }

      clutter_container_add_actor (CLUTTER_CONTAINER (data.notebook), table);

      data.notebook_pages[i] = table;
    }

  {
    ClutterActor *button;
    ClutterActor *table;
    CoglHandle material;
    float maximum_shininess;

    material = mash_model_get_pipeline (MASH_MODEL (data.model));

    /* Before version 1.3.10 on the 1.3 branch and 1.2.14 on the 1.2
       branch Cogl would remap the shininess property to the range
       [0,1]. After this it is just a value greater or equal to zero
       (but GL imposes a limit of 128.0) */
    if (clutter_check_version (1, 3, 9)
        || (clutter_major_version == 1
            && clutter_minor_version == 2
            && clutter_micro_version >= 13))
      maximum_shininess = 128.0f;
    else
      maximum_shininess = 1.0f;

    cogl_material_set_shininess (material, maximum_shininess);

    button = mx_button_new_with_label ("Material");
    data.notebook_buttons[i] = button;
    mx_table_add_actor (MX_TABLE (button_box), button, i, 0);
    table = mx_table_new ();
    data.notebook_pages[i] = table;
    clutter_container_add_actor (CLUTTER_CONTAINER (data.notebook), table);

    add_material_color_prop (table, "emission", material,
                             cogl_material_set_emission,
                             cogl_material_get_emission);
    add_material_color_prop (table, "diffuse", material,
                             cogl_material_set_diffuse,
                             cogl_material_get_diffuse);
    add_material_color_prop (table, "ambient", material,
                             cogl_material_set_ambient,
                             cogl_material_get_ambient);
    add_material_color_prop (table, "specular", material,
                             cogl_material_set_specular,
                             cogl_material_get_specular);
    add_material_float_prop (table, "shininess", material,
                             0.0f, maximum_shininess,
                             cogl_material_set_shininess,
                             cogl_material_get_shininess);
  }

  mash_model_set_light_set (MASH_MODEL (data.model), light_set);
  g_object_unref (light_set);

  for (i = 0; i < N_PAGES; i++)
    {
      g_signal_connect (data.notebook_buttons[i], "notify::toggled",
                        G_CALLBACK (notebook_button_cb), &data);
      mx_button_set_is_toggle (MX_BUTTON (data.notebook_buttons[i]), TRUE);
    }

  mx_button_set_toggled (MX_BUTTON (data.notebook_buttons[0]), TRUE);

  g_signal_connect (stage, "motion-event",
                    G_CALLBACK (motion_event_cb),
                    &data);

  clutter_actor_show (stage);

  clutter_main ();

  cogl_handle_unref (data.light_marker_material);

  return 0;
}
Exemplo n.º 12
0
int
main (int     argc,
      char  **argv)
{
  bool standalone = false;
  char const *geometry = NULL;
  int dpi = 0;
  GOptionEntry _options[] = {
    { "standalone", 's', 0, G_OPTION_ARG_NONE, &standalone,
      "Run as standalone app (for testing purpose)", NULL },
    { "geometry", 'g', 0, G_OPTION_ARG_STRING, &geometry,
      "Window geometry in standalone mode", NULL },
#if CLUTTER_CHECK_VERSION(1, 3, 0)
    { "clutter-font-dpi", 'd', 0, G_OPTION_ARG_INT, &dpi,
      "Set clutter font resolution to <dpi>", "<dpi>" },
#endif
    { NULL }
  };

  ClutterActor     *shell;
  GOptionContext   *context;
  ClutterInitError  clutter_error;
  GError           *error = NULL;

  setlocale (LC_ALL, "");
  bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
  textdomain (GETTEXT_PACKAGE);

  context = g_option_context_new ("- Dawati devices panel");
  g_option_context_add_main_entries (context, _options, GETTEXT_PACKAGE);
  g_option_context_add_group (context, clutter_get_option_group_without_init ());
  if (!g_option_context_parse (context, &argc, &argv, &error))
  {
    g_critical ("%s %s", G_STRLOC, error->message);
    g_critical ("Starting in standalone mode.");
    g_clear_error (&error);
    standalone = true;
  }
  g_option_context_free (context);

  clutter_error = clutter_init (&argc, &argv);
  if (clutter_error != CLUTTER_INIT_SUCCESS)
    {
      g_critical ("Unable to initialise clutter");
      return EXIT_FAILURE;
    }

  notify_init (_("Dawati Devices Panel"));

  /* Just for icon theme, no widgets. */
  gtk_init (&argc, &argv);

  if (dpi)
    {
#if CLUTTER_CHECK_VERSION(1, 3, 0)
      ClutterSettings *settings = clutter_settings_get_default ();
      g_object_set (settings, "font-dpi", dpi * 1000, NULL);
#endif
    }

  /* Load base styling for default font size */
  mpl_panel_clutter_load_base_style ();

  mx_texture_cache_load_cache (mx_texture_cache_get_default (),
                               PKGDATADIR "/mx.cache");
  mx_style_load_from_file (mx_style_get_default (),
                           THEMEDIR "/panel.css", NULL);

  if (standalone)
  {
    ClutterActor *stage = clutter_stage_get_default ();

    if (geometry)
    {
      int x, y;
      unsigned int width, height;
      XParseGeometry (geometry, &x, &y, &width, &height);
      clutter_actor_set_size (stage, width, height);
    } else
    {
      clutter_actor_set_size (stage, MPD_SHELL_WIDTH, MPD_SHELL_HEIGHT);
    }

    shell = mpd_shell_new ();

    g_signal_connect (shell, "request-hide",
                      G_CALLBACK (_shell_request_hide_cb), NULL);
    g_signal_connect (stage, "notify::width",
                      G_CALLBACK (_stage_width_notify_cb), shell);
    g_signal_connect (stage, "notify::height",
                      G_CALLBACK (_stage_height_notify_cb), shell);

    clutter_container_add_actor (CLUTTER_CONTAINER (stage), shell);
    clutter_actor_show_all (stage);

  } else {

    MplPanelClient *panel = mpd_panel_new ("devices",
                                           _("devices"),
                                           "devices-button");
    shell = mpd_shell_new ();
    mpd_shell_set_client (MPD_SHELL (shell), panel);
    g_signal_connect (shell, "request-hide",
                      G_CALLBACK (_shell_request_hide_cb), panel);
    g_signal_connect (shell, "request-show",
                      G_CALLBACK (_shell_request_show_cb), panel);
    g_signal_connect (panel, "size-changed",
                      G_CALLBACK (_panel_set_size_cb), shell);
    clutter_container_add_actor (CLUTTER_CONTAINER (panel), shell);
  }

  clutter_main ();
  return EXIT_SUCCESS;
}
Exemplo n.º 13
0
static void
mex_search_plugin_init (MexSearchPlugin *self)
{
  MexProxy *suggest_proxy;
  ClutterActor *icon, *header, *text, *frame, *box, *hbox;
  MexSearchPluginPrivate *priv = self->priv = SEARCH_PLUGIN_PRIVATE (self);

  /* Load style data */
  mx_style_load_from_file (mx_style_get_default (),
                           PLUGIN_DATA_DIR "/style.css", NULL);

  /* Create the history model and models list */
  priv->history_model = mex_feed_new (_("Search"), _("Search"));

  priv->model_info =
    mex_model_info_new_with_sort_funcs (MEX_MODEL (priv->history_model),
                                        "search", 0);
  g_object_unref (priv->history_model);
  priv->models = g_list_append (NULL, priv->model_info);

  /* Create the actions list */
  memset (&priv->action_info, 0, sizeof (MexActionInfo));
  priv->action_info.action =
    mx_action_new_full ("x-mex/search",
                        _("Search"),
                        G_CALLBACK (mex_search_plugin_history_cb),
                        self);
  priv->action_info.mime_types = (gchar **)search_mimetypes;
  priv->actions = g_list_append (NULL, &priv->action_info);

  /* Create the suggestions model */
  priv->suggest_model =
    mex_feed_new (_("Suggestions"), _("Google Suggestions"));

  /* Create the search page */

  /* Create header */
  icon = mx_icon_new ();
  mx_stylable_set_style_class (MX_STYLABLE (icon), "Search");

  header = mx_box_layout_new ();
  mx_box_layout_set_spacing (MX_BOX_LAYOUT (header), 5);
  clutter_actor_set_name (header, "search-header");

  /* Create search entry */
  frame = mx_table_new ();
  clutter_actor_set_name (frame, "search-entry-frame");
  priv->search_entry = mx_entry_new ();
  priv->spinner = mx_spinner_new ();

  mx_table_add_actor (MX_TABLE (frame), priv->search_entry, 0, 0);
  mx_table_add_actor (MX_TABLE (frame), priv->spinner, 0, 1);
  mx_table_child_set_x_fill (MX_TABLE (frame), priv->spinner, FALSE);
  mx_table_child_set_x_expand (MX_TABLE (frame), priv->spinner, FALSE);
  mx_table_child_set_y_fill (MX_TABLE (frame), priv->spinner, FALSE);

  mx_spinner_set_animating (MX_SPINNER (priv->spinner), FALSE);
  clutter_actor_hide (priv->spinner);

  clutter_container_add (CLUTTER_CONTAINER (header), icon, frame, NULL);
  clutter_container_child_set (CLUTTER_CONTAINER (header), icon,
                               "x-fill", FALSE, "y-fill", FALSE, NULL);
  clutter_container_child_set (CLUTTER_CONTAINER (header), frame,
                               "expand", TRUE, "x-fill", TRUE, NULL);

  text = mx_entry_get_clutter_text (MX_ENTRY (priv->search_entry));
  g_signal_connect_swapped (text, "activate",
                            G_CALLBACK (mex_search_plugin_search_cb), self);
  g_signal_connect (priv->search_entry, "notify::text",
                    G_CALLBACK (mex_search_text_changed_cb), self);
  g_signal_connect (priv->search_entry, "notify::style-pseudo-class",
                    G_CALLBACK (mex_search_text_style_changed), header);

  /* Create the suggestions column */
  priv->suggest_column = mx_box_layout_new ();
  clutter_actor_set_name (priv->suggest_column, "suggest-column");
  mx_box_layout_set_orientation (MX_BOX_LAYOUT (priv->suggest_column),
                                 MX_ORIENTATION_VERTICAL);
  suggest_proxy = mex_generic_proxy_new (MEX_MODEL (priv->suggest_model),
                                        MX_TYPE_BUTTON);
  mex_generic_proxy_bind (MEX_GENERIC_PROXY (suggest_proxy),
                          mex_enum_to_string (MEX_TYPE_CONTENT_METADATA,
                                              MEX_CONTENT_METADATA_TITLE),
                          "label");
  g_signal_connect (suggest_proxy, "object-created",
                    G_CALLBACK (mex_search_proxy_add_cb),
                    priv->suggest_column);
  g_signal_connect (suggest_proxy, "object-removed",
                    G_CALLBACK (mex_search_proxy_remove_cb),
                    priv->suggest_column);
  g_object_weak_ref (G_OBJECT (priv->suggest_column),
                     (GWeakNotify)g_object_unref, suggest_proxy);

  /* Pack the search page */
  priv->search_page = mx_frame_new ();
  clutter_actor_set_name (priv->search_page, "search-page");
  mx_bin_set_fill (MX_BIN (priv->search_page), FALSE, TRUE);
  mx_bin_set_alignment (MX_BIN (priv->search_page), MX_ALIGN_START,
                        MX_ALIGN_START);
  hbox = mex_resizing_hbox_new ();
  mex_resizing_hbox_set_resizing_enabled (MEX_RESIZING_HBOX (hbox), FALSE);
  box = mx_box_layout_new ();
  clutter_container_add_actor (CLUTTER_CONTAINER (priv->search_page), hbox);
  clutter_container_add_actor (CLUTTER_CONTAINER (hbox), box);
  mx_box_layout_set_orientation (MX_BOX_LAYOUT (box),
                                 MX_ORIENTATION_VERTICAL);
  clutter_container_add (CLUTTER_CONTAINER (box),
                         header, priv->suggest_column, NULL);
  mx_box_layout_child_set_expand (MX_BOX_LAYOUT (box),
                                  priv->suggest_column, TRUE);
  clutter_container_child_set (CLUTTER_CONTAINER (box), header,
                               "x-fill", TRUE,
                               "x-align", MX_ALIGN_START, NULL);
  clutter_container_child_set (CLUTTER_CONTAINER (box),
                               priv->suggest_column,
                               "x-fill", TRUE,
                               "x-align", MX_ALIGN_START, NULL);
  clutter_actor_set_width (box, 426.0);

  /* Update the history list */
  mex_search_plugin_update_history (self, NULL);

  /* Start the history list and suggestions proxy */
  mex_proxy_start (suggest_proxy);
}
Exemplo n.º 14
0
int
main (int    argc,
      char **argv)
{
  GtkWidget *window, *embed, *vbox, *menubar, *vpaned, *textpanel;
  ClutterActor *stage, *grid_view;

  setlocale (LC_ALL, "");
  bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
  textdomain (GETTEXT_PACKAGE);

  g_thread_init (NULL);
  profile_timer = g_timer_new ();

  clutter_init (&argc, &argv);
  gtk_init(&argc, &argv);
  g_set_application_name("GNOME Social Zone");
  
    mx_style_load_from_file (mx_style_get_default (),
                           THEMEDIR "/panel.css", NULL);

    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title (GTK_WINDOW (window), _("GNOME Social Zone"));
    gtk_window_set_icon_name (GTK_WINDOW (window), "gnome-social-zone");
    gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
    g_signal_connect (window, "destroy",
                    G_CALLBACK (gtk_main_quit),
                    NULL);
                    
    vbox = gtk_vbox_new(FALSE, 0);
    gtk_container_add(GTK_CONTAINER(window), vbox);
    
    menubar = get_menubar_menu (GTK_WIDGET(window));
    vpaned = gtk_vpaned_new ();
    
    gtk_box_pack_start(GTK_BOX (vbox), menubar, FALSE, TRUE, 0);
    gtk_box_pack_start(GTK_BOX (vbox), vpaned, TRUE, TRUE, 0);

    embed = gtk_clutter_embed_new ();
    
    gtk_paned_pack1 (GTK_PANED (vpaned), GTK_WIDGET(embed), FALSE, FALSE);
    
    textpanel = get_text_panel();

    gtk_paned_pack2 (GTK_PANED (vpaned), textpanel, TRUE, TRUE);

    stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (embed));
    clutter_actor_realize (stage);
    
    grid_view = g_object_new (PENGE_TYPE_GRID_VIEW,
                              NULL);
    
    clutter_container_add_actor (CLUTTER_CONTAINER (stage),
                                 (ClutterActor *)grid_view);
    clutter_actor_set_size ((ClutterActor *)grid_view, 1016, 536);
    gtk_widget_set_size_request (embed, 1016, 536);
    
    clutter_actor_show_all (stage);
    
    gtk_widget_show_all (GTK_WIDGET(window));
    
  g_signal_connect_after (stage,
                          "paint",
                          (GCallback)_stage_paint_cb,
                          NULL);

  g_message (G_STRLOC ": PROFILE: Main loop started: %f",
             g_timer_elapsed (profile_timer, NULL));
  gtk_main();

  return 0;
}