#include <modest-defs.h>
#include "modest-maemo-utils.h"
+#include "modest-text-utils.h"
#include "modest-platform.h"
/*
#endif /* MODEST_HAVE_HILDON1_WIDGETS */
}
-FILE*
-modest_maemo_open_mcc_mapping_file (void)
+GtkWidget *
+modest_maemo_utils_get_manager_menubar_as_menu (GtkUIManager *manager,
+ const gchar *item_name)
{
- FILE* result;
-
- const gchar* path;
- const gchar* path1 = MODEST_OPERATOR_WIZARD_MCC_MAPPING;
- const gchar* path2 = MODEST_MCC_MAPPING;
-
- if (access(path1, R_OK) == 0)
- path = path1;
- else if (access(path2, R_OK) == 0)
- path = path2;
- else {
- g_warning ("%s: neither '%s' nor '%s' is a readable mapping file",
- __FUNCTION__, path1, path2);
- return NULL;
+ GtkWidget *new_menu;
+ GtkWidget *menubar;
+ GList *children, *iter;
+
+ menubar = gtk_ui_manager_get_widget (manager, item_name);
+ new_menu = gtk_menu_new ();
+
+ children = gtk_container_get_children (GTK_CONTAINER (menubar));
+ for (iter = children; iter != NULL; iter = g_list_next (iter)) {
+ GtkWidget *menu;
+
+ menu = GTK_WIDGET (iter->data);
+ gtk_widget_reparent (menu, new_menu);
}
- result = fopen (path, "r");
- if (!result) {
- g_warning ("%s: error opening mapping file '%s': %s",
- __FUNCTION__, path, strerror(errno));
- return NULL;
- }
- return result;
-}
+ g_list_free (children);
+ return new_menu;
+}