Commit 8cdac199 authored by Christian Hergert's avatar Christian Hergert
Browse files

panel: add panel-gtk private library

parent 3a03a555
......@@ -67,12 +67,14 @@ dist-hook:
.PHONY: AUTHORS
RUNTIME_TYPELIB_PATH = libide:contrib/egg:contrib/pnl:contrib/tmpl:$(GI_TYPELIB_PATH)
run:
PEAS_DEBUG=1 \
GB_IN_TREE_PLUGINS=1 \
GB_IN_TREE_FONTS=1 \
GB_IN_TREE_STYLE_SCHEMES=1 \
GI_TYPELIB_PATH="libide:contrib/egg:contrib/tmpl:$(GI_TYPELIB_PATH)" \
GI_TYPELIB_PATH="$(RUNTIME_TYPELIB_PATH)" \
GOBJECT_DEBUG=instance-count \
PYTHONDONTWRITEBYTECODE=yes \
PATH=$(top_builddir)/src:${PATH} \
......@@ -83,7 +85,7 @@ strace:
GB_IN_TREE_PLUGINS=1 \
GB_IN_TREE_FONTS=1 \
GB_IN_TREE_STYLE_SCHEMES=1 \
GI_TYPELIB_PATH="libide:contrib/egg:contrib/tmpl:$(GI_TYPELIB_PATH)" \
GI_TYPELIB_PATH="$(RUNTIME_TYPELIB_PATH)" \
GOBJECT_DEBUG=instance-count \
PYTHONDONTWRITEBYTECODE=yes \
PATH=$(top_builddir)/src:${PATH} \
......@@ -94,7 +96,7 @@ debug:
GB_IN_TREE_PLUGINS=1 \
GB_IN_TREE_FONTS=1 \
GB_IN_TREE_STYLE_SCHEMES=1 \
GI_TYPELIB_PATH="libide:contrib/egg:contrib/tmpl:$(GI_TYPELIB_PATH)" \
GI_TYPELIB_PATH="$(RUNTIME_TYPELIB_PATH)" \
G_DEBUG=fatal-criticals \
GOBJECT_DEBUG=instance-count \
PYTHONDONTWRITEBYTECODE=yes \
......@@ -106,7 +108,7 @@ valgrind:
GB_IN_TREE_PLUGINS=1 \
GB_IN_TREE_FONTS=1 \
GB_IN_TREE_STYLE_SCHEMES=1 \
GI_TYPELIB_PATH="libide:contrib/egg:contrib/tmpl:$(GI_TYPELIB_PATH)" \
GI_TYPELIB_PATH="$(RUNTIME_TYPELIB_PATH)" \
G_DEBUG=fatal-criticals \
G_SLICE=always-malloc \
PYTHONDONTWRITEBYTECODE=yes \
......
......@@ -197,6 +197,7 @@ PKG_CHECK_MODULES(LIBIDE, [gio-2.0 >= glib_required_version
pangoft2 >= pangoft2_required_version])
PKG_CHECK_MODULES(NAUTILUS, [glib-2.0 >= glib_required_version
gtk+-3.0 >= gtk_required_version])
PKG_CHECK_MODULES(PANEL_GTK,[gtk+-3.0 >= gtk_required_version])
PKG_CHECK_MODULES(PYGOBJECT,[pygobject-3.0 >= pygobject_required_version],
[have_pygobject=yes],
[have_pygobject=no])
......@@ -395,10 +396,12 @@ dnl ***********************************************************************
dnl Setup common cflags and ldflags for plugins
dnl ***********************************************************************
PLUGIN_CFLAGS="$PLUGIN_CFLAGS -I\$(top_builddir)/contrib/egg"
PLUGIN_CFLAGS="$PLUGIN_CFLAGS -I\$(top_builddir)/contrib/pnl"
PLUGIN_CFLAGS="$PLUGIN_CFLAGS -I\$(top_builddir)/libide"
PLUGIN_CFLAGS="$PLUGIN_CFLAGS -I\$(top_srcdir)/contrib/egg"
PLUGIN_CFLAGS="$PLUGIN_CFLAGS -I\$(top_srcdir)/contrib/gd"
PLUGIN_CFLAGS="$PLUGIN_CFLAGS -I\$(top_srcdir)/contrib/nautilus"
PLUGIN_CFLAGS="$PLUGIN_CFLAGS -I\$(top_srcdir)/contrib/pnl"
PLUGIN_CFLAGS="$PLUGIN_CFLAGS -I\$(top_srcdir)/contrib/rg"
PLUGIN_CFLAGS="$PLUGIN_CFLAGS -I\$(top_srcdir)/contrib/search"
PLUGIN_CFLAGS="$PLUGIN_CFLAGS -I\$(top_srcdir)/contrib/xml"
......@@ -423,6 +426,7 @@ PLUGIN_VALAFLAGS="$PLUGIN_VALAFLAGS --target-glib=2.44"
PLUGIN_VALAFLAGS="$PLUGIN_VALAFLAGS --thread"
PLUGIN_VALAFLAGS="$PLUGIN_VALAFLAGS --vapidir \$(top_builddir)/libide"
PLUGIN_VALAFLAGS="$PLUGIN_VALAFLAGS --vapidir \$(top_builddir)/contrib/egg"
PLUGIN_VALAFLAGS="$PLUGIN_VALAFLAGS --vapidir \$(top_builddir)/contrib/pnl"
PLUGIN_VALAFLAGS="$PLUGIN_VALAFLAGS --vapidir \$(top_builddir)/contrib/tmpl"
PLUGIN_VALAFLAGS="$PLUGIN_VALAFLAGS --pkg libide-1.0"
PLUGIN_VALAFLAGS="$PLUGIN_VALAFLAGS --pkg libpeas-1.0"
......@@ -443,6 +447,8 @@ AC_CONFIG_FILES([
contrib/gd/Makefile
contrib/libeditorconfig/Makefile
contrib/nautilus/Makefile
contrib/pnl/Makefile
contrib/pnl/pnl-version.h
contrib/rg/Makefile
contrib/search/Makefile
contrib/tmpl/Makefile
......
......@@ -3,6 +3,7 @@ SUBDIRS = \
gd \
libeditorconfig \
nautilus \
pnl \
rg \
search \
tmpl \
......
CLEANFILES =
DISTCLEANFILES =
EXTRA_DIST =
BUILT_SOURCES =
pkglibdir = $(libdir)/gnome-builder
pkglib_LTLIBRARIES = libpanel-gtk.la
headersdir = $(includedir)/gnome-builder-@VERSION@/pnl
headers_DATA = \
pnl-animation.h \
pnl-dock-bin.h \
pnl-dock-bin-edge.h \
pnl-dock-item.h \
pnl-dock-manager.h \
pnl-dock-overlay.h \
pnl-dock-paned.h \
pnl-dock-revealer.h \
pnl-dock-stack.h \
pnl-dock-types.h \
pnl-dock-widget.h \
pnl-dock-window.h \
pnl-dock.h \
pnl-frame-source.h \
pnl-multi-paned.h \
pnl-tab-strip.h \
pnl-tab.h \
pnl-version.h \
pnl.h \
$(NULL)
libpanel_gtk_la_SOURCES = \
$(headers_DATA) \
pnl-animation.c \
pnl-dock-bin-edge.c \
pnl-dock-bin-edge-private.h \
pnl-dock-bin.c \
pnl-dock-item.c \
pnl-dock-manager.c \
pnl-dock-overlay-edge-private.h \
pnl-dock-overlay-edge.c \
pnl-dock-overlay.c \
pnl-dock-paned-private.h \
pnl-dock-paned.c \
pnl-dock-revealer.c \
pnl-dock-stack.c \
pnl-dock-tab-strip.c \
pnl-dock-tab-strip.h \
pnl-dock-transient-grab.c \
pnl-dock-transient-grab.h \
pnl-dock-widget.c \
pnl-dock-window.c \
pnl-dock.c \
pnl-frame-source.c \
pnl-multi-paned.c \
pnl-tab-strip.c \
pnl-tab.c \
pnl-util-private.h \
pnl-util.c \
$(NULL)
nodist_libpanel_gtk_la_SOURCES = pnl-resources.c pnl-resources.h
libpanel_gtk_la_CFLAGS = \
-DPNL_COMPILATION \
$(PANEL_GTK_CFLAGS) \
$(NULL)
libpanel_gtk_la_LIBADD = \
$(PANEL_GTK_LIBS) \
$(NULL)
libpanel_gtk_la_LDFLAGS = \
--no-undefined \
$(NULL)
glib_resources_h = pnl-resources.h
glib_resources_c = pnl-resources.c
glib_resources_xml = pnl.gresource.xml
glib_resources_namespace = pnl
include $(top_srcdir)/build/autotools/Makefile.am.gresources
if HAVE_INTROSPECTION
-include $(INTROSPECTION_MAKEFILE)
INTROSPECTION_GIRS =
INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) --warn-all
INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
Pnl-1.0.gir: libpanel-gtk.la
Pnl_1_0_gir_INCLUDES = Gio-2.0 Gdk-3.0 Gtk-3.0
Pnl_1_0_gir_CFLAGS = $(libpanel_gtk_la_CFLAGS) -DPNL_COMPILATION
Pnl_1_0_gir_LIBS = libpanel-gtk.la
Pnl_1_0_gir_FILES = $(libpanel_gtk_la_SOURCES)
Pnl_1_0_gir_SCANNERFLAGS = \
--c-include="pnl.h" \
-n Pnl \
$(NULL)
INTROSPECTION_GIRS += Pnl-1.0.gir
girdir = $(datadir)/gnome-builder/gir-1.0
dist_gir_DATA = $(INTROSPECTION_GIRS)
typelibdir = $(pkglibdir)/girepository-1.0
typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
CLEANFILES += $(dist_gir_DATA) $(typelib_DATA)
endif
if ENABLE_VAPIGEN
-include $(VAPIGEN_MAKEFILE)
panel-gtk.vapi: Pnl-1.0.gir
VAPIGEN_VAPIS = panel-gtk.vapi
panel_gtk_vapi_DEPS = gio-2.0 gtk+-3.0
panel_gtk_vapi_METADATADIRS = $(srcdir)
panel_gtk_vapi_FILES = Pnl-1.0.gir
panel-gtk.deps: Makefile
$(AM_V_GEN) echo $(libpanel_gtk_vapi_DEPS) | tr ' ' '\n' > $@
vapidir = $(datadir)/gnome-builder/vapi
vapi_DATA = $(VAPIGEN_VAPIS) $(VAPIGEN_VAPIS:.vapi=.deps)
EXTRA_DIST += panel-gtk.deps
DISTCLEANFILES += $(vapi_DATA)
endif
-include $(top_srcdir)/git.mk
This diff is collapsed.
/* pnl-animation.h
*
* Copyright (C) 2010-2016 Christian Hergert <christian@hergert.me>
*
* This file is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This file 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 Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(PNL_INSIDE) && !defined(PNL_COMPILATION)
# error "Only <pnl.h> can be included directly."
#endif
#ifndef PNL_ANIMATION_H
#define PNL_ANIMATION_H
#include <gdk/gdk.h>
G_BEGIN_DECLS
#define PNL_TYPE_ANIMATION (pnl_animation_get_type())
#define PNL_TYPE_ANIMATION_MODE (pnl_animation_mode_get_type())
G_DECLARE_FINAL_TYPE (PnlAnimation, pnl_animation, PNL, ANIMATION, GInitiallyUnowned)
typedef enum
{
PNL_ANIMATION_LINEAR,
PNL_ANIMATION_EASE_IN_QUAD,
PNL_ANIMATION_EASE_OUT_QUAD,
PNL_ANIMATION_EASE_IN_OUT_QUAD,
PNL_ANIMATION_EASE_IN_CUBIC,
PNL_ANIMATION_EASE_OUT_CUBIC,
PNL_ANIMATION_EASE_IN_OUT_CUBIC,
PNL_ANIMATION_LAST
} PnlAnimationMode;
GType pnl_animation_mode_get_type (void);
void pnl_animation_start (PnlAnimation *animation);
void pnl_animation_stop (PnlAnimation *animation);
void pnl_animation_add_property (PnlAnimation *animation,
GParamSpec *pspec,
const GValue *value);
PnlAnimation *pnl_object_animatev (gpointer object,
PnlAnimationMode mode,
guint duration_msec,
GdkFrameClock *frame_clock,
const gchar *first_property,
va_list args);
PnlAnimation* pnl_object_animate (gpointer object,
PnlAnimationMode mode,
guint duration_msec,
GdkFrameClock *frame_clock,
const gchar *first_property,
...) G_GNUC_NULL_TERMINATED;
PnlAnimation* pnl_object_animate_full (gpointer object,
PnlAnimationMode mode,
guint duration_msec,
GdkFrameClock *frame_clock,
GDestroyNotify notify,
gpointer notify_data,
const gchar *first_property,
...) G_GNUC_NULL_TERMINATED;
G_END_DECLS
#endif /* PNL_ANIMATION_H */
/* pnl-dock-bin-edge-private.h
*
* Copyright (C) 2016 Christian Hergert <chergert@redhat.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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef PNL_DOCK_BIN_EDGE_PRIVATE_H
#define PNL_DOCK_BIN_EDGE_PRIVATE_H
#include "pnl-dock-bin-edge.h"
G_BEGIN_DECLS
GtkPositionType pnl_dock_bin_edge_get_edge (PnlDockBinEdge *self);
void pnl_dock_bin_edge_set_edge (PnlDockBinEdge *self,
GtkPositionType bin_edge);
G_END_DECLS
#endif /* PNL_DOCK_BIN_EDGE_PRIVATE_H */
/* pnl-dock-bin-edge.c
*
* Copyright (C) 2016 Christian Hergert <chergert@redhat.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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include "pnl-dock-bin.h"
#include "pnl-dock-bin-edge.h"
#include "pnl-dock-bin-edge-private.h"
#include "pnl-dock-revealer.h"
typedef struct
{
GtkPositionType edge : 3;
} PnlDockBinEdgePrivate;
G_DEFINE_TYPE_EXTENDED (PnlDockBinEdge, pnl_dock_bin_edge, PNL_TYPE_DOCK_REVEALER, 0,
G_ADD_PRIVATE (PnlDockBinEdge)
G_IMPLEMENT_INTERFACE (PNL_TYPE_DOCK_ITEM, NULL))
enum {
PROP_0,
PROP_EDGE,
N_PROPS
};
enum {
MOVE_TO_BIN_CHILD,
N_SIGNALS
};
static GParamSpec *properties [N_PROPS];
static guint signals [N_SIGNALS];
static void
pnl_dock_bin_edge_update_edge (PnlDockBinEdge *self)
{
PnlDockBinEdgePrivate *priv = pnl_dock_bin_edge_get_instance_private (self);
GtkStyleContext *style_context;
PnlDockRevealerTransitionType transition_type;
const gchar *class_name = NULL;
GtkWidget *child;
GtkOrientation orientation;
g_assert (PNL_IS_DOCK_BIN_EDGE (self));
style_context = gtk_widget_get_style_context (GTK_WIDGET (self));
gtk_style_context_remove_class (style_context, "left");
gtk_style_context_remove_class (style_context, "right");
gtk_style_context_remove_class (style_context, "top");
gtk_style_context_remove_class (style_context, "bottom");
if (priv->edge == GTK_POS_LEFT)
{
class_name = "left";
transition_type = PNL_DOCK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT;
orientation = GTK_ORIENTATION_VERTICAL;
}
else if (priv->edge == GTK_POS_RIGHT)
{
class_name = "right";
transition_type = PNL_DOCK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT;
orientation = GTK_ORIENTATION_VERTICAL;
}
else if (priv->edge == GTK_POS_TOP)
{
class_name = "top";
transition_type = PNL_DOCK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN;
orientation = GTK_ORIENTATION_HORIZONTAL;
}
else if (priv->edge == GTK_POS_BOTTOM)
{
class_name = "bottom";
transition_type = PNL_DOCK_REVEALER_TRANSITION_TYPE_SLIDE_UP;
orientation = GTK_ORIENTATION_HORIZONTAL;
}
else
{
g_assert_not_reached ();
return;
}
gtk_style_context_add_class (style_context, class_name);
pnl_dock_revealer_set_transition_type (PNL_DOCK_REVEALER (self), transition_type);
child = gtk_bin_get_child (GTK_BIN (self));
if (PNL_IS_DOCK_PANED (child))
gtk_orientable_set_orientation (GTK_ORIENTABLE (child), orientation);
}
GtkPositionType
pnl_dock_bin_edge_get_edge (PnlDockBinEdge *self)
{
PnlDockBinEdgePrivate *priv = pnl_dock_bin_edge_get_instance_private (self);
g_return_val_if_fail (PNL_IS_DOCK_BIN_EDGE (self), 0);
return priv->edge;
}
void
pnl_dock_bin_edge_set_edge (PnlDockBinEdge *self,
GtkPositionType edge)
{
PnlDockBinEdgePrivate *priv = pnl_dock_bin_edge_get_instance_private (self);
g_return_if_fail (PNL_IS_DOCK_BIN_EDGE (self));
if (edge != priv->edge)
{
priv->edge = edge;
pnl_dock_bin_edge_update_edge (self);
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_EDGE]);
}
}
static void
pnl_dock_bin_edge_add (GtkContainer *container,
GtkWidget *widget)
{
GtkWidget *child;
g_assert (GTK_IS_CONTAINER (container));
g_assert (GTK_IS_WIDGET (widget));
child = gtk_bin_get_child (GTK_BIN (container));
if (GTK_IS_CONTAINER (child))
gtk_container_add (GTK_CONTAINER (child), widget);
else
GTK_CONTAINER_CLASS (pnl_dock_bin_edge_parent_class)->add (container, widget);
}
static void
pnl_dock_bin_edge_real_move_to_bin_child (PnlDockBinEdge *self)
{
GtkWidget *parent;
g_assert (PNL_IS_DOCK_BIN_EDGE (self));
parent = gtk_widget_get_parent (GTK_WIDGET (self));
if (PNL_IS_DOCK_BIN (parent))
gtk_widget_grab_focus (parent);
}
static void
pnl_dock_bin_edge_constructed (GObject *object)
{
PnlDockBinEdge *self = (PnlDockBinEdge *)object;
G_OBJECT_CLASS (pnl_dock_bin_edge_parent_class)->constructed (object);
pnl_dock_bin_edge_update_edge (self);
}
static void
pnl_dock_bin_edge_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
PnlDockBinEdge *self = PNL_DOCK_BIN_EDGE (object);
switch (prop_id)
{
case PROP_EDGE:
g_value_set_enum (value, pnl_dock_bin_edge_get_edge (self));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
static void
pnl_dock_bin_edge_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
PnlDockBinEdge *self = PNL_DOCK_BIN_EDGE (object);
switch (prop_id)
{
case PROP_EDGE:
pnl_dock_bin_edge_set_edge (self, g_value_get_enum (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
static void
pnl_dock_bin_edge_class_init (PnlDockBinEdgeClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
GtkBindingSet *binding_set;
object_class->constructed = pnl_dock_bin_edge_constructed;
object_class->get_property = pnl_dock_bin_edge_get_property;
object_class->set_property = pnl_dock_bin_edge_set_property;
container_class->add = pnl_dock_bin_edge_add;
klass->move_to_bin_child = pnl_dock_bin_edge_real_move_to_bin_child;
properties [PROP_EDGE] =
g_param_spec_enum ("edge",
"Edge",
"The edge of the dock this widget is attached to",
GTK_TYPE_POSITION_TYPE,
GTK_POS_LEFT,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_properties (object_class, N_PROPS, properties);
signals [MOVE_TO_BIN_CHILD] =
g_signal_new ("move-to-bin-child",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (PnlDockBinEdgeClass, move_to_bin_child),
NULL, NULL, NULL, G_TYPE_NONE, 0);
binding_set = gtk_binding_set_by_class (klass);
gtk_binding_entry_add_signal (binding_set, GDK_KEY_Escape, 0, "move-to-bin-child", 0);
gtk_widget_class_set_css_name (widget_class, "dockbinedge");
}
static void
pnl_dock_bin_edge_init (PnlDockBinEdge *self)
{
GtkWidget *child;
child = g_object_new (PNL_TYPE_DOCK_PANED,
"visible", TRUE,
NULL);
GTK_CONTAINER_CLASS (pnl_dock_bin_edge_parent_class)->add (GTK_CONTAINER (self), child);
pnl_dock_bin_edge_update_edge (self);
}
/* pnl-dock-bin-edge.h
*
* Copyright (C) 2016 Christian Hergert <chergert@redhat.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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef PNL_DOCK_BIN_EDGE_H
#define PNL_DOCK_BIN_EDGE_H
#include "pnl-dock-revealer.h"
G_BEGIN_DECLS
#define PNL_TYPE_DOCK_BIN_EDGE (pnl_dock_bin_edge_get_type())
G_DECLARE_DERIVABLE_TYPE (PnlDockBinEdge, pnl_dock_bin_edge, PNL, DOCK_BIN_EDGE, PnlDockRevealer)