summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rwxr-xr-xmdkapplet54
-rwxr-xr-xmdkapplet_gui.pm100
3 files changed, 102 insertions, 53 deletions
diff --git a/Makefile b/Makefile
index 1450988a..734b40be 100644
--- a/Makefile
+++ b/Makefile
@@ -43,6 +43,7 @@ install: all
install -m644 pixmaps/*.png $(PIXDIR)/pixmaps
perl -pi -e "s/version = 1/version = $(VERSION)/" mdkonline.pm
install -m644 mdkonline.pm $(FBLIBDIR)
+ install -m644 mdkapplet_gui.pm $(FBLIBDIR)
install -m644 mdkapplet_urpm.pm $(FBLIBDIR)
for d in $(SUBDIRS); do make -C $$d $@; done
# mime
diff --git a/mdkapplet b/mdkapplet
index fffdb240..5563d19e 100755
--- a/mdkapplet
+++ b/mdkapplet
@@ -35,6 +35,7 @@ use mygtk2 qw(gtknew); #- do not import gtkadd which conflicts with ugtk2 versio
use ugtk2 qw(:all);
use lib qw(/usr/lib/libDrakX/drakfirsttime);
use mdkonline;
+use mdkapplet_gui;
use Gtk2::Notify '-init', 'mdkapplet';
use Rpmdrake::open_db;
@@ -45,25 +46,14 @@ if (!find { $_ eq '--auto-update' } @ARGV) {
}
-ugtk2::add_icon_path("/usr/share/mdkonline/pixmaps/");
my $online_site = "http://www.mandrivalinux.com/";
my ($menu, $timeout, $network_timeout, $state_global, $sub_state);
-my $localdir = "$ENV{HOME}/.MdkOnline";
-my $localfile = "$localdir/mdkonline";
-
my %config = getVarsFromSh('/etc/sysconfig/mdkapplet');
$config{UPDATE_FREQUENCY} ||= 3*60*60; # default to 3hours
$config{FIRST_CHECK_DELAY} ||= 5 * 60 * 1000; # default to 5 minutes
$config{DISTRO_CHECK_DELAY} ||= 60*60*24; # default : one day
-
-#compatibility
-mkdir_p($localdir) if !-d $localdir;
--e "$ENV{HOME}/.mdkonline" and system("mv", "$ENV{HOME}/.mdkonline", $localfile);
-
-my %local_config = getVarsFromSh($localfile);
-
my %state = (
delayed => {
colour => [ 'busy' ],
@@ -250,13 +240,6 @@ $SIG{CHLD} = \&harvester;
run_program::raw({ detach => 1 }, 'ionice', '-p', $$, '-n7');
-my $width = 500;
-my @common = (
- # explicitely wrap (for 2008.1):
- line_wrap => 1,
- # workaround infamous 6 years old gnome bug #101968:
- width => $width - 50,
-);
Gtk2->main;
@@ -358,24 +341,6 @@ sub harvester {
sub configNetwork() { log::explanations(N_("Launching drakconnect\n")); fork_exec("/usr/sbin/drakconnect") }
-sub new_portable_dialog {
- my ($title) = @_;
- ugtk2->new($title, width => $width + 20);
-}
-
-sub fill_n_run_portable_dialog {
- my ($w, $widgets) = @_;
-
- # use wizard button order (for both 2008.1 & 2009.0):
- local $::isWizard = 1;
- local $w->{pop_it} = 0;
- local $::isInstall = 1;
- gtkadd($w->{window}, gtknew('VBox', children_tight => $widgets));
-
- $w->{ok}->grab_focus;
- $w->main;
-}
-
sub confirm_upgrade() {
local $mygtk2::left_padding = 0;
my $warn_me = text2bool($local_config{DO_NOT_ASK_FOR_DISTRO_UPGRADE});
@@ -398,16 +363,6 @@ sub confirm_upgrade() {
$res ? really_confirm_upgrade() : 0;
}
-sub new_link_button {
- my ($url, $text) = @_;
- my $link = Gtk2::LinkButton->new($url, $text);
- $link->set_uri_hook(sub {
- my (undef, $url) = @_;
- run_program::raw({ detach => 1, setuid => get_parent_uid() }, 'www-browser', $url);
- });
- $link;
-}
-
sub really_confirm_upgrade() {
local $mygtk2::left_padding = 0;
my $w = ugtk2->new(N("New version of Mandriva Linux distribution"), width => $width + 20);
@@ -687,13 +642,6 @@ sub setState {
}
-sub setVar {
- my ($var, $st) = @_;
- my %s = getVarsFromSh($localfile);
- $s{$var} = $st;
- setVarsInSh($localfile, \%s);
-}
-
sub setAutoStart {
my $state = shift;
my $date = getTime();
diff --git a/mdkapplet_gui.pm b/mdkapplet_gui.pm
new file mode 100755
index 00000000..784c57a6
--- /dev/null
+++ b/mdkapplet_gui.pm
@@ -0,0 +1,100 @@
+package mdkapplet_gui;
+
+################################################################################
+# Mandriva Online #
+# #
+# Copyright (C) 2003-2008 Mandriva #
+# #
+# Daouda Lo #
+# Thierry Vignaud <tvignaud at mandriva dot com> #
+# #
+# This program is free software; you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License Version 2 as #
+# published by the Free Software Foundation. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program; if not, write to the Free Software #
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #
+################################################################################
+
+use strict;
+use lib qw(/usr/lib/libDrakX);
+use common;
+
+
+our @ISA = qw(Exporter);
+our @EXPORT = qw(
+ @common
+ %local_config
+ $localdir
+ $localfile
+ $width
+ fill_n_run_portable_dialog
+ new_link_button
+ new_portable_dialog
+ setVar
+ );
+
+
+use mygtk2 qw(gtknew); #- do not import gtkadd which conflicts with ugtk2 version
+use ugtk2 qw(:all);
+use lib qw(/usr/lib/libDrakX/drakfirsttime);
+
+ugtk2::add_icon_path("/usr/share/mdkonline/pixmaps/");
+
+our $localdir = "$ENV{HOME}/.MdkOnline";
+our $localfile = "$localdir/mdkonline";
+
+#compatibility
+mkdir_p($localdir) if !-d $localdir;
+-e "$ENV{HOME}/.mdkonline" and system("mv", "$ENV{HOME}/.mdkonline", $localfile);
+
+our %local_config = getVarsFromSh($localfile);
+
+our $width = 500;
+our @common = (
+ # explicitely wrap (for 2008.1):
+ line_wrap => 1,
+ # workaround infamous 6 years old gnome bug #101968:
+ width => $width - 50,
+);
+
+sub new_portable_dialog {
+ my ($title) = @_;
+ ugtk2->new($title, width => $width + 20);
+}
+
+sub fill_n_run_portable_dialog {
+ my ($w, $widgets) = @_;
+
+ # use wizard button order (for both 2008.1 & 2009.0):
+ local $::isWizard = 1;
+ local $w->{pop_it} = 0;
+ local $::isInstall = 1;
+ gtkadd($w->{window}, gtknew('VBox', children_tight => $widgets));
+
+ $w->{ok}->grab_focus;
+ $w->main;
+}
+
+sub new_link_button {
+ my ($url, $text) = @_;
+ my $link = Gtk2::LinkButton->new($url, $text);
+ $link->set_uri_hook(sub {
+ my (undef, $url) = @_;
+ run_program::raw({ detach => 1, setuid => get_parent_uid() }, 'www-browser', $url);
+ });
+ $link;
+}
+
+sub setVar {
+ my ($var, $st) = @_;
+ my %s = getVarsFromSh($localfile);
+ $s{$var} = $st;
+ setVarsInSh($localfile, \%s);
+}