#include <stdio.h>
+#include "../modest-maemo-utils.h"
#include "modest-easysetup-country-combo-box.h"
#include <gtk/gtkliststore.h>
#include <gtk/gtkcelllayout.h>
else /* error */
return 0;
} else {
- printf ("%c", kar);
my_country [j++] = kar;
}
}
char line[MAX_LINE_LEN];
guint previous_mcc = 0;
-
- /* Load the file one line at a time: */
-#ifdef MODEST_HILDON_VERSION_0
- const gchar* filepath = PROVIDER_DATA_DIR "/mcc_mapping";
-#else
- /* This is the official version, in the 'operator-wizard-settings' package */
- const gchar* filepath = "/usr/share/operator-wizard/mcc_mapping";
-#endif /*MODEST_HILDON_VERSION_0*/
- /* printf ("DEBUG: %s: filepath=%s\n", __FUNCTION__, filepath); */
- FILE *file = fopen(filepath, "r");
- if (!file) {
- const gchar* filepath_hack = HACK_TOP_SRCDIR "src/maemo/easysetup/mcc_mapping";
- g_warning ("Could not locate the official mcc_mapping countries list file from %s, "
- "so attempting to load it instead from %s", filepath, filepath_hack);
- file = fopen(filepath_hack, "r");
- }
+
+ FILE *file = modest_maemo_open_mcc_mapping_file ();
if (!file) {
g_warning("Could not open mcc_mapping file");
return;
}
}
+
+
+
+FILE*
+modest_maemo_open_mcc_mapping_file (void)
+{
+ FILE* result;
+
+ /* Load the file one line at a time: */
+#ifdef MODEST_HILDON_VERSION_0
+ const gchar* filepath = PROVIDER_DATA_DIR "/mcc_mapping";
+#else
+ const gchar* filepath = "/usr/share/operator-wizard/mcc_mapping";
+#endif /*MODEST_HILDON_VERSION_0*/
+
+ result = fopen (filepath, "r");
+ if (!result)
+ g_printerr ("modest: failed to open mcc mapping file");
+
+ return result;
+}
+
+
#define __MODEST_MAEMO_UTILS_H__
#include <gtk/gtk.h>
+#include <stdio.h> /* for FILE* */
#include <modest-protocol-info.h>
+#include <tny-fs-stream.h>
#define MODEST_MAEMO_UTILS_MYDOCS_FOLDER "MyDocs"
#define MODEST_MAEMO_UTILS_DEFAULT_IMAGE_FOLDER ".images"
void modest_maemo_show_dialog_and_forget (GtkWindow *parent_window, GtkDialog *dialog);
+/**
+ * modest_maemo_open_mcc_mapping_file:
+ *
+ * open the mcc mapping file, or NULL if it fails
+ *
+ * Returns: file ptr or NULL in case of error
+ */
+FILE* modest_maemo_open_mcc_mapping_file (void);
+
+/**
+ * modest_maemo_set_thumbable_scrollbar:
+ * @win: a scrollable window
+ * @thumbable: set it to thumbable (TRUE) or small (FALSE)
+ *
+ * changes the thumbability of scrollbars in a scrollable window
+ */
void modest_maemo_set_thumbable_scrollbar (GtkScrolledWindow *win, gboolean thumbable);
+
/**
* modest_maemo_toggle_action_set_active_block_notify:
* @action: a #GtkToggleAction
}
}
+
+
+static gboolean
+check_required_files (void)
+{
+ FILE *mcc_file = modest_maemo_open_mcc_mapping_file ();
+ if (!mcc_file) {
+ g_printerr ("modest: check for mcc file failed\n");
+ return FALSE;
+ } else
+ fclose (mcc_file);
+
+ if (access (MODEST_PROVIDERS_DATA_PATH, R_OK) != 0) {
+ g_printerr ("modest: cannot find providers data\n");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+
gboolean
modest_platform_init (int argc, char *argv[])
{
osso_hw_state_t hw_state = { 0 };
DBusConnection *con;
+ if (!check_required_files ()) {
+ g_printerr ("modest: missing required files\n");
+ return FALSE;
+ }
+
+
osso_context =
osso_initialize(PACKAGE,PACKAGE_VERSION,
FALSE, NULL);
return FALSE;
}
-
+
/* Add a D-Bus handler to be used when the main osso-rpc
* D-Bus handler has not handled something.
* We use this for D-Bus methods that need to use more complex types