menustore.h File Reference

#include <glib.h>
Include dependency graph for menustore.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef void(* taskbar_cb_t )()
typedef void(* tool_func_t )(const char *iname, const char *pname, const char *mname, const char *state, const char *service)
typedef gpointer(* add_item_func )(const char *name, const char *text, enum menu_state state, GdkPixbuf *img, gpointer menu_data, gpointer user_data)
typedef void(* separator_func )(gpointer user_data)

Enumerations

enum  menu_state { MENU_STATE_NORMAL = 0, MENU_STATE_SELECTED, MENU_STATE_DISABLED, MENU_STATE_ALTERNATE }
enum  {
  TREE_COL_TYPE = 0, TREE_COL_NAME, TREE_COL_TEXT, TREE_COL_ICON,
  TREE_COL_STATE, TREE_COL_IMAGE_NORMAL, TREE_COL_IMAGE_ALTERNATE, TREE_COL_ITER,
  TREE_NUM_COLS
}

Functions

void menustore_create (taskbar_cb_t cb)
void menustore_set_text ()
const char * menustore_get_current_menu ()
void menustore_set_current_menu (const char *name)
const char * menustore_get_current_service ()
gboolean menustore_add_group (const char *iname, const char *pname, const char *text, const char *icon)
 Add a menu group to the store.
gboolean menustore_add_item (const char *iname, const char *pname, const char *text, const char *icon)
 Add a menu item to a group.
gboolean menustore_add_menu (const char *iname, const char *label, const char *service, const char *group1, const char *group2, const char *group3, const char *group4)
 Create a new erMyThing object.
gboolean menustore_remove_group (const char *name)
 Remove menu group and everything below it.
gboolean menustore_remove_item (const char *iname, const char *pname)
 Remove a single item.
gboolean menustore_remove_menu (const char *name)
 Remove menu set.
gboolean menustore_set_group_state (const char *name, const char *state)
 Set the group state.
gboolean menustore_set_group_label (const char *name, const char *label)
 Set the group label.
gboolean menustore_set_item_state (const char *iname, const char *pname, const char *state)
 Set the item state.
gboolean menustore_set_item_label (const char *iname, const char *pname, const char *label)
 Set the item label text.
gboolean menustore_popup_has_changed ()
void menustore_clear_popup_changed ()
gboolean menustore_activate_item_iter (gpointer user_data, tool_func_t func)
void menustore_fill_menu (add_item_func item_cb, add_item_func submenu_cb, separator_func separator_cb, gpointer user_data)
const char * testing_menustore_print ()
const char * testing_menustore_get_route (const char *pname, const char *iname)

Typedef Documentation

typedef gpointer(* add_item_func)(const char *name, const char *text, enum menu_state state, GdkPixbuf *img, gpointer menu_data, gpointer user_data)

Definition at line 253 of file menustore.h.

typedef void(* separator_func)(gpointer user_data)

Definition at line 259 of file menustore.h.

typedef void(* taskbar_cb_t)()

Definition at line 65 of file menustore.h.

typedef void(* tool_func_t)(const char *iname, const char *pname, const char *mname, const char *state, const char *service)

Definition at line 233 of file menustore.h.


Enumeration Type Documentation

anonymous enum
Enumerator:
TREE_COL_TYPE 
TREE_COL_NAME 
TREE_COL_TEXT 
TREE_COL_ICON 
TREE_COL_STATE 
TREE_COL_IMAGE_NORMAL 
TREE_COL_IMAGE_ALTERNATE 
TREE_COL_ITER 
TREE_NUM_COLS 

Definition at line 48 of file menustore.h.

00049 {
00050   TREE_COL_TYPE = 0,
00051   TREE_COL_NAME,
00052   TREE_COL_TEXT,
00053   TREE_COL_ICON,
00054   TREE_COL_STATE,
00055   TREE_COL_IMAGE_NORMAL,
00056   TREE_COL_IMAGE_ALTERNATE,
00057   TREE_COL_ITER,
00058   TREE_NUM_COLS
00059 };

enum menu_state

File Name : menustore.h

Description: Copyright (C) 2008 iRex Technologies B.V. All rights reserved.

Enumerator:
MENU_STATE_NORMAL 
MENU_STATE_SELECTED 
MENU_STATE_DISABLED 
MENU_STATE_ALTERNATE 

Definition at line 40 of file menustore.h.

00041 {
00042   MENU_STATE_NORMAL = 0,
00043   MENU_STATE_SELECTED,
00044   MENU_STATE_DISABLED,
00045   MENU_STATE_ALTERNATE
00046 };


Function Documentation

gboolean menustore_activate_item_iter ( gpointer  user_data,
tool_func_t  func 
)

Definition at line 941 of file menustore.c.

References current_menu, DBUS_SERVICE_SYSTEM_CONTROL, MENU_STATE_DISABLED, MENU_STATE_NORMAL, menu_store, MENU_TYPE_ITEM, menustore_get_current_service(), state2str, taskbar_home_cb, TREE_COL_NAME, TREE_COL_STATE, TREE_COL_TYPE, and WARNPRINTF.

Referenced by menustore_activate_item(), and on_item_activate().

00942 {
00943     GtkTreeIter* iter = (GtkTreeIter*) user_data;
00944 
00945     gchar *iname;
00946     enum menu_type type = MENU_TYPE_ITEM;
00947     enum menu_state state = MENU_STATE_NORMAL;
00948     gtk_tree_model_get(GTK_TREE_MODEL (menu_store), iter,
00949                        TREE_COL_TYPE, &type,
00950                        TREE_COL_NAME, &iname,
00951                        TREE_COL_STATE, &state,
00952                        -1);
00953     
00954     if (type != MENU_TYPE_ITEM) {
00955         goto error;
00956     }
00957     if (state == MENU_STATE_DISABLED)
00958     {
00959         WARNPRINTF("cannot activate disabled item");
00960         goto error;
00961     }
00962 
00963     GtkTreeIter parent_iter;
00964     gtk_tree_model_iter_parent(GTK_TREE_MODEL (menu_store), 
00965                                &parent_iter,
00966                                iter);
00967     gchar *pname;
00968     gtk_tree_model_get(GTK_TREE_MODEL (menu_store), &parent_iter,
00969                        TREE_COL_NAME, &pname,
00970                        -1);
00971 
00972     if ((strcmp(pname, "system_top") == 0) || (strcmp(pname, "system_bottom") == 0))
00973     {
00974 #if MACHINE_IS_DR1000S || MACHINE_IS_DR1000SW
00975         // special case for Taskbar for "Home" and "Back to category"
00976         if ( (strcmp(iname, "desktop") == 0) || (strcmp(iname, "back_to_library") == 0) )
00977         {
00978             taskbar_home_cb();
00979         }
00980 #endif
00981         if (strcmp(iname, "back_to_library") == 0)
00982         {
00983             func(iname, "tasks", current_menu, state2str[state], DBUS_SERVICE_SYSTEM_CONTROL);
00984         }
00985         else
00986         {
00987             func(iname, "general", current_menu, state2str[state], DBUS_SERVICE_SYSTEM_CONTROL);
00988         }
00989     }
00990     else
00991     {
00992         func(iname, pname, current_menu, state2str[state], menustore_get_current_service());
00993     }
00994     g_free(iname);
00995     g_free(pname);
00996     return TRUE;
00997 error:
00998     g_free(iname);
00999     return FALSE;
01000 }

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean menustore_add_group ( const char *  iname,
const char *  pname,
const char *  text,
const char *  icon 
)

Add a menu group to the store.

---------------------------------------------------------------------------

Name : menustore_add_group

Parameters:
iname New group name
pname Parent group name it belongs to or NULL for root
text Label text
icon Icon name
Returns:
Returns TRUE on succes, FALSE otherwise

--------------------------------------------------------------------------

Definition at line 409 of file menustore.c.

References g_popup_has_changed, g_toolbar_has_changed, get_iter(), LOGPRINTF, MENU_STATE_NORMAL, menu_store, MENU_TYPE_GROUP, menustore_remove_group(), name_exists(), pixlist_icon_state(), TRACE, TREE_COL_ICON, TREE_COL_IMAGE_NORMAL, TREE_COL_ITER, TREE_COL_NAME, TREE_COL_STATE, TREE_COL_TEXT, TREE_COL_TYPE, and WARNPRINTF.

Referenced by add_group_cb(), and add_system_groups().

00410 {
00411     TRACE("%s() iname=%s  pname=%s  text=%s\n", __func__, iname, pname, text);
00412 
00413     // group name should be unique!
00414     if (name_exists(iname)) {
00415         LOGPRINTF("name '%s' already used, re-adding", iname);
00416         menustore_remove_group(iname);
00417     }
00418 
00419     // find optional parent
00420     GtkTreeIter *parent_iter = NULL;
00421     if (pname != NULL && strlen(pname) > 0) {
00422         parent_iter = get_iter(pname);
00423         if (!parent_iter) {
00424             WARNPRINTF("parent does not exist! (iname=%s, pname=%s)", iname, pname);
00425             return FALSE;
00426         }
00427     }
00428 
00429     // add to store and list
00430     GtkTreeIter iter;
00431     gtk_tree_store_append (GTK_TREE_STORE(menu_store), &iter, parent_iter);
00432     gtk_tree_store_set (GTK_TREE_STORE(menu_store), &iter,
00433                       TREE_COL_TYPE, MENU_TYPE_GROUP,
00434                       TREE_COL_NAME, iname,
00435                       TREE_COL_TEXT, text,
00436                       TREE_COL_ICON, icon,
00437                       TREE_COL_STATE, MENU_STATE_NORMAL,
00438                       TREE_COL_IMAGE_NORMAL, pixlist_icon_state(icon, "normal"),
00439                       TREE_COL_ITER, gtk_tree_iter_copy(&iter),
00440                       -1);
00441     g_popup_has_changed = TRUE;
00442     g_toolbar_has_changed = TRUE;
00443     return TRUE;
00444 }

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean menustore_add_item ( const char *  iname,
const char *  pname,
const char *  text,
const char *  icon 
)

Add a menu item to a group.

---------------------------------------------------------------------------

Name : menustore_add_item

Parameters:
iname New item name
pname Parent group name it belongs to
text Label text
icon Icon name
Returns:
Returns TRUE on succes, FALSE otherwise

--------------------------------------------------------------------------

Definition at line 447 of file menustore.c.

References ERRORPRINTF, g_popup_has_changed, g_toolbar_has_changed, get_child_by_iter(), get_iter(), MENU_STATE_NORMAL, menu_store, MENU_TYPE_ITEM, pixlist_icon_state(), TRACE, TREE_COL_ICON, TREE_COL_IMAGE_ALTERNATE, TREE_COL_IMAGE_NORMAL, TREE_COL_ITER, TREE_COL_NAME, TREE_COL_STATE, TREE_COL_TEXT, TREE_COL_TYPE, and WARNPRINTF.

Referenced by add_item_cb(), and add_system_groups().

00448 {
00449     TRACE("%s() iname=%s  pname=%s  text=%s\n", __func__, iname, pname, text);
00450 
00451     // check pname
00452     if (pname == 0 || strlen(pname) == 0) {
00453         WARNPRINTF("no pname (iname=%s)", iname);
00454         return FALSE;
00455     }
00456 
00457     // find parent
00458     GtkTreeIter *parent_iter = get_iter(pname);
00459     if (!parent_iter) {
00460         WARNPRINTF("parent does not exist! (iname=%s, pname=%s)", iname, pname);
00461         return FALSE;
00462     }
00463 
00464     // check if child exists
00465     if (get_child_by_iter(iname, parent_iter)) {
00466         ERRORPRINTF("name '%s.%s' already used", pname, iname);
00467         return FALSE;
00468     }
00469 
00470     // add to store and list
00471     GtkTreeIter iter;
00472     gtk_tree_store_append (GTK_TREE_STORE(menu_store), &iter, parent_iter);
00473     gtk_tree_store_set (GTK_TREE_STORE(menu_store), &iter,
00474                         TREE_COL_TYPE, MENU_TYPE_ITEM,
00475                         TREE_COL_NAME, iname,
00476                         TREE_COL_TEXT, text,
00477                         TREE_COL_ICON, icon,
00478                         TREE_COL_STATE, MENU_STATE_NORMAL,
00479                         TREE_COL_IMAGE_NORMAL, pixlist_icon_state(icon, "normal"),
00480                         TREE_COL_IMAGE_ALTERNATE, pixlist_icon_state(icon, "alternate"),
00481                         TREE_COL_ITER, gtk_tree_iter_copy(&iter),
00482                         -1);
00483     g_popup_has_changed = TRUE;
00484     g_toolbar_has_changed = TRUE;
00485     return TRUE;
00486 }

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean menustore_add_menu ( const char *  iname,
const char *  label,
const char *  service,
const char *  group1,
const char *  group2,
const char *  group3,
const char *  group4 
)

Create a new erMyThing object.

---------------------------------------------------------------------------

Name : menustore_add_menu

Parameters:
iname New menu set
label Label text
service IPC service name
group1 Name of group in 1st row
group2 Name of group in 2nd row
group3 Name of group in 3rd row
group4 Name of group in 4th row
Returns:
Returns TRUE on succes, FALSE otherwise

--------------------------------------------------------------------------

Definition at line 531 of file menustore.c.

References add_menu_group2(), check_group(), find_menu(), g_popup_has_changed, g_toolbar_has_changed, MenuEntry::groups, LOGPRINTF, menu_list, menustore_remove_menu(), MenuEntry::name, MenuEntry::service, and TRACE.

Referenced by add_menu_cb().

00534 {
00535     TRACE("%s() iname=%s  ilabel=%s  service=%s  groups={%s, %s, %s, %s)\n", __func__,
00536         iname, ilabel, service, group1, group2, group3, group4);
00537 
00538     // check name
00539     if (find_menu(iname)) {
00540         LOGPRINTF("name '%s' already used, re-adding", iname);
00541         menustore_remove_menu(iname);
00542     }
00543 
00544     // check groups
00545     if (!check_group(group1, iname)) return FALSE;
00546     if (!check_group(group2, iname)) return FALSE;
00547     if (!check_group(group3, iname)) return FALSE;
00548     if (!check_group(group4, iname)) return FALSE;
00549 
00550     // add menu to list
00551     MenuEntry *new_menu = g_new0 (MenuEntry, 1);
00552     new_menu->name = g_strdup(iname);
00553     new_menu->service = g_strdup(service);
00554     new_menu->groups = NULL;
00555     menu_list = g_list_append(menu_list, new_menu);
00556 
00557     // add groups to menu
00558     add_menu_group2(&new_menu->groups, group1);
00559     add_menu_group2(&new_menu->groups, group2);
00560     add_menu_group2(&new_menu->groups, group3);
00561     add_menu_group2(&new_menu->groups, group4);
00562 
00563     g_popup_has_changed = TRUE;
00564     g_toolbar_has_changed = TRUE;
00565     return TRUE;
00566 }

Here is the call graph for this function:

Here is the caller graph for this function:

void menustore_clear_popup_changed (  ) 

Definition at line 844 of file menustore.c.

References g_popup_has_changed.

Referenced by create_menu().

00845 {
00846     g_popup_has_changed = FALSE;
00847 }

Here is the caller graph for this function:

void menustore_create ( taskbar_cb_t  cb  ) 

Definition at line 236 of file menustore.c.

References add_system_groups(), menu_store, menustore_set_text(), taskbar_home_cb, and TREE_NUM_COLS.

Referenced by main().

00237 {
00238     menu_store = gtk_tree_store_new (TREE_NUM_COLS,
00239                                      G_TYPE_INT,        // TREE_COL_TYPE
00240                                      G_TYPE_STRING,     // TREE_COL_NAME
00241                                      G_TYPE_STRING,     // TREE_COL_TEXT
00242                                      G_TYPE_STRING,     // TREE_COL_ICON
00243                                      G_TYPE_INT,        // TREE_COL_STATE
00244                                      GDK_TYPE_PIXBUF,   // TREE_COL_IMAGE_NORMAL
00245                                      GDK_TYPE_PIXBUF,   // TREE_COL_IMAGE_ALTERNATE
00246                                      G_TYPE_POINTER);   // TREE_COL_ITER
00247     taskbar_home_cb = cb;
00248     add_system_groups();
00249     menustore_set_text();
00250 }

Here is the call graph for this function:

Here is the caller graph for this function:

void menustore_fill_menu ( add_item_func  item_cb,
add_item_func  submenu_cb,
separator_func  separator_cb,
gpointer  user_data 
)

Definition at line 1110 of file menustore.c.

References fill_add_group(), and get_menu_groups().

Referenced by create_menu(), and testing_menustore_print().

01114 {
01115     fill_add_group("system_top", item_cb, submenu_cb, separator_cb, user_data);
01116     separator_cb(user_data);
01117 
01118     gboolean is_added = FALSE;
01119     const GList *groups = get_menu_groups();
01120     while (groups) {
01121         is_added = fill_add_group((const char*)groups->data, item_cb, submenu_cb, separator_cb, user_data);
01122 
01123         if (is_added) separator_cb(user_data);
01124 
01125         groups = g_list_next(groups);
01126     }
01127 
01128     fill_add_group("system_bottom", item_cb, submenu_cb, separator_cb, user_data);
01129 }

Here is the call graph for this function:

Here is the caller graph for this function:

const char* menustore_get_current_menu (  ) 

Definition at line 180 of file menustore.c.

References current_menu.

Referenced by handle_status_item().

00181 {
00182     return current_menu;
00183 }

Here is the caller graph for this function:

const char* menustore_get_current_service (  ) 

Definition at line 523 of file menustore.c.

References current_menu, find_menu(), and MenuEntry::service.

Referenced by handle_status_item(), ipc_send_page_change(), menustore_activate_item_iter(), and testing_extra_prints().

00524 {
00525     MenuEntry *entry = find_menu(current_menu);
00526     if (entry) return entry->service;
00527     return "";
00528 }

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean menustore_popup_has_changed (  ) 

Definition at line 838 of file menustore.c.

References g_popup_has_changed.

Referenced by create_menu().

00839 {
00840     return g_popup_has_changed;
00841 }

Here is the caller graph for this function:

gboolean menustore_remove_group ( const char *  name  ) 

Remove menu group and everything below it.

---------------------------------------------------------------------------

Name : menustore_remove_group

Parameters:
name Name of menu group
Returns:
Returns TRUE on succes, FALSE otherwise

--------------------------------------------------------------------------

Definition at line 584 of file menustore.c.

References check_type(), g_popup_has_changed, g_toolbar_has_changed, get_iter(), LOGPRINTF, menu_store, MENU_TYPE_GROUP, MENU_TYPE_ITEM, menustore_remove_group(), menustore_remove_item(), TRACE, TREE_COL_NAME, and TREE_COL_TYPE.

Referenced by menustore_add_group(), menustore_remove_group(), and remove_group_cb().

00585 {
00586     TRACE("%s() name=%s\n", __func__, name);
00587 
00588     // check name
00589     GtkTreeIter *menu_iter = get_iter(name);
00590     if (menu_iter == NULL)
00591     {
00592         LOGPRINTF("'%s' not found", name);
00593         return FALSE;
00594     }
00595 
00596     if (!check_type(menu_iter, name, MENU_TYPE_GROUP)) return FALSE;
00597 
00598     // remove children in this group and below
00599     GtkTreeIter child_iter;
00600     if (gtk_tree_model_iter_children(GTK_TREE_MODEL(menu_store), &child_iter, menu_iter))
00601     {
00602         enum menu_type type = MENU_TYPE_ITEM;
00603         gchar* child_name = NULL;
00604         gtk_tree_model_get (GTK_TREE_MODEL(menu_store), &child_iter,
00605                             TREE_COL_NAME, &child_name,
00606                             TREE_COL_TYPE, &type,
00607                             -1);
00608         switch (type) {
00609         case MENU_TYPE_GROUP:
00610             menustore_remove_group(child_name);
00611             break;
00612         case MENU_TYPE_ITEM:
00613             menustore_remove_item(child_name, name);
00614             break;
00615         }
00616         g_free(child_name);
00617     }
00618 
00619     // remove group itself
00620     gtk_tree_store_remove(GTK_TREE_STORE(menu_store), menu_iter);
00621     gtk_tree_iter_free(menu_iter);
00622 
00623     g_popup_has_changed = TRUE;
00624     g_toolbar_has_changed = TRUE;
00625     return TRUE;
00626 }

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean menustore_remove_item ( const char *  iname,
const char *  pname 
)

Remove a single item.

---------------------------------------------------------------------------

Name : menustore_remove_item

Parameters:
iname New item name
pname Parent group name it belongs to
Returns:
Returns TRUE on succes, FALSE otherwise

--------------------------------------------------------------------------

Definition at line 629 of file menustore.c.

References check_type(), g_popup_has_changed, g_toolbar_has_changed, get_child_by_iter(), get_iter(), LOGPRINTF, menu_store, MENU_TYPE_ITEM, TRACE, and WARNPRINTF.

Referenced by menustore_remove_group(), and remove_item_cb().

00630 {
00631     TRACE("%s() iname=%s  pname=%s\n", __func__, iname, pname);
00632 
00633     // check parent name
00634     if (pname == 0 || strlen(pname) == 0) {
00635         WARNPRINTF("no pname (iname=%s)", iname);
00636         return FALSE;
00637     }
00638 
00639     // find parent
00640     GtkTreeIter *parent_iter = get_iter(pname);
00641     if (!parent_iter) {
00642         WARNPRINTF("parent does not exist! (iname=%s, pname=%s)", iname, pname);
00643         return FALSE;
00644     }
00645 
00646     // check if child exists
00647     GtkTreeIter *child_iter = get_child_by_iter(iname, parent_iter);
00648     if (!child_iter) {
00649         LOGPRINTF("'%s.%s' not found", pname, iname);
00650         return FALSE;
00651     }
00652 
00653     if (!check_type(child_iter, iname, MENU_TYPE_ITEM)) return FALSE;
00654 
00655     // remove item
00656     gtk_tree_store_remove(GTK_TREE_STORE(menu_store), child_iter);
00657     gtk_tree_iter_free(child_iter);
00658 
00659     g_popup_has_changed = TRUE;
00660     g_toolbar_has_changed = TRUE;
00661     return TRUE;
00662 }

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean menustore_remove_menu ( const char *  name  ) 

Remove menu set.

---------------------------------------------------------------------------

Name : menustore_remove_menu

Parameters:
name Name of menu set
Returns:
Returns TRUE on succes, FALSE otherwise

--------------------------------------------------------------------------

Definition at line 673 of file menustore.c.

References current_menu, free_menu_entry(), g_popup_has_changed, g_toolbar_has_changed, menu_list, menustore_set_current_menu(), MenuEntry::name, TRACE, and WARNPRINTF.

Referenced by menustore_add_menu(), and remove_menu_cb().

00674 {
00675     TRACE("%s() name=%s\n", __func__, name);
00676 
00677     GList *iter = g_list_first(menu_list);
00678     while (iter != NULL)
00679     {
00680         MenuEntry *entry = (MenuEntry *) iter->data;
00681         if (strcmp(entry->name, name) == 0) break;
00682         iter = g_list_next(iter);
00683     }
00684 
00685     if (iter == NULL) {
00686         WARNPRINTF("menu '%s' not found", name);
00687         return FALSE;
00688     }
00689 
00690     free_menu_entry(iter->data);
00691     menu_list = g_list_delete_link(menu_list, iter);
00692 
00693     if (current_menu && strcmp(current_menu, name) == 0)
00694     {
00695         menustore_set_current_menu(NULL);
00696     }
00697 
00698     g_popup_has_changed = TRUE;
00699     g_toolbar_has_changed = TRUE;
00700     return TRUE;
00701 }

Here is the call graph for this function:

Here is the caller graph for this function:

void menustore_set_current_menu ( const char *  name  ) 

Definition at line 186 of file menustore.c.

References current_menu, g_popup_has_changed, and g_toolbar_has_changed.

Referenced by menustore_remove_menu(), and show_menu_cb().

00187 {
00188     if (current_menu && name && strcmp(name, current_menu) == 0) return;
00189 
00190     g_free(current_menu);
00191     if (name == NULL)  current_menu = NULL;
00192     else current_menu = g_strdup(name);
00193     g_popup_has_changed = TRUE;
00194     g_toolbar_has_changed = TRUE;
00195 }

Here is the caller graph for this function:

gboolean menustore_set_group_label ( const char *  name,
const char *  label 
)

Set the group label.

---------------------------------------------------------------------------

Name : menustore_set_group_label

Parameters:
name Name of group
state New label text
Returns:
Returns TRUE on succes, FALSE otherwise

--------------------------------------------------------------------------

Definition at line 801 of file menustore.c.

References check_type(), get_iter(), LOGPRINTF, MENU_TYPE_GROUP, TRACE, and update_label().

Referenced by set_group_label_cb().

00802 {
00803     TRACE("%s() name=%s  label=%s\n", __func__, name, label);
00804 
00805     // check name
00806     GtkTreeIter *iter = get_iter(name);
00807     if (iter == NULL)
00808     {
00809         LOGPRINTF("'%s' not found", name);
00810         return FALSE;
00811     }
00812 
00813     // check type
00814     if (!check_type(iter, name, MENU_TYPE_GROUP)) return FALSE;
00815 
00816     update_label(iter, name, NULL, label);
00817     return TRUE;
00818 }

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean menustore_set_group_state ( const char *  name,
const char *  state 
)

Set the group state.

---------------------------------------------------------------------------

Name : menustore_set_group_state

Parameters:
name Name of group
state New state
Returns:
Returns TRUE on succes, FALSE otherwise

--------------------------------------------------------------------------

Definition at line 753 of file menustore.c.

References check_type(), get_iter(), LOGPRINTF, MENU_TYPE_GROUP, TRACE, and update_state().

Referenced by set_group_state_cb().

00754 {
00755     TRACE("%s() name=%s  state=%s\n", __func__, name, stateStr);
00756 
00757     GtkTreeIter *iter = get_iter(name);
00758     if (iter == NULL)
00759     {
00760         LOGPRINTF("'%s' not found", name);
00761         return FALSE;
00762     }
00763 
00764     if (!check_type(iter, name, MENU_TYPE_GROUP)) return FALSE;
00765 
00766     return update_state(iter, name, NULL, stateStr);
00767 }

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean menustore_set_item_label ( const char *  iname,
const char *  pname,
const char *  label 
)

Set the item label text.

---------------------------------------------------------------------------

Name : menustore_set_item_label

Parameters:
iname New item name
pname Parent group name it belongs to
label New label text
Returns:
Returns TRUE on succes, FALSE otherwise

--------------------------------------------------------------------------

Definition at line 821 of file menustore.c.

References get_child_by_name(), LOGPRINTF, TRACE, and update_label().

Referenced by menustore_set_text(), and set_item_label_cb().

00822 {
00823     TRACE("%s() iname=%s  pname=%s  label=%s\n", __func__, iname, pname, label);
00824 
00825     // check name
00826     GtkTreeIter *iter = get_child_by_name(iname, pname);
00827     if (iter == NULL)
00828     {
00829         LOGPRINTF("'%s.%s' not found", pname, iname);
00830         return FALSE;
00831     }
00832 
00833     update_label(iter, iname, pname, label);
00834     return TRUE;
00835 }

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean menustore_set_item_state ( const char *  iname,
const char *  pname,
const char *  state 
)

Set the item state.

---------------------------------------------------------------------------

Name : menustore_set_item_state

Parameters:
iname New item name
pname Parent group name it belongs to
state New state
Returns:
Returns TRUE on succes, FALSE otherwise

--------------------------------------------------------------------------

Definition at line 770 of file menustore.c.

References get_child_by_name(), LOGPRINTF, TRACE, and update_state().

Referenced by add_system_groups(), and set_item_state_cb().

00771 {
00772     TRACE("%s() iname=%s  pname=%s  state=%s\n", __func__, iname, pname, stateStr);
00773 
00774     if ( (pname != NULL) && strcmp(pname, "general")==0 )
00775     {
00776         pname = "system_bottom";
00777     }
00778     
00779     // check item
00780     GtkTreeIter *iter = get_child_by_name(iname, pname);
00781     if (iter == NULL)
00782     {
00783         LOGPRINTF("'%s.%s' not found", pname, iname);
00784         return FALSE;
00785     }
00786 
00787     return update_state(iter, iname, pname, stateStr);
00788 }

Here is the call graph for this function:

Here is the caller graph for this function:

void menustore_set_text (  ) 

Definition at line 219 of file menustore.c.

References LOGPRINTF, and menustore_set_item_label().

Referenced by cb_sys_changed_locale(), and menustore_create().

00220 {
00221     LOGPRINTF("entry");
00222 
00223     // update language texts
00224     menustore_set_item_label("desktop",         "system_top",    _("Go to Home"));
00225     menustore_set_item_label("back_to_library", "system_top",    "");
00226 #if MACHINE_IS_DR1000S || MACHINE_IS_DR1000SW
00227     menustore_set_item_label("lock",            "system_bottom", _("Lock Sensors"));
00228     menustore_set_item_label("eject_card",      "system_bottom", _("Safely Remove"));
00229     menustore_set_item_label("shutdown",        "system_bottom", _("Turn Off Device"));
00230 #endif
00231     menustore_set_item_label("rotate_screen",   "system_bottom", _("Rotate"));
00232 }

Here is the call graph for this function:

Here is the caller graph for this function:

const char* testing_menustore_get_route ( const char *  pname,
const char *  iname 
)

Definition at line 1319 of file menustore.c.

References testing_route_to_item().

Referenced by testing_route_menu_item_cb().

01320 {
01321     return testing_route_to_item(pname, iname);
01322 }

Here is the call graph for this function:

Here is the caller graph for this function:

const char* testing_menustore_print (  ) 

Definition at line 1308 of file menustore.c.

References menustore_fill_menu(), print_item(), print_separator(), and testing_extra_prints().

Referenced by testing_list_menu_items_cb().

01309 {
01310     testing_extra_prints();
01311 
01312     cp = buffer;
01313     menustore_fill_menu(print_item, print_item, print_separator, NULL);
01314     *cp = 0;
01315     return buffer;
01316 }

Here is the call graph for this function:

Here is the caller graph for this function:

Generated by  doxygen 1.6.2-20100208