|
Packit |
1e8aac |
/*
|
|
Packit |
1e8aac |
* glade-gtk-popover.c - GladeWidgetAdaptor for GtkPopover
|
|
Packit |
1e8aac |
*
|
|
Packit |
1e8aac |
* Copyright (C) 2014 Red Hat, Inc
|
|
Packit |
1e8aac |
*
|
|
Packit |
1e8aac |
* Authors:
|
|
Packit |
1e8aac |
* Matthias Clasen <mclasen@redhat.com>
|
|
Packit |
1e8aac |
*
|
|
Packit |
1e8aac |
* This library is free software; you can redistribute it and/or modify it
|
|
Packit |
1e8aac |
* under the terms of the GNU Lesser General Public License as
|
|
Packit |
1e8aac |
* published by the Free Software Foundation; either version 2.1 of
|
|
Packit |
1e8aac |
* the License, or (at your option) any later version.
|
|
Packit |
1e8aac |
*
|
|
Packit |
1e8aac |
* This library is distributed in the hope that it will be useful, but
|
|
Packit |
1e8aac |
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
1e8aac |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
1e8aac |
* Lesser General Public License for more details.
|
|
Packit |
1e8aac |
*
|
|
Packit |
1e8aac |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit |
1e8aac |
* License along with this program; if not, write to the Free Software
|
|
Packit |
1e8aac |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
Packit |
1e8aac |
*/
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
#include <config.h>
|
|
Packit |
1e8aac |
#include <glib/gi18n-lib.h>
|
|
Packit |
1e8aac |
#include <gladeui/glade.h>
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
#include "glade-popover-editor.h"
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
GObject *
|
|
Packit |
1e8aac |
glade_gtk_popover_constructor (GType type,
|
|
Packit |
1e8aac |
guint n_construct_properties,
|
|
Packit |
1e8aac |
GObjectConstructParam * construct_properties)
|
|
Packit |
1e8aac |
{
|
|
Packit |
1e8aac |
GladeWidgetAdaptor *adaptor;
|
|
Packit |
1e8aac |
GObject *ret_obj;
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
ret_obj = GWA_GET_OCLASS (GTK_TYPE_CONTAINER)->constructor
|
|
Packit |
1e8aac |
(type, n_construct_properties, construct_properties);
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
adaptor = GLADE_WIDGET_ADAPTOR (ret_obj);
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
glade_widget_adaptor_action_remove (adaptor, "add_parent");
|
|
Packit |
1e8aac |
glade_widget_adaptor_action_remove (adaptor, "remove_parent");
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
return ret_obj;
|
|
Packit |
1e8aac |
}
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
GladeEditable *
|
|
Packit |
1e8aac |
glade_gtk_popover_create_editable (GladeWidgetAdaptor * adaptor,
|
|
Packit |
1e8aac |
GladeEditorPageType type)
|
|
Packit |
1e8aac |
{
|
|
Packit |
1e8aac |
if (type == GLADE_PAGE_GENERAL)
|
|
Packit |
1e8aac |
return (GladeEditable *) glade_popover_editor_new ();
|
|
Packit |
1e8aac |
else
|
|
Packit |
1e8aac |
return GWA_GET_CLASS (GTK_TYPE_CONTAINER)->create_editable (adaptor, type);
|
|
Packit |
1e8aac |
}
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
static gint
|
|
Packit |
1e8aac |
popover_key_press (GtkWidget *popover, GdkEventKey *event, gpointer user_data)
|
|
Packit |
1e8aac |
{
|
|
Packit |
1e8aac |
if (event->keyval == GDK_KEY_Escape)
|
|
Packit |
1e8aac |
return TRUE;
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
return FALSE;
|
|
Packit |
1e8aac |
}
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
void
|
|
Packit |
1e8aac |
glade_gtk_popover_post_create (GladeWidgetAdaptor *adaptor,
|
|
Packit |
1e8aac |
GObject *popover,
|
|
Packit |
1e8aac |
GladeCreateReason reason)
|
|
Packit |
1e8aac |
{
|
|
Packit |
1e8aac |
/* Ignore some events causing the popover to disappear from the workspace
|
|
Packit |
1e8aac |
*/
|
|
Packit |
1e8aac |
g_signal_connect (popover, "key-press-event",
|
|
Packit |
1e8aac |
G_CALLBACK (popover_key_press), NULL);
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
gtk_popover_set_modal (GTK_POPOVER (popover), FALSE);
|
|
Packit |
1e8aac |
gtk_popover_set_relative_to (GTK_POPOVER (popover), NULL);
|
|
Packit |
1e8aac |
|
|
Packit |
1e8aac |
GWA_GET_CLASS (GTK_TYPE_CONTAINER)->post_create (adaptor, popover, reason);
|
|
Packit |
1e8aac |
}
|