Browse Source

sidebar: Tweak the styling of the sidebar toolbar a bit

Adjust the height and of the toolbar to match the height of the new playbar.
Also center the buttons in sidebar instead of aligning them against the left
side.
tags/1.4.0
JosephMcc 4 years ago
parent
commit
fd0d05d163
4 changed files with 144 additions and 74 deletions
  1. +122
    -70
      data/playlist.ui
  2. +10
    -2
      src/xplayer-object.c
  3. +11
    -2
      src/xplayer-playlist.c
  4. +1
    -0
      src/xplayer-playlist.h

+ 122
- 70
data/playlist.ui View File

@@ -96,84 +96,111 @@
<property name="can_focus">False</property>
<property name="icon_size">1</property>
<property name="toolbar-style">icons</property>
<style>
<class name="inline-toolbar"/>
</style>
<child>
<object class="GtkToolButton" id="add_button">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="icon_name">list-add-symbolic</property>
<signal name="clicked" handler="xplayer_playlist_add_files"/>
<property name="tooltip-text" translatable="yes">Add...</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolButton" id="remove_button">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="icon_name">list-remove-symbolic</property>
<signal name="clicked" handler="playlist_remove_button_clicked"/>
<property name="tooltip-text" translatable="yes">Remove</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolButton" id="save_button">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="icon_name">document-save-symbolic</property>
<property name="tooltip-text" translatable="yes">Save Playlist...</property>
<signal name="clicked" handler="xplayer_playlist_save_files"/>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolButton" id="up_button">
<object class="GtkToolItem" id="toolbutton1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="icon_name">go-up-symbolic</property>
<property name="tooltip-text" translatable="yes">Move Up</property>
<signal name="clicked" handler="xplayer_playlist_up_files"/>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolButton" id="down_button">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="icon_name">go-down-symbolic</property>
<property name="tooltip-text" translatable="yes">Move Down</property>
<signal name="clicked" handler="xplayer_playlist_down_files"/>
<property name="border_width">3</property>
<child>
<object class="GtkBox" id="box5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="hexpand">True</property>
<child>
<object class="GtkButton" id="add_button">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="image">image1</property>
<signal name="clicked" handler="xplayer_playlist_add_files"/>
<property name="tooltip-text" translatable="yes">Add...</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="remove_button">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="image">image2</property>
<signal name="clicked" handler="playlist_remove_button_clicked"/>
<property name="tooltip-text" translatable="yes">Remove</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="save_button">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="image">image3</property>
<property name="tooltip-text" translatable="yes">Save Playlist...</property>
<signal name="clicked" handler="xplayer_playlist_save_files"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="up_button">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="image">image4</property>
<property name="tooltip-text" translatable="yes">Move Up</property>
<signal name="clicked" handler="xplayer_playlist_up_files"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="down_button">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="image">image5</property>
<property name="tooltip-text" translatable="yes">Move Down</property>
<signal name="clicked" handler="xplayer_playlist_down_files"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
<style>
<class name="linked"/>
</style>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="expand">True</property>
<property name="homogeneous">True</property>
</packing>
</child>
<style>
<class name="inline-toolbar"/>
</style>
</object>
<packing>
<property name="expand">False</property>
@@ -182,4 +209,29 @@
</packing>
</child>
</object>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">list-add-symbolic</property>
</object>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">list-remove-symbolic</property>
</object>
<object class="GtkImage" id="image3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">document-save-symbolic</property>
</object>
<object class="GtkImage" id="image4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">go-up-symbolic</property>
</object>
<object class="GtkImage" id="image5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">go-down-symbolic</property>
</object>
</interface>

+ 10
- 2
src/xplayer-object.c View File

@@ -4138,9 +4138,11 @@ xplayer_setup_window (XplayerObject *xplayer)
void
xplayer_callback_connect (XplayerObject *xplayer)
{
GtkWidget *item, *image, *label;
GIcon *icon;
GtkWidget *item, *image;
GtkWidget *sidebar_toolbar;
GtkWidget *size_box;
GtkAction *action;
GtkSizeGroup *size_group;
GtkActionGroup *action_group;
GtkBox *box;

@@ -4286,6 +4288,12 @@ xplayer_callback_connect (XplayerObject *xplayer)

action = gtk_action_group_get_action (action_group, "skip-backwards");
gtk_action_set_sensitive (action, FALSE);

sidebar_toolbar = xplayer_playlist_get_toolbar (xplayer->playlist);
size_box = GTK_BOX (gtk_builder_get_object (xplayer->xml, "tmw_controls_vbox"));
size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
gtk_size_group_add_widget (size_group, size_box);
gtk_size_group_add_widget (size_group, sidebar_toolbar);
}

void


+ 11
- 2
src/xplayer-playlist.c View File

@@ -84,6 +84,7 @@ struct XplayerPlaylistPrivate
GtkWidget *remove_button;
GtkWidget *up_button;
GtkWidget *down_button;
GtkWidget *toolbar;

/* These is the current paths for the file selectors */
char *path;
@@ -1691,8 +1692,8 @@ xplayer_playlist_init (XplayerPlaylist *playlist)
widget = GTK_WIDGET (gtk_builder_get_object (xml, ("scrolledwindow1")));
context = gtk_widget_get_style_context (widget);
gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM);
widget = GTK_WIDGET (gtk_builder_get_object (xml, ("toolbar1")));
context = gtk_widget_get_style_context (widget);
playlist->priv->toolbar = GTK_WIDGET (gtk_builder_get_object (xml, ("toolbar1")));
context = gtk_widget_get_style_context (playlist->priv->toolbar);
gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);

/* Reparent the vbox */
@@ -2889,6 +2890,14 @@ xplayer_playlist_get_last (XplayerPlaylist *playlist)
return len - 1;
}

GtkWidget *
xplayer_playlist_get_toolbar (XplayerPlaylist *playlist)
{
g_return_if_fail (XPLAYER_IS_PLAYLIST (playlist));

return playlist->priv->toolbar;
}

void
xplayer_playlist_set_current (XplayerPlaylist *playlist, guint current_index)
{


+ 1
- 0
src/xplayer-playlist.h View File

@@ -164,6 +164,7 @@ void xplayer_playlist_set_at_end (XplayerPlaylist *playlist);
int xplayer_playlist_get_current (XplayerPlaylist *playlist);
int xplayer_playlist_get_last (XplayerPlaylist *playlist);
void xplayer_playlist_set_current (XplayerPlaylist *playlist, guint current_index);
GtkWidget *xplayer_playlist_get_toolbar (XplayerPlaylist *playlist);

G_END_DECLS



Loading…
Cancel
Save