anjuta r4624 - in trunk: . libanjuta src
- From: sgranjoux svn gnome org
- To: svn-commits-list gnome org
- Subject: anjuta r4624 - in trunk: . libanjuta src
- Date: Wed, 21 Jan 2009 20:28:04 +0000 (UTC)
Author: sgranjoux
Date: Wed Jan 21 20:28:04 2009
New Revision: 4624
URL: http://svn.gnome.org/viewvc/anjuta?rev=4624&view=rev
Log:
* src/anjuta-app.c
libanjuta/anjuta-ui.h
libanjuta/anjuta-ui.c:
Fix #548310 â Allow plugins to load/save key accelerators
Needed for vim plugin
Modified:
trunk/ChangeLog
trunk/libanjuta/anjuta-ui.c
trunk/libanjuta/anjuta-ui.h
trunk/src/anjuta-app.c
Modified: trunk/libanjuta/anjuta-ui.c
==============================================================================
--- trunk/libanjuta/anjuta-ui.c (original)
+++ trunk/libanjuta/anjuta-ui.c Wed Jan 21 20:28:04 2009
@@ -947,28 +947,54 @@
}
void
-anjuta_ui_load_accels (void)
+anjuta_ui_load_accels (const gchar *filename)
{
- gchar *filename;
-
- filename = anjuta_ui_get_accel_file ();
- if (filename != NULL)
+ if (filename)
{
gtk_accel_map_load (filename);
- g_free (filename);
+ }
+ else
+ {
+ gchar *def_filename = anjuta_ui_get_accel_file ();
+ if (def_filename != NULL)
+ {
+ gtk_accel_map_load (def_filename);
+ g_free (def_filename);
+ }
}
}
void
-anjuta_ui_save_accels (void)
+anjuta_ui_save_accels (const gchar *filename)
{
- gchar *filename;
-
- filename = anjuta_ui_get_accel_file ();
- if (filename != NULL)
+ if (filename)
{
gtk_accel_map_save (filename);
- g_free (filename);
+ }
+ else
+ {
+ gchar * def_filename = anjuta_ui_get_accel_file ();
+
+ if (def_filename != NULL)
+ {
+ gtk_accel_map_save (def_filename);
+ g_free (def_filename);
+ }
}
}
+static void anjuta_ui_remove_accel (AnjutaUI *ui,
+ const gchar *accel_path, guint accel_key,
+ GdkModifierType accel_mods, gboolean changed)
+{
+ gtk_accel_group_disconnect_key (anjuta_ui_get_accel_group(ui), accel_key, accel_mods);
+}
+
+void
+anjuta_ui_unload_accels (AnjutaUI *ui)
+{
+ anjuta_ui_save_accels (NULL);
+ gtk_accel_map_foreach_unfiltered (ui, anjuta_ui_remove_accel);
+}
+
+
Modified: trunk/libanjuta/anjuta-ui.h
==============================================================================
--- trunk/libanjuta/anjuta-ui.h (original)
+++ trunk/libanjuta/anjuta-ui.h Wed Jan 21 20:28:04 2009
@@ -131,9 +131,11 @@
void anjuta_ui_dump_tree (AnjutaUI *ui);
/* Loading and saving accels */
-void anjuta_ui_load_accels (void);
+void anjuta_ui_load_accels (const gchar *filename);
-void anjuta_ui_save_accels (void);
+void anjuta_ui_save_accels (const gchar *filename);
+
+void anjuta_ui_unload_accels (AnjutaUI *ui);
/* Convenience macros to register stock icons */
#define BEGIN_REGISTER_ICON(plugin) \
Modified: trunk/src/anjuta-app.c
==============================================================================
--- trunk/src/anjuta-app.c (original)
+++ trunk/src/anjuta-app.c Wed Jan 21 20:28:04 2009
@@ -497,7 +497,7 @@
G_CALLBACK (on_session_load), app);
/* Loading accels */
- anjuta_ui_load_accels ();
+ anjuta_ui_load_accels (NULL);
}
static void
@@ -601,7 +601,7 @@
g_warning ("Saving dock layout to '%s' failed!", filename);
/* This is a good place to save the accels too */
- anjuta_ui_save_accels ();
+ anjuta_ui_save_accels (NULL);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]