aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--widgets/misc/ChangeLog5
-rw-r--r--widgets/misc/Makefile.am2
-rw-r--r--widgets/misc/e-info-label.c171
-rw-r--r--widgets/misc/e-info-label.h57
4 files changed, 235 insertions, 0 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index dc9baff90d..4f62dc5f68 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,3 +1,8 @@
+2004-04-08 Not Zed <NotZed@Ximian.com>
+
+ * e-info-label.[ch]: A widget to show component info for the
+ current component/view.
+
2004-04-07 Jeffrey Stedfast <fejj@ximian.com>
* e-multi-config-dialog.c: Updated for changes to e-config-page.c
diff --git a/widgets/misc/Makefile.am b/widgets/misc/Makefile.am
index 25cce4416e..768f36cd9b 100644
--- a/widgets/misc/Makefile.am
+++ b/widgets/misc/Makefile.am
@@ -26,6 +26,7 @@ widgetsinclude_HEADERS = \
e-dropdown-button.h \
e-expander.h \
e-image-chooser.h \
+ e-info-label.h \
e-map.h \
e-multi-config-dialog.h \
e-search-bar.h \
@@ -54,6 +55,7 @@ libemiscwidgets_la_SOURCES = \
e-dropdown-button.c \
e-expander.c \
e-image-chooser.c \
+ e-info-label.c \
e-map.c \
e-multi-config-dialog.c \
e-search-bar.c \
diff --git a/widgets/misc/e-info-label.c b/widgets/misc/e-info-label.c
new file mode 100644
index 0000000000..3e04355583
--- /dev/null
+++ b/widgets/misc/e-info-label.c
@@ -0,0 +1,171 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Authors: Michael Zucchi <notzed@ximian.com>
+ *
+ * Copyright 2004 Novell Inc. (www.novell.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * 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., 59 Temple Street #330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <gtk/gtkimage.h>
+
+#include "e-info-label.h"
+#include <gtk/gtklabel.h>
+#include "e-clipped-label.h"
+
+static GtkHBoxClass *el_parent;
+
+static void
+el_init(GObject *o)
+{
+ /*EInfoLabel *el = (EInfoLabel *)o;*/
+}
+
+static void
+el_finalise(GObject *o)
+{
+ ((GObjectClass *)el_parent)->finalize(o);
+}
+
+static void
+el_destroy (GtkObject *o)
+{
+ ((EInfoLabel *)o)->location = NULL;
+ ((EInfoLabel *)o)->info = NULL;
+
+ ((GtkObjectClass *)el_parent)->destroy(o);
+}
+
+static int
+el_expose_event(GtkWidget *w, GdkEventExpose *event)
+{
+ int x = ((GtkContainer *)w)->border_width;
+
+ /* This seems a hack to me, but playing with styles wouldn't affect the background */
+ gtk_paint_flat_box(w->style, w->window,
+ GTK_STATE_ACTIVE, GTK_SHADOW_NONE,
+ &event->area, w, "EInfoLabel",
+ w->allocation.x+x, w->allocation.y+x,
+ w->allocation.width-x*2, w->allocation.height-x*2);
+
+ return ((GtkWidgetClass *)el_parent)->expose_event(w, event);
+}
+
+static void
+el_class_init(GObjectClass *klass)
+{
+ klass->finalize = el_finalise;
+
+ ((GtkObjectClass *)klass)->destroy = el_destroy;
+ ((GtkWidgetClass *)klass)->expose_event = el_expose_event;
+}
+
+GType
+e_info_label_get_type(void)
+{
+ static GType type = 0;
+
+ if (type == 0) {
+ static const GTypeInfo info = {
+ sizeof(EInfoLabelClass),
+ NULL, NULL,
+ (GClassInitFunc)el_class_init,
+ NULL, NULL,
+ sizeof(EInfoLabel), 0,
+ (GInstanceInitFunc)el_init
+ };
+ el_parent = g_type_class_ref(gtk_hbox_get_type());
+ type = g_type_register_static(gtk_hbox_get_type(), "EInfoLabel", &info, 0);
+ }
+
+ return type;
+}
+
+/**
+ * e_info_label_new:
+ * @icon:
+ *
+ * Create a new info label widget. @icon is the name of the icon
+ * (from the icon theme) to use for the icon image.
+ *
+ * Return value:
+ **/
+GtkWidget *
+e_info_label_new(const char *icon)
+{
+ EInfoLabel *el = g_object_new(e_info_label_get_type(), 0);
+ GtkWidget *image;
+ char *name = g_strdup_printf(MAP_DIR "/%s", icon);
+
+ /* FIXME: the image stuff should use the icon theme stuff when its committed */
+ image = gtk_image_new_from_file(name);
+ g_free(name);
+ gtk_misc_set_padding((GtkMisc *)image, 6, 6);
+ gtk_box_pack_start((GtkBox *)el, image, FALSE, TRUE, 0);
+ gtk_widget_show(image);
+
+ gtk_container_set_border_width((GtkContainer *)el, 3);
+
+ return (GtkWidget *)el;
+}
+
+/**
+ * e_info_label_set_info:
+ * @el:
+ * @location:
+ * @info:
+ *
+ * Set the information to show on the label. @location is some
+ * context about the current view. e.g. the folder name. If the
+ * label is too wide, this will be truncated.
+ *
+ * @info is some info about this location.
+ **/
+void
+e_info_label_set_info(EInfoLabel *el, const char *location, const char *info)
+{
+ char *tmp;
+
+ if (el->location == NULL)
+ el->location = e_clipped_label_new(location, PANGO_WEIGHT_BOLD, 1.0);
+ else
+ e_clipped_label_set_text((EClippedLabel *)el->location, location);
+
+ if (el->info == NULL)
+ el->info = gtk_label_new(NULL);
+
+ tmp = g_strdup_printf("<span size=\"smaller\">%s</span>", info);
+ gtk_label_set_markup((GtkLabel *)el->info, tmp);
+ g_free(tmp);
+
+ gtk_misc_set_alignment((GtkMisc *)el->location, 0.0, 0.0);
+ gtk_misc_set_padding((GtkMisc *)el->location, 0, 6);
+ gtk_misc_set_alignment((GtkMisc *)el->info, 0.0, 1.0);
+ gtk_misc_set_padding((GtkMisc *)el->info, 0, 6);
+
+ gtk_widget_show(el->location);
+ gtk_widget_show(el->info);
+
+ gtk_box_pack_start((GtkBox *)el, (GtkWidget *)el->location, TRUE, TRUE, 0);
+ gtk_box_pack_end((GtkBox *)el, (GtkWidget *)el->info, FALSE, TRUE, 6);
+
+ gtk_widget_set_state((GtkWidget *)el, GTK_STATE_ACTIVE);
+}
+
diff --git a/widgets/misc/e-info-label.h b/widgets/misc/e-info-label.h
new file mode 100644
index 0000000000..a0effadb9a
--- /dev/null
+++ b/widgets/misc/e-info-label.h
@@ -0,0 +1,57 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- *
+ *
+ * Authors: Michael Zucchi <notzed@ximian.com>
+ *
+ * Copyright 2004 Novell Inc. (www.novell.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * 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., 59 Temple Street #330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef _E_INFO_LABEL_H
+#define _E_INFO_LABEL_H
+
+#include <gtk/gtkhbox.h>
+
+#ifdef __cplusplus
+extern "C" {
+#pragma }
+#endif /* __cplusplus */
+
+#define E_INFO_LABEL_GET_CLASS(emfv) ((EInfoLabelClass *) G_OBJECT_GET_CLASS (emfv))
+
+typedef struct _EInfoLabel EInfoLabel;
+typedef struct _EInfoLabelClass EInfoLabelClass;
+
+struct _EInfoLabel {
+ GtkHBox parent;
+
+ struct _GtkWidget *location;
+ struct _GtkWidget *info;
+};
+
+struct _EInfoLabelClass {
+ GtkHBoxClass parent_class;
+};
+
+GType e_info_label_get_type(void);
+
+GtkWidget *e_info_label_new(const char *icon);
+void e_info_label_set_info(EInfoLabel *, const char *loc, const char *info);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* ! _E_INFO_LABEL_H */
s'>-5/+3 * net/ipgrab: fix build with clangwg2013-06-142-10/+22 * net/gq: fix build with clangwg2013-06-141-0/+12 * No need to globally define X_NESTSERVER_PORTbapt2013-06-141-1/+1 * - Update to 0.13sunpoet2013-06-142-17/+9 * Fix building with clang (CPPFLAGS+=-Wno-return-type).bsam2013-06-131-1/+1 * - Update to 0.12.2sunpoet2013-06-132-3/+6 * - Add rubygem-dropbox-sdk 1.5.1sunpoet2013-06-134-0/+26 * - Update to 0.48jadawin2013-06-132-3/+3 * - Trim old-style header.hrs2013-06-133-19/+21 * Update to version 4.2.59pawel2013-06-132-3/+3 * - Fix build with new site_perlaz2013-06-131-1/+1 * - Fix build with new site_perlaz2013-06-131-1/+1 * - Do not remove directories not created by this portmiwi2013-06-121-1/+0 * net/py-twitter-tools: Python API and CLI toolset for Twitter [NEW PORT]koobs2013-06-126-0/+106 * net/py-twitter: Update to 1.0, Use CHEESESHOP (pypi)koobs2013-06-122-8/+6 * Fix MAN8 leftover.rakuco2013-06-121-1/+2 * - Update tcpflow to 1.4.0b1antoine2013-06-124-56/+33 * - Update to 2.5.7wg2013-06-123-7/+10 * - Fix buildmiwi2013-06-111-2/+0 * - Fix buildmiwi2013-06-111-2/+0 * Update to 0.6.5.2jhay2013-06-113-7/+13 * Update to 1.119.tobez2013-06-112-3/+3 * - Remove unnecesary patchsumikawa2013-06-113-14/+3 * - Unbreak buildmiwi2013-06-111-2/+0 * - Update to 3.1.11zi2013-06-112-3/+3 * - Update to 1.42jadawin2013-06-102-3/+3 * - Update to 1.8.6.3gabor2013-06-102-5/+8 * Update to 0.56(00).tobez2013-06-103-3/+5 * Update to 1.118.tobez2013-06-102-3/+3 * - Update to 0.5.12swills2013-06-102-3/+3 * - Update to 1.1.0wg2013-06-1024-1676/+220 * * Major update to FLAC 1.3.0, including shared library bumps.naddy2013-06-101-1/+1 * - Remove php4 referencemiwi2013-06-101-1/+0 * - Do not remove directories not created by this portmiwi2013-06-091-1/+0 * - Update to 0.20.3sunpoet2013-06-092-3/+3 * - Update to 0.14.3sunpoet2013-06-093-12/+12 * - update to 0.90jgh2013-06-092-3/+3 * Update to 1.10.0.marcus2013-06-094-16/+33 * Update to 3.0.4.marcus2013-06-093-5/+6 * - Fix build with clang and warnings [1]wg2013-06-086-11/+63 * - Add new port: net/urtwn-firmware-kmod:gjb2013-06-085-0/+52 * Revert the pkgconfig change in r320019. It didn't work and my initialbrooks2013-06-074-35/+8 * Update to 1.14.tobez2013-06-072-3/+3 * - Update to 1.0.14miwi2013-06-072-3/+3 * - Revert LICENSE_FILE lineaz2013-06-071-0/+1 * - Remove of use SITE_PERLaz2013-06-071-9/+2 * - Update to 1.8.6.1 bugfix releasegabor2013-06-072-3/+3 * Finish conversion to new options frameworkbapt2013-06-071-12/+1 * - fix OPTIONS spellingohauer2013-06-071-1/+1 * *PERL* cleanup. ports@ maintained ports.mat2013-06-061-2/+1 * - Add another upstream patch to fix build with Clang.avilla2013-06-061-0/+43 * Convert to new options frameworkbapt2013-06-061-32/+31 * - Fix INDEX and options conversionbdrewery2013-06-061-1/+1 * Convert cvsup and cvsup-without-gui to OptionsNG.eadler2013-06-062-22/+10 * Remove SGE support as the SGE ports will be removed shortly.brooks2013-06-064-25/+38 * Take a first pass at cleaning up this port:eadler2013-06-061-13/+2 * - Update to 1.8.6.0gabor2013-06-053-5/+4 * Convert to new options frameworkbapt2013-06-0512-173/+141 * Convert to new options framework, while here cleanup linknxbapt2013-06-053-52/+48