static gboolean
update_status (DrWright *dr)
{
    gint       min;
    gchar     *str;
#ifdef HAVE_APP_INDICATOR
    GtkWidget *item;
#endif /* HAVE_APP_INDICATOR */

    if (!dr->enabled) {
#ifdef HAVE_APP_INDICATOR
        app_indicator_set_status (dr->indicator,
                                  APP_INDICATOR_STATUS_PASSIVE);
#else
        gtk_status_icon_set_tooltip_text (dr->icon,
                                          _("Disabled"));
#endif /* HAVE_APP_INDICATOR */
        return TRUE;
    }

    min = get_time_left (dr);

    if (min >= 1) {
#ifdef HAVE_APP_INDICATOR
        str = g_strdup_printf (_("Take a break now (next in %dm)"), min);
#else
        str = g_strdup_printf (ngettext("%d minute until the next break",
                                        "%d minutes until the next break",
                                        min), min);
#endif /* HAVE_APP_INDICATOR */
    } else {
#ifdef HAVE_APP_INDICATOR
        str = g_strdup_printf (_("Take a break now (next in less than one minute)"));
#else
        str = g_strdup_printf (_("Less than one minute until the next break"));
#endif /* HAVE_APP_INDICATOR */
    }

#ifdef HAVE_APP_INDICATOR
    item = gtk_ui_manager_get_widget (dr->ui_manager, "/Pop/TakeABreak");
    gtk_menu_item_set_label (GTK_MENU_ITEM (item), str);
#else
    gtk_status_icon_set_tooltip_text (dr->icon, str);
#endif /* HAVE_APP_INDICATOR */

    g_free (str);

    return TRUE;
}
예제 #2
0
파일: timer.cpp 프로젝트: KelinciFX/godot
bool Timer::is_stopped() const {
	return get_time_left() <= 0;
}