[pitivi] Remove deprecation from dialogs
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] Remove deprecation from dialogs
- Date: Wed, 24 Sep 2014 17:03:50 +0000 (UTC)
commit 4b83d0a9a59e3f91b36da46b82240cccfea5fb5a
Author: Lubosz Sarnecki <lubosz gmail com>
Date: Wed Sep 17 20:17:36 2014 +0200
Remove deprecation from dialogs
* add default response
* set_transient_for in about dialog
https://developer.gnome.org/gtk3/unstable/GtkWindow.html#gtk-window-set-transient-for
* don't use stock buttons
* remove unneeded close callback
data/ui/filelisterrordialog.ui | 4 +---
pitivi/mainwindow.py | 24 ++++++++++++------------
pitivi/medialibrary.py | 14 ++++++--------
3 files changed, 19 insertions(+), 23 deletions(-)
---
diff --git a/data/ui/filelisterrordialog.ui b/data/ui/filelisterrordialog.ui
index 6e06d17..65c577e 100644
--- a/data/ui/filelisterrordialog.ui
+++ b/data/ui/filelisterrordialog.ui
@@ -61,12 +61,11 @@
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="okbutton1">
- <property name="label">gtk-ok</property>
+ <property name="label" translatable="true">OK</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
- <property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -95,7 +94,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="resize_mode">queue</property>
<child>
<object class="GtkBox" id="errorvbox">
<property name="orientation">vertical</property>
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index 3cad1db..07e3ba8 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -602,6 +602,7 @@ class PitiviMainWindow(Gtk.ApplicationWindow, Loggable):
abt.set_icon_name("pitivi")
abt.set_logo_icon_name("pitivi")
abt.connect("response", self._aboutResponseCb)
+ abt.set_transient_for(self)
abt.show()
def openProject(self):
@@ -616,6 +617,7 @@ class PitiviMainWindow(Gtk.ApplicationWindow, Loggable):
action=Gtk.FileChooserAction.OPEN)
chooser.add_buttons(_("Cancel"), Gtk.ResponseType.CANCEL,
_("Open"), Gtk.ResponseType.OK)
+ chooser.set_default_response(Gtk.ResponseType.OK)
chooser.set_select_multiple(False)
# TODO: Remove this set_current_folder call when GTK bug 683999 is fixed
chooser.set_current_folder(self.settings.lastProjectFolder)
@@ -724,21 +726,18 @@ class PitiviMainWindow(Gtk.ApplicationWindow, Loggable):
return True
if project.uri and not project_manager.disable_save:
- save = Gtk.STOCK_SAVE
+ save = _("Save")
else:
- save = Gtk.STOCK_SAVE_AS
+ save = _("Save as...")
- dialog = Gtk.Dialog(title="",
- transient_for=self, modal=True)
+ dialog = Gtk.Dialog(title="", transient_for=self, modal=True)
dialog.add_buttons(_("Close without saving"), Gtk.ResponseType.REJECT,
- Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
- save, Gtk.ResponseType.YES)
+ _("Cancel"), Gtk.ResponseType.CANCEL,
+ save, Gtk.ResponseType.YES)
# Even though we set the title to an empty string when creating dialog,
# seems we really have to do it once more so it doesn't show "pitivi"...
- dialog.set_title("")
dialog.set_resizable(False)
dialog.set_default_response(Gtk.ResponseType.CANCEL)
- dialog.set_transient_for(self)
dialog.get_accessible().set_name("unsaved changes dialog")
primary = Gtk.Label()
@@ -854,14 +853,15 @@ class PitiviMainWindow(Gtk.ApplicationWindow, Loggable):
uri = asset.get_id()
new_uri = None
dialog = Gtk.Dialog(title=_("Locate missing file..."),
- transient_for=self,
- modal=True)
+ transient_for=self,
+ modal=True)
- dialog.add_buttons(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
- Gtk.STOCK_OPEN, Gtk.ResponseType.OK)
+ dialog.add_buttons(_("Cancel"), Gtk.ResponseType.CANCEL,
+ _("Open"), Gtk.ResponseType.OK)
dialog.set_border_width(SPACING * 2)
dialog.get_content_area().set_spacing(SPACING)
dialog.set_transient_for(self)
+ dialog.set_default_response(Gtk.ResponseType.OK)
# This box will contain the label and optionally a thumbnail
hbox = Gtk.HBox()
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index 81dc5e4..1ad558c 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -456,11 +456,11 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
close_after.set_active(self.app.settings.closeImportDialog)
self._importDialog = Gtk.FileChooserDialog(title=dialogtitle, transient_for=None,
- action=chooser_action)
+ action=chooser_action)
- self._importDialog.add_buttons(Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE,
- Gtk.STOCK_ADD, Gtk.ResponseType.OK)
self._importDialog.set_icon_name("pitivi")
+ self._importDialog.add_buttons(_("Cancel"), Gtk.ResponseType.CANCEL,
+ _("Add"), Gtk.ResponseType.OK)
self._importDialog.props.extra_widget = close_after
self._importDialog.set_default_response(Gtk.ResponseType.OK)
self._importDialog.set_select_multiple(True)
@@ -468,7 +468,6 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
self._importDialog.set_transient_for(self.app.gui)
self._importDialog.set_current_folder(self.app.settings.lastImportFolder)
self._importDialog.connect('response', self._dialogBoxResponseCb)
- self._importDialog.connect('close', self._dialogBoxCloseCb)
previewer = PreviewWidget(self.app.settings)
self._importDialog.set_preview_widget(previewer)
self._importDialog.set_use_preview_label(False)
@@ -737,10 +736,6 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
dialogbox.destroy()
self._importDialog = None
- def _dialogBoxCloseCb(self, unused_dialogbox):
- self.debug("closing")
- self._importDialog = None
-
def _removeSources(self):
"""
Determine which clips are selected in the icon or list view,
@@ -817,6 +812,7 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
path = paths[0]
asset = self.storemodel[path][COL_ASSET]
dialog = ClipMediaPropsDialog(self.app.project_manager.current_project, asset)
+ dialog.dialog.set_transient_for(self.app.gui)
dialog.run()
def _warningInfoBarDismissedCb(self, unused_button):
@@ -839,8 +835,10 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
error_dialogbox = FileListErrorDialog(*msgs)
error_dialogbox.connect("close", self._errorDialogBoxCloseCb)
error_dialogbox.connect("response", self._errorDialogBoxResponseCb)
+
for uri, reason, extra in self._errors:
error_dialogbox.addFailedFile(uri, reason, extra)
+ error_dialogbox.window.set_transient_for(self.app.gui)
error_dialogbox.window.show()
# Reset the error list, since the user has read them.
self._resetErrorList()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]