#! /bin/sh /usr/share/dpatch/dpatch-run ## 06_install_smbnfs.dpatch by Sebastien Bacher ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: No description. @DPATCH@ diff -urNad gnome-system-tools-1.4.1~/interfaces/shares.glade.in gnome-system-tools-1.4.1/interfaces/shares.glade.in --- gnome-system-tools-1.4.1~/interfaces/shares.glade.in 2005-08-23 11:35:02.000000000 +0200 +++ gnome-system-tools-1.4.1/interfaces/shares.glade.in 2005-12-09 11:51:12.000000000 +0100 @@ -1778,4 +1778,155 @@ + + Sharing services are not installed + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + False + True + False + False + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST + True + True + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + gtk-close + True + GTK_RELIEF_NORMAL + True + -7 + + + + + + True + True + True + gtk-apply + True + GTK_RELIEF_NORMAL + True + -10 + + + + + 0 + False + True + GTK_PACK_END + + + + + + True + False + 0 + + + + True + You need to install at least either Samba or NFS in order to share your folders. +You can install these services or close the tool now. + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + True + + + 0 + False + False + + + + + + True + True + _Samba to share folders with Windows/Linux systems + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + + + + + True + True + _NFS to share folders with Unix/Linux systems + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + + + + 0 + True + True + + + + + + diff -urNad gnome-system-tools-1.4.1~/src/shares/transfer.c gnome-system-tools-1.4.1/src/shares/transfer.c --- gnome-system-tools-1.4.1~/src/shares/transfer.c 2005-08-23 11:35:36.000000000 +0200 +++ gnome-system-tools-1.4.1/src/shares/transfer.c 2005-12-09 11:51:59.000000000 +0100 @@ -24,19 +24,28 @@ #include #include "gst.h" +#include "../common/gst-package.h" #include "share-export.h" #include "table.h" static void check_servers (GstTool *tool, xmlNodePtr root) { - GtkWidget *dialog; + GtkWidget *dialog, *widget; gboolean smb_installed, nfs_installed; + gint response_id; smb_installed = gst_xml_element_get_boolean (root, "smbinstalled"); nfs_installed = gst_xml_element_get_boolean (root, "nfsinstalled"); if (!smb_installed && !nfs_installed) { + if (gst_package_is_installer_available ()) + { + dialog = gst_dialog_get_widget (tool->main_dialog, "install_services"); + } + else + { + dialog = gtk_message_dialog_new (GTK_WINDOW (tool->main_dialog), GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, @@ -46,8 +55,37 @@ _("You need to install at least either Samba or NFS " "in order to share your folders. The tool " "will close now.")); - gtk_dialog_run (GTK_DIALOG (dialog)); - g_signal_emit_by_name (G_OBJECT (tool), "close"); + } + + response_id = gtk_dialog_run (GTK_DIALOG (dialog)); + if(response_id == GTK_RESPONSE_APPLY) + { + int i=0; + char *packages[] = {NULL, NULL, NULL}; + + widget = gst_dialog_get_widget (tool->main_dialog, "checkbutton_smb"); + smb_installed = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)); + if(smb_installed) + packages[i++] = strdup("samba"); + + widget = gst_dialog_get_widget (tool->main_dialog, "checkbutton_nfs"); + nfs_installed = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)); + if(nfs_installed) + packages[i++] = strdup("nfs-kernel-server"); + + if(gst_packages_install(dialog, packages)) + { + if(smb_installed) gst_xml_element_set_boolean(root, "smbinstalled", TRUE); + if(nfs_installed) gst_xml_element_set_boolean(root, "nfsinstalled", TRUE); + } + + while(i<0) + g_free(packages[--i]); + + gtk_widget_hide(dialog); + } + if(!smb_installed && !nfs_installed) + g_signal_emit_by_name (G_OBJECT (tool), "close"); } }