[gnome-calendar/ui-rewrite] gcal-new-event-widget: initial rework of new-event-widget
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/ui-rewrite] gcal-new-event-widget: initial rework of new-event-widget
- Date: Mon, 1 Jul 2013 19:03:40 +0000 (UTC)
commit aa2aecdb0ef2ec05c8c8329d211918db699e0c71
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Sat Jun 22 23:17:12 2013 -0400
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
configure.ac | 1 +
data/Makefile.am | 3 +-
data/ui/new-event.ui | 139 +++++++++++++++++++++++++++++++++++++++++++
src/Makefile.am | 2 +
src/calendar.gresource.xml | 2 +
src/gcal-new-event-widget.c | 84 ++++++++++++++++++++++++++
src/gcal-new-event-widget.h | 71 ++++++++++++++++++++++
7 files changed, 300 insertions(+), 2 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 71ec295..3f081c4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -76,6 +76,7 @@ EDATASERVERUI_REQUIRED=3.5.3
LIBICAL_REQUIRED=0.43
PKG_CHECK_MODULES(CALENDAR,
+ gmodule-export-2.0
glib-2.0 >= $GLIB_MIN_VERSION
gtk+-3.0 >= $GTK_MIN_VERSION
libecal-1.2 >= $ECAL_REQUIRED
diff --git a/data/Makefile.am b/data/Makefile.am
index 67b3b4c..a9546a7 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -18,8 +18,7 @@ gsettings_SCHEMAS = $(gsettingsschema_in_files:.xml.in=.xml)
styledir = $(pkgdatadir)/style
dist_style_DATA = \
- theme/gtk-styles.css \
- theme/close-window.svg
+ theme/gtk-styles.css
EXTRA_DIST= \
gnome-calendar.desktop \
diff --git a/data/ui/new-event.ui b/data/ui/new-event.ui
new file mode 100644
index 0000000..466202a
--- /dev/null
+++ b/data/ui/new-event.ui
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.10 -->
+ <template class="GcalNewEventWidget" parent="GtkOverlay">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <style>
+ <class name="new-event-widget"/>
+ </style>
+ <child type="overlay">
+ <object class="GtkButton" id="close_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="halign">end</property>
+ <property name="valign">start</property>
+ <property name="focus_on_click">False</property>
+ <property name="relief">none</property>
+ <child>
+ <object class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="resource">/org/gnome/calendar/close.svg</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GcalArrowBin" id="container">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">14</property>
+ <style>
+ <class name="arrow-bin"/>
+ </style>
+ <child>
+ <object class="GtkGrid" id="main_grid">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="row_spacing">18</property>
+ <property name="column_spacing">12</property>
+ <property name="column_homogeneous">True</property>
+ <property name="margin">18</property>
+ <child>
+ <object class="GtkLabel" id="title_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">2</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="create_button">
+ <property name="label" translatable="yes">Create</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <style>
+ <class name="suggested-action"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="details_button">
+ <property name="label" translatable="yes">More Details</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">2</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="row_grid">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="column_spacing">6</property>
+ <child>
+ <object class="GtkEntry" id="what_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkMenuButton" id="calendar_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="always_show_image">True</property>
+ <child>
+ <object class="GtkImage" id="image2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">x-office-calendar-symbolic</property>
+ <property name="icon_size">1</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">2</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </template>
+</interface>
diff --git a/src/Makefile.am b/src/Makefile.am
index ee303ac..f98a9e4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -48,6 +48,8 @@ gnome_calendar_SOURCES = \
gcal-event-widget.h \
gcal-event-overlay.c \
gcal-event-overlay.h \
+ gcal-new-event-widget.c \
+ gcal-new-event-widget.h \
gcal-edit-dialog.c \
gcal-edit-dialog.h \
gcal-time-entry.c \
diff --git a/src/calendar.gresource.xml b/src/calendar.gresource.xml
index 5d76007..3b653d5 100644
--- a/src/calendar.gresource.xml
+++ b/src/calendar.gresource.xml
@@ -3,5 +3,7 @@
<gresource prefix="/org/gnome/calendar">
<file alias="nav_bar.ui" compressed="true" preprocess="xml-stripblanks">../data/ui/nav_bar.ui</file>
<file alias="viewport.ui" compressed="true" preprocess="xml-stripblanks">../data/ui/viewport.ui</file>
+ <file alias="new-event.ui" compressed="true" preprocess="xml-stripblanks">../data/ui/new-event.ui</file>
+ <file alias="close.svg" compressed="true"
preprocess="xml-stripblanks">../data/theme/close-window.svg</file>
</gresource>
</gresources>
diff --git a/src/gcal-new-event-widget.c b/src/gcal-new-event-widget.c
new file mode 100644
index 0000000..8d561c1
--- /dev/null
+++ b/src/gcal-new-event-widget.c
@@ -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);
+}
diff --git a/src/gcal-new-event-widget.h b/src/gcal-new-event-widget.h
new file mode 100644
index 0000000..b183900
--- /dev/null
+++ b/src/gcal-new-event-widget.h
@@ -0,0 +1,71 @@
+/* -*- mode: c; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * gcal-new-event-widget.h
+ * 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/>.
+ */
+
+#ifndef __GCAL_NEW_EVENT_WIDGET_H__
+#define __GCAL_NEW_EVENT_WIDGET_H__
+
+#include <gtk/gtk.h>
+#include <libical/icaltime.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GcalNewEventData GcalNewEventData;
+
+struct _GcalNewEventData
+{
+ icaltimetype *start_date;
+ icaltimetype *end_date;
+ gchar *calendar_uid;
+ gchar *summary;
+};
+
+#define GCAL_TYPE_NEW_EVENT_WIDGET (gcal_new_event_widget_get_type ())
+#define GCAL_NEW_EVENT_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),
GCAL_TYPE_NEW_EVENT_WIDGET, GcalNewEventWidget))
+#define GCAL_NEW_EVENT_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),
GCAL_TYPE_NEW_EVENT_WIDGET, GcalNewEventWidgetClass))
+#define GCAL_IS_NEW_EVENT_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),
GCAL_TYPE_NEW_EVENT_WIDGET))
+#define GCAL_IS_NEW_EVENT_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),
GCAL_TYPE_NEW_EVENT_WIDGET))
+#define GCAL_NEW_EVENT_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),
GCAL_TYPE_NEW_EVENT_WIDGET, GcalNewEventWidgetClass))
+
+typedef struct _GcalNewEventWidget GcalNewEventWidget;
+typedef struct _GcalNewEventWidgetClass GcalNewEventWidgetClass;
+typedef struct _GcalNewEventWidgetPrivate GcalNewEventWidgetPrivate;
+
+struct _GcalNewEventWidget
+{
+ GtkOverlay parent;
+
+ GcalNewEventWidgetPrivate *priv;
+};
+
+struct _GcalNewEventWidgetClass
+{
+ GtkOverlayClass parent_class;
+};
+
+
+GType gcal_new_event_widget_get_type (void);
+
+GtkWidget* gcal_new_event_widget_new (void);
+
+void gcal_new_event_widget_set_title (GcalNewEventWidget *widget,
+ const gchar *title);
+
+G_END_DECLS
+
+#endif /* __GCAL_NEW_EVENT_WIDGET_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]