Changeset 2328

Show
Ignore:
Timestamp:
05/17/07 05:44:12 (2 years ago)
Author:
isak
Message:

* Spawn autosu synchronously so that we can wait and see what it returns (we don't wanna exit if user clicks cancel for instance)
* Check so that the g_spawn_() call succeeded and abort the exit if it failed.
* This is done as a step towards fixing #21

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • frontend/trunk/manager/ChangeLog

    r2327 r2328  
     12007-05-17  Isak Savo  <isak.savo@gmail.com> 
     2 
     3        * frontend-gtk/main.c (remove_clicked): Spawn autosu synchronously so that we can wait and see what it returns (we don't wanna exit if user clicks cancel for instance) 
     4        Check so that the g_spawn_() call succeeded and abort the exit if it failed.  
     5 
    162007-05-13  Isak Savo  <isak.savo@gmail.com> 
    27 
  • frontend/trunk/manager/frontend-gtk/main.c

    r2321 r2328  
    3535#include <time.h> 
    3636#include <sys/types.h> 
     37#include <sys/wait.h> 
    3738#include <libintl.h> 
    3839 
     
    627628            if (!autosu) 
    628629            { 
     630                    uninstall_completed_callback(GINT_TO_POINTER(-1)); 
    629631                    GtkWidget *dlg = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, 
    630632                                                            GTK_MESSAGE_ERROR, 
     
    637639                                                            
    638640            } 
     641            GError *err = NULL; 
     642            gint child_exitstatus; 
    639643            gchar *argv[7]; 
    640644            argv[0] = autosu; 
     
    645649            argv[5] = "--rootmode"; 
    646650            argv[6] = NULL; 
    647             g_spawn_async (NULL, argv, NULL, G_SPAWN_CHILD_INHERITS_STDIN, NULL, NULL, NULL, NULL); 
    648             exit(0); 
     651            if (!g_spawn_sync (NULL, argv, NULL, G_SPAWN_CHILD_INHERITS_STDIN, 
     652                               NULL, NULL, NULL /* stdout */, NULL /* stderr */, &child_exitstatus, &err)) 
     653            { 
     654                    uninstall_completed_callback(GINT_TO_POINTER(-2)); 
     655                    GtkWidget *dlg = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, 
     656                                                            GTK_MESSAGE_ERROR, 
     657                                                            GTK_BUTTONS_OK, 
     658                                                            "Cannot uninstall the selected package because the program used to switch " 
     659                                                            "to root (autosu) could not be launched.\n\n" 
     660                                                            "The error reported was: %s", err->message); 
     661                    gtk_dialog_run(GTK_DIALOG(dlg)); 
     662                    g_error_free(err); 
     663                    gtk_widget_destroy(dlg); 
     664                    return; 
     665                     
     666            } 
     667            child_exitstatus = WEXITSTATUS(child_exitstatus); 
     668            TRACE ("Exitstatus of autosu: %d\n", child_exitstatus); 
     669            if (child_exitstatus == 0) 
     670                    exit(0); 
     671            uninstall_completed_callback(GINT_TO_POINTER(-3)); 
    649672        } 
    650673 
     
    803826    g_free (prefix); 
    804827    g_free (selfpath); 
    805 
    806  
     828 
     829    return 0; 
     830
     831 
  • frontend/trunk/manager/po/Makefile.in.in

    r2307 r2328  
    2626srcdir = @srcdir@ 
    2727top_srcdir = @top_srcdir@ 
    28 top_builddir = .. 
     28top_builddir = @top_builddir@ 
    2929VPATH = @srcdir@ 
    3030 
     
    5757PO_LINGUAS=$(shell if test -r $(srcdir)/LINGUAS; then grep -v "^\#" $(srcdir)/LINGUAS; fi) 
    5858 
    59 POFILES=$(shell if test -n "$(PO_LINGUAS)"; then LINGUAS="$(PO_LINGUAS)"; else LINGUAS="$(ALL_LINGUAS)"; fi; for lang in $$LINGUAS; do printf "$$lang.po "; done) 
     59USER_LINGUAS=$(shell if test -n "$(LINGUAS)"; then LLINGUAS="$(LINGUAS)"; ALINGUAS="$(ALL_LINGUAS)"; for lang in $$LLINGUAS; do if test -n "`grep ^$$lang$$ $(srcdir)/LINGUAS`" -o -n "`echo $$ALINGUAS|grep ' ?$$lang ?'`"; then printf "$$lang "; fi; done; fi) 
     60 
     61USE_LINGUAS=$(shell if test -n "$(USER_LINGUAS)"; then LLINGUAS="$(USER_LINGUAS)"; else if test -n "$(PO_LINGUAS)"; then LLINGUAS="$(PO_LINGUAS)"; else LLINGUAS="$(ALL_LINGUAS)"; fi; fi; for lang in $$LLINGUAS; do printf "$$lang "; done) 
     62 
     63POFILES=$(shell LINGUAS="$(USE_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.po "; done) 
    6064 
    6165DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(POFILES) 
     
    6367 
    6468POTFILES = \ 
    65 #This Gets Replace for some reason 
    66  
    67 CATALOGS=$(shell if test -n "$(PO_LINGUAS)"; then LINGUAS="$(PO_LINGUAS)"; else LINGUAS="$(ALL_LINGUAS)"; fi; for lang in $$LINGUAS; do printf "$$lang.gmo "; done) 
     69# This comment gets stripped out 
     70 
     71CATALOGS=$(shell LINGUAS="$(USE_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.gmo "; done) 
    6872 
    6973.SUFFIXES: 
     
    99103install-data-yes: all 
    100104        $(mkdir_p) $(DESTDIR)$(itlocaledir) 
    101         if test -n "$(PO_LINGUAS)"; then \ 
    102           linguas="$(PO_LINGUAS)"; \ 
    103         else \ 
    104           linguas="$(ALL_LINGUAS)"; \ 
    105         fi; \ 
     105        linguas="$(USE_LINGUAS)"; \ 
    106106        for lang in $$linguas; do \ 
    107107          dir=$(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES; \ 
     
    137137 
    138138uninstall: 
    139         if test -n "$(PO_LINGUAS)"; then \ 
    140           linguas="$(PO_LINGUAS)"; \ 
    141         else \ 
    142           linguas="$(ALL_LINGUAS)"; \ 
    143         fi; \ 
     139        linguas="$(USE_LINGUAS)"; \ 
    144140        for lang in $$linguas; do \ 
    145141          rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \ 
     
    148144 
    149145check: all $(GETTEXT_PACKAGE).pot 
     146        rm -f missing notexist 
     147        srcdir=$(srcdir) $(INTLTOOL_UPDATE) -m 
     148        if [ -r missing -o -r notexist ]; then \ 
     149          exit 1; \ 
     150        fi 
    150151 
    151152mostlyclean: 
     
    180181        $(MAKE) $(GETTEXT_PACKAGE).pot 
    181182        tmpdir=`pwd`; \ 
    182         if test -n "$(PO_LINGUAS)"; then \ 
    183           linguas="$(PO_LINGUAS)"; \ 
    184         else \ 
    185           linguas="$(ALL_LINGUAS)"; \ 
    186         fi; \ 
     183        linguas="$(USE_LINGUAS)"; \ 
    187184        for lang in $$linguas; do \ 
    188185          echo "$$lang:"; \ 
     
    212209        fi 
    213210 
    214 stamp-it: Makefile.in.in ../config.status POTFILES.in 
    215         cd ..
     211stamp-it: Makefile.in.in $(top_builddir)/config.status POTFILES.in 
     212        cd $(top_builddir)
    216213          && CONFIG_FILES=$(subdir)/Makefile.in CONFIG_HEADERS= CONFIG_LINKS= \ 
    217214               $(SHELL) ./config.status