[pitivi] Use icon_name all over the place, as stock icons are deprecated in GTK+ 3.10



commit 5cab48d658082e6e3fca0a64cef96eeeb4418e49
Author: Jean-François Fortin Tam <nekohayo gmail com>
Date:   Fri Dec 27 13:40:49 2013 -0500

    Use icon_name all over the place, as stock icons are deprecated in GTK+ 3.10

 pitivi/mainwindow.py          |    3 +--
 pitivi/mediafilespreviewer.py |    9 ++++++---
 pitivi/project.py             |    3 +--
 pitivi/render.py              |    4 ++--
 pitivi/utils/widgets.py       |    7 +++----
 pitivi/viewer.py              |   25 ++++++++++++++-----------
 6 files changed, 27 insertions(+), 24 deletions(-)
---
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index e62f4d8..7895a69 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -924,8 +924,7 @@ class PitiviMainWindow(Gtk.Window, Loggable):
         vbox.pack_start(secondary, True, True, 0)
 
         # make the [[image] text] hbox
-        image = Gtk.Image.new_from_stock(Gtk.STOCK_DIALOG_QUESTION,
-               Gtk.IconSize.DIALOG)
+        image = Gtk.Image.new_from_icon_name("dialog-question", Gtk.IconSize.DIALOG)
         hbox = Gtk.HBox(homogeneous=False, spacing=SPACING * 2)
         hbox.pack_start(image, False, True, 0)
         hbox.pack_start(vbox, True, True, 0)
diff --git a/pitivi/mediafilespreviewer.py b/pitivi/mediafilespreviewer.py
index 2379d54..516eb0d 100644
--- a/pitivi/mediafilespreviewer.py
+++ b/pitivi/mediafilespreviewer.py
@@ -97,7 +97,8 @@ class PreviewWidget(Gtk.VBox, Loggable):
 
         # Play button
         self.bbox = Gtk.HBox()
-        self.play_button = Gtk.ToolButton.new_from_stock(Gtk.STOCK_MEDIA_PLAY)
+        self.play_button = Gtk.ToolButton()
+        self.play_button.set_icon_name("media-playback-start")
         self.play_button.connect("clicked", self._on_start_stop_clicked_cb)
         self.bbox.pack_start(self.play_button, False, True, 0)
 
@@ -112,9 +113,11 @@ class PreviewWidget(Gtk.VBox, Loggable):
         self.bbox.pack_start(self.seeker, True, True, 0)
 
         # Zoom buttons
-        self.b_zoom_in = Gtk.ToolButton.new_from_stock(Gtk.STOCK_ZOOM_IN)
+        self.b_zoom_in = Gtk.ToolButton()
+        self.b_zoom_in.set_icon_name("zoom-in")
         self.b_zoom_in.connect("clicked", self._on_zoom_clicked_cb, 1)
-        self.b_zoom_out = Gtk.ToolButton.new_from_stock(Gtk.STOCK_ZOOM_OUT)
+        self.b_zoom_out = Gtk.ToolButton()
+        self.b_zoom_out.set_icon_name("zoom-out")
         self.b_zoom_out.connect("clicked", self._on_zoom_clicked_cb, -1)
         self.bbox.pack_start(self.b_zoom_in, False, True, 0)
         self.bbox.pack_start(self.b_zoom_out, False, True, 0)
diff --git a/pitivi/project.py b/pitivi/project.py
index 9735ee5..fd20db8 100644
--- a/pitivi/project.py
+++ b/pitivi/project.py
@@ -215,8 +215,7 @@ class ProjectManager(Signallable, Loggable):
         vbox.pack_start(primary, True, True, 0)
 
         # make the [[image] text] hbox
-        image = Gtk.Image.new_from_stock(Gtk.STOCK_DIALOG_QUESTION,
-                                         Gtk.IconSize.DIALOG)
+        image = Gtk.Image.new_from_icon_name("dialog-question", Gtk.IconSize.DIALOG)
         hbox = Gtk.HBox(homogeneous=False, spacing=SPACING * 2)
         hbox.pack_start(image, False, True, 0)
         hbox.pack_start(vbox, True, True, 0)
diff --git a/pitivi/render.py b/pitivi/render.py
index 63d28e0..46ae6b2 100644
--- a/pitivi/render.py
+++ b/pitivi/render.py
@@ -701,7 +701,7 @@ class RenderDialog(Loggable):
         if not path:
             # This happens when the window is initialized.
             return
-        warning_icon = Gtk.STOCK_DIALOG_WARNING
+        warning_icon = "dialog-warning"
         filename = self.fileentry.get_text()
         if not filename:
             tooltip_text = _("A file name is required.")
@@ -712,7 +712,7 @@ class RenderDialog(Loggable):
         else:
             warning_icon = None
             tooltip_text = None
-        self.fileentry.set_icon_from_stock(1, warning_icon)
+        self.fileentry.set_icon_from_icon_name(1, warning_icon)
         self.fileentry.set_icon_tooltip_text(1, tooltip_text)
 
     def _getFilesizeEstimate(self):
diff --git a/pitivi/utils/widgets.py b/pitivi/utils/widgets.py
index 8483b81..da36bdf 100644
--- a/pitivi/utils/widgets.py
+++ b/pitivi/utils/widgets.py
@@ -171,11 +171,11 @@ class TextWidget(Gtk.HBox, DynamicWidget):
                 if self.send_signal:
                     self.emit("value-changed")
                 if not self.valid:
-                    self.text.set_icon_from_stock(1, None)
+                    self.text.set_icon_from_icon_name(1, None)
                 self.valid = True
             else:
                 if self.valid:
-                    self.text.set_icon_from_stock(1, Gtk.STOCK_DIALOG_WARNING)
+                    self.text.set_icon_from_icon_name(1, "dialog-warning")
                 self.valid = False
         elif self.send_signal:
             self.emit("value-changed")
@@ -1048,8 +1048,7 @@ class ZoomBox(Gtk.HBox, Zoomable):
         zoom_fit_btn = Gtk.Button()
         zoom_fit_btn.set_relief(Gtk.ReliefStyle.NONE)
         zoom_fit_btn.set_tooltip_text(ZOOM_FIT)
-        zoom_fit_icon = Gtk.Image()
-        zoom_fit_icon.set_from_stock(Gtk.STOCK_ZOOM_FIT, Gtk.IconSize.BUTTON)
+        zoom_fit_icon = Gtk.Image.new_from_icon_name("zoom-best-fit", Gtk.IconSize.BUTTON)
         zoom_fit_btn_hbox = Gtk.HBox()
         zoom_fit_btn_hbox.pack_start(zoom_fit_icon, False, True, 0)
         zoom_fit_btn_hbox.pack_start(Gtk.Label(label=_("Zoom")), False, True, 0)
diff --git a/pitivi/viewer.py b/pitivi/viewer.py
index 81770ea..a630a64 100644
--- a/pitivi/viewer.py
+++ b/pitivi/viewer.py
@@ -213,13 +213,15 @@ class PitiviViewer(Gtk.VBox, Loggable):
         boxalign.add(bbox)
         self.pack_start(boxalign, False, True, 0)
 
-        self.goToStart_button = Gtk.ToolButton.new_from_stock(Gtk.STOCK_MEDIA_PREVIOUS)
+        self.goToStart_button = Gtk.ToolButton()
+        self.goToStart_button.set_icon_name("media-skip-backward")
         self.goToStart_button.connect("clicked", self._goToStartCb)
         self.goToStart_button.set_tooltip_text(_("Go to the beginning of the timeline"))
         self.goToStart_button.set_sensitive(False)
         bbox.pack_start(self.goToStart_button, False, True, 0)
 
-        self.back_button = Gtk.ToolButton.new_from_stock(Gtk.STOCK_MEDIA_REWIND)
+        self.back_button = Gtk.ToolButton()
+        self.back_button.set_icon_name("media-seek-backward")
         self.back_button.connect("clicked", self._backCb)
         self.back_button.set_tooltip_text(_("Go back one second"))
         self.back_button.set_sensitive(False)
@@ -230,13 +232,15 @@ class PitiviViewer(Gtk.VBox, Loggable):
         bbox.pack_start(self.playpause_button, False, True, 0)
         self.playpause_button.set_sensitive(False)
 
-        self.forward_button = Gtk.ToolButton.new_from_stock(Gtk.STOCK_MEDIA_FORWARD)
+        self.forward_button = Gtk.ToolButton()
+        self.forward_button.set_icon_name("media-seek-forward")
         self.forward_button.connect("clicked", self._forwardCb)
         self.forward_button.set_tooltip_text(_("Go forward one second"))
         self.forward_button.set_sensitive(False)
         bbox.pack_start(self.forward_button, False, True, 0)
 
-        self.goToEnd_button = Gtk.ToolButton.new_from_stock(Gtk.STOCK_MEDIA_NEXT)
+        self.goToEnd_button = Gtk.ToolButton()
+        self.goToEnd_button.set_icon_name("media-skip-forward")
         self.goToEnd_button.connect("clicked", self._goToEndCb)
         self.goToEnd_button.set_tooltip_text(_("Go to the end of the timeline"))
         self.goToEnd_button.set_sensitive(False)
@@ -376,7 +380,8 @@ class PitiviViewer(Gtk.VBox, Loggable):
         self.external_window.set_type_hint(Gdk.WindowTypeHint.UTILITY)
         self.external_window.show()
 
-        self.fullscreen_button = Gtk.ToggleToolButton(Gtk.STOCK_FULLSCREEN)
+        self.fullscreen_button = Gtk.ToggleToolButton()
+        self.fullscreen_button.set_icon_name("view-fullscreen")
         self.fullscreen_button.set_tooltip_text(_("Show this window in fullscreen"))
         self.buttons.pack_end(self.fullscreen_button, expand=False, fill=False, padding=6)
         self.fullscreen_button.show()
@@ -1022,17 +1027,15 @@ class PlayPauseButton(Gtk.Button, Loggable):
         self.emit("play", self.playing)
 
     def setPlay(self):
-        """ display the play image """
-        self.log("setPlay")
+        self.log("Displaying the play image")
         self.playing = True
-        self.set_image(Gtk.Image.new_from_stock(Gtk.STOCK_MEDIA_PLAY, Gtk.IconSize.BUTTON))
+        self.set_image(Gtk.Image.new_from_icon_name("media-playback-start", Gtk.IconSize.BUTTON))
         self.set_tooltip_text(_("Play"))
         self.playing = False
 
     def setPause(self):
-        self.log("setPause")
-        """ display the pause image """
+        self.log("Displaying the pause image")
         self.playing = False
-        self.set_image(Gtk.Image.new_from_stock(Gtk.STOCK_MEDIA_PAUSE, Gtk.IconSize.BUTTON))
+        self.set_image(Gtk.Image.new_from_icon_name("media-playback-pause", Gtk.IconSize.BUTTON))
         self.set_tooltip_text(_("Pause"))
         self.playing = True


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]