gcal-new-event-widget: initial rework of new-event-widget
Moved into new-style composited widget Added GtkBuilder ui file Added gmodule-export-2.0 dependency
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
/* -*- mode: c; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* gcal-new-event-widget.c
|
||||
* Copyright (C) 2012 Erick Pérez Castellanos <erickpc@gnome.org>
|
||||
*
|
||||
* gnome-calendar 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.
|
||||
*
|
||||
* gnome-calendar 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 "gcal-new-event-widget.h"
|
||||
#include "gcal-arrow-bin.h"
|
||||
|
||||
struct _GcalNewEventWidgetPrivate
|
||||
{
|
||||
GtkWidget *title_label;
|
||||
GtkWidget *what_entry;
|
||||
GtkWidget *calendar_button;
|
||||
|
||||
GtkWidget *create_button;
|
||||
GtkWidget *details_button;
|
||||
|
||||
GtkWidget *close_button;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(GcalNewEventWidget, gcal_new_event_widget, GTK_TYPE_OVERLAY)
|
||||
|
||||
static void
|
||||
gcal_new_event_widget_class_init (GcalNewEventWidgetClass *klass)
|
||||
{
|
||||
GtkWidgetClass *widget_class;
|
||||
|
||||
widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
/* Setup the template GtkBuilder xml for this class */
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/calendar/new-event.ui");
|
||||
|
||||
/* Bind internals widgets */
|
||||
gtk_widget_class_bind_child (widget_class, GcalNewEventWidgetPrivate, title_label);
|
||||
gtk_widget_class_bind_child (widget_class, GcalNewEventWidgetPrivate, what_entry);
|
||||
gtk_widget_class_bind_child (widget_class, GcalNewEventWidgetPrivate, calendar_button);
|
||||
gtk_widget_class_bind_child (widget_class, GcalNewEventWidgetPrivate, create_button);
|
||||
gtk_widget_class_bind_child (widget_class, GcalNewEventWidgetPrivate, details_button);
|
||||
gtk_widget_class_bind_child (widget_class, GcalNewEventWidgetPrivate, close_button);
|
||||
|
||||
g_type_class_add_private ((gpointer)klass, sizeof(GcalNewEventWidgetPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
gcal_new_event_widget_init (GcalNewEventWidget *self)
|
||||
{
|
||||
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
||||
GCAL_TYPE_NEW_EVENT_WIDGET,
|
||||
GcalNewEventWidgetPrivate);
|
||||
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
GtkWidget*
|
||||
gcal_new_event_widget_new (void)
|
||||
{
|
||||
return g_object_new (GCAL_TYPE_NEW_EVENT_WIDGET, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
gcal_new_event_widget_set_title (GcalNewEventWidget *widget,
|
||||
const gchar *title)
|
||||
{
|
||||
GcalNewEventWidgetPrivate *priv;
|
||||
|
||||
priv = widget->priv;
|
||||
|
||||
gtk_label_set_text (GTK_LABEL (priv->title_label), title);
|
||||
}
|
||||
Reference in New Issue
Block a user