Skip to content

Commit

Permalink
libgpaste-keybinding; make xcb-wrapper protected
Browse files Browse the repository at this point in the history
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
  • Loading branch information
Keruspe committed Oct 30, 2012
1 parent fd064cf commit 401006a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
5 changes: 3 additions & 2 deletions libgpaste/keybinder/gpaste-keybinding-private.h
Expand Up @@ -30,6 +30,9 @@ struct _GPasteKeybinding
{
GObject parent_instance;

/*< protected >*/
GPasteXcbWrapper *xcb_wrapper;

/*< private >*/
GPasteKeybindingPrivate *priv;
};
Expand All @@ -39,8 +42,6 @@ struct _GPasteKeybindingClass
GObjectClass parent_class;
};

GPasteXcbWrapper *g_paste_keybinding_get_xcb_wrapper (GPasteKeybinding *self);

GPasteKeybinding *_g_paste_keybinding_new (GType type,
GPasteXcbWrapper *xcb_wrapper,
GPasteSettings *settings,
Expand Down
19 changes: 5 additions & 14 deletions libgpaste/keybinder/gpaste-keybinding.c
Expand Up @@ -27,7 +27,6 @@ G_DEFINE_TYPE (GPasteKeybinding, g_paste_keybinding, G_TYPE_OBJECT)

struct _GPasteKeybindingPrivate
{
GPasteXcbWrapper *xcb_wrapper;
gchar *binding;
xcb_keycode_t *keycodes;
guint16 modifiers;
Expand Down Expand Up @@ -55,7 +54,7 @@ g_paste_keybinding_activate (GPasteKeybinding *self)

g_return_if_fail (!priv->active);

GPasteXcbWrapper *xcb_wrapper = priv->xcb_wrapper;
GPasteXcbWrapper *xcb_wrapper = self->xcb_wrapper;
xcb_connection_t *connection = (xcb_connection_t *) g_paste_xcb_wrapper_get_connection (xcb_wrapper);
xcb_screen_t *screen = (xcb_screen_t *) g_paste_xcb_wrapper_get_screen (xcb_wrapper);
guint keysym;
Expand Down Expand Up @@ -99,7 +98,7 @@ g_paste_keybinding_deactivate (GPasteKeybinding *self)

g_return_if_fail (priv->active);

GPasteXcbWrapper *xcb_wrapper = priv->xcb_wrapper;
GPasteXcbWrapper *xcb_wrapper = self->xcb_wrapper;

for (xcb_keycode_t *keycode = priv->keycodes; *keycode; ++keycode)
{
Expand Down Expand Up @@ -134,15 +133,6 @@ g_paste_keybinding_rebind (GPasteKeybinding *self,
}
}

/**
* g_paste_keybinding_get_xcb_wrapper: (skip)
*/
GPasteXcbWrapper *
g_paste_keybinding_get_xcb_wrapper (GPasteKeybinding *self)
{
return self->priv->xcb_wrapper;
}

/**
* g_paste_keybinding_get_keycodes:
* @self: a #GPasteKeybinding instance
Expand Down Expand Up @@ -221,7 +211,7 @@ g_paste_keybinding_dispose (GObject *object)

if (priv->active)
g_paste_keybinding_deactivate (self);
g_object_unref (priv->xcb_wrapper);
g_object_unref (self->xcb_wrapper);
g_object_unref (priv->settings);

G_OBJECT_CLASS (g_paste_keybinding_parent_class)->dispose (object);
Expand Down Expand Up @@ -271,7 +261,8 @@ _g_paste_keybinding_new (GType type,
GPasteKeybinding *self = g_object_new (type, NULL);
GPasteKeybindingPrivate *priv = self->priv;

priv->xcb_wrapper = g_object_ref (xcb_wrapper);
self->xcb_wrapper = g_object_ref (xcb_wrapper);

priv->settings = g_object_ref (settings);
priv->binding = g_strdup (getter (settings));
priv->getter = getter;
Expand Down
2 changes: 1 addition & 1 deletion libgpaste/keybinder/gpaste-paste-and-pop-keybinding.c
Expand Up @@ -102,7 +102,7 @@ paste_and_pop_clear_clipboard_data (GtkClipboard *clipboard G_GNUC_UNUSED,
static void
paste_and_pop (GPasteKeybinding *data)
{
GPasteXcbWrapper *xcb_wrapper = g_paste_keybinding_get_xcb_wrapper (data);
GPasteXcbWrapper *xcb_wrapper = data->xcb_wrapper;
xcb_connection_t *connection = (xcb_connection_t *) g_paste_xcb_wrapper_get_connection (xcb_wrapper);
xcb_screen_t *screen = (xcb_screen_t *) g_paste_xcb_wrapper_get_screen (xcb_wrapper);

Expand Down

0 comments on commit 401006a

Please sign in to comment.