Commit d9948e20 authored by William Jon McCann's avatar William Jon McCann Committed by William Jon McCann

Add a basic session chooser widget.

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

	* configure.ac:
	* gui/simple-greeter/Makefile.am:
	* gui/simple-greeter/gdm-session-chooser-dialog.c:
	(gdm_session_chooser_dialog_get_current_session_name),
	(gdm_session_chooser_dialog_set_property),
	(gdm_session_chooser_dialog_get_property),
	(gdm_session_chooser_dialog_constructor),
	(gdm_session_chooser_dialog_dispose),
	(gdm_session_chooser_dialog_class_init), (on_response),
	(gdm_session_chooser_dialog_init),
	(gdm_session_chooser_dialog_finalize),
	(gdm_session_chooser_dialog_new):
	* gui/simple-greeter/gdm-session-chooser-dialog.h:
	* gui/simple-greeter/gdm-session-chooser-widget.c:
	(chooser_session_free),
	(gdm_session_chooser_widget_get_current_session_name),
	(select_name),
	(gdm_session_chooser_widget_set_current_session_name),
	(gdm_session_chooser_widget_set_property),
	(gdm_session_chooser_widget_get_property),
	(gdm_session_chooser_widget_constructor),
	(gdm_session_chooser_widget_dispose),
	(gdm_session_chooser_widget_class_init), (on_session_selected),
	(get_flags_from_key_file), (load_session_file),
	(collect_sessions_from_directory),
	(collect_sessions_from_directories), (collect_sessions),
	(on_row_activated), (add_session_to_model), (populate_model),
	(gdm_session_chooser_widget_init),
	(gdm_session_chooser_widget_finalize),
	(gdm_session_chooser_widget_new):
	* gui/simple-greeter/gdm-session-chooser-widget.h:
	* gui/simple-greeter/test-session-chooser.c: (main):
	Add a basic session chooser widget.


svn path=/branches/mccann-gobject/; revision=5324
parent e05a5a07
2007-10-01 William Jon McCann <mccann@jhu.edu>
* configure.ac:
* gui/simple-greeter/Makefile.am:
* gui/simple-greeter/gdm-session-chooser-dialog.c:
(gdm_session_chooser_dialog_get_current_session_name),
(gdm_session_chooser_dialog_set_property),
(gdm_session_chooser_dialog_get_property),
(gdm_session_chooser_dialog_constructor),
(gdm_session_chooser_dialog_dispose),
(gdm_session_chooser_dialog_class_init), (on_response),
(gdm_session_chooser_dialog_init),
(gdm_session_chooser_dialog_finalize),
(gdm_session_chooser_dialog_new):
* gui/simple-greeter/gdm-session-chooser-dialog.h:
* gui/simple-greeter/gdm-session-chooser-widget.c:
(chooser_session_free),
(gdm_session_chooser_widget_get_current_session_name),
(select_name),
(gdm_session_chooser_widget_set_current_session_name),
(gdm_session_chooser_widget_set_property),
(gdm_session_chooser_widget_get_property),
(gdm_session_chooser_widget_constructor),
(gdm_session_chooser_widget_dispose),
(gdm_session_chooser_widget_class_init), (on_session_selected),
(get_flags_from_key_file), (load_session_file),
(collect_sessions_from_directory),
(collect_sessions_from_directories), (collect_sessions),
(on_row_activated), (add_session_to_model), (populate_model),
(gdm_session_chooser_widget_init),
(gdm_session_chooser_widget_finalize),
(gdm_session_chooser_widget_new):
* gui/simple-greeter/gdm-session-chooser-widget.h:
* gui/simple-greeter/test-session-chooser.c: (main):
Add a basic session chooser widget.
2007-09-24 William Jon McCann <mccann@jhu.edu>
* daemon/gdm-session-worker.c: (gdm_session_worker_initialize_pam):
......
......@@ -110,22 +110,6 @@ if test x$withval != x; then
USER_POST_PATH="$withval"
fi
dnl
dnl PAM prefix
dnl
withval=""
AC_ARG_WITH(pam-prefix,
[ --with-pam-prefix=<prefix> specify where pam files go],[
if test x$withval != x; then
AC_MSG_RESULT("PAM files will be installed in prefix ${withval}.")
fi])
if test x$withval != x; then
PAM_PREFIX="$withval"
else
PAM_PREFIX='${sysconfdir}'
fi
AC_SUBST(PAM_PREFIX)
dnl
dnl file that sets LANG
dnl
......@@ -393,9 +377,24 @@ AC_CHECK_HEADERS(linux/vt.h, [
AC_SUBST(GDMOPEN)
dnl ---------------------------------------------------------------------------
dnl - Check for PAM
dnl - Check for PAM stuff
dnl ---------------------------------------------------------------------------
dnl PAM prefix
withval=""
AC_ARG_WITH(pam-prefix,
[ --with-pam-prefix=<prefix> specify where pam files go],[
if test x$withval != x; then
AC_MSG_RESULT("PAM files will be installed in prefix ${withval}.")
fi])
if test x$withval != x; then
PAM_PREFIX="$withval"
else
PAM_PREFIX='${sysconfdir}'
fi
AC_SUBST(PAM_PREFIX)
have_pam=no
AC_CHECK_LIB(pam, pam_start, have_pam=yes)
......@@ -408,8 +407,21 @@ AC_SUBST(PAM_LIBS)
AC_CHECK_HEADERS([security/pam_modutil.h security/pam_ext.h])
AC_CHECK_LIB(pam, pam_syslog, [AC_DEFINE(HAVE_PAM_SYSLOG, [], [Define to 1 if you have the pam_syslog function])])
dnl test whether struct pam_message is const (Linux) or not (Sun)
if test "x$have_pam" = "xyes"; then
pam_appl_h="$ac_pam_includes/security/pam_appl.h"
AC_MSG_CHECKING(for const pam_message)
AC_EGREP_HEADER([struct pam_message],
$pam_appl_h,
[ AC_EGREP_HEADER([const struct pam_message],
$pam_appl_h,
[AC_MSG_RESULT(["const: Linux-type PAM"]) ],
[AC_MSG_RESULT(["nonconst: Sun-type PAM"])
AC_DEFINE(PAM_MESSAGE_NONCONST, 1, [Define if your PAM support takes non-const arguments (Solaris)])]
)],
[AC_MSG_RESULT(["not found - assume const, Linux-type PAM"])]
)
fi
dnl Check if we can use the setpenv function to add specialvariable
dnl to the environment (such as the /etc/environment file under AIX)
......
......@@ -8,6 +8,7 @@ INCLUDES = \
-I$(top_srcdir)/common \
-I$(top_srcdir)/libgreeter \
-I$(top_srcdir)/gui/simple-greeter/libnotificationarea \
-DDMCONFDIR=\""$(dmconfdir)"\" \
-DGDMCONFDIR=\"$(gdmconfdir)\" \
-DDATADIR=\""$(datadir)"\" \
-DLIBLOCALEDIR=\""$(libdir)/locale"\" \
......@@ -25,6 +26,7 @@ noinst_PROGRAMS = \
test-greeter-background \
test-greeter-panel \
test-language-chooser \
test-session-chooser \
$(NULL)
test_greeter_background_SOURCES = \
......@@ -62,6 +64,18 @@ test_language_chooser_LDADD = \
$(GUI_LIBS) \
$(NULL)
test_session_chooser_SOURCES = \
test-session-chooser.c \
gdm-session-chooser-widget.h \
gdm-session-chooser-widget.c \
gdm-session-chooser-dialog.h \
gdm-session-chooser-dialog.c \
$(NULL)
test_session_chooser_LDADD = \
$(GUI_LIBS) \
$(NULL)
libexec_PROGRAMS = \
gdm-simple-greeter
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* 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.
*
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <glib.h>
#include <glib/gi18n.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include "gdm-session-chooser-widget.h"
#include "gdm-session-chooser-dialog.h"
#define GDM_SESSION_CHOOSER_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_SESSION_CHOOSER_DIALOG, GdmSessionChooserDialogPrivate))
struct GdmSessionChooserDialogPrivate
{
GtkWidget *chooser_widget;
};
enum {
PROP_0,
};
static void gdm_session_chooser_dialog_class_init (GdmSessionChooserDialogClass *klass);
static void gdm_session_chooser_dialog_init (GdmSessionChooserDialog *session_chooser_dialog);
static void gdm_session_chooser_dialog_finalize (GObject *object);
G_DEFINE_TYPE (GdmSessionChooserDialog, gdm_session_chooser_dialog, GTK_TYPE_DIALOG)
char *
gdm_session_chooser_dialog_get_current_session_name (GdmSessionChooserDialog *dialog)
{
char *session_name;
g_return_val_if_fail (GDM_IS_SESSION_CHOOSER_DIALOG (dialog), NULL);
session_name = gdm_session_chooser_widget_get_current_session_name (GDM_SESSION_CHOOSER_WIDGET (dialog->priv->chooser_widget));
return session_name;
}
static void
gdm_session_chooser_dialog_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GdmSessionChooserDialog *self;
self = GDM_SESSION_CHOOSER_DIALOG (object);
switch (prop_id) {
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gdm_session_chooser_dialog_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GdmSessionChooserDialog *self;
self = GDM_SESSION_CHOOSER_DIALOG (object);
switch (prop_id) {
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static GObject *
gdm_session_chooser_dialog_constructor (GType type,
guint n_construct_properties,
GObjectConstructParam *construct_properties)
{
GdmSessionChooserDialog *session_chooser_dialog;
GdmSessionChooserDialogClass *klass;
klass = GDM_SESSION_CHOOSER_DIALOG_CLASS (g_type_class_peek (GDM_TYPE_SESSION_CHOOSER_DIALOG));
session_chooser_dialog = GDM_SESSION_CHOOSER_DIALOG (G_OBJECT_CLASS (gdm_session_chooser_dialog_parent_class)->constructor (type,
n_construct_properties,
construct_properties));
return G_OBJECT (session_chooser_dialog);
}
static void
gdm_session_chooser_dialog_dispose (GObject *object)
{
GdmSessionChooserDialog *session_chooser_dialog;
session_chooser_dialog = GDM_SESSION_CHOOSER_DIALOG (object);
G_OBJECT_CLASS (gdm_session_chooser_dialog_parent_class)->dispose (object);
}
static void
gdm_session_chooser_dialog_class_init (GdmSessionChooserDialogClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->get_property = gdm_session_chooser_dialog_get_property;
object_class->set_property = gdm_session_chooser_dialog_set_property;
object_class->constructor = gdm_session_chooser_dialog_constructor;
object_class->dispose = gdm_session_chooser_dialog_dispose;
object_class->finalize = gdm_session_chooser_dialog_finalize;
g_type_class_add_private (klass, sizeof (GdmSessionChooserDialogPrivate));
}
static void
on_response (GdmSessionChooserDialog *dialog,
gint response_id)
{
switch (response_id) {
default:
break;
}
}
static void
gdm_session_chooser_dialog_init (GdmSessionChooserDialog *dialog)
{
dialog->priv = GDM_SESSION_CHOOSER_DIALOG_GET_PRIVATE (dialog);
dialog->priv->chooser_widget = gdm_session_chooser_widget_new ();
gdm_session_chooser_widget_set_current_session_name (GDM_SESSION_CHOOSER_WIDGET (dialog->priv->chooser_widget), g_getenv ("LANG"));
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), dialog->priv->chooser_widget);
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
g_signal_connect (dialog,
"response",
G_CALLBACK (on_response),
dialog);
gtk_widget_show_all (GTK_WIDGET (dialog));
}
static void
gdm_session_chooser_dialog_finalize (GObject *object)
{
GdmSessionChooserDialog *session_chooser_dialog;
g_return_if_fail (object != NULL);
g_return_if_fail (GDM_IS_SESSION_CHOOSER_DIALOG (object));
session_chooser_dialog = GDM_SESSION_CHOOSER_DIALOG (object);
g_return_if_fail (session_chooser_dialog->priv != NULL);
G_OBJECT_CLASS (gdm_session_chooser_dialog_parent_class)->finalize (object);
}
GtkWidget *
gdm_session_chooser_dialog_new (void)
{
GObject *object;
object = g_object_new (GDM_TYPE_SESSION_CHOOSER_DIALOG,
NULL);
return GTK_WIDGET (object);
}
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* 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_SESSION_CHOOSER_DIALOG_H
#define __GDM_SESSION_CHOOSER_DIALOG_H
#include <glib-object.h>
#include <gtk/gtkdialog.h>
G_BEGIN_DECLS
#define GDM_TYPE_SESSION_CHOOSER_DIALOG (gdm_session_chooser_dialog_get_type ())
#define GDM_SESSION_CHOOSER_DIALOG(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDM_TYPE_SESSION_CHOOSER_DIALOG, GdmSessionChooserDialog))
#define GDM_SESSION_CHOOSER_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDM_TYPE_SESSION_CHOOSER_DIALOG, GdmSessionChooserDialogClass))
#define GDM_IS_SESSION_CHOOSER_DIALOG(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDM_TYPE_SESSION_CHOOSER_DIALOG))
#define GDM_IS_SESSION_CHOOSER_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDM_TYPE_SESSION_CHOOSER_DIALOG))
#define GDM_SESSION_CHOOSER_DIALOG_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDM_TYPE_SESSION_CHOOSER_DIALOG, GdmSessionChooserDialogClass))
typedef struct GdmSessionChooserDialogPrivate GdmSessionChooserDialogPrivate;
typedef struct
{
GtkDialog parent;
GdmSessionChooserDialogPrivate *priv;
} GdmSessionChooserDialog;
typedef struct
{
GtkDialogClass parent_class;
} GdmSessionChooserDialogClass;
GType gdm_session_chooser_dialog_get_type (void);
GtkWidget * gdm_session_chooser_dialog_new (void);
char * gdm_session_chooser_dialog_get_current_session_name (GdmSessionChooserDialog *dialog);
G_END_DECLS
#endif /* __GDM_SESSION_CHOOSER_DIALOG_H */
This diff is collapsed.
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* 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_SESSION_CHOOSER_WIDGET_H
#define __GDM_SESSION_CHOOSER_WIDGET_H
#include <glib-object.h>
#include <gtk/gtkvbox.h>
G_BEGIN_DECLS
#define GDM_TYPE_SESSION_CHOOSER_WIDGET (gdm_session_chooser_widget_get_type ())
#define GDM_SESSION_CHOOSER_WIDGET(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDM_TYPE_SESSION_CHOOSER_WIDGET, GdmSessionChooserWidget))
#define GDM_SESSION_CHOOSER_WIDGET_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDM_TYPE_SESSION_CHOOSER_WIDGET, GdmSessionChooserWidgetClass))
#define GDM_IS_SESSION_CHOOSER_WIDGET(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDM_TYPE_SESSION_CHOOSER_WIDGET))
#define GDM_IS_SESSION_CHOOSER_WIDGET_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDM_TYPE_SESSION_CHOOSER_WIDGET))
#define GDM_SESSION_CHOOSER_WIDGET_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDM_TYPE_SESSION_CHOOSER_WIDGET, GdmSessionChooserWidgetClass))
typedef struct GdmSessionChooserWidgetPrivate GdmSessionChooserWidgetPrivate;
typedef struct
{
GtkVBox parent;
GdmSessionChooserWidgetPrivate *priv;
} GdmSessionChooserWidget;
typedef struct
{
GtkVBoxClass parent_class;
/* signals */
void (* session_activated) (GdmSessionChooserWidget *widget);
} GdmSessionChooserWidgetClass;
GType gdm_session_chooser_widget_get_type (void);
GtkWidget * gdm_session_chooser_widget_new (void);
char * gdm_session_chooser_widget_get_current_session_name (GdmSessionChooserWidget *widget);
void gdm_session_chooser_widget_set_current_session_name (GdmSessionChooserWidget *widget,
const char *session_name);
G_END_DECLS
#endif /* __GDM_SESSION_CHOOSER_WIDGET_H */
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* 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
*/
#include "config.h"
#include <stdlib.h>
#include <libintl.h>
#include <locale.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <errno.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "gdm-session-chooser-dialog.h"
int
main (int argc, char *argv[])
{
GtkWidget *dialog;
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
setlocale (LC_ALL, "");
gtk_init (&argc, &argv);
dialog = gdm_session_chooser_dialog_new ();
gtk_widget_set_size_request (dialog, 480, 480);
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) {
char *name;
name = gdm_session_chooser_dialog_get_current_session_name (GDM_SESSION_CHOOSER_DIALOG (dialog));
g_message ("Session: %s", name ? name : "(null)");
g_free (name);
}
gtk_widget_destroy (dialog);
return 0;
}
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