[bijiben] emptyResultsBox : initial unused draft



commit f93eac8813587bd26563c725b2bf3639a5b75fda
Author: Pierre-Yves Luyten <py luyten fr>
Date:   Sun Apr 21 02:20:13 2013 +0200

    emptyResultsBox : initial unused draft
    
    the box shows no note exists. It migth be improved to also
    handle the case of search. Or a different box might be used.

 data/icons/hicolor_actions_scalable_note.svg |  132 +++++++------------------
 src/Makefile.am                              |    2 +
 src/bjb-empty-results-box.c                  |  136 ++++++++++++++++++++++++++
 src/bjb-empty-results-box.h                  |   76 ++++++++++++++
 4 files changed, 249 insertions(+), 97 deletions(-)
---
diff --git a/data/icons/hicolor_actions_scalable_note.svg b/data/icons/hicolor_actions_scalable_note.svg
old mode 100755
new mode 100644
index 71ecfa0..a8160df
--- a/data/icons/hicolor_actions_scalable_note.svg
+++ b/data/icons/hicolor_actions_scalable_note.svg
@@ -9,14 +9,14 @@
    xmlns="http://www.w3.org/2000/svg";
    xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd";
    xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape";
-   width="128"
-   height="128"
-   id="svg2"
+   width="64px"
+   height="64px"
+   id="svg11721"
    version="1.1"
-   inkscape:version="0.48.1 r9760"
-   sodipodi:docname="Nouveau document 1">
+   inkscape:version="0.48.4 r9939"
+   sodipodi:docname="New document 3">
   <defs
-     id="defs4" />
+     id="defs11723" />
   <sodipodi:namedview
      id="base"
      pagecolor="#ffffff"
@@ -25,18 +25,25 @@
      inkscape:pageopacity="0.0"
      inkscape:pageshadow="2"
      inkscape:zoom="1"
-     inkscape:cx="80.204786"
-     inkscape:cy="59.856421"
-     inkscape:document-units="px"
+     inkscape:cx="86.208614"
+     inkscape:cy="-4.5168404"
      inkscape:current-layer="layer1"
      showgrid="false"
-     inkscape:window-width="1024"
-     inkscape:window-height="712"
+     inkscape:document-units="px"
+     inkscape:grid-bbox="true"
+     inkscape:snap-nodes="false"
+     inkscape:snap-bbox="true"
+     inkscape:window-width="1600"
+     inkscape:window-height="841"
      inkscape:window-x="0"
-     inkscape:window-y="26"
-     inkscape:window-maximized="1" />
+     inkscape:window-y="27"
+     inkscape:window-maximized="1">
+    <inkscape:grid
+       type="xygrid"
+       id="grid11740" />
+  </sodipodi:namedview>
   <metadata
-     id="metadata7">
+     id="metadata11726">
     <rdf:RDF>
       <cc:Work
          rdf:about="">
@@ -48,89 +55,20 @@
     </rdf:RDF>
   </metadata>
   <g
-     inkscape:label="Calque 1"
-     inkscape:groupmode="layer"
      id="layer1"
-     transform="translate(0,-924.36218)">
-    <text
-       xml:space="preserve"
-       
style="font-size:6px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
-       x="3.5355339"
-       y="5.670527"
-       id="text2987"
-       sodipodi:linespacing="125%"
-       transform="translate(0,924.36218)"><tspan
-         sodipodi:role="line"
-         id="tspan2989"
-         x="3.5355339"
-         y="5.670527">bijiben note editor allows you to leverage</tspan><tspan
-         sodipodi:role="line"
-         x="3.5355339"
-         y="13.170527"
-         id="tspan2991">tracker to classiy your books.</tspan><tspan
-         sodipodi:role="line"
-         x="3.5355339"
-         y="20.670527"
-         id="tspan2993">The tile comes from the Chinese Bijiben</tspan><tspan
-         sodipodi:role="line"
-         x="3.5355339"
-         y="28.170527"
-         id="tspan2995">which simply means workbook ; BI - JI </tspan><tspan
-         sodipodi:role="line"
-         x="3.5355339"
-         y="35.670528"
-         id="tspan2997">characters mean to remind, while the </tspan><tspan
-         sodipodi:role="line"
-         x="3.5355339"
-         y="43.170528"
-         id="tspan2999">last charcter, BEN, can serves to </tspan><tspan
-         sodipodi:role="line"
-         x="3.5355339"
-         y="50.670528"
-         id="tspan3001">describe several objects like books</tspan><tspan
-         sodipodi:role="line"
-         x="3.5355339"
-         y="58.170528"
-         id="tspan3007">One note can use some </tspan><tspan
-         sodipodi:role="line"
-         x="3.5355339"
-         y="65.670525"
-         id="tspan3009">format like</tspan><tspan
-         sodipodi:role="line"
-         x="3.5355339"
-         y="73.170525"
-         id="tspan3011">                       * One</tspan><tspan
-         sodipodi:role="line"
-         x="3.5355339"
-         y="80.670525"
-         id="tspan3015">                       * Two</tspan><tspan
-         sodipodi:role="line"
-         x="3.5355339"
-         y="88.170525"
-         id="tspan3019">                    * * Two One</tspan><tspan
-         sodipodi:role="line"
-         x="3.5355339"
-         y="95.670525"
-         id="tspan3021">                    * * Two two</tspan><tspan
-         sodipodi:role="line"
-         x="3.5355339"
-         y="103.17052"
-         id="tspan3023">                       * Three.</tspan><tspan
-         sodipodi:role="line"
-         x="3.5355339"
-         y="110.67052"
-         id="tspan3025" /></text>
-    <text
-       xml:space="preserve"
-       
style="font-size:6px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
-       x="136.82516"
-       y="15.570022"
-       id="text3027"
-       sodipodi:linespacing="125%"
-       transform="translate(0,924.36218)"><tspan
-         sodipodi:role="line"
-         id="tspan3029"
-         x="136.82516"
-         y="15.570022" /></text>
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer">
+    <path
+       style="fill:#ffffff;fill-opacity:1;stroke:none"
+       d="M 2.165515,3.020685 2.165515,62 46,62 l 0,-14.0625 0,-2 2,0 14,0 0,-42.916815 z M 48,47.9375 48,62 
50.0625,62 62,49.84375 62,47.9375 z"
+       id="rect12512-4"
+       inkscape:connector-curvature="0"
+       sodipodi:nodetypes="ccccccccccccccc" />
+    <path
+       style="fill:#bebebe;fill-opacity:1;stroke:none"
+       d="M 2.165515,2.0206849 2.165515,61 46,61 l 0,-14.0625 0,-2 2,0 14,0 0,-42.9168151 z M 48,46.9375 
48,61 50.0625,61 62,48.84375 62,46.9375 z"
+       id="rect12512"
+       inkscape:connector-curvature="0"
+       sodipodi:nodetypes="ccccccccccccccc" />
   </g>
 </svg>
diff --git a/src/Makefile.am b/src/Makefile.am
index a9360b0..8b68f11 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -56,6 +56,8 @@ bijiben_SOURCES = \
        bjb-debug.h \
        bjb-editor-toolbar.c \
        bjb-editor-toolbar.h \
+       bjb-empty-results-box.c \
+       bjb-empty-results-box.h \
        bjb-main.c \
        bjb-main-toolbar.c \
        bjb-main-toolbar.h \
diff --git a/src/bjb-empty-results-box.c b/src/bjb-empty-results-box.c
new file mode 100644
index 0000000..75e7304
--- /dev/null
+++ b/src/bjb-empty-results-box.c
@@ -0,0 +1,136 @@
+/*
+ * Bijiben
+ * Copyright © 2012, 2013 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
+ *   + Photos
+ */
+
+
+#include "config.h"
+
+#include <glib/gi18n.h>
+
+#include "bjb-bijiben.h"
+#include "bjb-empty-results-box.h"
+
+
+G_DEFINE_TYPE (BjbEmptyResultsBox, bjb_empty_results_box, GTK_TYPE_GRID);
+
+
+static void
+bjb_empty_results_box_constructed (GObject *object)
+{
+  BjbEmptyResultsBox *self = BJB_EMPTY_RESULTS_BOX (object);
+  GtkStyleContext *context;
+  GdkPixbuf *pixbuf; // debug only
+  GtkWidget *image;
+  GtkWidget *labels_grid;
+  GtkWidget *title_label;
+  GtkWidget *details_label;
+  gchar *label;
+  gchar *icons_path;
+  gchar *note_icon_path;
+
+  G_OBJECT_CLASS (bjb_empty_results_box_parent_class)->constructed (object);
+
+  gtk_widget_set_halign (GTK_WIDGET (self), GTK_ALIGN_CENTER);
+  gtk_widget_set_hexpand (GTK_WIDGET (self), TRUE);
+  gtk_widget_set_valign (GTK_WIDGET (self), GTK_ALIGN_CENTER);
+  gtk_widget_set_vexpand (GTK_WIDGET (self), TRUE);
+  gtk_orientable_set_orientation (GTK_ORIENTABLE (self), GTK_ORIENTATION_HORIZONTAL);
+  gtk_grid_set_column_spacing (GTK_GRID (self), 12);
+  context = gtk_widget_get_style_context (GTK_WIDGET (self));
+  gtk_style_context_add_class (context, "dim-label");
+
+  icons_path = (gchar*) bijiben_get_bijiben_dir ();
+  note_icon_path = g_build_filename (icons_path,
+                                "bijiben",
+                                "icons",
+                                "hicolor",
+                                "scalable",
+                                "actions",
+                                "note.svg",
+                                NULL);
+
+  GError *error = NULL;
+  pixbuf = gdk_pixbuf_new_from_file (note_icon_path, &error);
+
+  if (error)
+  {
+    g_warning ("%s", error->message);
+    g_error_free (error);
+  }
+
+  image  = gtk_image_new_from_pixbuf (pixbuf);
+  g_free (note_icon_path);
+
+  gtk_image_set_pixel_size (GTK_IMAGE (image), 64);
+  gtk_container_add (GTK_CONTAINER (self), image);
+
+  labels_grid = gtk_grid_new ();
+  gtk_orientable_set_orientation (GTK_ORIENTABLE (labels_grid), GTK_ORIENTATION_VERTICAL);
+  gtk_grid_set_row_spacing (GTK_GRID (labels_grid), 12);
+  gtk_container_add (GTK_CONTAINER (self), labels_grid);
+
+  label = g_strconcat ("<b><span size=\"large\">", _("No Notes Found"), "</span></b>", NULL);
+  title_label = gtk_label_new (label);
+  gtk_widget_set_halign (title_label, GTK_ALIGN_START);
+  gtk_widget_set_vexpand (title_label, TRUE);
+  gtk_label_set_use_markup (GTK_LABEL (title_label), TRUE);
+  gtk_container_add (GTK_CONTAINER (labels_grid), title_label);
+  g_free (label);
+
+  label = _("Your notes collection is empty.\nClick the New button to create your first note.");
+  details_label = gtk_label_new (label);
+  gtk_label_set_use_markup (GTK_LABEL (details_label), TRUE);
+  gtk_widget_set_halign (title_label, GTK_ALIGN_START);
+  // xalign: 0,
+  // max_width_chars: 24,
+  // wrap: true
+
+  gtk_container_add (GTK_CONTAINER (labels_grid), details_label);
+
+  gtk_widget_set_valign (title_label, GTK_ALIGN_CENTER);
+  gtk_widget_show_all (GTK_WIDGET (self));
+}
+
+
+static void
+bjb_empty_results_box_init (BjbEmptyResultsBox *self)
+{
+}
+
+
+static void
+bjb_empty_results_box_class_init (BjbEmptyResultsBoxClass *class)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (class);
+
+  object_class->constructed = bjb_empty_results_box_constructed;
+}
+
+
+GtkWidget *
+bjb_empty_results_box_new (void)
+{
+  return g_object_new (BJB_TYPE_EMPTY_RESULTS_BOX, NULL);
+}
+
diff --git a/src/bjb-empty-results-box.h b/src/bjb-empty-results-box.h
new file mode 100644
index 0000000..f83392d
--- /dev/null
+++ b/src/bjb-empty-results-box.h
@@ -0,0 +1,76 @@
+/*
+ * Bijiben
+ * Copyright © 2012, 2013 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
+ *   + Photos
+ */
+
+#ifndef BJB_EMPTY_RESULTS_BOX_H
+#define BJB_EMPTY_RESULTS_BOX_H
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define BJB_TYPE_EMPTY_RESULTS_BOX (bjb_empty_results_box_get_type ())
+
+#define BJB_EMPTY_RESULTS_BOX(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+   BJB_TYPE_EMPTY_RESULTS_BOX, BjbEmptyResultsBox))
+
+#define BJB_EMPTY_RESULTS_BOX_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST ((klass), \
+   BJB_TYPE_EMPTY_RESULTS_BOX, BjbEmptyResultsBoxClass))
+
+#define BJB_IS_EMPTY_RESULTS_BOX(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+   BJB_TYPE_EMPTY_RESULTS_BOX))
+
+#define BJB_IS_EMPTY_RESULTS_BOX_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+   BJB_TYPE_EMPTY_RESULTS_BOX))
+
+#define BJB_EMPTY_RESULTS_BOX_GET_CLASS(obj) \
+  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+   BJB_TYPE_EMPTY_RESULTS_BOX, BjbEmptyResultsBoxClass))
+
+typedef struct _BjbEmptyResultsBox        BjbEmptyResultsBox;
+typedef struct _BjbEmptyResultsBoxClass   BjbEmptyResultsBoxClass;
+typedef struct _BjbEmptyResultsBoxPrivate BjbEmptyResultsBoxPrivate;
+
+struct _BjbEmptyResultsBox
+{
+  GtkGrid parent_instance;
+  BjbEmptyResultsBoxPrivate *priv;
+};
+
+struct _BjbEmptyResultsBoxClass
+{
+  GtkGridClass parent_class;
+};
+
+GType               bjb_empty_results_box_get_type           (void) G_GNUC_CONST;
+
+GtkWidget          *bjb_empty_results_box_new                (void);
+
+G_END_DECLS
+
+#endif /* BJB_EMPTY_RESULTS_BOX_H */


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