Commit 169a989d authored by William Jon McCann's avatar William Jon McCann Committed by William Jon McCann

Use a custom scrolling widget for user list. Adapted from eog-thumb-nav.

2007-10-02  William Jon McCann  <mccann@jhu.edu>

	* gui/simple-greeter/Makefile.am:
	* gui/simple-greeter/gdm-icon-nav.c: (gdm_icon_nav_scroll_event),
	(gdm_icon_nav_adj_changed), (gdm_icon_nav_adj_value_changed),
	(gdm_icon_nav_scroll_step), (gdm_icon_nav_button_clicked),
	(gdm_icon_nav_start_scroll), (gdm_icon_nav_stop_scroll),
	(gdm_icon_nav_get_property), (gdm_icon_nav_set_property),
	(gdm_icon_nav_constructor), (gdm_icon_nav_class_init),
	(gdm_icon_nav_init), (gdm_icon_nav_new),
	(gdm_icon_nav_get_show_buttons), (gdm_icon_nav_set_show_buttons),
	(gdm_icon_nav_get_mode), (gdm_icon_nav_set_mode):
	* gui/simple-greeter/gdm-icon-nav.h:
	* gui/simple-greeter/gdm-user-chooser-widget.c:
	(gdm_user_chooser_widget_init):
	Use a custom scrolling widget for user list.  Adapted
	from eog-thumb-nav.


svn path=/branches/mccann-gobject/; revision=5327
parent 1d6d2e1b
2007-10-02 William Jon McCann <mccann@jhu.edu>
* gui/simple-greeter/Makefile.am:
* gui/simple-greeter/gdm-icon-nav.c: (gdm_icon_nav_scroll_event),
(gdm_icon_nav_adj_changed), (gdm_icon_nav_adj_value_changed),
(gdm_icon_nav_scroll_step), (gdm_icon_nav_button_clicked),
(gdm_icon_nav_start_scroll), (gdm_icon_nav_stop_scroll),
(gdm_icon_nav_get_property), (gdm_icon_nav_set_property),
(gdm_icon_nav_constructor), (gdm_icon_nav_class_init),
(gdm_icon_nav_init), (gdm_icon_nav_new),
(gdm_icon_nav_get_show_buttons), (gdm_icon_nav_set_show_buttons),
(gdm_icon_nav_get_mode), (gdm_icon_nav_set_mode):
* gui/simple-greeter/gdm-icon-nav.h:
* gui/simple-greeter/gdm-user-chooser-widget.c:
(gdm_user_chooser_widget_init):
Use a custom scrolling widget for user list. Adapted
from eog-thumb-nav.
2007-10-02 William Jon McCann <mccann@jhu.edu>
* gui/simple-greeter/Makefile.am:
......
......@@ -83,6 +83,8 @@ test_user_chooser_SOURCES = \
gdm-user-chooser-widget.c \
gdm-user-chooser-dialog.h \
gdm-user-chooser-dialog.c \
gdm-icon-nav.h \
gdm-icon-nav.c \
$(NULL)
test_user_chooser_LDADD = \
......
This diff is collapsed.
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2006 The Free Software Foundation
* Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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 Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GDM_ICON_NAV_H__
#define __GDM_ICON_NAV_H__
#include <gtk/gtk.h>
G_BEGIN_DECLS
typedef struct _GdmIconNav GdmIconNav;
typedef struct _GdmIconNavClass GdmIconNavClass;
typedef struct _GdmIconNavPrivate GdmIconNavPrivate;
#define GDM_TYPE_ICON_NAV (gdm_icon_nav_get_type ())
#define GDM_ICON_NAV(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GDM_TYPE_ICON_NAV, GdmIconNav))
#define GDM_ICON_NAV_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GDM_TYPE_ICON_NAV, GdmIconNavClass))
#define GDM_IS_ICON_NAV(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GDM_TYPE_ICON_NAV))
#define GDM_IS_ICON_NAV_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GDM_TYPE_ICON_NAV))
#define GDM_ICON_NAV_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GDM_TYPE_ICON_NAV, GdmIconNavClass))
typedef enum {
GDM_ICON_NAV_MODE_ONE_ROW,
GDM_ICON_NAV_MODE_ONE_COLUMN,
GDM_ICON_NAV_MODE_MULTIPLE_ROWS,
GDM_ICON_NAV_MODE_MULTIPLE_COLUMNS
} GdmIconNavMode;
struct _GdmIconNav {
GtkHBox base_instance;
GdmIconNavPrivate *priv;
};
struct _GdmIconNavClass {
GtkHBoxClass parent_class;
};
GType gdm_icon_nav_get_type (void) G_GNUC_CONST;
GtkWidget *gdm_icon_nav_new (GtkWidget *iconview,
GdmIconNavMode mode,
gboolean show_buttons);
gboolean gdm_icon_nav_get_show_buttons (GdmIconNav *nav);
void gdm_icon_nav_set_show_buttons (GdmIconNav *nav,
gboolean show_buttons);
GdmIconNavMode gdm_icon_nav_get_mode (GdmIconNav *nav);
void gdm_icon_nav_set_mode (GdmIconNav *nav,
GdmIconNavMode mode);
G_END_DECLS
#endif /* __GDM_ICON_NAV_H__ */
......@@ -33,6 +33,8 @@
#include <glib/gstdio.h>
#include <gtk/gtk.h>
#include "gdm-icon-nav.h"
#include "gdm-user-chooser-widget.h"
enum {
......@@ -53,6 +55,7 @@ struct GdmUserChooserWidgetPrivate
{
GtkWidget *iconview;
GtkWidget *nav;
GHashTable *available_users;
char *current_user;
};
......@@ -492,20 +495,12 @@ compare_user (GtkTreeModel *model,
static void
gdm_user_chooser_widget_init (GdmUserChooserWidget *widget)
{
GtkWidget *scrolled;
GtkTreeModel *model;
widget->priv = GDM_USER_CHOOSER_WIDGET_GET_PRIVATE (widget);
widget->priv->available_users = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify)chooser_user_free);
scrolled = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled),
GTK_SHADOW_IN);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_box_pack_start (GTK_BOX (widget), scrolled, TRUE, TRUE, 0);
widget->priv->iconview = gtk_icon_view_new ();
gtk_icon_view_set_selection_mode (GTK_ICON_VIEW (widget->priv->iconview), GTK_SELECTION_SINGLE);
gtk_icon_view_set_orientation (GTK_ICON_VIEW (widget->priv->iconview), GTK_ORIENTATION_VERTICAL);
......@@ -517,8 +512,11 @@ gdm_user_chooser_widget_init (GdmUserChooserWidget *widget)
"selection-changed",
G_CALLBACK (on_selection_changed),
widget);
gtk_container_add (GTK_CONTAINER (scrolled), widget->priv->iconview);
widget->priv->nav = gdm_icon_nav_new (widget->priv->iconview,
GDM_ICON_NAV_MODE_ONE_ROW,
TRUE);
gtk_box_pack_start (GTK_BOX (widget), widget->priv->nav, TRUE, TRUE, 0);
model = (GtkTreeModel *)gtk_list_store_new (3,
GDK_TYPE_PIXBUF,
......
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