~ubuntu-branches/ubuntu/edgy/gnome-system-tools/edgy

« back to all changes in this revision

Viewing changes to src/shares/shares-tool.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2006-09-05 22:55:34 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20060905225534-l34y2zttygpdskhn
Tags: 2.15.3-0ubuntu1
* New upstream version:
  Common:
  - Code cleanups and improvements
  - Fix configuration reloading when the user has to select a platform 
  Users:
  - Add back user profiles 
  Time:
  - Add "synchronize now" button
  - Fix crasher when time-admin can't communicate with gnome-screensaver 
  Network:
  - Fix several potential crashers
  - Fix --configure and --configure-type parameters
  Shares:
  - Do not crash in --add-share 
  Services:
  - Add heaps of services descriptions
* debian/control.in:
  - updated the liboobs-1-dev requirement according to configure
* debian/gnome-system-tools.install:
  - updated profiles file to install
* debian/patches/03_install_packages.dpatch:
  - replaced by a set of new patches
* debian/patches/18_disable_uid.dpatch:
  - fixed
* debian/patches/20_fuse_as_default_group.dpatch:
  - updated
* debian/patches/98_automake.dpatch:
  - updated
* debian/profiles, debian/profiles.xml:
  - user profiles updated to the new format, 
    by Carlos Garnacho <carlosg@gnome.org>
* debian/watch:
  - updated
* Patches by Carlos Garnacho <carlosg@gnome.org>:
* debian/patches/80_gst-packages-common.dpatch,
  debian/patches/81_gst-packages-shares-admin.dpatch,
  debian/patches/82_gst-packages-time-admin.dpatch:
  - based on the previous patches by Vincent Untz, allow to install required
    packages from the corresponding tool (Ubuntu: #55988)
* debian/patches/83_network-locations-apply-button.dpatch:
  - make network-admin use an apply button instead of applying changes when
    selecting a profile

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#include <glib-object.h>
22
22
#include "shares-tool.h"
23
23
#include <glib/gi18n.h>
 
24
#include "gst.h"
24
25
 
25
26
static void gst_shares_tool_class_init (GstSharesToolClass *class);
26
27
static void gst_shares_tool_init       (GstSharesTool      *tool);
27
28
static void gst_shares_tool_finalize   (GObject            *object);
28
29
 
29
 
static void gst_shares_tool_update_gui (GstTool            *tool);
 
30
static void gst_shares_tool_update_gui    (GstTool         *tool);
 
31
static void gst_shares_tool_update_config (GstTool         *tool);
30
32
 
31
33
static void gst_shares_tool_update_services_availability (GstSharesTool *tool);
32
34
 
40
42
 
41
43
        object_class->finalize = gst_shares_tool_finalize;
42
44
        tool_class->update_gui = gst_shares_tool_update_gui;
 
45
        tool_class->update_config = gst_shares_tool_update_config;
43
46
}
44
47
 
45
48
static void
107
110
        gtk_entry_set_text (GTK_ENTRY (widget), (str) ? str : "");
108
111
}
109
112
 
 
113
static gboolean
 
114
check_servers (GstSharesTool *tool)
 
115
{
 
116
        GtkWidget *dialog;
 
117
 
 
118
        if (tool->smb_available || tool->nfs_available)
 
119
                return TRUE;
 
120
 
 
121
        dialog = gtk_message_dialog_new (GTK_WINDOW (GST_TOOL (tool)->main_dialog),
 
122
                                         GTK_DIALOG_MODAL,
 
123
                                         GTK_MESSAGE_WARNING,
 
124
                                         GTK_BUTTONS_CLOSE,
 
125
                                         _("Sharing services are not installed"));
 
126
        gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog),
 
127
                                                    _("You need to install at least either Samba or NFS "
 
128
                                                      "in order to share your folders."));
 
129
        gtk_dialog_run (GTK_DIALOG (dialog));
 
130
        gtk_widget_destroy (dialog);
 
131
 
 
132
        return FALSE;
 
133
}
 
134
 
110
135
static void
111
136
gst_shares_tool_update_gui (GstTool *tool)
112
137
{
113
138
        GstSharesTool *shares_tool;
 
139
        GtkWidget *dialog_notebook;
114
140
        OobsList *list;
115
141
 
116
142
        shares_tool = GST_SHARES_TOOL (tool);
117
 
 
118
 
        list  = oobs_nfs_config_get_shares (OOBS_NFS_CONFIG (shares_tool->nfs_config));
119
 
        add_shares (list);
120
 
 
121
 
        list = oobs_smb_config_get_shares (OOBS_SMB_CONFIG (shares_tool->smb_config));
122
 
        add_shares (list);
123
 
 
124
 
        update_global_smb_config (tool, shares_tool->smb_config);
 
143
        dialog_notebook = gst_dialog_get_widget (tool->main_dialog, "shares_admin");
 
144
 
 
145
        if (check_servers (shares_tool)) {
 
146
                table_clear ();
 
147
 
 
148
                list  = oobs_nfs_config_get_shares (OOBS_NFS_CONFIG (shares_tool->nfs_config));
 
149
                add_shares (list);
 
150
 
 
151
                list = oobs_smb_config_get_shares (OOBS_SMB_CONFIG (shares_tool->smb_config));
 
152
                add_shares (list);
 
153
 
 
154
                update_global_smb_config (tool, shares_tool->smb_config);
 
155
                gtk_widget_set_sensitive (dialog_notebook, TRUE);
 
156
        } else {
 
157
                /* disable the tool UI, there's no way to add shares */
 
158
                gtk_widget_set_sensitive (dialog_notebook, FALSE);
 
159
        }
 
160
}
 
161
 
 
162
static void
 
163
gst_shares_tool_update_config (GstTool *tool)
 
164
{
 
165
        GstSharesTool *shares_tool;
 
166
 
 
167
        shares_tool = GST_SHARES_TOOL (tool);
 
168
        oobs_object_update (shares_tool->nfs_config);
 
169
        oobs_object_update (shares_tool->smb_config);
 
170
        oobs_object_update (shares_tool->services_config);
 
171
        oobs_object_update (shares_tool->hosts_config);
 
172
        oobs_object_update (shares_tool->ifaces_config);
 
173
        gst_shares_tool_update_services_availability (tool);
125
174
}
126
175
 
127
176
static void
131
180
        OobsListIter iter;
132
181
        GObject *service;
133
182
        gboolean valid;
134
 
        gchar *role;
 
183
        GstServiceRole role;
135
184
 
136
185
        services = oobs_services_config_get_services (tool->services_config);
137
186
        valid = oobs_list_get_iter_first (services, &iter);
138
187
 
139
188
        while (valid) {
140
189
                service = oobs_list_get (services, &iter);
141
 
                role = oobs_service_get_role (OOBS_SERVICE (service));
 
190
                role = gst_service_get_role (OOBS_SERVICE (service));
142
191
 
143
 
                if (strcmp (role, "FILE_SERVER_SMB") == 0)
 
192
                if (role == GST_ROLE_FILE_SERVER_SMB)
144
193
                        tool->smb_available = TRUE;
145
 
                else if (strcmp (role, "FILE_SERVER_NFS") == 0)
 
194
                else if (role == GST_ROLE_FILE_SERVER_NFS)
146
195
                        tool->nfs_available = TRUE;
147
196
 
148
197
                g_object_unref (service);