Commit 29e02f74 authored by Cheng Sun's avatar Cheng Sun Committed by Jean-Baptiste Kempf

misc. cleanups

Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent cfb7dfaf
......@@ -67,14 +67,13 @@ static const tool_actions_t tool_actions[] = {
{GTK_STOCK_MEDIA_PLAY, clicked_Play},
{GTK_STOCK_MEDIA_PAUSE, clicked_Pause},
{GTK_STOCK_MEDIA_STOP, clicked_Stop},
{"", clicked_Unknown},
{"gtk-volume-muted", clicked_Mute},
{"gtk-volume-unmuted", clicked_Unmute}
};
void VlcPluginGtk::toolbar_handler(GtkToolButton *btn, gpointer user_data)
static void toolbar_handler(GtkToolButton *btn, gpointer user_data)
{
VlcPluginBase *plugin = (VlcPluginBase *) user_data;
VlcPluginGtk *plugin = (VlcPluginGtk *) user_data;
const gchar *stock_id = gtk_tool_button_get_stock_id(btn);
for (int i = 0; i < sizeof(tool_actions)/sizeof(tool_actions_t); ++i) {
if (!strcmp(stock_id, tool_actions[i].stock_id)) {
......@@ -82,19 +81,19 @@ void VlcPluginGtk::toolbar_handler(GtkToolButton *btn, gpointer user_data)
return;
}
}
fprintf(stderr, "WARNING: No idea what you just clicked on (%s)\n", stock_id?stock_id:"NULL");
fprintf(stderr, "WARNING: No idea what toolbar button you just clicked on (%s)\n", stock_id?stock_id:"NULL");
}
bool VlcPluginGtk::time_slider_handler(GtkRange *range, GtkScrollType scroll, gdouble value, gpointer user_data)
static bool time_slider_handler(GtkRange *range, GtkScrollType scroll, gdouble value, gpointer user_data)
{
VlcPluginBase *plugin = (VlcPluginBase *) user_data;
VlcPluginGtk *plugin = (VlcPluginGtk *) user_data;
libvlc_media_player_set_position(plugin->getMD(), value/100.0);
return false;
}
bool VlcPluginGtk::vol_slider_handler(GtkRange *range, GtkScrollType scroll, gdouble value, gpointer user_data)
static bool vol_slider_handler(GtkRange *range, GtkScrollType scroll, gdouble value, gpointer user_data)
{
VlcPluginBase *plugin = (VlcPluginBase *) user_data;
VlcPluginGtk *plugin = (VlcPluginGtk *) user_data;
libvlc_audio_set_volume(plugin->getMD(), value);
return false;
}
......@@ -108,12 +107,12 @@ void VlcPluginGtk::update_controls()
toolbutton = gtk_toolbar_get_nth_item(GTK_TOOLBAR(toolbar), 0);
if (strcmp(gtk_tool_button_get_stock_id(GTK_TOOL_BUTTON(toolbutton)), stock_id)) {
gtk_tool_button_set_stock_id(GTK_TOOL_BUTTON(toolbutton), stock_id);
/* work around firefox not displaying the icon properly after change */
g_object_ref(toolbutton);
gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(toolbutton));
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), toolbutton, 0);
g_object_unref(toolbutton);
}
fprintf(stderr, "\n\n\ncurr stock id = %s\n\n\n", gtk_tool_button_get_stock_id(GTK_TOOL_BUTTON(toolbutton)));
/* time slider */
if (!libvlc_media_player ||
......@@ -149,13 +148,14 @@ bool VlcPluginGtk::create_windows()
gtk_widget_show_all(parent);
/*** TOOLBAR ***/
toolbar = gtk_toolbar_new();
gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS);
GtkToolItem *toolitem;
/* play/pause */
toolitem = gtk_tool_button_new_from_stock(GTK_STOCK_MEDIA_PLAY);
gtk_tool_button_set_stock_id(GTK_TOOL_BUTTON(toolitem),
GTK_STOCK_MEDIA_PAUSE);
g_signal_connect(G_OBJECT(toolitem), "clicked", G_CALLBACK(toolbar_handler), this);
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), toolitem, -1);
/* stop */
......@@ -173,7 +173,6 @@ bool VlcPluginGtk::create_windows()
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), toolitem, -1);
/* volume slider */
GtkWidget *vol_menu = gtk_menu_new();
toolitem = gtk_tool_item_new();
GtkWidget *vol_slider = gtk_hscale_new_with_range(0, 200, 10);
gtk_scale_set_draw_value(GTK_SCALE(vol_slider), false);
......@@ -182,7 +181,6 @@ bool VlcPluginGtk::create_windows()
gtk_widget_set_size_request(vol_slider, 100, -1);
gtk_container_add(GTK_CONTAINER(toolitem), vol_slider);
gtk_tool_item_set_expand(toolitem, false);
gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(toolitem), vol_menu);
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), toolitem, -1);
update_controls();
......
......@@ -51,9 +51,6 @@ public:
void hide_toolbar();
void update_controls();
static void toolbar_handler(GtkToolButton *, gpointer);
static bool time_slider_handler(GtkRange *, GtkScrollType, gdouble, gpointer);
static bool vol_slider_handler(GtkRange *, GtkScrollType, gdouble, gpointer);
private:
void set_player_window();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment