summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhang Xianwei <[email protected]>2018-01-07 16:07:12 +0800
committermonsta <[email protected]>2018-03-18 10:59:28 +0300
commitf184a1a48f0baf73bd74316d3d71566c626a6b5a (patch)
treea6d3f49578092a6da7d4883c678ef08ef791f097
parentfc5339eb8010062a267ac5fb9d2dc2e4f3a10c84 (diff)
downloadmate-control-center-f184a1a48f0baf73bd74316d3d71566c626a6b5a.tar.bz2
mate-control-center-f184a1a48f0baf73bd74316d3d71566c626a6b5a.tar.xz
libslab: fix search icon misaligned
Make use GtkSearchEntry instead of builtin NldSearchEntry fixes #299 Signed-off-by: Zhang Xianwei <[email protected]> (squashed afcb324eb181a9c6cb0b3c8e8589ed99391a63a0 + 172e05f957cfcf4b94c469f9b0933ce414faaf8a for 1.18 branch)
-rw-r--r--libslab/Makefile.am21
-rw-r--r--libslab/search-bar.c3
-rw-r--r--libslab/search-entry-watermark.svg58
-rw-r--r--libslab/search-entry.c148
-rw-r--r--libslab/search-entry.h54
-rw-r--r--libslab/slab.h1
6 files changed, 4 insertions, 281 deletions
diff --git a/libslab/Makefile.am b/libslab/Makefile.am
index 96bf3d9d..4bbb8316 100644
--- a/libslab/Makefile.am
+++ b/libslab/Makefile.am
@@ -20,7 +20,6 @@ HEADER_FILES= \
nameplate-tile.h \
search-bar.h \
search-context-picker.h \
- search-entry.h \
shell-window.h \
slab-mate-util.h \
slab-section.h \
@@ -44,8 +43,6 @@ libmate_slab_la_SOURCES = \
nameplate-tile.c \
search-bar.c \
search-context-picker.c \
- search-entry-watermark.h \
- search-entry.c \
shell-window.c \
slab-mate-util.c \
slab-section.c \
@@ -59,12 +56,6 @@ libmate_slab_includedir = $(includedir)/libmate-slab
libmate_slab_include_HEADERS = $(HEADER_FILES)
libmate_slab_la_LIBADD = $(LIBSLAB_LIBS)
-search-entry-watermark.h: search-entry-watermark.svg
- echo '#define SEARCH_ENTRY_WATERMARK_SVG "\' > $@; \
- sed -e 's/"/\\"/g' -e 's/$$/\\/' -e 's/#000000/#%s/g' $< >> $@; \
- echo '"' >> $@
-
-
MARSHAL_GENERATED = nld-marshal.c nld-marshal.h
nld-marshal.h: nld-marshal.list
@@ -78,16 +69,10 @@ nld-marshal.c: nld-marshal.h
|| ( rm -f nld-marshal.tmp && exit 1 )
-BUILT_SOURCES = \
- search-entry-watermark.h \
- $(MARSHAL_GENERATED)
+BUILT_SOURCES = $(MARSHAL_GENERATED)
-CLEANFILES = \
- search-entry-watermark.h \
- $(MARSHAL_GENERATED)
+CLEANFILES = $(MARSHAL_GENERATED)
-EXTRA_DIST= \
- search-entry-watermark.svg \
- nld-marshal.list
+EXTRA_DIST = nld-marshal.list
-include $(top_srcdir)/git.mk
diff --git a/libslab/search-bar.c b/libslab/search-bar.c
index f355fb01..d97847c1 100644
--- a/libslab/search-bar.c
+++ b/libslab/search-bar.c
@@ -21,7 +21,6 @@
#include "search-bar.h"
#include "config.h"
-#include "search-entry.h"
#include "search-context-picker.h"
#include "nld-marshal.h"
@@ -96,7 +95,7 @@ nld_search_bar_init (NldSearchBar * search_bar)
alignment = gtk_alignment_new (0.0, 0.5, 1.0, 0.0);
gtk_box_pack_start (GTK_BOX (priv->hbox), alignment, TRUE, TRUE, 0);
- entry = nld_search_entry_new ();
+ entry = gtk_search_entry_new ();
priv->entry = GTK_ENTRY (entry);
gtk_widget_show (entry);
gtk_container_add (GTK_CONTAINER (alignment), entry);
diff --git a/libslab/search-entry-watermark.svg b/libslab/search-entry-watermark.svg
deleted file mode 100644
index f72efff1..00000000
--- a/libslab/search-entry-watermark.svg
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://web.resource.org/cc/"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="24"
- height="16"
- id="svg5418"
- sodipodi:version="0.32"
- inkscape:version="0.42+devel"
- version="1.0"
- sodipodi:docbase="/home/jimmac/Desktop"
- sodipodi:docname="search-control-watermark.svg">
- <defs
- id="defs5420" />
- <sodipodi:namedview
- id="base"
- pagecolor="#ffffff"
- bordercolor="#d0d0d0"
- borderopacity="1"
- inkscape:pageopacity="0.0"
- inkscape:pageshadow="2"
- inkscape:zoom="11.313708"
- inkscape:cx="16.668254"
- inkscape:cy="7.6484815"
- inkscape:document-units="px"
- inkscape:current-layer="layer1"
- inkscape:showpageshadow="false"
- inkscape:window-width="770"
- inkscape:window-height="580"
- inkscape:window-x="218"
- inkscape:window-y="121" />
- <metadata
- id="metadata5423">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <g
- inkscape:label="Layer 1"
- inkscape:groupmode="layer"
- id="layer1">
- <path
- style="opacity:0.15340911;color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- d="M 3.4291453,1.1191527 C 2.6305762,2.3552041 2.1745042,3.8208445 2.1745042,5.400878 C 2.174511,9.770892 5.7107317,13.327038 10.080746,13.327038 C 11.948965,13.327031 13.605421,12.578488 14.959918,11.494855 C 14.849633,12.035463 14.910326,12.599456 15.358218,12.988478 L 17.807759,15.099467 L 22.627183,15.099467 L 17.429377,10.578766 C 17.423744,10.573876 17.415133,10.563637 17.409459,10.558855 C 17.055382,10.268755 16.617709,10.181311 16.194648,10.240213 C 17.261341,8.891261 18.006906,7.252857 18.006906,5.400878 C 18.006906,3.8201565 17.531556,2.355531 16.732353,1.1191527 L 14.481959,1.1191527 C 15.505805,2.208877 16.1349,3.6692927 16.1349,5.281383 C 16.134907,8.642939 13.402473,11.375366 10.040917,11.375366 C 6.679374,11.375366 3.9469402,8.642939 3.9469402,5.281383 C 3.9469402,3.6706415 4.5775542,2.2085978 5.5998813,1.1191527 L 3.4291453,1.1191527 z "
- id="path5105" />
- </g>
-</svg>
diff --git a/libslab/search-entry.c b/libslab/search-entry.c
deleted file mode 100644
index 26a54665..00000000
--- a/libslab/search-entry.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * This file is part of libslab.
- *
- * Copyright (c) 2006 Novell, Inc.
- *
- * Libslab is free software; you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * Libslab 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 Lesser General Public License for
- * more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with libslab; if not, write to the Free Software Foundation, Inc., 51
- * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "search-entry.h"
-#include "search-entry-watermark.h"
-
-#include <librsvg/rsvg.h>
-#include <string.h>
-
-typedef struct
-{
- GdkPixbuf *watermark;
- int width, height;
-} NldSearchEntryPrivate;
-
-#define NLD_SEARCH_ENTRY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NLD_TYPE_SEARCH_ENTRY, NldSearchEntryPrivate))
-
-static void nld_search_entry_class_init (NldSearchEntryClass *);
-static void nld_search_entry_init (NldSearchEntry *);
-static void nld_search_entry_finalize (GObject *);
-
-static void nld_search_entry_realize (GtkWidget * widget);
-static gboolean nld_search_entry_draw (GtkWidget * widget, cairo_t * cr);
-
-G_DEFINE_TYPE (NldSearchEntry, nld_search_entry, GTK_TYPE_ENTRY)
-
-static void nld_search_entry_class_init (NldSearchEntryClass * nld_search_entry_class)
-{
- GObjectClass *g_obj_class = G_OBJECT_CLASS (nld_search_entry_class);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (nld_search_entry_class);
-
- g_type_class_add_private (nld_search_entry_class, sizeof (NldSearchEntryPrivate));
-
- widget_class->realize = nld_search_entry_realize;
- widget_class->draw = nld_search_entry_draw;
-
- g_obj_class->finalize = nld_search_entry_finalize;
-}
-
-static void
-nld_search_entry_init (NldSearchEntry * entry)
-{
-}
-
-static void
-nld_search_entry_finalize (GObject * object)
-{
- NldSearchEntryPrivate *priv = NLD_SEARCH_ENTRY_GET_PRIVATE (object);
-
- if (priv->watermark)
- g_object_unref (priv->watermark);
-
- G_OBJECT_CLASS (nld_search_entry_parent_class)->finalize (object);
-}
-
-static void
-rsvg_size_callback (int *width, int *height, gpointer user_data)
-{
- NldSearchEntryPrivate *priv = user_data;
-
- *width = priv->width = priv->height * (double) *width / (double) *height;
- *height = priv->height;
-}
-
-static void
-nld_search_entry_realize (GtkWidget * widget)
-{
- NldSearchEntryPrivate *priv = NLD_SEARCH_ENTRY_GET_PRIVATE (widget);
- int height;
- GdkColor *gdkcolor;
- char *svg, color[7];
- RsvgHandle *rsvg;
- GdkRectangle text_area;
-
- GTK_WIDGET_CLASS (nld_search_entry_parent_class)->realize (widget);
-
- gtk_entry_get_text_area (GTK_ENTRY (widget), &text_area);
- height = text_area.height;
-
- if (height - 2 == priv->height)
- return;
- priv->height = height - 2;
-
- gdkcolor = &gtk_widget_get_style (widget)->fg[gtk_widget_get_state (widget)];
- snprintf (color, 6, "%02x%02x%02x", gdkcolor->red >> 8, gdkcolor->green >> 8,
- gdkcolor->blue >> 8);
- svg = g_strdup_printf (SEARCH_ENTRY_WATERMARK_SVG, color, color);
-
- rsvg = rsvg_handle_new ();
- rsvg_handle_set_size_callback (rsvg, rsvg_size_callback, priv, NULL);
- rsvg_handle_write (rsvg, (const guchar *) svg, strlen (svg), NULL);
- rsvg_handle_close (rsvg, NULL);
- g_free (svg);
-
- if (priv->watermark)
- g_object_unref (priv->watermark);
- priv->watermark = rsvg_handle_get_pixbuf (rsvg);
- rsvg_handle_free (rsvg);
-}
-
-static gboolean
-nld_search_entry_draw (GtkWidget * widget, cairo_t * cr)
-{
- NldSearchEntryPrivate *priv = NLD_SEARCH_ENTRY_GET_PRIVATE (widget);
- GdkRectangle text_area;
-
- gtk_entry_get_text_area (GTK_ENTRY (widget), &text_area);
-
- GTK_WIDGET_CLASS (nld_search_entry_parent_class)->draw (widget, cr);
-
- int width, x;
-
- if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
- {
- width = text_area.width;
- x = width - priv->width - 1;
- }
- else
- x = 1;
-
- gdk_cairo_set_source_pixbuf (cr, priv->watermark, x, 1);
- cairo_paint (cr);
-
- return FALSE;
-}
-
-GtkWidget *
-nld_search_entry_new (void)
-{
- return g_object_new (NLD_TYPE_SEARCH_ENTRY, NULL);
-}
diff --git a/libslab/search-entry.h b/libslab/search-entry.h
deleted file mode 100644
index 0cb07db2..00000000
--- a/libslab/search-entry.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * This file is part of libslab.
- *
- * Copyright (c) 2006 Novell, Inc.
- *
- * Libslab is free software; you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * Libslab 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 Lesser General Public License for
- * more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with libslab; if not, write to the Free Software Foundation, Inc., 51
- * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __NLD_SEARCH_ENTRY_H__
-#define __NLD_SEARCH_ENTRY_H__
-
-#include <gtk/gtk.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define NLD_TYPE_SEARCH_ENTRY (nld_search_entry_get_type ())
-#define NLD_SEARCH_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NLD_TYPE_SEARCH_ENTRY, NldSearchEntry))
-#define NLD_SEARCH_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NLD_TYPE_SEARCH_ENTRY, NldSearchEntryClass))
-#define NLD_IS_SEARCH_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NLD_TYPE_SEARCH_ENTRY))
-#define NLD_IS_SEARCH_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NLD_TYPE_SEARCH_ENTRY))
-#define NLD_SEARCH_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NLD_TYPE_SEARCH_ENTRY, NldSearchEntryClass))
-
-typedef struct
-{
- GtkEntry parent;
-} NldSearchEntry;
-
-typedef struct
-{
- GtkEntryClass parent_class;
-} NldSearchEntryClass;
-
-GType nld_search_entry_get_type (void);
-
-GtkWidget *nld_search_entry_new (void);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __NLD_SEARCH_ENTRY_H__ */
diff --git a/libslab/slab.h b/libslab/slab.h
index b4ecb87c..e35d2a40 100644
--- a/libslab/slab.h
+++ b/libslab/slab.h
@@ -34,7 +34,6 @@
#include "nameplate-tile.h"
#include "search-bar.h"
#include "search-context-picker.h"
-#include "search-entry.h"
#include "shell-window.h"
#include "slab-mate-util.h"
#include "slab-section.h"