Commit a5f474bc authored by Matthias Clasen's avatar Matthias Clasen

Add an icon browser

This is meant to help app authors choose the right icons.
parent 12e389dd
......@@ -1837,6 +1837,7 @@ demos/Makefile
demos/gtk-demo/Makefile
demos/gtk-demo/geninclude.pl
demos/widget-factory/Makefile
demos/icon-browser/Makefile
examples/Makefile
examples/application1/Makefile
examples/application2/Makefile
......
## Makefile.am for gtk+/demos
include $(top_srcdir)/Makefile.decl
SUBDIRS = gtk-demo widget-factory
SUBDIRS = gtk-demo widget-factory icon-browser
-include $(top_srcdir)/git.mk
AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/gdk \
-I$(top_builddir)/gdk \
$(GTK_DEBUG_FLAGS) \
$(GTK_DEP_CFLAGS)
LDADD = \
$(top_builddir)/gtk/libgtk-3.la \
$(top_builddir)/gdk/libgdk-3.la \
$(GTK_DEP_LIBS)
bin_PROGRAMS = gtk3-icon-browser
desktopdir = $(datadir)/applications
dist_desktop_DATA = gtk3-icon-browser.desktop
gtk3_icon_browser_SOURCES = \
main.c \
iconbrowserapp.c iconbrowserapp.h \
iconbrowserwin.c iconbrowserwin.h \
resources.c
BUILT_SOURCES = \
resources.c
resources.c: iconbrowser.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/iconbrowser.gresource.xml)
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $(srcdir)/iconbrowser.gresource.xml \
--target=$@ --sourcedir=$(srcdir) --generate-source
EXTRA_DIST = \
window.ui
-include $(top_srcdir)/git.mk
<?xml version="1.0"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<menu id="appmenu">
<section>
<item>
<attribute name="label" translatable="yes">_Quit</attribute>
<attribute name="action">app.quit</attribute>
</item>
</section>
</menu>
</interface>
[Desktop Entry]
Name=Icon Browser
Comment=An application that shows themed icons
Exec=gtk3-icon-browser
Icon=gtk3-icon-browser
Terminal=false
Type=Application
StartupNotify=true
Categories=GTK;
NoDisplay=true
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gtk/iconbrowser">
<file preprocess="xml-stripblanks">window.ui</file>
<file preprocess="xml-stripblanks">app-menu.ui</file>
</gresource>
</gresources>
#include <gtk/gtk.h>
#include "iconbrowserapp.h"
#include "iconbrowserwin.h"
struct _IconBrowserApp
{
GtkApplication parent;
};
struct _IconBrowserAppClass
{
GtkApplicationClass parent_class;
};
G_DEFINE_TYPE(IconBrowserApp, icon_browser_app, GTK_TYPE_APPLICATION);
static void
icon_browser_app_init (IconBrowserApp *app)
{
}
static void
quit_activated (GSimpleAction *action,
GVariant *parameter,
gpointer app)
{
g_application_quit (G_APPLICATION (app));
}
static GActionEntry app_entries[] =
{
{ "quit", quit_activated, NULL, NULL, NULL }
};
static void
icon_browser_app_startup (GApplication *app)
{
GtkBuilder *builder;
GMenuModel *app_menu;
const gchar *quit_accels[2] = { "<Ctrl>Q", NULL };
G_APPLICATION_CLASS (icon_browser_app_parent_class)->startup (app);
g_action_map_add_action_entries (G_ACTION_MAP (app),
app_entries, G_N_ELEMENTS (app_entries),
app);
gtk_application_set_accels_for_action (GTK_APPLICATION (app),
"app.quit",
quit_accels);
builder = gtk_builder_new_from_resource ("/org/gtk/iconbrowser/app-menu.ui");
app_menu = G_MENU_MODEL (gtk_builder_get_object (builder, "appmenu"));
gtk_application_set_app_menu (GTK_APPLICATION (app), app_menu);
g_object_unref (builder);
}
static void
icon_browser_app_activate (GApplication *app)
{
IconBrowserWindow *win;
win = icon_browser_window_new (ICON_BROWSER_APP (app));
gtk_window_present (GTK_WINDOW (win));
}
static void
icon_browser_app_class_init (IconBrowserAppClass *class)
{
G_APPLICATION_CLASS (class)->startup = icon_browser_app_startup;
G_APPLICATION_CLASS (class)->activate = icon_browser_app_activate;
}
IconBrowserApp *
icon_browser_app_new (void)
{
return g_object_new (ICON_BROWSER_APP_TYPE,
"application-id", "org.gtk.IconBrowser",
NULL);
}
#ifndef __ICON_BROWSER_APP_H
#define __ICON_BROWSER_APP_H
#include <gtk/gtk.h>
#define ICON_BROWSER_APP_TYPE (icon_browser_app_get_type ())
#define ICON_BROWSER_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ICON_BROWSER_APP_TYPE, IconBrowserApp))
typedef struct _IconBrowserApp IconBrowserApp;
typedef struct _IconBrowserAppClass IconBrowserAppClass;
GType icon_browser_app_get_type (void);
IconBrowserApp *icon_browser_app_new (void);
#endif /* __ICON_BROWSER_APP_H */
This diff is collapsed.
#ifndef __ICON_BROWSER_WIN_H
#define __ICON_BROWSER_WIN_H
#include <gtk/gtk.h>
#include "iconbrowserapp.h"
#define ICON_BROWSER_WINDOW_TYPE (icon_browser_window_get_type ())
#define ICON_BROWSER_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ICON_BROWSER_WINDOW_TYPE, IconBrowserWindow))
typedef struct _IconBrowserWindow IconBrowserWindow;
typedef struct _IconBrowserWindowClass IconBrowserWindowClass;
GType icon_browser_window_get_type (void);
IconBrowserWindow *icon_browser_window_new (IconBrowserApp *app);
#endif /* __ICON_BROWSER_WIN_H */
#include <gtk/gtk.h>
#include <iconbrowserapp.h>
int
main (int argc, char *argv[])
{
return g_application_run (G_APPLICATION (icon_browser_app_new ()), argc, argv);
}
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.8 -->
<object class="GtkListStore" id="store">
<columns>
<column type="gchararray"/>
<column type="gchararray"/>
<column type="gchararray"/>
</columns>
</object>
<template class="IconBrowserWindow" parent="GtkApplicationWindow">
<property name="title" translatable="yes">Icon Browser</property>
<property name="default-width">600</property>
<property name="default-height">800</property>
<child type="titlebar">
<object class="GtkHeaderBar" id="header">
<property name="visible">True</property>
<property name="title" translatable="yes">Icon Browser</property>
<property name="show-close-button">True</property>
<child>
<object class="GtkToggleButton" id="search">
<property name="visible">True</property>
<style>
<class name="image-button"/>
</style>
<child>
<object class="GtkImage" id="search-icon">
<property name="visible">True</property>
<property name="icon-name">edit-find-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
</child>
</object>
</child>
<child>
<object class="GtkBox" id="content_box">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkSearchBar" id="searchbar">
<property name="visible">True</property>
<child>
<object class="GtkSearchEntry" id="searchentry">
<signal name="search-changed" handler="search_text_changed"/>
<property name="visible">True</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkScrolledWindow" id="sw">
<property name="visible">True</property>
<property name="expand">True</property>
<property name="hscrollbar-policy">never</property>
<property name="vscrollbar-policy">automatic</property>
<child>
<object class="GtkTreeView" id="list">
<property name="visible">True</property>
<property name="model">store</property>
<child internal-child="selection">
<object class="GtkTreeSelection">
<property name="mode">single</property>
<signal name="changed" handler="selection_changed"/>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="column">
<property name="visible">True</property>
<property name="title" translatable="yes">Icon</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
<cell-packing>
<property name="expand">True</property>
</cell-packing>
</child>
<child>
<object class="GtkCellRendererPixbuf" id="cell">
<property name="xpad">10</property>
</object>
<attributes>
<attribute name="icon-name">0</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="margin">10</property>
<property name="row-spacing">10</property>
<property name="column-spacing">10</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Name</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="name">
<property name="visible">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
<property name="width">4</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Description</property>
<property name="xalign">0</property>
<property name="valign">start</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="description">
<property name="visible">True</property>
<property name="wrap">True</property>
<property name="xalign">0</property>
<property name="valign">start</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
<property name="width">4</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Context</property>
<property name="xalign">0</property>
<property name="valign">start</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="context">
<property name="visible">True</property>
<property name="wrap">True</property>
<property name="xalign">0</property>
<property name="valign">start</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
<property name="width">4</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="context_description">
<property name="visible">True</property>
<property name="wrap">True</property>
<property name="xalign">0</property>
<property name="valign">start</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">3</property>
<property name="width">4</property>
</packing>
</child>
</object>
</child>
<child>
<object class="GtkBox" id="images">
<property name="orientation">horizontal</property>
<property name="hexpand">True</property>
<property name="homogeneous">True</property>
<property name="spacing">10</property>
<property name="margin">10</property>
<child>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="xpad">4</property>
<property name="ypad">4</property>
<property name="halign">center</property>
<property name="tooltip-text">16</property>
</object>
</child>
<child>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="xpad">4</property>
<property name="ypad">4</property>
<property name="halign">center</property>
<property name="tooltip-text">24</property>
</object>
</child>
<child>
<object class="GtkImage" id="image3">
<property name="visible">True</property>
<property name="xpad">4</property>
<property name="ypad">4</property>
<property name="halign">center</property>
<property name="tooltip-text">32</property>
</object>
</child>
<child>
<object class="GtkImage" id="image4">
<property name="visible">True</property>
<property name="xpad">4</property>
<property name="ypad">4</property>
<property name="halign">center</property>
<property name="tooltip-text">48</property>
</object>
</child>
<child>
<object class="GtkImage" id="image5">
<property name="visible">True</property>
<property name="xpad">4</property>
<property name="ypad">4</property>
<property name="halign">center</property>
<property name="tooltip-text">64</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkEventBox" id="symbolic_eventbox">
<property name="visible">True</property>
<property name="above-child">True</property>
<child>
<object class="GtkBox" id="symbolic_images">
<property name="orientation">horizontal</property>
<property name="hexpand">True</property>
<property name="homogeneous">True</property>
<property name="spacing">10</property>
<property name="margin">10</property>
<child>
<object class="GtkImage" id="symbolic_image1">
<property name="visible">True</property>
<property name="xpad">4</property>
<property name="ypad">4</property>
<property name="halign">center</property>
<property name="tooltip-text">16</property>
</object>
</child>
<child>
<object class="GtkImage" id="symbolic_image2">
<property name="visible">True</property>
<property name="xpad">4</property>
<property name="ypad">4</property>
<property name="halign">center</property>
<property name="tooltip-text">24</property>
</object>
</child>
<child>
<object class="GtkImage" id="symbolic_image3">
<property name="visible">True</property>
<property name="xpad">4</property>
<property name="ypad">4</property>
<property name="halign">center</property>
<property name="tooltip-text">32</property>
</object>
</child>
<child>
<object class="GtkImage" id="symbolic_image4">
<property name="visible">True</property>
<property name="xpad">4</property>
<property name="ypad">4</property>
<property name="halign">center</property>
<property name="tooltip-text">48</property>
</object>
</child>
<child>
<object class="GtkImage" id="symbolic_image5">
<property name="visible">True</property>
<property name="xpad">4</property>
<property name="ypad">4</property>
<property name="halign">center</property>
<property name="tooltip-text">64</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</template>
</interface>
......@@ -153,6 +153,7 @@ content_files = \
x11.sgml \
gtk3-demo.xml \
gtk3-widget-factory.xml \
gtk3-icon-browser.xml \
gtk-query-immodules-3.0.xml \
gtk-update-icon-cache.xml \
gtk-launch.xml \
......@@ -335,6 +336,7 @@ man_MANS = \
gtk-launch.1 \
gtk3-demo.1 \
gtk3-widget-factory.1 \
gtk3-icon-browser.1 \
broadwayd.1
if ENABLE_MAN
......
......@@ -395,6 +395,7 @@
<title>GTK+ Tools</title>
<xi:include href="gtk3-demo.xml" />
<xi:include href="gtk3-widget-factory.xml" />
<xi:include href="gtk3-icon-browser.xml" />
<xi:include href="gtk-query-immodules-3.0.xml" />
<xi:include href="gtk-update-icon-cache.xml" />
<xi:include href="gtk-launch.xml" />
......
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<refentry id="gtk3-icon-browser">
<refentryinfo>
<title>gtk3-icon-browser</title>
<productname>GTK+</productname>
<authorgroup>
<author>
<contrib>Developer</contrib>
<firstname>Matthias</firstname>
<surname>Clasen</surname>
</author>
</authorgroup>
</refentryinfo>
<refmeta>
<refentrytitle>gtk3-icon-browser</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="manual">User Commands</refmiscinfo>
</refmeta>
<refnamediv>
<refname>gtk3-icon-browser</refname>
<refpurpose>List themed icons</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>gtk3-icon-browser</command>
<arg choice="opt">--help</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>
<para>
<command>gtk3-icon-browswer</command> is a utility to explore the icons
in the current icon theme. It shows icons in various sizes, their symbolic
variants where available, as well as a description of the icon and its context.
</para>
</refsect1>
<refsect1><title>Options</title>
<para>The following options are understood:</para>
<variablelist>
<varlistentry>
<term><option>-h</option>, <option>--help</option></term>
<listitem><para>Show help options</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
</refentry>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment