Now uses GLib for DBus communication instead of python-dbus

Now checks the file limit in DVD projects
This commit is contained in:
Sergio Costas 2014-08-06 16:34:31 +02:00
parent cc4039df9c
commit ec4829812a
4 changed files with 25 additions and 15 deletions

View file

@ -36,12 +36,13 @@ class message_window:
wmessage_text.set_markup(text)
wmessage_list = builder.get_object("list_message")
wmessage_liststore = builder.get_object("liststore_elements")
wmessage_window.show_all()
if (list_data == None):
wmessage_list.hide()
else:
for element in list_data:
wmessage_liststore.append([element])
wmessage_window.show_all()
wmessage_window.run()
wmessage_window.destroy()

View file

@ -393,6 +393,17 @@ class devede_project:
def on_create_disc_clicked(self,b):
if self.disc_type == "dvd":
max_files = 62
else:
max_files = -1
file_movies = self.get_all_files()
t = len(file_movies)
if (max_files != -1) and (t > max_files):
devede.message.message_window(_("The limit for this format is %(l)d files, but your project has %(h)d.") % {"l": max_files, "h" : t}, _("Too many files in the project"))
return
data = devede.create_disk_window.create_disk_window()
if (not data.run()):
return
@ -408,7 +419,6 @@ class devede_project:
self.shutdown = data.shutdown
run_window = devede.runner.runner()
file_movies = self.get_all_files()
final_dependencies = []

View file

@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
import dbus
from gi.repository import Gio, GLib
class shutdown:
@ -23,9 +23,9 @@ class shutdown:
# First, try with logind
try:
bus = dbus.SystemBus()
bus_object = bus.get_object("org.freedesktop.login1", "/org/freedesktop/login1")
bus_object.PowerOff(False, dbus_interface="org.freedesktop.login1.Manager")
bus = Gio.bus_get_sync(Gio.BusType.SYSTEM, None)
bus.call_sync("org.freedesktop.login1", "/org/freedesktop/login1", "org.freedesktop.login1.Manager",
"PowerOff", GLib.Variant_boolean('(bb)', ( False , False) ), None, Gio.DBusCallFlags.NONE, -1, None)
except:
failure=True
@ -34,9 +34,9 @@ class shutdown:
# If it fails, try with ConsoleKit
try:
bus = dbus.SystemBus()
bus_object = bus.get_object("org.freedesktop.ConsoleKit", "/org/freedesktop/ConsoleKit/Manager")
bus_object.Stop(dbus_interface="org.freedesktop.ConsoleKit.Manager")
bus = Gio.bus_get_sync(Gio.BusType.SYSTEM, None)
bus.call_sync("org.freedesktop.ConsoleKit", "/org/freedesktop/ConsoleKit/Manager", "org.freedesktop.ConsoleKit.Manager",
"Stop", None, None, Gio.DBusCallFlags.NONE, -1, None)
except:
failure=True
@ -45,8 +45,8 @@ class shutdown:
# If it fails, try with HAL
try:
bus = dbus.SystemBus()
bus_object = bus.get_object("org.freedesktop.Hal", "/org/freedesktop/Hal/devices/computer")
bus_object.Shutdown(dbus_interface="org.freedesktop.Hal.Device.SystemPowerManagement")
bus = Gio.bus_get_sync(Gio.BusType.SYSTEM, None)
bus.call_sync("org.freedesktop.Hal", "/org/freedesktop/Hal/devices/computer","org.freedesktop.Hal.Device.SystemPowerManagement",
"Shutdown", None, None, Gio.DBusCallFlags.NONE, -1, None)
except:
failure=True

View file

@ -25,7 +25,6 @@ from gi.repository import Gtk
import devede.project
import devede.configuration_data
import devede.choose_disc_type
import devede.converter
config_data = devede.configuration_data.configuration.get_config()