6
#include <glib-object.h>
12
#include "update-notifier.h"
15
#define CDROM_CHECKER PACKAGE_LIB_DIR"/update-notifier/apt-cdrom-check"
17
/* responses for the dialog */
24
/* Returnvalues from apt-cdrom-check:
26
# 1 - CD with packages
27
# 2 - dist-upgrader CD
38
distro_cd_detected(int cdtype,
39
const char *mount_point)
41
GtkWidget *dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
45
gchar *title, *markup;
47
case CD_WITH_PACKAGES:
48
title = _("Software Packages Volume Detected");
49
markup = _("<span weight=\"bold\" size=\"larger\">"
50
"A volume with software packages has "
51
"been detected.</span>\n\n"
52
"Would you like to open it with the "
54
gtk_dialog_add_buttons(GTK_DIALOG(dialog),
57
_("Start Package Manager"),
60
gtk_dialog_set_default_response (GTK_DIALOG(dialog), RES_START_PM);
62
case CD_WITH_DISTUPGRADER:
63
title = _("Upgrade volume detected");
64
markup = _("<span weight=\"bold\" size=\"larger\">"
65
"A distribution volume with software packages has "
66
"been detected.</span>\n\n"
67
"Would you like to try to upgrade from it automatically? ");
68
gtk_dialog_add_buttons(GTK_DIALOG(dialog),
74
gtk_dialog_set_default_response (GTK_DIALOG(dialog), RES_DIST_UPGRADER);
76
#if 0 // we don't have aptoncd support currently, g-a-i is not
77
// in the archive anymore
79
title = _("APTonCD volume detected");
80
markup = _("<span weight=\"bold\" size=\"larger\">"
81
"A volume with unofficial software packages has "
82
"been detected.</span>\n\n"
83
"Would you like to open it with the "
85
gtk_dialog_add_buttons(GTK_DIALOG(dialog),
88
_("Start package manager"),
91
gtk_dialog_set_default_response (GTK_DIALOG(dialog), RES_START_PM);
95
g_assert_not_reached();
98
gtk_window_set_title(GTK_WINDOW(dialog), title);
99
gtk_window_set_skip_taskbar_hint (GTK_WINDOW(dialog), FALSE);
100
gtk_message_dialog_set_markup(GTK_MESSAGE_DIALOG(dialog), markup);
102
int res = gtk_dialog_run (GTK_DIALOG (dialog));
106
argv[0] = "/usr/lib/update-notifier/backend_helper.py";
107
argv[1] = "add_cdrom";
108
argv[2] = (gchar *)mount_point;
110
g_spawn_async (NULL, argv, NULL, 0, NULL, NULL, NULL, NULL);
112
case RES_DIST_UPGRADER:
113
argv[0] = "/usr/bin/pkexec";
114
argv[1] = "/usr/lib/update-notifier/cddistupgrader";
115
argv[2] = (gchar *)mount_point;
117
g_spawn_async (NULL, argv, NULL, 0, NULL, NULL, NULL, NULL);
123
gtk_widget_destroy (dialog);
127
main (int argc, char **argv)
129
bindtextdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
130
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
131
textdomain(GETTEXT_PACKAGE);
135
printf("usage: %s cdtype mountpoint", argv[0]);
140
int cdtype = atoi(argv[1]);
141
char *mount_point = argv[2];
143
gtk_init (&argc, &argv);
144
distro_cd_detected(cdtype, mount_point);