diff --git a/gtk/gsynaptic.cc b/gtk/gsynaptic.cc index a6d5834f..2e5808f0 100644 --- a/gtk/gsynaptic.cc +++ b/gtk/gsynaptic.cc @@ -169,6 +169,19 @@ void welcome_dialog(RGMainWindow *mainWindow) } } +void admin_privileges_dialog(RGMainWindow *mainWindow) +{ + if (_config->FindB("Synaptic::ShowAdminPrivilegesDialog", true)) { + RGGtkBuilderUserDialog dia(mainWindow); + dia.run("admin_privileges"); + GtkWidget *cb = GTK_WIDGET(gtk_builder_get_object(dia.getGtkBuilder(), + "checkbutton_admin_privileges_not_show_again")); + assert(cb); + _config->Set("Synaptic::ShowAdminPrivilegesDialog", + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cb))); + } +} + void update_check(RGMainWindow *mainWindow, RPackageLister *lister) { struct stat st; @@ -429,18 +442,6 @@ int main(int argc, char **argv) if (_config->FindB("help") == true) ShowHelp(CmdL); - if (getuid() != 0) { - RGUserDialog userDialog; - userDialog.warning(g_strdup_printf("%s\n\n%s", - _("Starting \"Synaptic Package Manager\" without " - "administrative privileges"), - _("You will not be able to apply " - "any changes, but you can still " - "export the marked changes or " - "create a download script " - "for them."))); - } - if (!RInitConfiguration("synaptic.conf")) { RGUserDialog userDialog; userDialog.showErrors(); @@ -602,6 +603,9 @@ int main(int argc, char **argv) if (NonInteractive) { mainWindow->cbProceedClicked(NULL, mainWindow); } else { + if (getuid() != 0) { + admin_privileges_dialog(mainWindow); + } welcome_dialog(mainWindow); gtk_widget_grab_focus( GTK_WIDGET(gtk_builder_get_object( mainWindow->getGtkBuilder(), diff --git a/gtk/gtkbuilder/dialog_admin_privileges.ui b/gtk/gtkbuilder/dialog_admin_privileges.ui new file mode 100644 index 00000000..b7fbf6ee --- /dev/null +++ b/gtk/gtkbuilder/dialog_admin_privileges.ui @@ -0,0 +1,164 @@ + + + + + + False + 6 + Quick Introduction + False + dialog + + + True + False + vertical + 6 + + + True + False + end + + + _Close + True + True + True + True + False + True + + + False + True + 0 + + + + + False + True + end + 0 + + + + + True + False + 12 + + + True + False + 0 + dialog-warning + 6 + + + True + True + 0 + + + + + True + False + vertical + 12 + + + Show this dialog at startup + True + True + False + end + True + 0 + True + + + False + False + end + 0 + + + + + True + False + vertical + 6 + + + True + False + Starting "Synaptic Package Manager" without administrative privileges + True + 0 + 0 + + + + + + + False + True + 0 + + + + + True + False + You will not be able to apply any changes, but you can still export the marked changes or create a download script for them. + True + 0 + + + False + False + 1 + + + + + + + + + + + + + + False + True + 1 + + + + + False + True + 1 + + + + + True + True + 0 + + + + + + okbutton1 + + + diff --git a/gtk/rguserdialog.cc b/gtk/rguserdialog.cc index 6412086a..7c67e812 100644 --- a/gtk/rguserdialog.cc +++ b/gtk/rguserdialog.cc @@ -227,6 +227,12 @@ RGGtkBuilderUserDialog::RGGtkBuilderUserDialog(RGWindow *parent) _parentWindow = parent->window(); } +RGGtkBuilderUserDialog::RGGtkBuilderUserDialog(const char *name) +{ + _parentWindow = 0; + init(name); +} + void RGGtkBuilderUserDialog::init(const char *name) { gchar *main_widget = NULL; diff --git a/gtk/rguserdialog.h b/gtk/rguserdialog.h index b47c9a78..70929dad 100644 --- a/gtk/rguserdialog.h +++ b/gtk/rguserdialog.h @@ -80,6 +80,7 @@ class RGGtkBuilderUserDialog : public RGUserDialog public: RGGtkBuilderUserDialog(RGWindow* parent); RGGtkBuilderUserDialog(RGWindow* parent, const char *name); + RGGtkBuilderUserDialog(const char *name); virtual ~RGGtkBuilderUserDialog() { gtk_widget_destroy(_dialog); }; void setTitle(string title) { diff --git a/po/POTFILES.in b/po/POTFILES.in index a3e37da8..5bd83160 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -75,6 +75,7 @@ gtk/rgtaskswin.cc [type: gettext/glade]gtk/gtkbuilder/dialog_authentication.ui [type: gettext/glade]gtk/gtkbuilder/dialog_disc_label.ui [type: gettext/glade]gtk/gtkbuilder/dialog_new_repositroy.ui +[type: gettext/glade]gtk/gtkbuilder/dialog_admin_privileges.ui data/synaptic.desktop.in data/com.ubuntu.pkexec.synaptic.policy.in gtk/rgfiltermanager.h