[gnome-photos/wip/rishi/edit-mode: 7/10] add edit bar



commit 9e74d16200b0356027aff3ece223e8df5b411ace
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Mar 27 20:22:44 2015 +0100

    add edit bar

 src/Makefile.am       |    2 +
 src/photos-edit-bar.c |  100 +++++++++++++++++++++++++++++++++++++++++++++++++
 src/photos-edit-bar.h |   53 ++++++++++++++++++++++++++
 3 files changed, 155 insertions(+), 0 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 7c0538c..3f34e56 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -96,6 +96,8 @@ gnome_photos_SOURCES = \
        photos-dlna-renderers-manager.h \
        photos-dropdown.c \
        photos-dropdown.h \
+       photos-edit-bar.c \
+       photos-edit-bar.h \
        photos-embed.c \
        photos-embed.h \
        photos-empty-results-box.c \
diff --git a/src/photos-edit-bar.c b/src/photos-edit-bar.c
new file mode 100644
index 0000000..a853bc6
--- /dev/null
+++ b/src/photos-edit-bar.c
@@ -0,0 +1,100 @@
+/*
+ * Photos - access, organize and share your photos on GNOME
+ * Copyright © 2015 Red Hat, Inc.
+ *
+ * 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.
+ */
+
+/* Based on code from:
+ *   + Documents
+ */
+
+
+#include "config.h"
+
+#include "photos-edit-bar.h"
+
+
+struct _PhotosEditBar
+{
+  GtkBox parent_instance;
+  GtkWidget *button_area;
+};
+
+struct _PhotosEditBarClass
+{
+  GtkBoxClass parent_class;
+};
+
+
+G_DEFINE_TYPE (PhotosEditBar, photos_edit_bar, GTK_TYPE_BOX);
+
+
+static gboolean
+photos_edit_bar_draw (GtkWidget *widget, cairo_t *cr)
+{
+  GtkStyleContext *context;
+  gint height;
+  gint width;
+
+  context = gtk_widget_get_style_context (widget);
+  height = gtk_widget_get_allocated_height (widget);
+  width = gtk_widget_get_allocated_width (widget);
+  gtk_render_background (context, cr, 0, 0, width, height);
+  gtk_render_frame (context, cr, 0, 0, width, height);
+
+  return GTK_WIDGET_CLASS (photos_edit_bar_parent_class)->draw (widget, cr);
+}
+
+
+static void
+photos_edit_bar_init (PhotosEditBar *self)
+{
+  GtkStyleContext *context;
+
+  context = gtk_widget_get_style_context (GTK_WIDGET (self));
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOOLBAR);
+
+  self->button_area = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+  gtk_widget_set_hexpand (GTK_WIDGET (self->button_area), TRUE);
+  gtk_container_set_border_width (GTK_CONTAINER (self->button_area), 10);
+  gtk_box_set_spacing (GTK_BOX (self->button_area), 10);
+  gtk_container_add (GTK_CONTAINER (self), self->button_area);
+  gtk_widget_show (self->button_area);
+}
+
+
+static void
+photos_edit_bar_class_init (PhotosEditBarClass *class)
+{
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
+
+  widget_class->draw = photos_edit_bar_draw;
+}
+
+
+GtkWidget *
+photos_edit_bar_new (void)
+{
+  return g_object_new (PHOTOS_TYPE_EDIT_BAR, "orientation", GTK_ORIENTATION_HORIZONTAL, NULL);
+}
+
+
+GtkBox *
+photos_edit_bar_get_button_area (PhotosEditBar *self)
+{
+  return GTK_BOX (self->button_area);
+}
diff --git a/src/photos-edit-bar.h b/src/photos-edit-bar.h
new file mode 100644
index 0000000..f1971d4
--- /dev/null
+++ b/src/photos-edit-bar.h
@@ -0,0 +1,53 @@
+/*
+ * Photos - access, organize and share your photos on GNOME
+ * Copyright © 2015 Red Hat, Inc.
+ *
+ * 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.
+ */
+
+/* Based on code from:
+ *   + Documents
+ */
+
+#ifndef PHOTOS_EDIT_BAR_H
+#define PHOTOS_EDIT_BAR_H
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define PHOTOS_TYPE_EDIT_BAR (photos_edit_bar_get_type ())
+
+#define PHOTOS_EDIT_BAR(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+   PHOTOS_TYPE_EDIT_BAR, PhotosEditBar))
+
+#define PHOTOS_IS_EDIT_BAR(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+   PHOTOS_TYPE_EDIT_BAR))
+
+typedef struct _PhotosEditBar      PhotosEditBar;
+typedef struct _PhotosEditBarClass PhotosEditBarClass;
+
+GType                  photos_edit_bar_get_type               (void) G_GNUC_CONST;
+
+GtkWidget             *photos_edit_bar_new                    (void);
+
+GtkBox                *photos_edit_bar_get_button_area        (PhotosEditBar *self);
+
+G_END_DECLS
+
+#endif /* PHOTOS_EDIT_BAR_H */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]