diff options
-rw-r--r-- | src/accel-group.c | 28 | ||||
-rw-r--r-- | src/accel-group.h | 4 | ||||
-rw-r--r-- | src/window.c | 4 |
3 files changed, 16 insertions, 20 deletions
diff --git a/src/accel-group.c b/src/accel-group.c index 1b598b9..8e16c6b 100644 --- a/src/accel-group.c +++ b/src/accel-group.c @@ -34,12 +34,11 @@ struct _MqAccelGroup { GtkAccelGroup parent_instance; - MqWindow *window; MqConfig *config; }; enum { - PROP_WINDOW = 1, + PROP_CONFIG = 1, N_PROPERTIES }; @@ -75,9 +74,6 @@ constructed(GObject *object) gtk_accel_group_connect(GTK_ACCEL_GROUP(accel_group), GDK_KEY_W, GDK_CONTROL_MASK, 0, g_cclosure_new(G_CALLBACK(accel_close_tab), NULL, NULL)); - - gtk_window_add_accel_group(GTK_WINDOW(accel_group->window), - GTK_ACCEL_GROUP(accel_group)); } static void @@ -89,8 +85,8 @@ get_property(GObject *object, guint property_id, GValue *value, accel_group = MQ_ACCEL_GROUP(object); switch (property_id) { - case PROP_WINDOW: - g_value_set_pointer(value, accel_group->window); + case PROP_CONFIG: + g_value_set_pointer(value, accel_group->config); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, @@ -108,10 +104,8 @@ set_property(GObject *object, guint property_id, const GValue *value, accel_group = MQ_ACCEL_GROUP(object); switch (property_id) { - case PROP_WINDOW: - accel_group->window = g_value_get_pointer(value); - accel_group->config = mq_application_get_config( - mq_window_get_application(accel_group->window)); + case PROP_CONFIG: + accel_group->config = g_value_get_pointer(value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, @@ -129,10 +123,10 @@ mq_accel_group_class_init(MqAccelGroupClass *klass) object_class->get_property = get_property; object_class->set_property = set_property; - obj_properties[PROP_WINDOW] = g_param_spec_pointer( - "window", - P_("Window"), - P_("The attached MqWindow instance"), + obj_properties[PROP_CONFIG] = g_param_spec_pointer( + "config", + P_("MqConfig"), + P_("The application's MqConfig instance"), G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB); g_object_class_install_properties(object_class, N_PROPERTIES, @@ -145,9 +139,9 @@ mq_accel_group_init(G_GNUC_UNUSED MqAccelGroup *accel_group) } MqAccelGroup * -mq_accel_group_new(MqWindow *window) +mq_accel_group_new(MqConfig *config) { return g_object_new(MQ_TYPE_ACCEL_GROUP, - "window", window, + "config", config, NULL); } diff --git a/src/accel-group.h b/src/accel-group.h index 3f95dc1..999bc70 100644 --- a/src/accel-group.h +++ b/src/accel-group.h @@ -28,7 +28,7 @@ typedef struct _MqAccelGroupClass MqAccelGroupClass; #include <glib.h> #include <gtk/gtk.h> -#include "window.h" +#include "config/config.h" G_BEGIN_DECLS @@ -48,7 +48,7 @@ GType mq_accel_group_get_type(void); MqAccelGroup * -mq_accel_group_new(MqWindow *window); +mq_accel_group_new(MqConfig *config); G_END_DECLS diff --git a/src/window.c b/src/window.c index b1c35d0..55b09d0 100644 --- a/src/window.c +++ b/src/window.c @@ -219,7 +219,9 @@ constructed(GObject *object) FALSE); } - accel_group = mq_accel_group_new(window); + accel_group = mq_accel_group_new(window->config); + gtk_window_add_accel_group(GTK_WINDOW(window), + GTK_ACCEL_GROUP(accel_group)); gtk_widget_show_all(GTK_WIDGET(window)); } |