[vlc-commits] misc. cleanups
Cheng Sun
git at videolan.org
Wed Dec 21 12:54:08 CET 2011
npapi-vlc | branch: master | Cheng Sun <chengsun9 at gmail.com> | Sat Dec 10 10:54:38 2011 +0000| [29e02f7434b68b264a13639d5576026a6c85c793] | committer: Jean-Baptiste Kempf
misc. cleanups
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/npapi-vlc.git/?a=commit;h=29e02f7434b68b264a13639d5576026a6c85c793
---
npapi/vlcplugin_gtk.cpp | 24 +++++++++++-------------
npapi/vlcplugin_gtk.h | 3 ---
2 files changed, 11 insertions(+), 16 deletions(-)
diff --git a/npapi/vlcplugin_gtk.cpp b/npapi/vlcplugin_gtk.cpp
index 74a0b2c..9df901d 100644
--- a/npapi/vlcplugin_gtk.cpp
+++ b/npapi/vlcplugin_gtk.cpp
@@ -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();
diff --git a/npapi/vlcplugin_gtk.h b/npapi/vlcplugin_gtk.h
index 013a3f3..3291c09 100644
--- a/npapi/vlcplugin_gtk.h
+++ b/npapi/vlcplugin_gtk.h
@@ -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();
More information about the vlc-commits
mailing list