static void
_update_title (MexContentTile *tile)
{
  MexContentTilePrivate *priv = tile->priv;
  const gchar *title;

  /* set title */
  title = mex_content_get_metadata (priv->content, MEX_CONTENT_METADATA_TITLE);

  mex_tile_set_label (MEX_TILE (tile), title);
}
Exemple #2
0
static void
mex_tile_set_property (GObject      *object,
                       guint         property_id,
                       const GValue *value,
                       GParamSpec   *pspec)
{
  MexTile *self = MEX_TILE (object);

  switch (property_id)
    {
    case PROP_PRIMARY_ICON:
      mex_tile_set_primary_icon (self, g_value_get_object (value));
      break;

    case PROP_SECONDARY_ICON:
      mex_tile_set_secondary_icon (self, g_value_get_object (value));
      break;

    case PROP_LABEL:
      mex_tile_set_label (self, g_value_get_string (value));
      break;

    case PROP_SECONDARY_LABEL:
      mex_tile_set_secondary_label (self, g_value_get_string (value));
      break;

    case PROP_HEADER_VISIBLE:
      mex_tile_set_header_visible (self, g_value_get_boolean (value));
      break;

    case PROP_IMPORTANT:
      mex_tile_set_important (self, g_value_get_boolean (value));
      break;

    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
    }
}
Exemple #3
0
static gboolean
_create_settings_dialog (MexInfoBar *self)
{
  MexInfoBarPrivate *priv = self->priv;

  ClutterActor *dialog, *network_graphic;
  ClutterActor *network_tile, *dialog_layout, *dialog_label;
  ClutterActor *network_button;

  MxAction *close_dialog, *network_settings;

  dialog = mx_dialog_new ();
  mx_stylable_set_style_class (MX_STYLABLE (dialog), "MexInfoBarDialog");

  dialog_label = mx_label_new_with_text (_("Settings"));
  mx_stylable_set_style_class (MX_STYLABLE (dialog_label), "DialogHeader");

  /* Create actions for settings dialog */
  network_settings =
    _action_new_from_desktop_file ("mex-networks.desktop");

  close_dialog = mx_action_new_full ("close", _("Close"),
                                     G_CALLBACK (_close_dialog_cb), self);

  dialog_layout = mx_table_new ();
  mx_table_set_column_spacing (MX_TABLE (dialog_layout), 10);
  mx_table_set_row_spacing (MX_TABLE (dialog_layout), 30);

  mx_table_insert_actor (MX_TABLE (dialog_layout),
                         CLUTTER_ACTOR (dialog_label), 0, 0);

  if (network_settings)
    {
      gchar *tmp;
      network_graphic = mx_image_new ();
      mx_stylable_set_style_class (MX_STYLABLE (network_graphic),
                                   "NetworkGraphic");

      tmp = g_build_filename (mex_get_data_dir (), "style",
                              "graphic-network.png", NULL);
      mx_image_set_from_file (MX_IMAGE (network_graphic), tmp, NULL);
      g_free (tmp);

      network_tile = mex_tile_new ();
      mex_tile_set_label (MEX_TILE (network_tile), _("Network"));
      mex_tile_set_important (MEX_TILE (network_tile), TRUE);

      network_button = mx_button_new ();

      mx_button_set_action (MX_BUTTON (network_button), network_settings);

      mx_bin_set_child (MX_BIN (network_tile), network_button);
      mx_bin_set_child (MX_BIN (network_button), network_graphic);

      mx_table_insert_actor (MX_TABLE (dialog_layout),
                             CLUTTER_ACTOR (network_tile), 1, 1);
    }

  if (!network_settings)
    {
      ClutterActor *no_settings;
      no_settings = mx_label_new_with_text (_("No settings helpers installed"));

      clutter_actor_destroy (priv->settings_button);

      mx_table_insert_actor (MX_TABLE (dialog_layout),
                             CLUTTER_ACTOR (no_settings), 1, 0);
    }


  mx_bin_set_child (MX_BIN (dialog), dialog_layout);
  mx_dialog_add_action (MX_DIALOG (dialog), close_dialog);

  priv->settings_dialog = g_object_ref (dialog);

  return TRUE;
}
int
main (int argc, char **argv)
{
  const ClutterColor grey = { 0x40, 0x40, 0x40, 0xff };

  ClutterActor *stage, *tile, *tile2, *image, *image2, *dialog, *tiles;
  MxApplication *app;
  ClutterConstraint *constraint;

  mex_init (&argc, &argv);

  app = mx_application_new (&argc, &argv, "mex-tile-controls-test", 0);
  mex_style_load_default ();

  stage = clutter_stage_get_default ();
  clutter_stage_set_color (CLUTTER_STAGE (stage), &grey);
  clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE);

  image = mx_image_new ();
  mx_image_set_from_file (MX_IMAGE (image), "/home/michael/dev/mex-info-bar/graphic-mapButtons.png", NULL);

  image2 = mx_image_new ();
  mx_image_set_from_file (MX_IMAGE (image2), "/home/michael/dev/mex-info-bar/graphic-network.png", NULL);

  tile = mex_tile_new ();
  mex_tile_set_label (tile, "Remote mapping");
  mex_tile_set_important (tile, TRUE);

  ClutterActor *button;
  button = mx_button_new ();

  mx_bin_set_child (MX_BIN (tile), button);
  mx_bin_set_child (MX_BIN (button), image);

  tile2 = mex_tile_new ();
  mex_tile_set_label (tile2, "Network");
  mex_tile_set_important (tile2, TRUE);

  ClutterActor *button2;
  button2 = mx_button_new ();

  mx_bin_set_child (MX_BIN (tile2), button2);
  mx_bin_set_child (MX_BIN (button2), image2);

  tiles = mx_box_layout_new ();
  mx_box_layout_set_spacing (tiles, 10);
  mx_box_layout_set_orientation (tiles, MX_ORIENTATION_HORIZONTAL);
  mx_box_layout_add_actor (tiles, tile, 0);
  mx_box_layout_add_actor (tiles, tile2, 1);


  g_print (clutter_actor_get_reactive (tile) ? "reactive" : "notreactive");
  dialog = mx_dialog_new ();
  mx_dialog_set_transient_parent (dialog, stage);

  g_signal_connect (button2, "clicked", G_CALLBACK (focus_in_cb), NULL);
  g_signal_connect (button, "clicked", G_CALLBACK (focus_in_cb), NULL);

  clutter_container_add_actor (CLUTTER_CONTAINER (dialog), tiles);

  clutter_actor_show (dialog);

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

  clutter_main ();

  return 0;
}