src/frame-actions.h File Reference

Header for functions of the frame actions toolbutton menu. More...

#include <gtk/gtk.h>
Include dependency graph for frame-actions.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  unhandled_action_t { UA_DO_NOTHING = 0, UA_ERROR_MESSAGE = 1, UA_TRY_NEAREST = 2, LAST_UNHANDLED_ACTION_T }
 

List of things to do when an error happens on a frame action.

More...

Functions

void frame_action_setup_widgets ()
 Setups the frame actions panel's widgets (connects handlers, etc).

Detailed Description

Header for functions of the frame actions toolbutton menu.

Author:
Steve Dodier <sidnioulz@gmail.com>

This file contains functions that are linked to the menu items of the frame actions toolbutton menu.

Definition in file frame-actions.h.


Enumeration Type Documentation

List of things to do when an error happens on a frame action.

This enum is used to store constants that represent different actions to do when an action triggers an error on a frame.

Enumerator:
UA_DO_NOTHING 

Do nothing and stay on the previously working state

UA_ERROR_MESSAGE 

Display an error message in the frame and let the user fix things

UA_TRY_NEAREST 

When the error is due to an unhandled numeric value, try to use the nearest handled one

LAST_UNHANDLED_ACTION_T 

Definition at line 40 of file frame-actions.h.

00040              {
00041     UA_DO_NOTHING=0,        
00042     UA_ERROR_MESSAGE=1,     
00043     UA_TRY_NEAREST=2,       
00044     LAST_UNHANDLED_ACTION_T // DO NOT USE THIS - FOR LOOP PURPOSE ONLY
00045 } unhandled_action_t;


Function Documentation

void frame_action_setup_widgets (  ) 

Setups the frame actions panel's widgets (connects handlers, etc).

This function connects the frame actions panel's gtk widgets to their respective handlers.

Definition at line 162 of file frame-actions.c.

00163 {
00164     synema_instance_t   *inst       = synema_instance ();
00165     gchar               *name       = NULL;
00166     GList               *iter       = NULL;
00167     GList               *list       = NULL;
00168     GList               *prev       = NULL;
00169     GtkCellRenderer     *renderer   = NULL;
00170     GtkListStore        *store      = NULL;
00171     GtkTreeIter         treeiter;
00172     GtkTreeViewColumn   *column     = NULL;
00173     GtkWidget           *mac_view   = (GtkWidget *) gtk_builder_get_object (inst->builder, "action_treeview_set_machine");
00174     GtkWidget           *prd_view   = (GtkWidget *) gtk_builder_get_object (inst->builder, "action_treeview_set_period");
00175 
00176 
00177     // Setting up the time period tree view
00178     renderer = gtk_cell_renderer_text_new ();
00179     column = gtk_tree_view_column_new_with_attributes ("Name", renderer,
00180                                                         "text", 0, NULL);
00181     gtk_tree_view_append_column (GTK_TREE_VIEW (prd_view), column);
00182 
00183     store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_POINTER);
00184     gtk_tree_view_set_model (GTK_TREE_VIEW(prd_view), GTK_TREE_MODEL(store));
00185     g_signal_connect (prd_view, "row-activated", G_CALLBACK (frame_action_set_period), NULL);
00186 
00187 
00188     // Getting the list of time periods for all plugins
00189     iter = inst->plugins_list;
00190     if (iter) {
00191         do {
00192             list = g_list_concat (list, plugin_get_time_periods (iter->data));
00193         } while ((iter = g_list_next (iter)) != NULL);
00194     }
00195 
00196     list = g_list_sort (list, time_period_cmp_func);
00197     iter = list;
00198     if (iter) {
00199         name = time_period_get_display_name (iter->data, TRUE);
00200         gtk_list_store_append (store, &treeiter);
00201         gtk_list_store_set (store, &treeiter, 0, name, 1, iter->data, -1);
00202         g_free (name);
00203         prev = iter;
00204         while ((iter = g_list_next (iter)) != NULL) {
00205             if (time_period_cmp (prev->data, iter->data)) {
00206                 name = time_period_get_display_name (iter->data, TRUE);
00207                 gtk_list_store_append (store, &treeiter);
00208                 gtk_list_store_set (store, &treeiter, 0, name, 1, iter->data, -1);
00209                 g_free (name);
00210             }
00211             prev = iter;
00212         }
00213     }
00214 
00215     g_list_free (list);
00216     g_object_unref (store);
00217 
00218 
00219     // Setting up the machine tree view
00220     renderer = gtk_cell_renderer_text_new ();
00221     column = gtk_tree_view_column_new_with_attributes ("Name", renderer,
00222                                                         "text", 0, NULL);
00223     gtk_tree_view_append_column (GTK_TREE_VIEW (mac_view), column);
00224 
00225     store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_POINTER);
00226     gtk_tree_view_set_model (GTK_TREE_VIEW(mac_view), GTK_TREE_MODEL(store));
00227     g_signal_connect (mac_view, "row-activated", G_CALLBACK (frame_action_set_machine), NULL);
00228 
00229 
00230     // Filling the machine view
00231     if (inst->machines_list) {
00232         iter = inst->machines_list;
00233         do {
00234             gtk_list_store_append (store, &treeiter);
00235             gtk_list_store_set (store, &treeiter, 0, machine_get_display_name (iter->data), 1, iter->data, -1);
00236         } while ((iter = g_list_next (iter)) != NULL);
00237     }
00238     gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store), 0, GTK_SORT_ASCENDING);
00239 
00240     g_object_unref (store);
00241 }

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on Tue Jan 12 00:48:44 2010 for ENSIBSynema by  doxygen 1.6.1