Ejemplo n.º 1
0
static void
on_alert_toggled (GtkCellRendererToggle *renderer,
                  char                  *path_str,
                  GvcSoundThemeChooser  *chooser)
{
        GtkTreeModel *model;
        GtkTreeIter   iter;
        GtkTreePath  *path;
        gboolean      toggled;
        char         *id;

        model = gtk_tree_view_get_model (GTK_TREE_VIEW (chooser->priv->treeview));

        path = gtk_tree_path_new_from_string (path_str);
        gtk_tree_model_get_iter (model, &iter, path);
        gtk_tree_path_free (path);

        id = NULL;
        gtk_tree_model_get (model, &iter,
                            ALERT_IDENTIFIER_COL, &id,
                            ALERT_ACTIVE_COL, &toggled,
                            -1);

        toggled ^= 1;
        if (toggled) {
                update_alert (chooser, id);
        }

        g_free (id);
}
Ejemplo n.º 2
0
// Draw the warning on the screen
void roadmap_alerter_display(void){
   if (alert_should_be_visible) {
      if (the_active_alert.active_alert_id == -1){
         return;
      }
      if ((!alert_active) || (prev_alert.active_alert_id != the_active_alert.active_alert_id)){
         if (alert_active)
            hide_alert_dialog();
         kill_timer();
         prev_alert.active_alert_id = the_active_alert.active_alert_id;
         show_alert_dialog();
         if (the_active_alert.alert_type == ALERT)
            roadmap_alerter_audio();
         alert_active = TRUE;
      }
      else{
         update_alert();
      }
   } else {
      if (alert_active && !alert_should_be_visible) {
         if (AlerterTimerCallback == NULL){
            SsdWidget text = ssd_widget_get(dialog, "Distance");
            ssd_text_set_text(text, " ");
            g_seconds = 5;
            AlerterTimerCallback = hide_alert_timeout;
            roadmap_main_set_periodic (1000, AlerterTimerCallback);
         }
      }
   }
}
Ejemplo n.º 3
0
static void
update_alerts_from_theme_name (GvcSoundThemeChooser *chooser,
                               const gchar          *name)
{
        if (strcmp (name, CUSTOM_THEME_NAME) != 0) {
                /* reset alert to default */
                update_alert (chooser, DEFAULT_ALERT_ID);
        } else {
                int   sound_type;
                char *linkname;

                linkname = NULL;
                sound_type = get_file_type ("bell-terminal", &linkname);
                g_debug ("Found link: %s", linkname);
                if (sound_type == SOUND_TYPE_CUSTOM) {
                        update_alert (chooser, linkname);
                }
        }
}