Add GtkNumerableIcon
This is a subclass of GEmblemedIcon that can show a number or short string as an emblem, overlayed on top of another emblem. Written by Cosimo Cecchi https://bugzilla.gnome.org/show_bug.cgi?id=637169
This commit is contained in:
@ -351,7 +351,9 @@ HTML_IMAGES = \
|
||||
$(srcdir)/images/sliders.png \
|
||||
$(srcdir)/images/focus.png \
|
||||
$(srcdir)/images/handles.png \
|
||||
$(srcdir)/images/extensions.png
|
||||
$(srcdir)/images/extensions.png \
|
||||
$(srcdir)/images/numerableicon.png \
|
||||
$(srcdir)/images/numerableicon2.png
|
||||
|
||||
# Extra options to supply to gtkdoc-fixref
|
||||
FIXXREF_OPTIONS=--extra-dir=../gdk/html \
|
||||
|
||||
@ -61,6 +61,7 @@
|
||||
<xi:include href="xml/gtkgradient.xml" />
|
||||
<xi:include href="xml/gtkicontheme.xml" />
|
||||
<xi:include href="xml/gtkiconfactory.xml" />
|
||||
<xi:include href="xml/gtknumerableicon.xml" />
|
||||
<xi:include href="xml/gtkrc.xml" />
|
||||
<xi:include href="xml/gtkstyle.xml" />
|
||||
</part>
|
||||
|
||||
@ -2269,6 +2269,34 @@ GtkNotebookTab
|
||||
GtkNotebookPrivate
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtknumerableicon</FILE>
|
||||
<TITLE>GtkNumerableIcon</TITLE>
|
||||
GtkNumerableIcon
|
||||
gtk_numerable_icon_new
|
||||
gtk_numerable_icon_new_with_style_context
|
||||
gtk_numerable_icon_get_background_gicon
|
||||
gtk_numerable_icon_set_background_gicon
|
||||
gtk_numerable_icon_get_background_icon_name
|
||||
gtk_numerable_icon_set_background_icon_name
|
||||
gtk_numerable_icon_get_count
|
||||
gtk_numerable_icon_set_count
|
||||
gtk_numerable_icon_get_label
|
||||
gtk_numerable_icon_set_label
|
||||
gtk_numerable_icon_get_style_context
|
||||
gtk_numerable_icon_set_style_context
|
||||
<SUBSECTION Standard>
|
||||
GTK_NUMERABLE_ICON
|
||||
GTK_IS_NUMERABLE_ICON
|
||||
GTK_TYPE_NUMERABLE_ICON
|
||||
GTK_NUMERABLE_ICON_CLASS
|
||||
GTK_IS_NUMERABLE_ICON_CLASS
|
||||
GTK_NUMERABLE_ICON_GET_CLASS
|
||||
|
||||
<SUBSECTION Private>
|
||||
gtk_numerable_icon_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkoffscreenwindow</FILE>
|
||||
<TITLE>GtkOffscreenWindow</TITLE>
|
||||
|
||||
@ -101,6 +101,7 @@ gtk_message_dialog_get_type
|
||||
gtk_misc_get_type
|
||||
gtk_mount_operation_get_type
|
||||
gtk_notebook_get_type
|
||||
gtk_numerable_icon_get_type
|
||||
gtk_offscreen_window_get_type
|
||||
gtk_orientable_get_type
|
||||
gtk_page_setup_get_type
|
||||
|
||||
BIN
docs/reference/gtk/images/numerableicon.png
Normal file
BIN
docs/reference/gtk/images/numerableicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
BIN
docs/reference/gtk/images/numerableicon2.png
Normal file
BIN
docs/reference/gtk/images/numerableicon2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
@ -252,6 +252,7 @@ gtk_public_h_sources = \
|
||||
gtkmodules.h \
|
||||
gtkmountoperation.h \
|
||||
gtknotebook.h \
|
||||
gtknumerableicon.h \
|
||||
gtkoffscreenwindow.h \
|
||||
gtkorientable.h \
|
||||
gtkpagesetup.h \
|
||||
@ -401,6 +402,7 @@ gtk_private_h_sources = \
|
||||
gtkmnemonichash.h \
|
||||
gtkmodifierstyle.h \
|
||||
gtkmountoperationprivate.h \
|
||||
gtknumerableiconprivate.h \
|
||||
gtkpango.h \
|
||||
gtkpathbar.h \
|
||||
gtkplugprivate.h \
|
||||
@ -565,6 +567,7 @@ gtk_base_c_sources = \
|
||||
gtkmodules.c \
|
||||
gtkmountoperation.c \
|
||||
gtknotebook.c \
|
||||
gtknumerableicon.c \
|
||||
gtkoffscreenwindow.c \
|
||||
gtkorientable.c \
|
||||
gtkpagesetup.c \
|
||||
|
||||
@ -137,6 +137,7 @@
|
||||
#include <gtk/gtkmodules.h>
|
||||
#include <gtk/gtkmountoperation.h>
|
||||
#include <gtk/gtknotebook.h>
|
||||
#include <gtk/gtknumerableicon.h>
|
||||
#include <gtk/gtkoffscreenwindow.h>
|
||||
#include <gtk/gtkorientable.h>
|
||||
#include <gtk/gtkpagesetup.h>
|
||||
|
||||
@ -1606,6 +1606,19 @@ gtk_notebook_set_tab_pos
|
||||
gtk_notebook_set_tab_reorderable
|
||||
gtk_notebook_tab_get_type G_GNUC_CONST
|
||||
gtk_number_up_layout_get_type G_GNUC_CONST
|
||||
gtk_numerable_icon_get_background_gicon
|
||||
gtk_numerable_icon_get_background_icon_name
|
||||
gtk_numerable_icon_get_count
|
||||
gtk_numerable_icon_get_label
|
||||
gtk_numerable_icon_get_style_context
|
||||
gtk_numerable_icon_get_type G_GNUC_CONST
|
||||
gtk_numerable_icon_new
|
||||
gtk_numerable_icon_new_with_style_context
|
||||
gtk_numerable_icon_set_background_gicon
|
||||
gtk_numerable_icon_set_background_icon_name
|
||||
gtk_numerable_icon_set_count
|
||||
gtk_numerable_icon_set_label
|
||||
gtk_numerable_icon_set_style_context
|
||||
gtk_offscreen_window_get_pixbuf
|
||||
gtk_offscreen_window_get_surface
|
||||
gtk_offscreen_window_get_type G_GNUC_CONST
|
||||
|
||||
@ -45,6 +45,7 @@
|
||||
#include "gtkbuiltincache.h"
|
||||
#include "gtkintl.h"
|
||||
#include "gtkmain.h"
|
||||
#include "gtknumerableiconprivate.h"
|
||||
#include "gtksettings.h"
|
||||
#include "gtkprivate.h"
|
||||
|
||||
@ -3799,6 +3800,9 @@ gtk_icon_theme_lookup_by_gicon (GtkIconTheme *icon_theme,
|
||||
GList *list, *l;
|
||||
GtkIconInfo *emblem_info;
|
||||
|
||||
if (GTK_IS_NUMERABLE_ICON (icon))
|
||||
_gtk_numerable_icon_set_background_icon_size (GTK_NUMERABLE_ICON (icon), size / 2);
|
||||
|
||||
base = g_emblemed_icon_get_icon (G_EMBLEMED_ICON (icon));
|
||||
info = gtk_icon_theme_lookup_by_gicon (icon_theme, base, size, flags);
|
||||
if (info)
|
||||
|
||||
1048
gtk/gtknumerableicon.c
Normal file
1048
gtk/gtknumerableicon.c
Normal file
File diff suppressed because it is too large
Load Diff
89
gtk/gtknumerableicon.h
Normal file
89
gtk/gtknumerableicon.h
Normal file
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* gtknumerableicon.h: an emblemed icon with number emblems
|
||||
*
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with the Gnome Library; see the file COPYING.LIB. If not,
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors: Cosimo Cecchi <cosimoc@redhat.com>
|
||||
*/
|
||||
|
||||
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __GTK_NUMERABLE_ICON_H__
|
||||
#define __GTK_NUMERABLE_ICON_H__
|
||||
|
||||
#include <gio/gio.h>
|
||||
#include <gtk/gtkstylecontext.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_NUMERABLE_ICON (gtk_numerable_icon_get_type ())
|
||||
#define GTK_NUMERABLE_ICON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_NUMERABLE_ICON, GtkNumerableIcon))
|
||||
#define GTK_NUMERABLE_ICON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_NUMERABLE_ICON, GtkNumerableIconClass))
|
||||
#define GTK_IS_NUMERABLE_ICON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_NUMERABLE_ICON))
|
||||
#define GTK_IS_NUMERABLE_ICON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_NUMERABLE_ICON))
|
||||
#define GTK_NUMERABLE_ICON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_NUMERABLE_ICON, GtkNumerableIconClass))
|
||||
|
||||
typedef struct _GtkNumerableIcon GtkNumerableIcon;
|
||||
typedef struct _GtkNumerableIconClass GtkNumerableIconClass;
|
||||
typedef struct _GtkNumerableIconPrivate GtkNumerableIconPrivate;
|
||||
|
||||
struct _GtkNumerableIcon {
|
||||
GEmblemedIcon parent;
|
||||
|
||||
/*< private >*/
|
||||
GtkNumerableIconPrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkNumerableIconClass {
|
||||
GEmblemedIconClass parent_class;
|
||||
|
||||
/* padding for future class expansion */
|
||||
gpointer padding[8];
|
||||
};
|
||||
|
||||
GType gtk_numerable_icon_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GIcon * gtk_numerable_icon_new (GIcon *base_icon);
|
||||
GIcon * gtk_numerable_icon_new_with_style_context (GIcon *base_icon,
|
||||
GtkStyleContext *context);
|
||||
|
||||
GtkStyleContext * gtk_numerable_icon_get_style_context (GtkNumerableIcon *self);
|
||||
void gtk_numerable_icon_set_style_context (GtkNumerableIcon *self,
|
||||
GtkStyleContext *style);
|
||||
|
||||
gint gtk_numerable_icon_get_count (GtkNumerableIcon *self);
|
||||
void gtk_numerable_icon_set_count (GtkNumerableIcon *self,
|
||||
gint count);
|
||||
|
||||
const gchar * gtk_numerable_icon_get_label (GtkNumerableIcon *self);
|
||||
void gtk_numerable_icon_set_label (GtkNumerableIcon *self,
|
||||
const gchar *label);
|
||||
|
||||
void gtk_numerable_icon_set_background_gicon (GtkNumerableIcon *self,
|
||||
GIcon *icon);
|
||||
GIcon * gtk_numerable_icon_get_background_gicon (GtkNumerableIcon *self);
|
||||
|
||||
void gtk_numerable_icon_set_background_icon_name (GtkNumerableIcon *self,
|
||||
const gchar *icon_name);
|
||||
const gchar * gtk_numerable_icon_get_background_icon_name (GtkNumerableIcon *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_NUMERABLE_ICON_H__ */
|
||||
32
gtk/gtknumerableiconprivate.h
Normal file
32
gtk/gtknumerableiconprivate.h
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* gtknumerableiconprivate.h: private methods for GtkNumerableIcon
|
||||
*
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with the Gnome Library; see the file COPYING.LIB. If not,
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors: Cosimo Cecchi <cosimoc@redhat.com>
|
||||
*/
|
||||
|
||||
#ifndef __GTK_NUMERABLE_ICON_PRIVATE_H__
|
||||
#define __GTK_NUMERABLE_ICON_PRIVATE_H__
|
||||
|
||||
#include "gtknumerableicon.h"
|
||||
|
||||
void _gtk_numerable_icon_set_background_icon_size (GtkNumerableIcon *self,
|
||||
gint icon_size);
|
||||
|
||||
#endif /* __GTK_NUMERABLE_ICON_PRIVATE_H__ */
|
||||
@ -63,6 +63,7 @@ noinst_PROGRAMS = $(TEST_PROGS) \
|
||||
testmultidisplay \
|
||||
testmultiscreen \
|
||||
testnotebookdnd \
|
||||
testnumerableicon \
|
||||
testnouiprint \
|
||||
testoffscreen \
|
||||
testoffscreenwindow \
|
||||
@ -158,6 +159,7 @@ testmultidisplay_DEPENDENCIES = $(TEST_DEPS)
|
||||
testmultiscreen_DEPENDENCIES = $(TEST_DEPS)
|
||||
testnotebookdnd_DEPENDENCIES = $(TEST_DEPS)
|
||||
testnouiprint_DEPENDENCIES = $(TEST_DEPS)
|
||||
testnumerableicon_DEPENDENCIES = $(TEST_DEPS)
|
||||
testoffscreen_DEPENDENCIES = $(TEST_DEPS)
|
||||
testoffscreenwindow_DEPENDENCIES = $(TEST_DEPS)
|
||||
testappchooser_DEPENDENCIES = $(TEST_DEPS)
|
||||
@ -236,6 +238,7 @@ testmultidisplay_LDADD = $(LDADDS)
|
||||
testmultiscreen_LDADD = $(LDADDS)
|
||||
testnotebookdnd_LDADD = $(LDADDS)
|
||||
testnouiprint_LDADD = $(LDADDS)
|
||||
testnumerableicon_LDADD = $(LDADDS)
|
||||
testoffscreen_LDADD = $(LDADDS)
|
||||
testoffscreenwindow_LDADD = $(LDADDS)
|
||||
testappchooser_LDADD = $(LDADDS)
|
||||
@ -363,6 +366,10 @@ testiconview_SOURCES = \
|
||||
testiconview_keynav_SOURCES = \
|
||||
testiconview-keynav.c
|
||||
|
||||
testnumerableicon_SOURCES = \
|
||||
testnumerableicon.c \
|
||||
prop-editor.c
|
||||
|
||||
testrecentchooser_SOURCES = \
|
||||
prop-editor.c \
|
||||
testrecentchooser.c
|
||||
|
||||
198
tests/testnumerableicon.c
Normal file
198
tests/testnumerableicon.c
Normal file
@ -0,0 +1,198 @@
|
||||
/* testnumerableicon.c
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
* Authors: Cosimo Cecchi
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "prop-editor.h"
|
||||
|
||||
|
||||
typedef struct {
|
||||
GIcon *numerable;
|
||||
GtkWidget *image;
|
||||
gboolean odd;
|
||||
GtkIconSize size;
|
||||
} PackData;
|
||||
|
||||
static void
|
||||
button_clicked_cb (GtkButton *b,
|
||||
gpointer user_data)
|
||||
{
|
||||
PackData *d = user_data;
|
||||
GtkCssProvider *provider;
|
||||
GtkStyleContext *style;
|
||||
GError *error = NULL;
|
||||
gchar *data, *bg_str, *grad1, *grad2;
|
||||
const gchar data_format[] = "GtkNumerableIcon { background-color: %s; color: #000000;"
|
||||
"background-image: -gtk-gradient (linear, 0 0, 1 1, from(%s), to(%s));"
|
||||
"font: Monospace 12;"
|
||||
/* "background-image: url('apple-red.png');" */
|
||||
"}";
|
||||
|
||||
bg_str = g_strdup_printf ("rgb(%d,%d,%d)", g_random_int_range (0, 255), g_random_int_range (0, 255), g_random_int_range (0, 255));
|
||||
grad1 = g_strdup_printf ("rgb(%d,%d,%d)", g_random_int_range (0, 255), g_random_int_range (0, 255), g_random_int_range (0, 255));
|
||||
grad2 = g_strdup_printf ("rgb(%d,%d,%d)", g_random_int_range (0, 255), g_random_int_range (0, 255), g_random_int_range (0, 255));
|
||||
|
||||
data = g_strdup_printf (data_format, bg_str, grad1, grad2);
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_data (provider, data, -1, &error);
|
||||
|
||||
g_assert (error == NULL);
|
||||
|
||||
style = gtk_widget_get_style_context (d->image);
|
||||
gtk_style_context_add_provider (style, GTK_STYLE_PROVIDER (provider),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_USER);
|
||||
|
||||
if (d->odd) {
|
||||
gtk_numerable_icon_set_background_icon_name (GTK_NUMERABLE_ICON (d->numerable), NULL);
|
||||
gtk_numerable_icon_set_count (GTK_NUMERABLE_ICON (d->numerable), g_random_int_range (-99, 99));
|
||||
} else {
|
||||
gtk_numerable_icon_set_background_icon_name (GTK_NUMERABLE_ICON (d->numerable),
|
||||
"emblem-favorite");
|
||||
gtk_numerable_icon_set_label (GTK_NUMERABLE_ICON (d->numerable), "IVX");
|
||||
}
|
||||
|
||||
gtk_image_set_from_gicon (GTK_IMAGE (d->image), d->numerable, d->size);
|
||||
|
||||
d->odd = !d->odd;
|
||||
|
||||
g_free (data);
|
||||
g_free (bg_str);
|
||||
g_free (grad1);
|
||||
g_free (grad2);
|
||||
|
||||
g_object_unref (provider);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
delete_event_cb (GtkWidget *editor,
|
||||
gint response,
|
||||
gpointer user_data)
|
||||
{
|
||||
gtk_widget_hide (editor);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
properties_cb (GtkWidget *button,
|
||||
GObject *entry)
|
||||
{
|
||||
GtkWidget *editor;
|
||||
|
||||
editor = g_object_get_data (entry, "properties-dialog");
|
||||
|
||||
if (editor == NULL)
|
||||
{
|
||||
editor = create_prop_editor (G_OBJECT (entry), G_TYPE_INVALID);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (editor), 12);
|
||||
gtk_window_set_transient_for (GTK_WINDOW (editor),
|
||||
GTK_WINDOW (gtk_widget_get_toplevel (button)));
|
||||
g_signal_connect (editor, "delete-event", G_CALLBACK (delete_event_cb), NULL);
|
||||
g_object_set_data (entry, "properties-dialog", editor);
|
||||
}
|
||||
|
||||
gtk_window_present (GTK_WINDOW (editor));
|
||||
}
|
||||
|
||||
static void
|
||||
refresh_cb (GtkWidget *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
PackData *d = user_data;
|
||||
|
||||
gtk_image_set_from_gicon (GTK_IMAGE (d->image), d->numerable, d->size);
|
||||
}
|
||||
|
||||
static void
|
||||
pack_numerable (GtkWidget *parent,
|
||||
GtkIconSize size)
|
||||
{
|
||||
PackData *d;
|
||||
GtkWidget *vbox, *label, *image, *button;
|
||||
gchar *str;
|
||||
GIcon *icon, *numerable;
|
||||
|
||||
d = g_slice_new0 (PackData);
|
||||
|
||||
image = gtk_image_new ();
|
||||
icon = g_themed_icon_new ("system-file-manager");
|
||||
numerable = gtk_numerable_icon_new (icon);
|
||||
|
||||
d->image = image;
|
||||
d->numerable = numerable;
|
||||
d->odd = FALSE;
|
||||
d->size = size;
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
||||
gtk_box_pack_start (GTK_BOX (parent), vbox, FALSE, FALSE, 0);
|
||||
|
||||
gtk_numerable_icon_set_count (GTK_NUMERABLE_ICON (numerable), 42);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), image, FALSE, FALSE, 0);
|
||||
gtk_numerable_icon_set_style_context (GTK_NUMERABLE_ICON (numerable),
|
||||
gtk_widget_get_style_context (image));
|
||||
gtk_image_set_from_gicon (GTK_IMAGE (image), numerable, size);
|
||||
|
||||
label = gtk_label_new (NULL);
|
||||
str = g_strdup_printf ("Numerable icon, hash %u", g_icon_hash (numerable));
|
||||
gtk_label_set_label (GTK_LABEL (label), str);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
||||
|
||||
button = gtk_button_new_with_label ("Change icon number");
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (button_clicked_cb), d);
|
||||
|
||||
button = gtk_button_new_with_label ("Properties");
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (properties_cb), numerable);
|
||||
|
||||
button = gtk_button_new_with_label ("Refresh");
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (refresh_cb), d);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char **argv)
|
||||
{
|
||||
GtkWidget *hbox, *toplevel;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
toplevel = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
|
||||
gtk_container_add (GTK_CONTAINER (toplevel), hbox);
|
||||
|
||||
pack_numerable (hbox, GTK_ICON_SIZE_DIALOG);
|
||||
pack_numerable (hbox, GTK_ICON_SIZE_BUTTON);
|
||||
|
||||
gtk_widget_show_all (toplevel);
|
||||
|
||||
g_signal_connect (toplevel, "delete-event",
|
||||
G_CALLBACK (gtk_main_quit), NULL);
|
||||
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user