Example #1
0
//Status list notebook signal, switch pages to show different queues
        private void on_StatusNotebook_switch_page(object o, SwitchPageArgs args)
        {
            async_update_status();
            while (gfax.activeNetwork)
            {
                System.Threading.Thread.Sleep(100);
            }

            switch (StatusNotebook.CurrentPage)
            {
            case SENDQ_PAGE:
                activeQ = ActiveQ.send;
                //if (update_queue_status("sendq") > 0)
                //	DeleteJobButton.Sensitive = true;
                //else {
                DeleteJobButton.Sensitive = false;
                //}
                async_update_queue_status("sendq");
                break;

            case DONEQ_PAGE:
                DeleteJobButton.Sensitive = false;
                activeQ = ActiveQ.done;
                async_update_queue_status("doneq");
                break;

            case RECEIVEQ_PAGE:
                DeleteJobButton.Sensitive     = false;
                RecvfaxDeleteButton.Sensitive = false;
                activeQ = ActiveQ.receive;
                async_update_queue_status("recvq");
                break;
            }
        }
Example #2
0
        // This is where we end up if the New Fax button or the menu item
        // has been selected.
        private void send_new_fax()
        {
            string [] largs = { "do_filename" };
            GfaxSend  sd    = new GfaxSend("", largs);

            // send the faxes
            if (sd.DoSend)
            {
                Fax.sendfax(sd.Filename);
                // if file is temp data (/var/spool/gfax/D.*) then delete it
                FileInfo f = new FileInfo(sd.Filename);
                if (File.Exists(String.Concat(gfax.SpoolDirectory, "/", f.Name)))
                {
                    File.Delete(String.Concat(gfax.SpoolDirectory, "/", f.Name));
                }
            }
            activeQ = ActiveQ.send;
            async_update_queue_status("sendq");
            sd    = null;
            largs = null;
        }
Example #3
0
        public Gfax(string fname, string[] args)
            : base(APPNAME, VERSION, Modules.UI, args, new object [0])
        {
            //Phonebook[] pb;  delete me

            // Set the program icon
            Gtk.Window.DefaultIconName = "gfax";

            Application.Init();

            // check to see if we've run before, if so gfax will be there
            if (Settings.RunSetupAtStart)
            {
                Settings.RunSetupAtStart = false;

                MessageDialog md;
                md = new MessageDialog(
                    null,
                    DialogFlags.DestroyWithParent,
                    MessageType.Info,
                    ButtonsType.Ok,
                    Catalog.GetString(
                        @"
This is the first time you have run Gfax.
You should set your MODEM TYPE and PORT under preferences.

Gfax is initially setup to use Efax, you may change it use 
Hylafax if you prefer or require connection to a network 
facsimile server.")
                    );
                md.Run();
                md.Destroy();
            }

            if (!Directory.Exists(gfax.SpoolDirectory))
            {
                G_Message gm = new G_Message(Catalog.GetString(
                                                 @"Your spool directory is missing!
					
Please login as the root user and create the "
                                                 + gfax.SpoolDirectory +
                                                 " directory.\n\nAll users should be able to write to it.\n"));
                return;
            }
            if (!Directory.Exists(gfax.SpoolDirectory + "/doneq"))
            {
                G_Message gm = new G_Message(Catalog.GetString(
                                                 @"The doneq directory is missing in your spool directory!
					
Please login as the root user and create the "
                                                 + gfax.SpoolDirectory + "/doneq" +
                                                 " directory.\n\nAll users should be able to write to it.\n"));
                return;
            }
            if (!Directory.Exists(gfax.SpoolDirectory + "/recq"))
            {
                G_Message gm = new G_Message(Catalog.GetString(
                                                 @"The recq directory is missing in your spool directory!
					
Please login as the root user and create the "
                                                 + gfax.SpoolDirectory + "/recq" +
                                                 " directory.\n\nAll users should be able to write to it.\n"));
                return;
            }


            gxml = new Glade.XML(null, "gfax.glade", "GfaxWindow", null);
            gxml.Autoconnect(this);


            // Set initial gui state as per preferences
            // GConf.PropertyEditors.EditorShell doesn't handle
            // checkmenuitems;
            eventsEnabled = false;
            if (Settings.TransmitAgent == "hylafax")
            {
                AutoQRefreshCheckMenuItem.Active      = Settings.RefreshQueueEnabled;
                EmailNotificationCheckMenuItem.Active = Settings.EmailNotify;
                HiResolutionModeCheckMenuItem.Active  = Settings.HiResolution;
                LogEnabledCheckMenuItem.Active        = Settings.LogEnabled;
            }
            if (Settings.TransmitAgent == "efax")
            {
                AutoQRefreshCheckMenuItem.Active         = Settings.RefreshQueueEnabled;
                AutoQRefreshCheckMenuItem.Sensitive      = false;
                EmailNotificationCheckMenuItem.Active    = false;
                EmailNotificationCheckMenuItem.Sensitive = false;
                HiResolutionModeCheckMenuItem.Active     = Settings.HiResolution;
                LogEnabledCheckMenuItem.Visible          = false;
            }

            FaxTracingCheckMenuItem.Active = Settings.Faxtracing;

            eventsEnabled = true;

            StatusText.Editable = false;
            StatusText.CanFocus = false;
            StatusText.Buffer   = StatusTextBuffer;

            // Set the program icon
            Gdk.Pixbuf Icon = new Gdk.Pixbuf(null, "gfax.png");

            gfax.MainWindow = GfaxWindow;

            // Setup listview icons
            InitListViewIcons();

            StatusStore = new ListStore(
                typeof(Gdk.Pixbuf),
                typeof(string),
                typeof(string),
                typeof(string),
                typeof(string),
                typeof(string),
                typeof(string),
                typeof(DateTime),
                typeof(string));

            RecvStore = new ListStore(
                typeof(Gdk.Pixbuf),
                typeof(string),
                typeof(string),
                typeof(string),
                typeof(DateTime),
                typeof(string));


            lv = new G_ListView(StatusList, StatusStore);
            lv.AddColumnIcon(Gtk.Stock.Info, 0);
            lv.AddColumnTitle(Catalog.GetString("Jobid"), 1, 1);
            lv.AddColumnTitle(Catalog.GetString("Number"), 2, 2);
            lv.AddColumnTitle(Catalog.GetString("Status"), 3, 3);
            lv.AddColumnTitle(Catalog.GetString("Owner"), 4, 4);
            lv.AddColumnTitle(Catalog.GetString("Pages"), 5, 5);
            lv.AddColumnTitle(Catalog.GetString("Dials"), 6, 6);
            lv.AddColumnDateTime(Catalog.GetString("Send At"), "G", 7, 7);
            lv.AddColumnTitle(Catalog.GetString("Information"), 8, 8);

            // List view for completed jobs tab
            jobsCompletedView = new G_ListView(JobsCompleteList, StatusStore);
            jobsCompletedView.AddColumnIcon(Gtk.Stock.Info, 0);
            jobsCompletedView.AddColumnTitle(Catalog.GetString("Jobid"), 1, 1);
            jobsCompletedView.AddColumnTitle(Catalog.GetString("Number"), 2, 2);
            jobsCompletedView.AddColumnTitle(Catalog.GetString("Status"), 3, 3);
            jobsCompletedView.AddColumnTitle(Catalog.GetString("Owner"), 4, 4);
            jobsCompletedView.AddColumnTitle(Catalog.GetString("Pages"), 5, 5);
            jobsCompletedView.AddColumnTitle(Catalog.GetString("Dials"), 6, 6);
            jobsCompletedView.AddColumnDateTime(Catalog.GetString("Send At"), "G", 7, 7);
            jobsCompletedView.AddColumnTitle(Catalog.GetString("Information"), 8, 8);

            jobsReceivedView = new G_ListView(JobsReceivedList, RecvStore);
            jobsReceivedView.AddColumnIcon(Gtk.Stock.Info, 0);
            jobsReceivedView.AddColumnTitle(Catalog.GetString("Sender"), 1, 1);
            jobsReceivedView.AddColumnTitle(Catalog.GetString("Status"), 2, 2);
            jobsReceivedView.AddColumnTitle(Catalog.GetString("Pages  "), 3, 3);
            jobsReceivedView.AddColumnDateTime(Catalog.GetString("Arrived"), "G", 4, 4);
            jobsReceivedView.AddColumnTitle(Catalog.GetString("Filename"), 5, 5);

            StatusList.Selection.Changed +=
                new EventHandler(on_StatusList_selection);
            StatusList.Selection.Mode = SelectionMode.Multiple;
            StatusList.HeadersVisible = true;

            JobsCompleteList.Selection.Changed +=
                new EventHandler(on_JobsCompleteList_selection);
            JobsCompleteList.Selection.Mode = SelectionMode.Multiple;
            JobsCompleteList.HeadersVisible = true;

            JobsReceivedList.Selection.Changed +=
                new EventHandler(on_JobsReceivedList_selection);
            JobsReceivedList.Selection.Mode = SelectionMode.Multiple;
            JobsReceivedList.HeadersVisible = true;

            // Make sure headers are visible
            lv.AddTextToRow(null, "", "", "", "", "", "", null, "");
            jobsCompletedView.AddTextToRow(null, "", "", "", "", "", "", null, "");
            jobsReceivedView.AddTextToRow(null, "", "", "", null, "");
            StatusStore.Clear();
            RecvStore.Clear();

            DeleteJobButton.Sensitive = false;
            if (Settings.TransmitAgent == "hylafax")
            {
                ModifyJobButton.Sensitive = false;
            }
            else
            {
                ModifyJobButton.Visible = false;
            }
            ViewPrintButton.Sensitive = false;

            // Setup some global variables
            gfax.MainProgressBar   = Appbar.Progress;
            gfax.GStatusTextBuffer = StatusTextBuffer;
            gfax.GAppbar           = Appbar;

            gfax.Pulser = new Pulser();
            gfax.Status = new Status(StatusText, StatusTextBuffer);

            if (Settings.RefreshQueueEnabled)
            {
                GLib.Timeout.Add((uint)(Settings.RefreshQueueInterval * 1000),
                                 new TimeoutHandler(queue_refresh));
            }

            async_update_status();

            if (Settings.TransmitAgent == "hylafax")
            {
                while (gfax.activeNetwork)
                {
                    System.Threading.Thread.Sleep(100);
                }

                async_net_read_finished();
            }

            activeQ = ActiveQ.send;
            async_update_queue_status("sendq");

            StatusIcon sicon = new StatusIcon(Icon);

            sicon.Activate += new EventHandler(OnImageClick);
            sicon.Tooltip   = "Gfax Facsimile Sender";
            // showing the trayicon
            sicon.Visible = true;
            // setup system tray icon
            gfax.MainWindow.SkipTaskbarHint = true;
            gfax.MainWindow.Iconify();

            Application.Run();
        }
Example #4
0
File: gui.cs Project: horga83/gfax
        //Status list notebook signal, switch pages to show different queues
        private void on_StatusNotebook_switch_page(object o, SwitchPageArgs args)
        {
            async_update_status();
            while (gfax.activeNetwork)
                System.Threading.Thread.Sleep(100);

            switch (StatusNotebook.CurrentPage) {
                case SENDQ_PAGE:
                            activeQ = ActiveQ.send;
                            //if (update_queue_status("sendq") > 0)
                            //	DeleteJobButton.Sensitive = true;
                            //else {
                            DeleteJobButton.Sensitive = false;
                            //}
                            async_update_queue_status("sendq");
                            break;
                case DONEQ_PAGE:
                            DeleteJobButton.Sensitive = false;
                            activeQ = ActiveQ.done;
                            async_update_queue_status("doneq");
                            break;
                case RECEIVEQ_PAGE:
                            DeleteJobButton.Sensitive = false;
                            RecvfaxDeleteButton.Sensitive = false;
                            activeQ = ActiveQ.receive;
                            async_update_queue_status("recvq");
                            break;
            }
        }
Example #5
0
File: gui.cs Project: horga83/gfax
        public Gfax(string fname, string[] args)
            : base(APPNAME, VERSION, Modules.UI, args, new object [0])
        {
            //Phonebook[] pb;  delete me

             			// Set the program icon
             			Gtk.Window.DefaultIconName = "gfax";

            Application.Init ();

            // check to see if we've run before, if so gfax will be there
            if ( Settings.RunSetupAtStart ) {
                Settings.RunSetupAtStart = false;

                MessageDialog md;
                md = new MessageDialog (
                    null,
                    DialogFlags.DestroyWithParent,
                    MessageType.Info,
                    ButtonsType.Ok,
                    Catalog.GetString(
                        @"
            This is the first time you have run Gfax.
            You should set your MODEM TYPE and PORT under preferences.

            Gfax is initially setup to use Efax, you may change it use
            Hylafax if you prefer or require connection to a network
            facsimile server.")
                );
                md.Run ();
                md.Destroy();
            }

            if (!Directory.Exists(gfax.SpoolDirectory)) {
                G_Message gm = new G_Message(Catalog.GetString(
                    @"Your spool directory is missing!

            Please login as the root user and create the "
            + gfax.SpoolDirectory +
            " directory.\n\nAll users should be able to write to it.\n"));
                return;
            }
            if (!Directory.Exists(gfax.SpoolDirectory + "/doneq")) {
                G_Message gm = new G_Message(Catalog.GetString(
                    @"The doneq directory is missing in your spool directory!

            Please login as the root user and create the "
            + gfax.SpoolDirectory + "/doneq" +
            " directory.\n\nAll users should be able to write to it.\n"));
                return;
            }
            if (!Directory.Exists(gfax.SpoolDirectory + "/recq")) {
                G_Message gm = new G_Message(Catalog.GetString(
                    @"The recq directory is missing in your spool directory!

            Please login as the root user and create the "
            + gfax.SpoolDirectory + "/recq" +
            " directory.\n\nAll users should be able to write to it.\n"));
                return;
            }

            gxml = new Glade.XML (null, "gfax.glade", "GfaxWindow", null);
            gxml.Autoconnect (this);

            // Set initial gui state as per preferences
            // GConf.PropertyEditors.EditorShell doesn't handle
            // checkmenuitems;
            eventsEnabled = false;
             	if (Settings.TransmitAgent == "hylafax") {
                AutoQRefreshCheckMenuItem.Active = Settings.RefreshQueueEnabled;
                EmailNotificationCheckMenuItem.Active = Settings.EmailNotify;
                HiResolutionModeCheckMenuItem.Active = Settings.HiResolution;
                LogEnabledCheckMenuItem.Active = Settings.LogEnabled;
            }
            if (Settings.TransmitAgent == "efax") {
                AutoQRefreshCheckMenuItem.Active = Settings.RefreshQueueEnabled;
                AutoQRefreshCheckMenuItem.Sensitive = false;
                EmailNotificationCheckMenuItem.Active = false;
                EmailNotificationCheckMenuItem.Sensitive = false;
                HiResolutionModeCheckMenuItem.Active = Settings.HiResolution;
                LogEnabledCheckMenuItem.Visible = false;
            }

            FaxTracingCheckMenuItem.Active = Settings.Faxtracing;

            eventsEnabled = true;

            StatusText.Editable = false;
            StatusText.CanFocus = false;
            StatusText.Buffer = StatusTextBuffer;

            // Set the program icon
            Gdk.Pixbuf Icon = new Gdk.Pixbuf(null, "gfax.png");

            gfax.MainWindow = GfaxWindow;

             			// Setup listview icons
             			InitListViewIcons();

            StatusStore = new ListStore(
             						typeof (Gdk.Pixbuf),
                        typeof (string),
                        typeof (string),
                        typeof (string),
                        typeof (string),
                        typeof (string),
                        typeof (string),
             						typeof (DateTime),
                        typeof (string));

            RecvStore = new ListStore(
             						typeof (Gdk.Pixbuf),
                        typeof (string),
                        typeof (string),
                        typeof (string),
             						typeof (DateTime),
                        typeof (string));

            lv = new G_ListView(StatusList, StatusStore);
             			lv.AddColumnIcon(Gtk.Stock.Info, 0);
             			lv.AddColumnTitle(Catalog.GetString("Jobid"),	1, 1);
             			lv.AddColumnTitle(Catalog.GetString("Number"),	2, 2);
             			lv.AddColumnTitle(Catalog.GetString("Status"),	3, 3);
             			lv.AddColumnTitle(Catalog.GetString("Owner"),	4, 4);
             			lv.AddColumnTitle(Catalog.GetString("Pages"),	5, 5);
             			lv.AddColumnTitle(Catalog.GetString("Dials"),	6, 6);
             			lv.AddColumnDateTime(Catalog.GetString("Send At"), "G",	7, 7);
             			lv.AddColumnTitle(Catalog.GetString("Information"),	8, 8);

            // List view for completed jobs tab
            jobsCompletedView = new G_ListView(JobsCompleteList, StatusStore);
             			jobsCompletedView.AddColumnIcon(Gtk.Stock.Info, 0);
             			jobsCompletedView.AddColumnTitle(Catalog.GetString("Jobid"),	1, 1);
             			jobsCompletedView.AddColumnTitle(Catalog.GetString("Number"),	2, 2);
             			jobsCompletedView.AddColumnTitle(Catalog.GetString("Status"),	3, 3);
             			jobsCompletedView.AddColumnTitle(Catalog.GetString("Owner"),	4, 4);
             			jobsCompletedView.AddColumnTitle(Catalog.GetString("Pages"),	5, 5);
             			jobsCompletedView.AddColumnTitle(Catalog.GetString("Dials"),	6, 6);
             			jobsCompletedView.AddColumnDateTime(Catalog.GetString("Send At"), "G",	7, 7);
             			jobsCompletedView.AddColumnTitle(Catalog.GetString("Information"),	8, 8);

            jobsReceivedView = new G_ListView(JobsReceivedList, RecvStore);
             			jobsReceivedView.AddColumnIcon(Gtk.Stock.Info, 0);
             			jobsReceivedView.AddColumnTitle(Catalog.GetString("Sender"),	1, 1);
             			jobsReceivedView.AddColumnTitle(Catalog.GetString("Status"),	2, 2);
             			jobsReceivedView.AddColumnTitle(Catalog.GetString("Pages  "),	3, 3);
             			jobsReceivedView.AddColumnDateTime(Catalog.GetString("Arrived"), "G",	4, 4);
             			jobsReceivedView.AddColumnTitle(Catalog.GetString("Filename"),	5, 5);

            StatusList.Selection.Changed +=
                new EventHandler(on_StatusList_selection);
            StatusList.Selection.Mode = SelectionMode.Multiple;
            StatusList.HeadersVisible = true;

            JobsCompleteList.Selection.Changed +=
                new EventHandler(on_JobsCompleteList_selection);
            JobsCompleteList.Selection.Mode = SelectionMode.Multiple;
            JobsCompleteList.HeadersVisible = true;

            JobsReceivedList.Selection.Changed +=
                new EventHandler(on_JobsReceivedList_selection);
            JobsReceivedList.Selection.Mode = SelectionMode.Multiple;
            JobsReceivedList.HeadersVisible = true;

            // Make sure headers are visible
            lv.AddTextToRow(null,"","","","","","",null,"");
            jobsCompletedView.AddTextToRow(null,"","","","","","",null,"");
            jobsReceivedView.AddTextToRow(null,"","","",null,"");
            StatusStore.Clear();
            RecvStore.Clear();

            DeleteJobButton.Sensitive = false;
            if (Settings.TransmitAgent == "hylafax")
                ModifyJobButton.Sensitive = false;
            else
                ModifyJobButton.Visible = false;
            ViewPrintButton.Sensitive = false;

            // Setup some global variables
            gfax.MainProgressBar = Appbar.Progress;
            gfax.GStatusTextBuffer = StatusTextBuffer;
            gfax.GAppbar = Appbar;

            gfax.Pulser = new Pulser();
            gfax.Status = new Status(StatusText, StatusTextBuffer);

            if (Settings.RefreshQueueEnabled)
                GLib.Timeout.Add((uint)(Settings.RefreshQueueInterval * 1000),
                    new TimeoutHandler (queue_refresh));

            async_update_status();

            if (Settings.TransmitAgent == "hylafax" ) {
                while (gfax.activeNetwork)
                    System.Threading.Thread.Sleep(100);

                async_net_read_finished();
            }

            activeQ = ActiveQ.send;
            async_update_queue_status("sendq");

            StatusIcon sicon = new StatusIcon(Icon);
            sicon.Activate += new EventHandler (OnImageClick);
            sicon.Tooltip = "Gfax Facsimile Sender";
            // showing the trayicon
            sicon.Visible = true;
            // setup system tray icon
            gfax.MainWindow.SkipTaskbarHint = true;
            gfax.MainWindow.Iconify();

            Application.Run ();
        }
Example #6
0
File: gui.cs Project: horga83/gfax
        // This is where we end up if the New Fax button or the menu item
        // has been selected.
        private void send_new_fax()
        {
            string [] largs = {"do_filename"};
            GfaxSend sd = new GfaxSend ("", largs);

            // send the faxes
            if (sd.DoSend) {
                Fax.sendfax(sd.Filename);
                // if file is temp data (/var/spool/gfax/D.*) then delete it
                FileInfo f = new FileInfo(sd.Filename);
                if (File.Exists(String.Concat(gfax.SpoolDirectory, "/", f.Name)))
                    File.Delete(String.Concat(gfax.SpoolDirectory, "/", f.Name));
            }
            activeQ = ActiveQ.send;
            async_update_queue_status("sendq");
            sd = null;
            largs = null;
        }