diff options
author | George Lebl <jirka@5z.com> | 2003-07-15 17:52:22 +0000 |
---|---|---|
committer | George Lebl <jirka@src.gnome.org> | 2003-07-15 17:52:22 +0000 |
commit | bac29b1c270adaed8b3fba2f7f074ce01276a564 (patch) | |
tree | 0cc93972c4020d4b55f033f53de1078664846bcb | |
parent | f7b84760777ddd89aa2284418ffee423b98fd08b (diff) | |
download | gdm-bac29b1c270adaed8b3fba2f7f074ce01276a564.tar.gz |
Fix #97774 by resetting the rlimits back to infinity after we fork the
Mon Jul 14 16:44:19 2003 George Lebl <jirka@5z.com>
* daemon/misc.[ch], daemon/slave.c: Fix #97774 by resetting the
rlimits back to infinity after we fork the user session.
* config/gdm.conf.in, daemon/gdm.h: The default for
AlwaysRestartServer is now again false, since it turns out to be
a LOT nicer with buggy X servers (and it turns out quite a lot of
people have these).
* daemon/slave.c: properly guess the failsafeness of a session and
don't re-guess it again
* daemon/slave.c: when under the influence of rlimits never
ABORT a display since it really could just be that we're hitting
stupid limits (definately set way too low).
* daemon/slave.c, daemon/server.c, daemon/misc.c: Be extra careful
about when to reset signals to avoid races (unlikely though they
may be)
-rw-r--r-- | NEWS | 15 | ||||
-rw-r--r-- | configure.in | 4 | ||||
-rw-r--r-- | gui/Makefile.am | 3 | ||||
-rw-r--r-- | gui/gdmchooser-strings.c | 8 | ||||
-rw-r--r-- | gui/gdmchooser.c | 203 | ||||
-rw-r--r-- | gui/gdmchooser.glade | 85 | ||||
-rw-r--r-- | gui/gdmlogin.c | 1 | ||||
-rw-r--r-- | gui/gdmsetup.c | 2 | ||||
-rw-r--r-- | gui/greeter/greeter_action_language.c | 1 | ||||
-rw-r--r-- | gui/greeter/greeter_canvas_item.c | 1 |
10 files changed, 156 insertions, 167 deletions
@@ -10,14 +10,19 @@ Ahh news... - Fix DNS lookup stuff in XDMCP for places without DNS. Also cache last result of DNS lookup to cut down traffic during session setup. -- daemon, gdmgreeter and gdmlogin don't link against libgnome and - friends (gdmgreeter still uses canvas). This reduces number of - libs linked by daemon from 46 to 26, for gdmgreeter this goes - from 56 to 32 and for gdmlogin this goes from 52 to 22 +- daemon, gdmgreeter, gdmlogin and gdmchooser don't link against + libgnome and friends (gdmgreeter still uses canvas). This + reduces number of libs linked by daemon from 46 to 26, for + gdmgreeter this goes from 56 to 32 and for gdmlogin this goes + from 52 to 22, and gdmchooser is down to 27 - If a greeter crashes within 10 seconds of display start, try running a different greeter (and telling the user that) +- Fix the chooser so that it actually chooses the host that + you clicked on and not some random one. This also changes + the chooser to use GtkTreeView + - Fix #97774 by resetting the rlimits back after we fork the user session. Also make AlwaysRestartServer default to false again since it was a workaround for this bug. @@ -64,7 +69,7 @@ Ahh news... - Translation updates (Danilo Segan, Serbian team, Metin Amiroff, Christian Rose, Kjartan Maraas, Artur Flinta, Vincent van Adrighem, Valek Filippov, Laurent Dhima, Christophe Merlet, Mohammad DAMT, - Dafydd Harries) + Dafydd Harries, Kang Jeong-Hee, Simos Xenitellis) 2.4.2.96 stuff: diff --git a/configure.in b/configure.in index d4049ab6..151fde5f 100644 --- a/configure.in +++ b/configure.in @@ -131,6 +131,10 @@ PKG_CHECK_MODULES(GUI, gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED gtk+-2.0 >= $GTK_R AC_SUBST(GUI_CFLAGS) AC_SUBST(GUI_LIBS) +PKG_CHECK_MODULES(GUIGLADE, gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED gtk+-2.0 >= $GTK_REQUIRED libglade-2.0 >= $LIBGLADE_REQUIRED) +AC_SUBST(GUIGLADE_CFLAGS) +AC_SUBST(GUIGLADE_LIBS) + PKG_CHECK_MODULES(GUING, gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED gtk+-2.0 >= $GTK_REQUIRED) AC_SUBST(GUING_CFLAGS) AC_SUBST(GUING_LIBS) diff --git a/gui/Makefile.am b/gui/Makefile.am index 8dd1f571..adafa843 100644 --- a/gui/Makefile.am +++ b/gui/Makefile.am @@ -71,9 +71,10 @@ gdmsetup_SOURCES = \ gdmchooser_LDFLAGS = -export-dynamic gdmchooser_LDADD = \ libgdmwm.a \ - $(GUI_LIBS) \ + $(GUIGLADE_LIBS) \ $(X_LIBS) \ $(XDMCP_LIBS) \ + -lpopt \ -lX11 \ $(XINERAMA_LIBS) \ $(X_EXTRA_LIBS) \ diff --git a/gui/gdmchooser-strings.c b/gui/gdmchooser-strings.c index d9c2a017..78cb77ad 100644 --- a/gui/gdmchooser-strings.c +++ b/gui/gdmchooser-strings.c @@ -1,7 +1,7 @@ /* * Soubor s přeložitelnými řetězci generovaný programem Glade. - * Přidejte tento soubor do POTFILES.in svého projektu. - * NEPŘEKLÁDEJTE JEJ jako součást své aplikace. + * Přidejte tento soubor do souboru vašeho projektu POTFILES.in. + * NEPŘEKLÁDEJTE JEJ jako součást vaší aplikace. */ gchar *s = N_("GDM Host Chooser"); @@ -15,7 +15,3 @@ gchar *s = N_("Add host: "); gchar *s = N_("*"); gchar *s = N_("Query and add this host to the above list"); gchar *s = N_("Add"); -gchar *s = N_("The main area of this application shows the hosts on the local network that have \"XDMCP\" enabled. This allows users to login remotely to other machines as if they were logged on using the console.\n" - "\n" - "You can rescan the network for new hosts by clicking \"Refresh\". When you have selected a host click \"Connect\" to open a session to that machine."); -gchar *s = N_("Information"); diff --git a/gui/gdmchooser.c b/gui/gdmchooser.c index 6d71ed8b..7b282d7f 100644 --- a/gui/gdmchooser.c +++ b/gui/gdmchooser.c @@ -56,6 +56,12 @@ static gboolean RUNNING_UNDER_GDM = FALSE; +enum { + CHOOSER_LIST_ICON_COLUMN = 0, + CHOOSER_LIST_LABEL_COLUMN, + CHOOSER_LIST_HOST_COLUMN +}; + typedef struct _GdmChooserHost GdmChooserHost; struct _GdmChooserHost { gchar *name; @@ -63,7 +69,6 @@ struct _GdmChooserHost { struct in_addr ia; GdkPixbuf *picture; gboolean willing; - int pos; }; @@ -154,8 +159,25 @@ static GIOChannel *channel; static GList *hosts = NULL; static GdkPixbuf *defhostimg; static GtkWidget *browser; +static GtkTreeModel *browser_model; static GdmChooserHost *curhost; +static gboolean +find_host_in_list (GdmChooserHost *host, GtkTreeIter *iter) +{ + if (gtk_tree_model_get_iter_first (browser_model, iter)) { + do { + GdmChooserHost *lhost; + gtk_tree_model_get (browser_model, iter, + CHOOSER_LIST_HOST_COLUMN, &lhost, + -1); + if (lhost == host) + return TRUE; + } while (gtk_tree_model_iter_next (browser_model, iter)); + } + return FALSE; +} + static void setup_cursor (GdkCursorType type) { @@ -181,18 +203,6 @@ gdm_chooser_host_dispose (GdmChooserHost *host) g_free (host); } -static gint -gdm_chooser_sort_func (gpointer d1, gpointer d2) -{ - GdmChooserHost *a = d1; - GdmChooserHost *b = d2; - - if (!d1 || !d2) - return 0; - - return strcmp (a->name, b->name); -} - static GdmChooserHost * gdm_chooser_host_alloc (const char *hostname, const char *description, @@ -202,28 +212,14 @@ gdm_chooser_host_alloc (const char *hostname, GdmChooserHost *host; GdkPixbuf *img; gchar *hostimg; - GList *hostl; host = g_new0 (GdmChooserHost, 1); - host->pos = -1; host->name = g_strdup (hostname); host->desc = g_strdup (description); memcpy (&host->ia, ia, sizeof (struct in_addr)); host->willing = willing; - hostl = g_list_find_custom (hosts, - host, - (GCompareFunc) gdm_chooser_sort_func); - /* replace */ - if (hostl != NULL) { - GdmChooserHost *old = hostl->data; - hostl->data = host; - gdm_chooser_host_dispose (old); - } else { - hosts = g_list_insert_sorted (hosts, - host, - (GCompareFunc) gdm_chooser_sort_func); - } + hosts = g_list_prepend (hosts, host); if ( ! willing) return host; @@ -271,22 +267,39 @@ static void gdm_chooser_browser_add_host (GdmChooserHost *host) { if (host->willing) { - /* FIXME: the \n doesn't actually propagate - * since the icon list is a broken piece of horsedung */ - char *temp = g_strconcat (host->name, " \n", - host->desc, NULL); - host->pos = - gnome_icon_list_append_pixbuf (GNOME_ICON_LIST (browser), - host->picture, - NULL /* icon_filename */, - temp); - g_free (temp); + GtkTreeIter iter = {0}; + const char *addr = inet_ntoa (host->ia); + char *label; + + if (strcmp (addr, host->name) == 0) + label = g_strdup_printf ("%s\n%s", + host->name, + host->desc); + else + label = g_strdup_printf ("%s (%s)\n%s", + host->name, + addr, + host->desc); + + gtk_list_store_append (GTK_LIST_STORE (browser_model), &iter); + gtk_list_store_set (GTK_LIST_STORE (browser_model), &iter, + CHOOSER_LIST_ICON_COLUMN, host->picture, + CHOOSER_LIST_LABEL_COLUMN, label, + CHOOSER_LIST_HOST_COLUMN, host, + -1); + g_free (label); if (added_addr != NULL && memcmp (&host->ia, added_addr, sizeof (struct in_addr)) == 0) { - gnome_icon_list_select_icon (GNOME_ICON_LIST (browser), - host->pos); + GtkTreeSelection *selection; + GtkTreePath *path = gtk_tree_model_get_path (browser_model, &iter); + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (browser)); + gtk_tree_selection_select_iter (selection, &iter); + gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (browser), + path, NULL, + FALSE, 0.0, 0.0); + gtk_tree_path_free (path); gtk_widget_grab_focus (manage); } g_free (added_host); @@ -608,7 +621,7 @@ gdm_chooser_xdmcp_discover (void) gtk_widget_set_sensitive (GTK_WIDGET (manage), FALSE); gtk_widget_set_sensitive (GTK_WIDGET (rescan), FALSE); - gnome_icon_list_clear (GNOME_ICON_LIST (browser)); + gtk_list_store_clear (GTK_LIST_STORE (browser_model)); gtk_widget_set_sensitive (GTK_WIDGET (browser), FALSE); gtk_label_set_text (GTK_LABEL (status_label), _(scanning_message)); @@ -887,9 +900,16 @@ gdm_chooser_add_host (void) host = gdm_host_known (ia); if (host != NULL) { - if (host->pos >= 0) { - gnome_icon_list_select_icon (GNOME_ICON_LIST (browser), - host->pos); + GtkTreeIter iter = {0}; + if (find_host_in_list (host, &iter)) { + GtkTreeSelection *selection; + GtkTreePath *path = gtk_tree_model_get_path (browser_model, &iter); + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (browser)); + gtk_tree_selection_select_iter (selection, &iter); + gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (browser), + path, NULL, + FALSE, 0.0, 0.0); + gtk_tree_path_free (path); gtk_widget_grab_focus (manage); } else { /* hmm, probably not willing, ping the host then for @@ -1036,43 +1056,29 @@ gdm_chooser_parse_config (void) if (GdmIconMaxHeight < 0) GdmIconMaxHeight = 128; } -static GdmChooserHost * -gdm_nth_willing_host (int n) +static void +host_selected (GtkTreeSelection *selection, gpointer data) { - GList *li; - int i; + GtkTreeModel *tm = NULL; + GtkTreeIter iter = {0}; - i = 0; - for (li = hosts; li != NULL; li = li->next) { - GdmChooserHost *host = li->data; - if (host->willing) { - if (i == n) - return host; - i++; - } - } - return NULL; -} - - -void -gdm_chooser_browser_select (GtkWidget *widget, gint selected, GdkEvent *event) -{ - curhost = gdm_nth_willing_host (selected); - gtk_widget_set_sensitive (manage, TRUE); + curhost = NULL; - if (event != NULL && - event->type == GDK_2BUTTON_PRESS) { - gdm_chooser_manage (NULL, NULL); + if (gtk_tree_selection_get_selected (selection, &tm, &iter)) { + gtk_tree_model_get (tm, &iter, CHOOSER_LIST_HOST_COLUMN, + &curhost, -1); } -} + gtk_widget_set_sensitive (manage, curhost != NULL); +} -void -gdm_chooser_browser_unselect (GtkWidget *widget, gint selected, GdkEvent *event) +static void +row_activated (GtkTreeView *tree_view, + GtkTreePath *path, + GtkTreeViewColumn *column) { - curhost = NULL; - gtk_widget_set_sensitive (manage, FALSE); + if (curhost != NULL) + gdm_chooser_manage (NULL, NULL); } void @@ -1109,12 +1115,14 @@ gdm_chooser_gui_init (void) { int width; int height; + GtkTreeSelection *selection; + GtkTreeViewColumn *column; glade_helper_add_glade_directory (GDM_GLADE_DIR); glade_helper_search_gnome_dirs (FALSE); /* Enable theme */ - if (GdmGtkRC) + if (RUNNING_UNDER_GDM && GdmGtkRC) gtk_rc_parse (GdmGtkRC); /* Load default host image */ @@ -1151,12 +1159,45 @@ gdm_chooser_gui_init (void) GTK_TYPE_ENTRY); browser = glade_helper_get (chooser_app, "chooser_iconlist", - GNOME_TYPE_ICON_LIST); - gnome_icon_list_freeze (GNOME_ICON_LIST (browser)); - gnome_icon_list_set_separators (GNOME_ICON_LIST (browser), " /-_.\n"); - gnome_icon_list_set_icon_width (GNOME_ICON_LIST (browser), GdmIconMaxWidth + 20); - gnome_icon_list_set_icon_border (GNOME_ICON_LIST (browser), 2); - gnome_icon_list_thaw (GNOME_ICON_LIST (browser)); + GTK_TYPE_TREE_VIEW); + + gtk_dialog_set_has_separator (GTK_DIALOG (chooser), FALSE); + + gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (browser), TRUE); + + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (browser)); + gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE); + + g_signal_connect (selection, "changed", + G_CALLBACK (host_selected), + NULL); + g_signal_connect (browser, "row_activated", + G_CALLBACK (row_activated), + NULL); + + browser_model = (GtkTreeModel *)gtk_list_store_new (3, + GDK_TYPE_PIXBUF, + G_TYPE_STRING, + G_TYPE_POINTER); + gtk_tree_view_set_model (GTK_TREE_VIEW (browser), browser_model); + column = gtk_tree_view_column_new_with_attributes + ("Icon", + gtk_cell_renderer_pixbuf_new (), + "pixbuf", CHOOSER_LIST_ICON_COLUMN, + NULL); + gtk_tree_view_append_column (GTK_TREE_VIEW (browser), column); + + column = gtk_tree_view_column_new_with_attributes + ("Hostname", + gtk_cell_renderer_text_new (), + "text", CHOOSER_LIST_LABEL_COLUMN, + NULL); + gtk_tree_view_append_column (GTK_TREE_VIEW (browser), column); + + gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (browser_model), + CHOOSER_LIST_LABEL_COLUMN, + GTK_SORT_ASCENDING); + if ( ! GdmAllowAdd) { GtkWidget *w = glade_helper_get (chooser_app, "add_hbox", diff --git a/gui/gdmchooser.glade b/gui/gdmchooser.glade index 42bc6f9c..7c8b4618 100644 --- a/gui/gdmchooser.glade +++ b/gui/gdmchooser.glade @@ -2,9 +2,9 @@ <!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> <glade-interface> -<requires lib="gnome"/> <widget class="GtkDialog" id="gdmchooser_main"> + <property name="border_width">6</property> <property name="visible">True</property> <property name="title" translatable="yes">GDM Host Chooser</property> <property name="type">GTK_WINDOW_TOPLEVEL</property> @@ -20,7 +20,7 @@ <widget class="GtkVBox" id="dialog-vbox1"> <property name="visible">True</property> <property name="homogeneous">False</property> - <property name="spacing">0</property> + <property name="spacing">6</property> <child internal-child="action_area"> <widget class="GtkHButtonBox" id="dialog-action_area1"> @@ -152,15 +152,12 @@ <property name="use_underline">False</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> + <property name="wrap">True</property> <property name="selectable">False</property> - <property name="xalign">0.5</property> + <property name="xalign">0</property> <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> - <accessibility> - <atkrelation target="chooser_iconlist" type="label-for"/> - </accessibility> </widget> <packing> <property name="padding">0</property> @@ -179,21 +176,13 @@ <property name="window_placement">GTK_CORNER_TOP_LEFT</property> <child> - <widget class="GnomeIconList" id="chooser_iconlist"> + <widget class="GtkTreeView" id="chooser_iconlist"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="selection_mode">GTK_SELECTION_SINGLE</property> - <property name="icon_width">78</property> - <property name="row_spacing">4</property> - <property name="column_spacing">2</property> - <property name="text_spacing">2</property> - <property name="text_editable">False</property> - <property name="text_static">False</property> - <accessibility> - <atkrelation target="status_label" type="labelled-by"/> - </accessibility> - <signal name="select_icon" handler="gdm_chooser_browser_select" last_modification_time="Tue, 09 Jul 2002 02:43:48 GMT"/> - <signal name="unselect_icon" handler="gdm_chooser_browser_unselect" last_modification_time="Tue, 09 Jul 2002 02:44:00 GMT"/> + <property name="headers_visible">False</property> + <property name="rules_hint">True</property> + <property name="reorderable">False</property> + <property name="enable_search">True</property> </widget> </child> </widget> @@ -208,7 +197,7 @@ <widget class="GtkHBox" id="add_hbox"> <property name="visible">True</property> <property name="homogeneous">False</property> - <property name="spacing">0</property> + <property name="spacing">6</property> <child> <widget class="GtkLabel" id="add_label"> @@ -224,8 +213,8 @@ <property name="xpad">0</property> <property name="ypad">0</property> <accessibility> - <atkrelation target="add_entry" type="label-for"/> <atkrelation target="add_button" type="label-for"/> + <atkrelation target="add_entry" type="label-for"/> </accessibility> </widget> <packing> @@ -288,56 +277,4 @@ </child> </widget> -<widget class="GnomeMessageBox" id="gdmchooser_help_dialog"> - <property name="visible">True</property> - <property name="message_box_type">GNOME_MESSAGE_BOX_INFO</property> - <property name="message" translatable="yes">The main area of this application shows the hosts on the local network that have "XDMCP" enabled. This allows users to login remotely to other machines as if they were logged on using the console. - -You can rescan the network for new hosts by clicking "Refresh". When you have selected a host click "Connect" to open a session to that machine.</property> - <property name="title" translatable="yes">Information</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="resizable">False</property> - <property name="destroy_with_parent">False</property> - <property name="auto_close">True</property> - <property name="hide_on_close">False</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="dialog-vbox3"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">8</property> - - <child internal-child="action_area"> - <widget class="GtkHButtonBox" id="dialog-action_area3"> - <property name="visible">True</property> - <property name="layout_style">GTK_BUTTONBOX_END</property> - - <child> - <widget class="GtkButton" id="button6"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-ok</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">4</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> -</widget> - </glade-interface> diff --git a/gui/gdmlogin.c b/gui/gdmlogin.c index 8538cde9..6ffa254e 100644 --- a/gui/gdmlogin.c +++ b/gui/gdmlogin.c @@ -3212,6 +3212,7 @@ gdm_login_gui_init (void) GtkTreeViewColumn *column; browser = gtk_tree_view_new (); + gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (browser), TRUE); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (browser), FALSE); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (browser)); diff --git a/gui/gdmsetup.c b/gui/gdmsetup.c index e0f6b71c..19b9b20a 100644 --- a/gui/gdmsetup.c +++ b/gui/gdmsetup.c @@ -1825,6 +1825,8 @@ setup_graphical_themes (void) char *theme_dir = get_theme_dir (); + gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (theme_list), TRUE); + selected_theme = ve_config_get_string (ve_config_get (GDM_CONFIG_FILE), GDM_KEY_GRAPHICAL_THEME); diff --git a/gui/greeter/greeter_action_language.c b/gui/greeter/greeter_action_language.c index 8dd02c7e..3dce79cb 100644 --- a/gui/greeter/greeter_action_language.c +++ b/gui/greeter/greeter_action_language.c @@ -209,6 +209,7 @@ greeter_action_language (GreeterItemInfo *info, gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), label, FALSE, FALSE, 0); view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (lang_model)); + gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (view), TRUE); /* FIXME: we should handle this better, but things really look * like crap if we aren't always LTR */ gtk_widget_set_direction (view, GTK_TEXT_DIR_LTR); diff --git a/gui/greeter/greeter_canvas_item.c b/gui/greeter/greeter_canvas_item.c index 8f1e0692..abdec994 100644 --- a/gui/greeter/greeter_canvas_item.c +++ b/gui/greeter/greeter_canvas_item.c @@ -346,6 +346,7 @@ greeter_item_create_canvas_item (GreeterItemInfo *item) * to it then, depending on the type. Likely userlist is the * only type we support */ list = gtk_tree_view_new (); + gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (list), TRUE); swin = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (swin), GTK_SHADOW_NONE); |