summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am1
-rw-r--r--src/evbp-plug.c50
-rw-r--r--src/evbp-plug.h61
-rw-r--r--src/evbp.c3
4 files changed, 114 insertions, 1 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 1364eaf..b64b825 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,6 +1,7 @@
libevbp2_viewer_la_CFLAGS = $(E_CFLAGS) $(MOZILLA_CFLAGS) $(EVINCE2_CFLAGS)
libevbp2_viewer_la_LIBADD = $(EVINCE2_LIBS)
libevbp2_viewer_la_SOURCES = \
+ evbp-plug.h evbp-plug.c \
evbp-viewer.h evbp-viewer.c \
evbp-mime.h evbp-mime.c \
ev-page-action.h ev-page-action.c \
diff --git a/src/evbp-plug.c b/src/evbp-plug.c
new file mode 100644
index 0000000..6e74f9a
--- /dev/null
+++ b/src/evbp-plug.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2013 Dan Nicholson <dbn.lists@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+#include <config.h>
+#include "evbp-plug.h"
+#include <gtk/gtk.h>
+#if GTK_MAJOR_VERSION > 2
+#include <gtk/gtkx.h>
+#endif
+#include <gdk/gdkx.h>
+
+G_DEFINE_TYPE(EvbpPlug, evbp_plug, GTK_TYPE_PLUG)
+
+static void
+evbp_plug_class_init(EvbpPlugClass *class)
+{
+}
+
+static void
+evbp_plug_init(EvbpPlug *plug)
+{
+}
+
+GtkWidget *
+evbp_plug_new(Window socket_id)
+{
+ EvbpPlug *plug;
+
+ plug = g_object_new(EVBP_TYPE_PLUG, NULL);
+ gtk_plug_construct_for_display(GTK_PLUG(plug),
+ gdk_display_get_default(),
+ socket_id);
+ return GTK_WIDGET(plug);
+}
diff --git a/src/evbp-plug.h b/src/evbp-plug.h
new file mode 100644
index 0000000..69f78de
--- /dev/null
+++ b/src/evbp-plug.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2013 Dan Nicholson <dbn.lists@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+#ifndef _EVBP_PLUG_H_
+#define _EVBP_PLUG_H_
+
+#include <glib-object.h>
+#include <gtk/gtk.h>
+#if GTK_MAJOR_VERSION > 2
+#include <gtk/gtkx.h>
+#endif
+#include <gdk/gdkx.h>
+
+G_BEGIN_DECLS
+
+#define EVBP_TYPE_PLUG \
+ (evbp_plug_get_type())
+#define EVBP_PLUG(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), EVBP_TYPE_PLUG, EvbpPlug))
+#define EVBP_PLUG_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), EVBP_TYPE_PLUG, EvbpPlugClass))
+#define EVBP_IS_PLUG(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), EVBP_TYPE_PLUG))
+#define EVBP_IS_PLUG_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), EVBP_TYPE_PLUG))
+#define EVBP_GET_PLUG_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj), EVBP_TYPE_PLUG, EvbpPlugClass))
+
+typedef struct _EvbpPlug EvbpPlug;
+typedef struct _EvbpPlugClass EvbpPlugClass;
+
+struct _EvbpPlug {
+ GtkPlug plug;
+};
+
+struct _EvbpPlugClass {
+ GtkPlugClass parent_class;
+};
+
+GType evbp_plug_get_type(void) G_GNUC_CONST;
+GtkWidget *evbp_plug_new(Window socket_id);
+
+G_END_DECLS
+
+#endif /* _EVBP_PLUG_H_ */
diff --git a/src/evbp.c b/src/evbp.c
index 8971021..5fcee76 100644
--- a/src/evbp.c
+++ b/src/evbp.c
@@ -18,6 +18,7 @@
*/
#include <config.h>
+#include "evbp-plug.h"
#include "evbp-viewer.h"
#include "evbp-mime.h"
@@ -209,7 +210,7 @@ evbp_set_window(NPP instance, NPWindow *window)
Window id = (Window)window->window;
g_debug("plugging into window id %lu", (unsigned long)id);
- priv->plug = gtk_plug_new(id);
+ priv->plug = evbp_plug_new(id);
gtk_widget_set_size_request(priv->plug, window->width,
window->height);
gtk_container_add(GTK_CONTAINER(priv->plug), priv->viewer);