Compare commits
9 Commits
matthiasc/
...
wip/list
Author | SHA1 | Date | |
---|---|---|---|
|
fd8306f340 | ||
|
e12b785653 | ||
|
fe421e1a7d | ||
|
3bb8419dff | ||
|
b5dc516704 | ||
|
e34702911b | ||
|
5822782963 | ||
|
02bc5022fa | ||
|
b794cdbb0a |
@@ -31,18 +31,18 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<row><entry>EggSMClient::quit-requested</entry><entry>instead of calling will_quit (FALSE,...) in response to this signal, install an inhibitor</entry></row>
|
<row><entry>EggSMClient::quit-requested</entry><entry>instead of calling will_quit (FALSE,...) in response to this signal, install an inhibitor</entry></row>
|
||||||
<row><entry>EggSMClient::quit</entry><entry>the #GtkApplication::quit signal</entry></row>
|
<row><entry>EggSMClient::quit</entry><entry>the #GApplication::shutdown signal</entry></row>
|
||||||
<row><entry>EggSMClient::quit-cancelled</entry><entry></entry></row>
|
<row><entry>EggSMClient::quit-cancelled</entry><entry>-</entry></row>
|
||||||
<row><entry>egg_sm_client_will_quit</entry><entry>instead of calling will_quit (FALSE,...), install an inhibitor</entry></row>
|
<row><entry>egg_sm_client_will_quit</entry><entry>instead of calling will_quit (FALSE,...), install an inhibitor</entry></row>
|
||||||
<row><entry>egg_sm_client_end_session</entry><entry>gtk_application_end_session()</entry></row>
|
<row><entry>egg_sm_client_end_session</entry><entry>-</entry></row>
|
||||||
</tbody>
|
</tbody>
|
||||||
</tgroup>
|
</tgroup>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
At this point, GtkApplication has no special support for state saving.
|
At this point, GtkApplication has no special support for state saving
|
||||||
Applications can use GSettings or GKeyFile and save as much state as
|
and restarting. Applications can use GSettings or GKeyFile and save as
|
||||||
they see fit in response to #GtkApplication::quit or whenever they
|
much state as they see fit in response to #GApplication::shutdown or
|
||||||
consider appropriate.
|
whenever they consider appropriate.
|
||||||
</para>
|
</para>
|
||||||
</chapter>
|
</chapter>
|
||||||
|
@@ -267,6 +267,7 @@ gtk_public_h_sources = \
|
|||||||
gtklayout.h \
|
gtklayout.h \
|
||||||
gtklinkbutton.h \
|
gtklinkbutton.h \
|
||||||
gtkliststore.h \
|
gtkliststore.h \
|
||||||
|
gtklistview.h \
|
||||||
gtklockbutton.h \
|
gtklockbutton.h \
|
||||||
gtkmain.h \
|
gtkmain.h \
|
||||||
gtkmenu.h \
|
gtkmenu.h \
|
||||||
@@ -726,6 +727,7 @@ gtk_base_c_sources = \
|
|||||||
gtklayout.c \
|
gtklayout.c \
|
||||||
gtklinkbutton.c \
|
gtklinkbutton.c \
|
||||||
gtkliststore.c \
|
gtkliststore.c \
|
||||||
|
gtklistview.c \
|
||||||
gtklockbutton.c \
|
gtklockbutton.c \
|
||||||
gtkmain.c \
|
gtkmain.c \
|
||||||
gtkmarshalers.c \
|
gtkmarshalers.c \
|
||||||
|
@@ -124,6 +124,7 @@
|
|||||||
#include <gtk/gtklayout.h>
|
#include <gtk/gtklayout.h>
|
||||||
#include <gtk/gtklinkbutton.h>
|
#include <gtk/gtklinkbutton.h>
|
||||||
#include <gtk/gtkliststore.h>
|
#include <gtk/gtkliststore.h>
|
||||||
|
#include <gtk/gtklistview.h>
|
||||||
#include <gtk/gtklockbutton.h>
|
#include <gtk/gtklockbutton.h>
|
||||||
#include <gtk/gtkmain.h>
|
#include <gtk/gtkmain.h>
|
||||||
#include <gtk/gtkmenu.h>
|
#include <gtk/gtkmenu.h>
|
||||||
|
@@ -2996,7 +2996,7 @@ gtk_icon_view_paint_item (GtkIconView *icon_view,
|
|||||||
GtkIconViewPrivate *priv = icon_view->priv;
|
GtkIconViewPrivate *priv = icon_view->priv;
|
||||||
GtkCellAreaContext *context;
|
GtkCellAreaContext *context;
|
||||||
|
|
||||||
if (priv->model == NULL)
|
if (priv->model == NULL || item->cell_area.width <= 0 || item->cell_area.height <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_gtk_icon_view_set_cell_data (icon_view, item);
|
_gtk_icon_view_set_cell_data (icon_view, item);
|
||||||
|
7052
gtk/gtklistview.c
Normal file
7052
gtk/gtklistview.c
Normal file
File diff suppressed because it is too large
Load Diff
128
gtk/gtklistview.h
Normal file
128
gtk/gtklistview.h
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
/* gtklistview.h
|
||||||
|
* Copyright (C) 2012 Benjamin Otte <otte@redhat.com>
|
||||||
|
*
|
||||||
|
* 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||||
|
#error "Only <gtk/gtk.h> can be included directly."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __GTK_LIST_VIEW_H__
|
||||||
|
#define __GTK_LIST_VIEW_H__
|
||||||
|
|
||||||
|
#include <gtk/gtkcontainer.h>
|
||||||
|
#include <gtk/gtktreemodel.h>
|
||||||
|
#include <gtk/gtkcellrenderer.h>
|
||||||
|
#include <gtk/gtkcellarea.h>
|
||||||
|
#include <gtk/gtkselection.h>
|
||||||
|
#include <gtk/gtktooltip.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
#define GTK_TYPE_LIST_VIEW (gtk_list_view_get_type ())
|
||||||
|
#define GTK_LIST_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_LIST_VIEW, GtkListView))
|
||||||
|
#define GTK_LIST_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_LIST_VIEW, GtkListViewClass))
|
||||||
|
#define GTK_IS_LIST_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_LIST_VIEW))
|
||||||
|
#define GTK_IS_LIST_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_LIST_VIEW))
|
||||||
|
#define GTK_LIST_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_LIST_VIEW, GtkListViewClass))
|
||||||
|
|
||||||
|
typedef struct _GtkListView GtkListView;
|
||||||
|
typedef struct _GtkListViewClass GtkListViewClass;
|
||||||
|
typedef struct _GtkListViewPrivate GtkListViewPrivate;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/**
|
||||||
|
* GtkListViewForeachFunc:
|
||||||
|
* @list_view: a #GtkListView
|
||||||
|
* @path: The #GtkTreePath of a selected row
|
||||||
|
* @data: user data
|
||||||
|
*
|
||||||
|
* A function used by gtk_list_view_selected_foreach() to map all
|
||||||
|
* selected rows. It will be called on every selected row in the view.
|
||||||
|
*/
|
||||||
|
typedef void (* GtkListViewForeachFunc) (GtkListView *list_view,
|
||||||
|
GtkTreePath *path,
|
||||||
|
gpointer data);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct _GtkListView
|
||||||
|
{
|
||||||
|
GtkContainer parent;
|
||||||
|
|
||||||
|
/*< private >*/
|
||||||
|
GtkListViewPrivate *priv;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _GtkListViewClass
|
||||||
|
{
|
||||||
|
GtkContainerClass parent_class;
|
||||||
|
|
||||||
|
void (* item_activated) (GtkListView *list_view,
|
||||||
|
GtkTreePath *path);
|
||||||
|
void (* selection_changed) (GtkListView *list_view);
|
||||||
|
|
||||||
|
/* Key binding signals */
|
||||||
|
void (* select_all) (GtkListView *list_view);
|
||||||
|
void (* unselect_all) (GtkListView *list_view);
|
||||||
|
void (* select_cursor_item) (GtkListView *list_view);
|
||||||
|
void (* toggle_cursor_item) (GtkListView *list_view);
|
||||||
|
gboolean (* move_cursor) (GtkListView *list_view,
|
||||||
|
GtkMovementStep step,
|
||||||
|
gint count);
|
||||||
|
gboolean (* activate_cursor_item) (GtkListView *list_view);
|
||||||
|
|
||||||
|
/* Padding for future expansion */
|
||||||
|
void (*_gtk_reserved1) (void);
|
||||||
|
void (*_gtk_reserved2) (void);
|
||||||
|
void (*_gtk_reserved3) (void);
|
||||||
|
void (*_gtk_reserved4) (void);
|
||||||
|
};
|
||||||
|
|
||||||
|
GType gtk_list_view_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
GtkWidget * gtk_list_view_new (void);
|
||||||
|
GtkWidget * gtk_list_view_new_with_model (GtkTreeModel *model);
|
||||||
|
|
||||||
|
void gtk_list_view_set_model (GtkListView *list_view,
|
||||||
|
GtkTreeModel *model);
|
||||||
|
GtkTreeModel * gtk_list_view_get_model (GtkListView *list_view);
|
||||||
|
void gtk_list_view_set_selection_mode (GtkListView *list_view,
|
||||||
|
GtkSelectionMode mode);
|
||||||
|
GtkSelectionMode gtk_list_view_get_selection_mode (GtkListView *list_view);
|
||||||
|
|
||||||
|
gboolean gtk_list_view_get_visible_range (GtkListView *list_view,
|
||||||
|
GtkTreePath **start_path,
|
||||||
|
GtkTreePath **end_path);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* for when we support selections, we want to imitate Iconview API */
|
||||||
|
void gtk_list_view_selected_foreach (GtkListView *list_view,
|
||||||
|
GtkListViewForeachFunc func,
|
||||||
|
gpointer data);
|
||||||
|
void gtk_list_view_select_path (GtkListView *list_view,
|
||||||
|
GtkTreePath *path);
|
||||||
|
void gtk_list_view_unselect_path (GtkListView *list_view,
|
||||||
|
GtkTreePath *path);
|
||||||
|
gboolean gtk_list_view_path_is_selected (GtkListView *list_view,
|
||||||
|
GtkTreePath *path);
|
||||||
|
GList * gtk_list_view_get_selected_items (GtkListView *list_view);
|
||||||
|
void gtk_list_view_select_all (GtkListView *list_view);
|
||||||
|
void gtk_list_view_unselect_all (GtkListView *list_view);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* __GTK_LIST_VIEW_H__ */
|
@@ -108,6 +108,7 @@ noinst_PROGRAMS = $(TEST_PROGS) \
|
|||||||
testtooltips \
|
testtooltips \
|
||||||
testexpand \
|
testexpand \
|
||||||
testexpander \
|
testexpander \
|
||||||
|
testlistview \
|
||||||
testvolumebutton \
|
testvolumebutton \
|
||||||
testscrolledwindow \
|
testscrolledwindow \
|
||||||
testswitch \
|
testswitch \
|
||||||
@@ -232,6 +233,7 @@ testtreemenu_DEPENDENCIES = $(TEST_DEPS)
|
|||||||
testwindows_DEPENDENCIES = $(TEST_DEPS)
|
testwindows_DEPENDENCIES = $(TEST_DEPS)
|
||||||
testexpand_DEPENDENCIES = $(TEST_DEPS)
|
testexpand_DEPENDENCIES = $(TEST_DEPS)
|
||||||
testexpander_DEPENDENCIES = $(TEST_DEPS)
|
testexpander_DEPENDENCIES = $(TEST_DEPS)
|
||||||
|
testlistview_DEPENDENCIES = $(TEST_DEPS)
|
||||||
testswitch_DEPENDENCIES = $(TEST_DEPS)
|
testswitch_DEPENDENCIES = $(TEST_DEPS)
|
||||||
styleexamples_DEPENDENCIES = $(TEST_DEPS)
|
styleexamples_DEPENDENCIES = $(TEST_DEPS)
|
||||||
testtoplevelembed_DEPENDENCIES = $(TEST_DEPS)
|
testtoplevelembed_DEPENDENCIES = $(TEST_DEPS)
|
||||||
@@ -409,6 +411,8 @@ testexpand_SOURCES = testexpand.c
|
|||||||
|
|
||||||
testexpander_SOURCES = testexpander.c
|
testexpander_SOURCES = testexpander.c
|
||||||
|
|
||||||
|
testlistview_SOURCES = testlistview.c
|
||||||
|
|
||||||
testswitch_SOURCES = testswitch.c
|
testswitch_SOURCES = testswitch.c
|
||||||
|
|
||||||
styleexamples_SOURCES = styleexamples.c
|
styleexamples_SOURCES = styleexamples.c
|
||||||
|
50
tests/testlistview.c
Normal file
50
tests/testlistview.c
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
static GtkTreeModel *
|
||||||
|
create_treemodel (void)
|
||||||
|
{
|
||||||
|
GtkListStore *store;
|
||||||
|
char *all_the_words;
|
||||||
|
char **words;
|
||||||
|
guint i;
|
||||||
|
|
||||||
|
store = gtk_list_store_new (1, G_TYPE_STRING);
|
||||||
|
|
||||||
|
if (!g_file_get_contents ("/usr/share/dict/words", &all_the_words, NULL, NULL))
|
||||||
|
return GTK_TREE_MODEL (store);
|
||||||
|
|
||||||
|
words = g_strsplit (all_the_words, "\n", -1);
|
||||||
|
g_free (all_the_words);
|
||||||
|
|
||||||
|
for (i = 0; words[i]; i++)
|
||||||
|
{
|
||||||
|
gtk_list_store_insert_with_values (store, NULL, -1, 0, words[i], -1);
|
||||||
|
}
|
||||||
|
g_print ("created GtkListStore with %u items\n", gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL));
|
||||||
|
|
||||||
|
return GTK_TREE_MODEL (store);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc, char *argv[])
|
||||||
|
{
|
||||||
|
GtkWidget *window, *list;
|
||||||
|
GtkTreeModel *model;
|
||||||
|
|
||||||
|
gtk_init (&argc, &argv);
|
||||||
|
|
||||||
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
|
g_signal_connect (window, "delete-event", G_CALLBACK (gtk_main_quit), NULL);
|
||||||
|
|
||||||
|
model = create_treemodel ();
|
||||||
|
list = gtk_list_view_new_with_model (model);
|
||||||
|
g_object_unref (model);
|
||||||
|
|
||||||
|
gtk_container_add (GTK_CONTAINER (window), list);
|
||||||
|
gtk_widget_show_all (window);
|
||||||
|
|
||||||
|
gtk_main ();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
Reference in New Issue
Block a user