[epiphany] Move the save/load accelerators methods to the ephy file utilities
- From: Claudio Saavedra <csaavedra src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Move the save/load accelerators methods to the ephy file utilities
- Date: Wed, 8 Jun 2011 16:30:00 +0000 (UTC)
commit 769cf77926d58dc75e1f031b15433522ecd8d9a2
Author: Claudio Saavedra <csaavedra igalia com>
Date: Wed Jun 8 14:37:29 2011 +0300
Move the save/load accelerators methods to the ephy file utilities
Second patch in an attempt to clean up ephy-main.c
https://bugzilla.gnome.org/show_bug.cgi?id=652119
lib/ephy-file-helpers.c | 37 +++++++++++++++++++++++++++++++++++++
lib/ephy-file-helpers.h | 2 ++
src/ephy-main.c | 41 ++---------------------------------------
3 files changed, 41 insertions(+), 39 deletions(-)
---
diff --git a/lib/ephy-file-helpers.c b/lib/ephy-file-helpers.c
index efd35cb..64ea917 100644
--- a/lib/ephy-file-helpers.c
+++ b/lib/ephy-file-helpers.c
@@ -932,3 +932,40 @@ ephy_file_delete_uri (const char *uri)
}
g_object_unref (file);
}
+
+static gchar *
+get_accels_filename (void)
+{
+ const char *home;
+
+ home = g_get_home_dir();
+ if (!home)
+ return NULL;
+ return g_build_filename (home, GNOME_DOT_GNOME, "accels", PACKAGE, NULL);
+}
+
+void
+ephy_file_load_accels (void)
+{
+ char *filename;
+
+ filename = get_accels_filename ();
+ if (!filename)
+ return;
+
+ gtk_accel_map_load (filename);
+ g_free (filename);
+}
+
+void
+ephy_file_save_accels (void)
+{
+ char *filename;
+
+ filename = get_accels_filename ();
+ if (!filename)
+ return;
+
+ gtk_accel_map_save (filename);
+ g_free (filename);
+}
diff --git a/lib/ephy-file-helpers.h b/lib/ephy-file-helpers.h
index e290f38..095f713 100644
--- a/lib/ephy-file-helpers.h
+++ b/lib/ephy-file-helpers.h
@@ -84,6 +84,8 @@ gboolean ephy_file_browse_to (GFile *file,
void ephy_file_delete_directory (const char *path);
void ephy_file_delete_uri (const char *uri);
gboolean ephy_has_private_profile (void);
+void ephy_file_load_accels (void);
+void ephy_file_save_accels (void);
G_END_DECLS
diff --git a/src/ephy-main.c b/src/ephy-main.c
index 5e1a842..850b283 100644
--- a/src/ephy-main.c
+++ b/src/ephy-main.c
@@ -383,43 +383,6 @@ show_error_message (GError **error)
gtk_dialog_run (GTK_DIALOG (dialog));
}
-static gchar *
-get_accels_filename (void)
-{
- const char *home;
-
- home = g_get_home_dir();
- if (!home)
- return NULL;
- return g_build_filename (home, GNOME_DOT_GNOME, "accels", PACKAGE, NULL);
-}
-
-static void
-load_accels (void)
-{
- char *filename;
-
- filename = get_accels_filename ();
- if (!filename)
- return;
-
- gtk_accel_map_load (filename);
- g_free (filename);
-}
-
-static void
-save_accels (void)
-{
- char *filename;
-
- filename = get_accels_filename ();
- if (!filename)
- return;
-
- gtk_accel_map_save (filename);
- g_free (filename);
-}
-
static void
shell_quit_cb (EphyShell *shell, gpointer data)
{
@@ -689,7 +652,7 @@ main (int argc,
}
ephy_stock_icons_init ();
- load_accels ();
+ ephy_file_load_accels ();
/* Work-around Flash Player crash */
g_setenv ("XLIB_SKIP_ARGB_VISUALS", "1", FALSE);
@@ -705,7 +668,7 @@ main (int argc,
/* Shutdown */
g_object_unref (ephy_shell);
- save_accels ();
+ ephy_file_save_accels ();
ephy_state_save ();
ephy_settings_shutdown ();
ephy_file_helpers_shutdown ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]