Ejemplo n.º 1
0
static void
mnb_statusbar_update_datetime (MnbStatusbar *self)
{
  MnbStatusbarPrivate *priv = self->priv;
  GDateTime *datetime = g_date_time_new_now_local ();
  gchar *time_str;
  GConfClient *client = gconf_client_get_default ();
  gboolean c24h = gconf_client_get_bool (client, MNB_24H_KEY, NULL);

  if (c24h)
    {

      /* translators: translate this to a suitable 24 hourt time
       * format for your locale showing only hours and minutes. For
       * available format specifiers see
       * http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html
       */
      time_str = g_date_time_format (datetime, _("%A %B %e, %Y - %H:%M"));
    }
  else
    {
      /* translators: translate this to a suitable default time format for
       * your locale showing only hours and minutes. For available format
       * specifiers see
       * http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html
       */
      time_str = g_date_time_format (datetime, _("%A %B %e, %Y - %l:%M %P"));
    }

  mx_button_set_label (MX_BUTTON (priv->datetime), time_str);

  g_date_time_unref (datetime);
  g_free (time_str);
}
Ejemplo n.º 2
0
/**
 * mpl_entry_set_label:
 * @self: #MplEntry
 * @label: text of the entry propmpt
 *
 * Sets the text of the entry prompt.
 */
void
mpl_entry_set_label (MplEntry     *self,
                     const gchar  *label)
{
  g_return_if_fail (self);

  mx_button_set_label (MX_BUTTON (self->priv->search_button), label);
}
Ejemplo n.º 3
0
Archivo: mx-button.c Proyecto: danni/mx
static void
mx_button_set_property (GObject      *gobject,
                        guint         prop_id,
                        const GValue *value,
                        GParamSpec   *pspec)
{
  MxButton *button = MX_BUTTON (gobject);

  switch (prop_id)
    {
    case PROP_LABEL:
      mx_button_set_label (button, g_value_get_string (value));
      break;

    case PROP_ICON_NAME:
      mx_button_set_icon_name (button, g_value_get_string (value));
      break;

    case PROP_ICON_SIZE:
      mx_button_set_icon_size (button, g_value_get_uint (value));
      break;

    case PROP_IS_TOGGLE:
      mx_button_set_is_toggle (button, g_value_get_boolean (value));
      break;

    case PROP_TOGGLED:
      mx_button_set_toggled (button, g_value_get_boolean (value));
      break;

    case PROP_ACTION:
      mx_button_set_action (button, g_value_get_object (value));
      break;

    case PROP_ICON_POSITION:
      mx_button_set_icon_position (button, g_value_get_enum (value));
      break;

    case PROP_ICON_VISIBLE:
      mx_button_set_icon_visible (button, g_value_get_boolean (value));
      break;

    case PROP_LABEL_VISIBLE:
      mx_button_set_label_visible (button, g_value_get_boolean (value));
      break;

    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
      break;
    }
}
Ejemplo n.º 4
0
static void
dawati_bt_request_update_strings (DawatiBtRequest *request)
{
  DawatiBtRequestPrivate *priv = GET_PRIVATE (request);
  const char *name = NULL;
  char *msg = NULL;
  const char *yes = "";

  switch (priv->request) {
    case DAWATI_BT_REQUEST_TYPE_AUTH:
      if (priv->request_data) {
        name = g_hash_table_lookup (priv->uuid_strings, priv->request_data);
        if (name) {
          /* TRANSLATORS: request message. Will appear just below a device name */
          msg = g_strdup_printf (_("Wants access to %s service"), name);
        } else {
          g_debug ("Unrecognised service '%s' requested", priv->request_data);
          /* TRANSLATORS: request message. Will appear just below a device name */
          msg = g_strdup (_("wants access to a service"));
        }
      /* TRANSLATORS: request button label */
        yes = _("Grant this time");
      }
      break;
    case DAWATI_BT_REQUEST_TYPE_PIN:
    case DAWATI_BT_REQUEST_TYPE_PASSKEY:
      /* TRANSLATORS: request message. Will appear just below a device name */
      msg = g_strdup (_("Wants to pair with this computer. "
                        "Please enter the PIN mentioned on the device"));
      /* TRANSLATORS: request button label */
      yes = _("OK");
      break;
    case DAWATI_BT_REQUEST_TYPE_CONFIRM:
      /* TRANSLATORS: request message. Will appear just below a device name */
      msg = g_strdup_printf (_("Wants to pair with this computer. "
                               "Please confirm whether the PIN '%s' matches the one on the device"),
                             priv->request_data);
      /* TRANSLATORS: request button label */
      yes = _("Matches");
      break;
    default:
      break;
  }

  mx_label_set_text (MX_LABEL (priv->request_label), msg);
  mx_button_set_label (MX_BUTTON (priv->request_yes_btn), yes);

  g_free (msg);
}
Ejemplo n.º 5
0
static void
ntf_wm_update_notification (NtfNotification *ntf, MetaWindow *window)
{
  ClutterActor *src_icon;
  ClutterActor *button;
  NtfSource    *src;
  const gchar  *title;
  const gchar  *summary;
  const gchar  *body;

  g_return_if_fail (ntf && window);

  src = ntf_notification_get_source (ntf);

  if ((src_icon = ntf_source_get_icon (src)))
    {
      ClutterActor *icon = clutter_clone_new (src_icon) ;

      ntf_notification_set_icon (ntf, icon);
    }

  title = meta_window_get_title (window);

  if (title)
    summary = title;
  else
    summary = _("Unknown window");

  ntf_notification_set_summary (ntf, summary);

  body = _("is asking for your attention.");

  ntf_notification_set_body (ntf, body);

  ntf_notification_remove_all_buttons (ntf);

  button = mx_button_new ();

  mx_button_set_label (MX_BUTTON (button), _("Activate"));

  g_signal_connect (button, "clicked",
                    G_CALLBACK (ntf_wm_activate_cb),
                    window);

  ntf_notification_add_button (ntf, button, 0);
}
Ejemplo n.º 6
0
static void
ntf_tray_constructed (GObject *object)
{
  NtfTray        *self = (NtfTray*) object;
  ClutterActor   *actor = (ClutterActor*) self;
  NtfTrayPrivate *priv = self->priv;
  ClutterActor   *button;

  if (G_OBJECT_CLASS (ntf_tray_parent_class)->constructed)
    G_OBJECT_CLASS (ntf_tray_parent_class)->constructed (object);

  priv->notifiers = clutter_actor_new ();

  clutter_actor_add_child(actor, priv->notifiers);
  /* 'Overflow' control */
  priv->control = mx_table_new ();

  mx_stylable_set_style_class (MX_STYLABLE (priv->control),
                               "notification-control");
#if 0
  button = mx_button_new ();
  mx_button_set_label (MX_BUTTON (button), _("Dismiss All"));
  mx_table_add_actor (MX_TABLE (priv->control), button, 0, 1);

  g_signal_connect (button, "clicked",
                    G_CALLBACK (ntf_tray_dismiss_all_cb), self);
#endif //DV
  priv->control_text = mx_label_new ();
  mx_table_add_actor (MX_TABLE (priv->control),
                        CLUTTER_ACTOR (priv->control_text), 0, 0);

  clutter_actor_set_width (priv->control, CLUSTER_WIDTH);

  clutter_actor_add_child(actor, priv->control);

  clutter_actor_hide (priv->control);

  clutter_actor_set_reactive (priv->notifiers, TRUE);
  clutter_actor_set_reactive (actor, TRUE);

  mnb_input_manager_push_actor (actor, MNB_INPUT_LAYER_TOP);
}
Ejemplo n.º 7
0
static void
mnb_toolbar_clock_update_time_date (MnbToolbarClock *clock)
{
  MnbToolbarClockPrivate *priv = clock->priv;

  time_t           t;
  struct tm       *tmp;
  char             time_str[64];
  static gboolean  setup_done = FALSE;
  GConfClient     *client;
  char            *time_ptr;

  if (priv->disposed)
    return;

  client = gconf_client_get_default ();

  t = time (NULL);
  tmp = localtime (&t);
  if (tmp)
    {
      gboolean c24h = gconf_client_get_bool (client, MNB_24H_KEY, NULL);

      if (c24h)
        {

          /* translators: translate this to a suitable 24 hourt time format for
           * your locale showing only hours and minutes. For available format
           * specifiers see
           * http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html
           */
          strftime (time_str, 64, _("%H:%M"), tmp);
        }
      else
        {
          /* translators: translate this to a suitable default time format for
           * your locale showing only hours and minutes. For available format
           * specifiers see
           * http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html
           */
          strftime (time_str, 64, _("%l:%M %P"), tmp);
        }
    }
  else
    snprintf (time_str, 64, "Time");

  /*
   * Strip leading space, if any.
   */
  if (time_str[0] == ' ')
    time_ptr = &time_str[1];
  else
    time_ptr = &time_str[0];

  mx_button_set_label (MX_BUTTON (clock), time_ptr);

  if (tmp)
    /* translators: translate this to a suitable date format for your locale.
     * For availabe format specifiers see
     * http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html
     */
    strftime (time_str, 64, _("%B %e, %Y"), tmp);
  else
    snprintf (time_str, 64, "Date");

  mx_widget_set_tooltip_text (MX_WIDGET (clock), time_str);

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

      setup_done = TRUE;

      gconf_client_add_dir (client, MNB_24H_KEY_DIR,
                            GCONF_CLIENT_PRELOAD_NONE,
                            &error);

      if (error)
        {
          g_warning (G_STRLOC ": Error when adding directory "
                     MNB_24H_KEY_DIR " for notification: %s",
                     error->message);
          g_clear_error (&error);
        }

      gconf_client_notify_add (client,
                               MNB_24H_KEY,
                               mnb_toolbar_clock_format_changed_cb,
                               clock,
                               NULL,
                               &error);

      if (error)
        {
          g_warning (G_STRLOC ": Error when adding key "
                     MNB_24H_KEY " for notification: %s",
                     error->message);
          g_clear_error (&error);
        }
    }

  g_object_unref (client);
}
Ejemplo n.º 8
0
static void
ntf_libnotify_update (NtfNotification *ntf, Notification *details)
{
  ClutterActor *icon = NULL;

  g_return_if_fail (store && ntf && details);

  if (details->summary)
    ntf_notification_set_summary (ntf, details->summary);

  if (details->body)
    ntf_notification_set_body (ntf, details->body);

  if (details->icon_pixbuf)
    {
      GdkPixbuf *pixbuf = details->icon_pixbuf;

      icon = clutter_texture_new ();

      clutter_texture_set_from_rgb_data (CLUTTER_TEXTURE (icon),
                                         gdk_pixbuf_get_pixels (pixbuf),
                                         gdk_pixbuf_get_has_alpha (pixbuf),
                                         gdk_pixbuf_get_width (pixbuf),
                                         gdk_pixbuf_get_height (pixbuf),
                                         gdk_pixbuf_get_rowstride (pixbuf),
                                         gdk_pixbuf_get_has_alpha (pixbuf) ?
                                         4 : 3,
                                         0, NULL);
    }
  else if (details->icon_name)
    {
      GtkIconTheme *theme;
      GtkIconInfo  *info;

      theme = gtk_icon_theme_get_default ();
      info = gtk_icon_theme_lookup_icon (theme, details->icon_name, 24, 0);

      if (info)
        {
          icon = clutter_texture_new ();

          clutter_texture_set_from_file (CLUTTER_TEXTURE(icon),
                                         gtk_icon_info_get_filename (info),
                                         NULL);
          gtk_icon_info_free (info);
        }
    }

  if (icon)
    clutter_actor_set_size (icon, 24.0, 24.0);
  ntf_notification_set_icon (ntf, icon);

  if (details->actions)
    {
      GList *action;
      gchar *key, *value;

      ntf_notification_remove_all_buttons (ntf);

      for (action = details->actions; action;)
        {
          /*
           * The action list length is
           * guaranteed to be % 2 and > 0
           */
          key = action->data;
          action = g_list_next (action);
          value = action->data;
          action = g_list_next (action);

          if (strcasecmp(key, "default") != 0)
            {
              ActionData   *data;
              ClutterActor *button;
              KeySym        keysym = 0;

              data = g_slice_new0 (ActionData);
              data->notification = ntf;
              data->action       = g_strdup (key);
              data->id           = details->id;
              data->store        = store;

              button = mx_button_new ();

              mx_button_set_label (MX_BUTTON (button), value);

              g_signal_connect_data (button, "clicked",
                                     G_CALLBACK (ntf_libnotify_action_cb),
                                     data,
                                     (GClosureNotify) free_action_data,
                                     0);

              /*
               * Handle the dawati key shortcut protocol
               */
              if (!strncmp (key, DAWATI_KEY_PREFIX, strlen (DAWATI_KEY_PREFIX)))
                {
                  const char *k = key + strlen (DAWATI_KEY_PREFIX);
                  const char *pfx = strstr (k, "XK_");
                  char       *name;

                  if (pfx)
                    {
                      if (k == pfx)
                        {
                          name = g_strdup (k + 3);
                        }
                      else
                        {
                          name = g_strdup (k);

                          name [pfx - k] = 0;
                          strcat (name, pfx + 3);
                        }

                      keysym = XStringToKeysym (name);

                      if (!keysym)
                        g_warning (G_STRLOC ": no keysym found for %s (%s)",
                                   key, name);

                      g_free (name);

                    }
                  else
                    {
                      g_warning (G_STRLOC ": invalid key %s", key);
                    }
                }

              ntf_notification_add_button (ntf, button, key, keysym);
              mx_stylable_set_style_class (MX_STYLABLE (button),
                                           "Primary");
            }
        }
    }

  ntf_notification_set_urgent (ntf, details->is_urgent);

  ntf_notification_set_timeout (ntf, details->timeout_ms);
}
Ejemplo n.º 9
0
static void
dawati_bt_request_init (DawatiBtRequest *request)
{
  ClutterActor *title_box, *close_btn, *btn_box;
  DawatiBtRequestPrivate *priv = GET_PRIVATE (request);

  mx_box_layout_set_orientation (MX_BOX_LAYOUT (request),
                                 MX_ORIENTATION_VERTICAL);
  mx_stylable_set_style_class (MX_STYLABLE (request), "BtRequest");

  priv->request = DAWATI_BT_REQUEST_TYPE_PIN;

  /* FIXME: this should maybe not be instance-specific */
  priv->uuid_strings = _new_uiid_strings ();

  title_box = mx_box_layout_new ();
  mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (request), title_box, -1,
                                           "expand", TRUE,
                                           "x-fill", TRUE,
                                           "x-align", MX_ALIGN_START,
                                           NULL);

  priv->title = mx_label_new ();
  mx_stylable_set_style_class (MX_STYLABLE (priv->title), "BtTitle");
  mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (title_box), priv->title, -1,
                                           "expand", TRUE,
                                           "x-fill", TRUE,
                                           "x-align", MX_ALIGN_START,
                                           NULL);

  close_btn = mx_button_new ();
  mx_stylable_set_style_class (MX_STYLABLE (close_btn), "BtCloseButton");
  mx_bin_set_child (MX_BIN (close_btn), mx_icon_new ());
  mx_box_layout_add_actor (MX_BOX_LAYOUT (title_box), close_btn, -1);
  g_signal_connect (close_btn, "clicked",
                    G_CALLBACK (_close_clicked_cb), request);


  priv->request_label = mx_label_new ();
  mx_stylable_set_style_class (MX_STYLABLE (priv->request_label), "BtLabel");
  mx_label_set_line_wrap (MX_LABEL (priv->request_label), TRUE);
  mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (request), priv->request_label, -1,
                                           "expand", TRUE,
                                           "x-fill", FALSE,
                                           "x-align", MX_ALIGN_START,
                                           NULL);

  btn_box = mx_box_layout_new ();
  mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (request), btn_box, -1,
                                           "expand", TRUE,
                                           "x-fill", FALSE,
                                           "x-align", MX_ALIGN_END,
                                           NULL);

  priv->request_entry = mx_entry_new ();
  mx_box_layout_add_actor (MX_BOX_LAYOUT (btn_box), priv->request_entry, -1);

  priv->request_always_btn = mx_button_new ();
  /* TRANSLATORS: request button label */
  mx_button_set_label (MX_BUTTON (priv->request_always_btn),
                       _("Always grant"));
  mx_box_layout_add_actor (MX_BOX_LAYOUT (btn_box), priv->request_always_btn, -1);
  g_signal_connect (priv->request_always_btn, "clicked",
                    G_CALLBACK (_always_clicked_cb), request);

  priv->request_yes_btn = mx_button_new ();
  mx_box_layout_add_actor (MX_BOX_LAYOUT (btn_box), priv->request_yes_btn, -1);
  g_signal_connect (priv->request_yes_btn, "clicked",
                    G_CALLBACK (_yes_clicked_cb), request);
}
Ejemplo n.º 10
0
static void
mnp_world_clock_construct (MnpWorldClock *world_clock)
{
    ClutterActor *entry, *box, *stage;
    MxBoxLayout *table = (MxBoxLayout *)world_clock;
    gfloat width, height;
    MnpWorldClockPrivate *priv = GET_PRIVATE (world_clock);

    stage = priv->stage;
    priv->location_tile = FALSE;

    mx_box_layout_set_orientation ((MxBoxLayout *)world_clock, MX_ORIENTATION_VERTICAL);
    mx_box_layout_set_spacing ((MxBoxLayout *)world_clock, 0);
    clutter_actor_set_name (CLUTTER_ACTOR(world_clock), "TimePane");

    construct_heading_and_top_area (world_clock);

    priv->completion_timeout = 0;

    /* Search Entry */

    box = mx_box_layout_new ();
    mx_box_layout_set_enable_animations ((MxBoxLayout *)box, TRUE);
    mx_box_layout_set_orientation ((MxBoxLayout *)box, MX_ORIENTATION_HORIZONTAL);
    mx_box_layout_set_spacing ((MxBoxLayout *)box, 4);

    priv->entry_box = box;
    mx_stylable_set_style_class (MX_STYLABLE(box), "ZoneSearchEntryBox");

    entry = mx_entry_new ();
    mx_stylable_set_style_class (MX_STYLABLE (entry), "ZoneSearchEntry");

    priv->search_location = (MxEntry *)entry;
    mx_entry_set_hint_text (MX_ENTRY (entry), _("Enter a country or city"));
    mx_entry_set_secondary_icon_from_file (MX_ENTRY (entry),
                                           THEMEDIR"/edit-clear.png");
    g_signal_connect (entry, "secondary-icon-clicked",
                      G_CALLBACK (clear_btn_clicked_cb), world_clock);

    g_signal_connect (G_OBJECT (entry),
                      "notify::text", G_CALLBACK (text_changed_cb), world_clock);

    clutter_actor_get_size (entry, &width, &height);
    clutter_actor_set_size (entry, width+10, -1);

    mx_box_layout_add_actor ((MxBoxLayout *)box, entry, 0);
    clutter_container_child_set (CLUTTER_CONTAINER (box),
                                 entry,
                                 "expand", FALSE,
                                 "y-fill", FALSE,
                                 "x-fill", FALSE,
                                 "y-align", MX_ALIGN_MIDDLE,
                                 "x-align", MX_ALIGN_START,
                                 NULL);

    priv->add_location = mx_button_new ();
    mx_button_set_label ((MxButton *)priv->add_location, _("Add"));
    mx_stylable_set_style_class (MX_STYLABLE(priv->add_location), "ZoneSearchEntryAddButton");

    /* mx_box_layout_add_actor ((MxBoxLayout *)box, priv->add_location, 1); */
    /* g_signal_connect (priv->add_location, "clicked",
                    	G_CALLBACK (add_location_clicked_cb), world_clock); */
    /*clutter_container_child_set (CLUTTER_CONTAINER (box),
                               priv->add_location,
                               "expand", FALSE,
    		       "y-fill", FALSE,
    		       "y-align", MX_ALIGN_MIDDLE,
                               NULL);*/


    mx_box_layout_add_actor (MX_BOX_LAYOUT(priv->widget_box), box, -1);
    clutter_container_child_set (CLUTTER_CONTAINER (priv->widget_box),
                                 box,
                                 "expand", FALSE,
                                 "y-fill", FALSE,
                                 "x-fill", FALSE,
                                 "x-align",  MX_ALIGN_START,
                                 NULL);

    /* Prep GeoClue */
    priv->geo_position = geoclue_position_new ("org.freedesktop.Geoclue.Providers.Hostip",
                         "/org/freedesktop/Geoclue/Providers/Hostip");

    priv->geo_geocode = geoclue_geocode_new ("org.freedesktop.Geoclue.Providers.Yahoo",
                        "/org/freedesktop/Geoclue/Providers/Yahoo");

    priv->geo_reverse_geocode = geoclue_reverse_geocode_new ("org.freedesktop.Geoclue.Providers.Nominatim",
                                "/org/freedesktop/Geoclue/Providers/Nominatim");

    geoclue_position_get_position_async (priv->geo_position,
                                         mnp_wc_get_position_cb,
                                         world_clock);

    /* Clock Area */

    priv->area = mnp_clock_area_new ();
    g_signal_connect (priv->area, "time-changed", G_CALLBACK(time_changed), world_clock);
    clutter_actor_set_size ((ClutterActor *)priv->area, 300, -1);

    clutter_actor_set_reactive ((ClutterActor *)priv->area, TRUE);
    clutter_actor_set_name ((ClutterActor *)priv->area, "WorldClockArea");

    clutter_container_add_actor ((ClutterContainer *)stage, (ClutterActor *)priv->area);

    clutter_actor_lower_bottom ((ClutterActor *)priv->area);
    mx_droppable_enable ((MxDroppable *)priv->area);
    g_object_ref ((GObject *)priv->area);
    clutter_container_remove_actor ((ClutterContainer *)stage, (ClutterActor *)priv->area);
    mx_box_layout_add_actor ((MxBoxLayout *) table, (ClutterActor *)priv->area, -1);
    clutter_container_child_set (CLUTTER_CONTAINER (table),
                                 (ClutterActor *)priv->area,
                                 "expand", TRUE,
                                 "y-fill", TRUE,
                                 "x-fill", TRUE,
                                 NULL);


    priv->zones = mnp_load_zones ();
    mnp_clock_area_refresh_time (priv->area, TRUE);
    mnp_clock_area_set_zone_remove_cb (priv->area, (ZoneRemovedFunc) zone_removed_cb, (gpointer)world_clock);
    mnp_clock_area_set_zone_reordered_cb (priv->area, (ClockZoneReorderedFunc) zone_reordered_cb, (gpointer)world_clock);

    if (priv->zones->len) {
        int i=0;

        for (i=0; i<priv->zones->len; i++) {
            MnpZoneLocation *loc = (MnpZoneLocation *)priv->zones->pdata[i];
            loc->local = FALSE;
            MnpClockTile *tile = mnp_clock_tile_new (loc, mnp_clock_area_get_time(priv->area), FALSE);
            mnp_clock_area_add_tile (priv->area, tile);
        }
        if (priv->zones->len >= 4)
            clutter_actor_hide (priv->entry_box);
    }

    /*	div = clutter_texture_new_from_file (SINGLE_DIV_LINE, NULL);
    	mx_box_layout_add_actor (MX_BOX_LAYOUT(world_clock), div, -1);
    */
    box = mx_box_layout_new ();
    clutter_actor_set_name (box, "DateTimeLauncherBox");
    priv->launcher_box = box;
    mx_box_layout_set_orientation ((MxBoxLayout *)box, MX_ORIENTATION_VERTICAL);
    mx_box_layout_set_spacing ((MxBoxLayout *)box, 6);

    priv->launcher = mx_button_new ();
    mx_button_set_label ((MxButton *) priv->launcher, _("Set Time & Date"));
    mx_stylable_set_style_class (MX_STYLABLE(priv->launcher), "DateTimeLauncherButton");

    mx_box_layout_add_actor ((MxBoxLayout *)box, priv->launcher, -1);
    clutter_container_child_set (CLUTTER_CONTAINER (box),
                                 (ClutterActor *)priv->launcher,
                                 "expand", FALSE,
                                 "y-fill", FALSE,
                                 "x-fill", FALSE,
                                 "x-align", MX_ALIGN_END,
                                 NULL);


    mx_box_layout_add_actor ((MxBoxLayout *)world_clock, box, -1);
}
static GObject *
_constructor (GType                  type,
              unsigned int           n_properties,
              GObjectConstructParam *properties)
{
  MpdStorageDeviceTile *self = (MpdStorageDeviceTile *)
                        G_OBJECT_CLASS (mpd_storage_device_tile_parent_class)
                          ->constructor (type, n_properties, properties);
  MpdStorageDeviceTilePrivate *priv = GET_PRIVATE (self);
  GError  *error = NULL;

  if (priv->icon_file &&
      g_file_test (priv->icon_file, G_FILE_TEST_IS_REGULAR))
  {
    clutter_texture_set_from_file (CLUTTER_TEXTURE (priv->icon),
                                   priv->icon_file,
                                   &error);
  } else {
    clutter_texture_set_from_file (CLUTTER_TEXTURE (priv->icon),
                                   PKGICONDIR "/device-usb.png",
                                   &error);
  }
  if (error)
  {
    g_warning ("%s : %s", G_STRLOC, error->message);
    g_clear_error (&error);
  }

  if (priv->mount_point)
  {
    char *path;

    path = g_filename_from_uri (priv->mount_point, NULL, &error);
    if (error)
    {
      /* not all uris are file paths, that's ok */
      if (error->code != G_CONVERT_ERROR_BAD_URI)
      {
        g_warning ("%s: Failed to get filename from uri: %s",
                   G_STRLOC, error->message);
      }
      g_clear_error (&error);
    }
    if (path)
    {
      priv->storage = mpd_storage_device_new (path);
      g_signal_connect (priv->storage, "notify::size",
                      G_CALLBACK (_storage_size_notify_cb), self);
      g_signal_connect (priv->storage, "notify::available-size",
                      G_CALLBACK (_storage_size_notify_cb), self);
      g_free (path);
    }

    update (self);

  } else {
    g_critical ("%s : %s",
                G_STRLOC,
                "Invalid or no mount-point passed to constructor.");
    self = NULL;
  }

  /* FIXME: import button should only be active if the import app is available,
   * otherwise show an error. */
  if (0 == g_strcmp0 ("x-content/image-dcf", priv->mime_type))
  {
    mx_button_set_label (MX_BUTTON (priv->import), _("Import photos"));
  } else {
    mx_button_set_label (MX_BUTTON (priv->import), _("Import media"));
  }

  return (GObject *) self;
}