Пример #1
0
static void
clear_btn_clicked_cb (ClutterActor *button, MnpWorldClock *world_clock)
{
    MnpWorldClockPrivate *priv = GET_PRIVATE (world_clock);

    mx_entry_set_text (priv->search_location, "");
    clutter_actor_hide (priv->completion);
}
Пример #2
0
/**
 * mpl_entry_set_text:
 * @self: #MplEntry
 * @text: text to set the entry to
 *
 * Sets the text of the entry.
 */
void
mpl_entry_set_text (MplEntry     *self,
                    const gchar  *text)
{
  g_return_if_fail (self);

  if (text)
    mx_entry_set_text (MX_ENTRY (self->priv->entry), text);
}
Пример #3
0
static void
dropdown_hide_cb (MplPanelClient *client,
                  MnpWorldClock   *world_clock)
{
    MnpWorldClockPrivate *priv = GET_PRIVATE (world_clock);

    mx_entry_set_text (priv->search_location, "");
    clutter_actor_hide (priv->completion);
}
Пример #4
0
static void
mex_search_plugin_history_cb (MxAction        *action,
                              MexSearchPlugin *self)
{
  MexSearchPluginPrivate *priv = self->priv;
  MexContent *content = mex_action_get_content (action);
  const gchar *text = mex_content_get_metadata (content,
                                                MEX_CONTENT_METADATA_TITLE);

  mx_entry_set_text (MX_ENTRY (priv->search_entry), text);
  mex_search_plugin_search_cb (self);
}
Пример #5
0
static void
_update_clicked (MxButton         *button,
                 ObjectStoreTest  *app)
{
  char const *input;

  input = mx_entry_get_text (app->entry);
  if (input == NULL ||
      input[0] == '\0')
  {
    g_warning ("Please enter text");
    return;

  } else if (input[0] == '-') {

    /* Remove item */
    int index = g_ascii_isdigit (input[1]) ?
                  atoi (&input[1]) :
                  -1;
    if (index < 0)
    {
      g_warning ("Invalid number, can not remove");
      return;
    }

    clutter_model_remove (app->store, index);

  } else if (g_ascii_isdigit (input[0])) {

    /* Update item */
    unsigned index = atoi (input);
    char **tokens = g_strsplit (input, ":", 2);
    char const *text = tokens[1];
    FooTestObject *object = store_get_object (app->store, index);

    if (object == NULL)
    {
      g_warning ("Failed to find object");
      return;
    }

    foo_test_object_set_text (FOO_TEST_OBJECT (object), text);
    g_object_unref (object);

  } else {

    /* Add item */
    store_add_object (app->store, input);
  }

  mx_entry_set_text (app->entry, "");
}
Пример #6
0
static void
mnp_completion_done (gpointer data, const char *zone)
{
    MnpWorldClock *clock = (MnpWorldClock *)data;
    MnpWorldClockPrivate *priv = GET_PRIVATE (clock);

    clutter_actor_hide (priv->completion);
    g_signal_handlers_block_by_func (priv->search_location, text_changed_cb, clock);
    mx_entry_set_text (priv->search_location, zone);
    g_signal_handlers_unblock_by_func (priv->search_location, text_changed_cb, clock);
    add_location_clicked_cb (NULL, clock);

}
Пример #7
0
static void
clear_button_clicked_cb (MxButton *button,
                         MplEntry   *entry)
{
  mx_entry_set_text (MX_ENTRY (entry->priv->entry), NULL);
}
Пример #8
0
static void
clear_btn_clicked_cb (ClutterActor *button, MxEntry *entry)
{
  mx_entry_set_text (entry, "");
}
Пример #9
0
static void
btn_clicked_cb (ClutterActor *button, MxEntry *entry)
{
  mx_entry_set_text (entry, "Here is some text");
}
Пример #10
0
static void
add_location_tile(MnpWorldClock *world_clock, const char *display, gboolean priority)
{
    GWeatherLocation *location;
    MnpClockTile *tile;
    MnpZoneLocation *loc = g_new0(MnpZoneLocation, 1);
    const GWeatherTimezone *tzone;
    MnpWorldClockPrivate *priv = GET_PRIVATE (world_clock);
    int i;

    if (!priv->zones_model)
        priv->zones_model = mnp_get_world_timezones();

    location = (GWeatherLocation *) mnp_utils_get_location_from_display (priv->zones_model, display);
    if (!location)
        return;

    printf("Adding location: %s\n", display);
    loc->display = g_strdup(display);
    loc->city = g_strdup(gweather_location_get_city_name (location));
    tzone =  gweather_location_get_timezone (location);
    loc->tzid = g_strdup(gweather_timezone_get_tzid ((GWeatherTimezone *)tzone));
    loc->local = FALSE;

    for (i=0; i< priv->zones->len; i++) {
        MnpZoneLocation *cmp = priv->zones->pdata[i];

        if (strcmp (loc->tzid, cmp->tzid) == 0 &&
                strcmp (loc->city, cmp->city) == 0) {
            /* We already have this. So don't add. */
            g_free (loc->tzid);
            g_free (loc->city);
            g_free (loc->display);
            g_free (loc);
            printf("Not adding %s, as it is already there\n",
                   loc->city);

            return;
        }
    }

    if (priority) {
        priv->location_tile = TRUE;
        loc->local = TRUE;
    }

    g_ptr_array_add (priv->zones, loc);
    mnp_save_zones(priv->zones);

    mx_entry_set_text (priv->search_location, "");

    tile = mnp_clock_tile_new (loc, mnp_clock_area_get_time(priv->area), priority);
    mnp_clock_area_add_tile (priv->area, tile);

    priv->search_text = "asd";
    g_signal_emit_by_name (priv->zones_model, "filter-changed");

    if (priv->zones->len >= 4)
        clutter_actor_hide (priv->entry_box);

}