LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
楼主: dyte200

网络电视前端 gtk-sopcast(支持音量调节,实时状态显示,mplayer无延迟启动)

[复制链接]
 楼主| 发表于 2006-7-7 23:32:18 | 显示全部楼层
Post by duleell
emum中加个ACTIVE_COLUMN,把该列add在CARD_COLUMN列后,然后用该列显示当前播放频道的记号,如"@"(最好是加个图标)。

status bar 里已经有正在播放的channel名字了,这样岂不是多此一举?
回复 支持 反对

使用道具 举报

发表于 2006-7-7 23:33:34 | 显示全部楼层
参考代码来自:http://www.osprg.org/modules/new ... ic_id=6&forum=5


/* 关于列表的例子。
* 编译指令为:gcc `pkg-config --cflags --libs gtk+-2.0` -Wall -g -o list list.c
*/

#include <gtk/gtk.h>

int
main (int argc, char *argv[])
{
  GtkWidget *main_window;
  GtkWidget *tree_view;
  GtkListStore *list_store;
  GtkTreeViewColumn *column;
  GtkCellRenderer *cell_renderer;
  GtkTreeIter tree_iter;


  gtk_set_locale ();
  gtk_init (&argc, &argv);

  main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_default_size (GTK_WINDOW (main_window), 320, 240);
  gtk_window_set_title (GTK_WINDOW (main_window), "Main Window");


  list_store = gtk_list_store_new (5, G_TYPE_STRING, G_TYPE_UINT,
                                   G_TYPE_STRING, G_TYPE_STRING,
                                   G_TYPE_STRING);
  tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (list_store));
  gtk_widget_show (tree_view);
  gtk_container_add (GTK_CONTAINER (main_window), tree_view);


  /* 第一列:每列多个 CelRenderer,每个 CellRenderer 多个属性 */
  column = gtk_tree_view_column_new ();
  gtk_tree_view_column_set_title (column, "0001");
  gtk_tree_view_column_set_resizable (column, TRUE);
  gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED);
  gtk_tree_view_column_set_fixed_width (column, 100);
  gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);

  cell_renderer = gtk_cell_renderer_pixbuf_new ();
  gtk_tree_view_column_pack_start (column, cell_renderer, TRUE);
  gtk_tree_view_column_set_attributes (column, cell_renderer, "stock-id", 0,
                                       NULL);

  /* 一个 CellRenderer 的多个属性与 TreeModel 的多个数据项联系 */
  cell_renderer = gtk_cell_renderer_text_new ();
  gtk_tree_view_column_pack_start (column, cell_renderer, TRUE);
  gtk_tree_view_column_set_attributes (column, cell_renderer, "text", 1,
                                       "foreground", 2, NULL);

  /* 第二列 */
  column = gtk_tree_view_column_new ();
  gtk_tree_view_column_set_title (column, "0002");
  gtk_tree_view_column_set_resizable (column, TRUE);
  /* 下面注释的语句是为了试试 GtkTreeViewColumnSizing
   * 大家不妨,把注释去掉,看看结果有何不同
   */
  //  gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED);
  //  gtk_tree_view_column_set_fixed_width (column, 100);
  gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);

  cell_renderer = gtk_cell_renderer_text_new ();
  gtk_tree_view_column_pack_start (column, cell_renderer, TRUE);
  gtk_tree_view_column_set_attributes (column, cell_renderer, "text", 3,
                                       NULL);

  /* 第三列 */
  column = gtk_tree_view_column_new ();
  gtk_tree_view_column_set_title (column, "0003");
  gtk_tree_view_column_set_resizable (column, TRUE);
  gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED);
  gtk_tree_view_column_set_fixed_width (column, 100);
  gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);

  cell_renderer = gtk_cell_renderer_text_new ();
  gtk_tree_view_column_pack_start (column, cell_renderer, TRUE);
  gtk_tree_view_column_set_attributes (column, cell_renderer, "text", 4,
                                       NULL);


  gtk_list_store_append (list_store, &tree_iter);
  gtk_list_store_set (list_store, &tree_iter, 0, "gtk-cdrom", 1, 1000,
                      2, "red", 3, "string01..............", 4, "string02",
                      -1);
  gtk_list_store_append (list_store, &tree_iter);
  gtk_list_store_set (list_store, &tree_iter, 0, "gtk-help", 1, 2000,
                      2, "green", 3, "string11", 4, "string12", -1);

  g_signal_connect (G_OBJECT (main_window), "destroy",
                    G_CALLBACK (gtk_main_quit), NULL);

  gtk_widget_show_all (main_window);

  gtk_main ();

  return 0;
}

运行效果:

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
回复 支持 反对

使用道具 举报

发表于 2006-7-7 23:44:08 | 显示全部楼层
用顺了Apple的itunes,希望podcast的gtk前端向那样的操作方式和界面发展

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-7-10 16:34:29 | 显示全部楼层
0.2.3: 更多更好的状态量显示(百分比,上传/下载速度,上传/下载总量,peers个数),增加下拉菜单,Launch按钮被用于启动下拉菜单中的channel
0.2.4: 改进了下拉菜单启动电台的代码

gtk-sopcast我所渴望实现的代码基本都实现了。工作到此暂时结束。
回复 支持 反对

使用道具 举报

发表于 2006-7-10 18:47:50 | 显示全部楼层
为什么我从源码安装总是不成功?
$ make
gcc -O2  `pkg-config --cflags gtk+-2.0`  -c callbacks.c -o callbacks.o
Package gtk+-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk+-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtk+-2.0' found
In file included from callbacks.c:21:
header.h:24:21: error: gtk/gtk.h: No such file or directory
In file included from callbacks.c:21:
header.h:56: error: syntax error before ‘*’ token
header.h:56: warning: data definition has no type or storage class
header.h:57: error: syntax error before ‘*’ token
header.h:57: warning: data definition has no type or storage class
header.h:58: error: syntax error before ‘*’ token
header.h:58: warning: data definition has no type or storage class
header.h:59: error: syntax error before ‘*’ token
header.h:59: warning: data definition has no type or storage class
header.h:60: error: syntax error before ‘*’ token
header.h:60: warning: data definition has no type or storage class
header.h:61: error: syntax error before ‘*’ token
header.h:61: warning: data definition has no type or storage class
header.h:65: error: syntax error before ‘*’ token
header.h:65: warning: data definition has no type or storage class
header.h:66: error: syntax error before ‘*’ token
header.h:66: warning: data definition has no type or storage class
header.h:93: error: syntax error before ‘*’ token
header.h:93: warning: data definition has no type or storage class
header.h:94: error: syntax error before ‘*’ token
header.h:94: warning: data definition has no type or storage class
header.h:96: error: syntax error before ‘*’ token
header.h:96: warning: data definition has no type or storage class
header.h:97: error: syntax error before ‘*’ token
header.h:97: warning: data definition has no type or storage class
header.h:98: error: syntax error before ‘*’ token
header.h:98: warning: data definition has no type or storage class
header.h:99: error: syntax error before ‘*’ token
header.h:99: warning: data definition has no type or storage class
header.h:100: error: syntax error before ‘*’ token
header.h:100: warning: data definition has no type or storage class
callbacks.c:22: error: syntax error before ‘statistics_monitor’
callbacks.c:22: warning: data definition has no type or storage class
callbacks.c:23: error: syntax error before ‘launch_record’
callbacks.c:23: warning: data definition has no type or storage class
callbacks.c:26: error: syntax error before ‘flag_player’
callbacks.c:26: error: ‘FALSE’ undeclared here (not in a function)
callbacks.c:26: warning: data definition has no type or storage class
callbacks.c:27: error: syntax error before ‘tag_statistics’
callbacks.c:27: warning: data definition has no type or storage class
callbacks.c:28: error: syntax error before ‘*’ token
callbacks.c:28: warning: data definition has no type or storage class
callbacks.c:29: error: syntax error before ‘ptimer_statistics’
callbacks.c:29: warning: data definition has no type or storage class
callbacks.c:31: error: syntax error before ‘tag_record’
callbacks.c:31: warning: data definition has no type or storage class
callbacks.c:32: error: syntax error before ‘*’ token
callbacks.c:32: warning: data definition has no type or storage class
callbacks.c:34: error: syntax error before ‘ptimer_record’
callbacks.c:34: warning: data definition has no type or storage class
callbacks.c: In function ‘start_statistics_monitor’:
callbacks.c:63: error: ‘TRUE’ undeclared (first use in this function)
callbacks.c:63: error: (Each undeclared identifier is reported only once
callbacks.c:63: error: for each function it appears in.)
callbacks.c:82: error: ‘GdkColor’ undeclared (first use in this function)
callbacks.c:82: error: syntax error before ‘color’
callbacks.c:83: error: ‘color’ undeclared (first use in this function)
callbacks.c:84: error: ‘GTK_STATE_NORMAL’ undeclared (first use in this function)
callbacks.c: At top level:
callbacks.c:94: error: syntax error before ‘*’ token
callbacks.c:95: error: syntax error before ‘*’ token
callbacks.c: In function ‘list_operate’:
callbacks.c:97: error: ‘GList’ undeclared (first use in this function)
callbacks.c:97: error: ‘item’ undeclared (first use in this function)
callbacks.c:97: error: ‘list’ undeclared (first use in this function)
callbacks.c:100: error: ‘key’ undeclared (first use in this function)
callbacks.c:103: error: ‘last’ undeclared (first use in this function)
callbacks.c: At top level:
callbacks.c:118: error: syntax error before ‘*’ token
callbacks.c: In function ‘list_search_url’:
callbacks.c:120: error: ‘GList’ undeclared (first use in this function)
callbacks.c:120: error: ‘sitem’ undeclared (first use in this function)
callbacks.c:120: error: ‘slist’ undeclared (first use in this function)
callbacks.c:121: error: ‘uitem’ undeclared (first use in this function)
callbacks.c:121: error: ‘ulist’ undeclared (first use in this function)
callbacks.c:124: error: ‘key’ undeclared (first use in this function)
callbacks.c: At top level:
callbacks.c:136: error: syntax error before ‘*’ token
callbacks.c: In function ‘on_treeview1_row_activated’:
callbacks.c:140: error: ‘GtkTreeSelection’ undeclared (first use in this function)
callbacks.c:140: error: ‘selection’ undeclared (first use in this function)
callbacks.c:141: error: ‘treeview’ undeclared (first use in this function)
callbacks.c:143: error: ‘GtkTreeIter’ undeclared (first use in this function)
callbacks.c:143: error: syntax error before ‘iter’
callbacks.c:144: error: ‘GtkTreeModel’ undeclared (first use in this function)
callbacks.c:144: error: ‘model’ undeclared (first use in this function)
callbacks.c:145: error: ‘GtkTreePath’ undeclared (first use in this function)
callbacks.c:145: error: ‘path’ undeclared (first use in this function)
callbacks.c:146: error: ‘gchar’ undeclared (first use in this function)
callbacks.c:146: error: ‘name’ undeclared (first use in this function)
callbacks.c:146: error: ‘url’ undeclared (first use in this function)
callbacks.c:147: error: ‘iter’ undeclared (first use in this function)
callbacks.c:173: error: ‘GList’ undeclared (first use in this function)
callbacks.c:173: error: ‘result’ undeclared (first use in this function)
callbacks.c:182: warning: assignment makes pointer from integer without a cast
callbacks.c:183: warning: assignment makes pointer from integer without a cast
callbacks.c: In function ‘on_button_sopcast_clicked’:
callbacks.c:199: error: syntax error before ‘*’ token
callbacks.c:200: error: ‘str’ undeclared (first use in this function)
callbacks.c:200: error: invalid type argument of ‘->’
callbacks.c: In function ‘tree_search’:
callbacks.c:238: error: syntax error before ‘*’ token
callbacks.c:239: error: ‘str’ undeclared (first use in this function)
callbacks.c:240: error: ‘gchar’ undeclared (first use in this function)
callbacks.c:240: error: ‘str2’ undeclared (first use in this function)
callbacks.c: At top level:
callbacks.c:264: error: syntax error before ‘*’ token
callbacks.c: In function ‘on_button_expand_clicked’:
callbacks.c:266: error: ‘gboolean’ undeclared (first use in this function)
callbacks.c:266: error: syntax error before ‘flag’
callbacks.c:267: error: ‘widget’ undeclared (first use in this function)
callbacks.c:267: warning: passing argument 1 of ‘strlen’ makes pointer from integer without a cast
callbacks.c:267: warning: passing argument 1 of ‘__builtin_strcmp’ makes pointer from integer without a cast
callbacks.c:267: warning: passing argument 1 of ‘strlen’ makes pointer from integer without a cast
callbacks.c:267: warning: passing argument 1 of ‘__builtin_strcmp’ makes pointer from integer without a cast
callbacks.c:267: warning: passing argument 1 of ‘__builtin_strcmp’ makes pointer from integer without a cast
callbacks.c:267: warning: passing argument 1 of ‘__builtin_strcmp’ makes pointer from integer without a cast
callbacks.c:270: error: ‘flag’ undeclared (first use in this function)
callbacks.c:270: error: ‘TRUE’ undeclared (first use in this function)
callbacks.c:272: warning: passing argument 1 of ‘strlen’ makes pointer from integer without a cast
callbacks.c:272: warning: passing argument 1 of ‘__builtin_strcmp’ makes pointer from integer without a cast
callbacks.c:272: warning: passing argument 1 of ‘strlen’ makes pointer from integer without a cast
callbacks.c:272: warning: passing argument 1 of ‘__builtin_strcmp’ makes pointer from integer without a cast
callbacks.c:272: warning: passing argument 1 of ‘__builtin_strcmp’ makes pointer from integer without a cast
callbacks.c:272: warning: passing argument 1 of ‘__builtin_strcmp’ makes pointer from integer without a cast
callbacks.c:278: error: ‘GtkTreeModel’ undeclared (first use in this function)
callbacks.c:278: error: ‘model’ undeclared (first use in this function)
callbacks.c:282: error: syntax error before ‘valid’
callbacks.c:283: error: ‘GtkTreeIter’ undeclared (first use in this function)
callbacks.c:284: error: ‘GtkTreePath’ undeclared (first use in this function)
callbacks.c:284: error: ‘path’ undeclared (first use in this function)
callbacks.c:285: error: ‘valid’ undeclared (first use in this function)
callbacks.c:285: error: ‘iter’ undeclared (first use in this function)
callbacks.c: In function ‘on_button_player_clicked’:
callbacks.c:316: error: ‘TRUE’ undeclared (first use in this function)
callbacks.c: At top level:
callbacks.c:322: error: syntax error before ‘*’ token
callbacks.c: In function ‘on_button_channel_toggled’:
callbacks.c:324: error: ‘widget’ undeclared (first use in this function)
callbacks.c:324: error: invalid type argument of ‘->’
callbacks.c:326: error: invalid type argument of ‘->’
callbacks.c:327: error: ‘TRUE’ undeclared (first use in this function)
callbacks.c: In function ‘on_button_stop_clicked’:
callbacks.c:345: error: ‘TRUE’ undeclared (first use in this function)
callbacks.c:364: error: ‘GdkColor’ undeclared (first use in this function)
callbacks.c:364: error: syntax error before ‘color’
callbacks.c:365: error: ‘color’ undeclared (first use in this function)
callbacks.c:366: error: ‘GTK_STATE_NORMAL’ undeclared (first use in this function)
callbacks.c: At top level:
callbacks.c:406: error: syntax error before ‘*’ token
callbacks.c: In function ‘on_adj_sound_change_value’:
callbacks.c:408: error: ‘adj’ undeclared (first use in this function)
callbacks.c: At top level:
callbacks.c:422: error: syntax error before ‘*’ token
callbacks.c: In function ‘on_button_record_clicked’:
callbacks.c:424: warning: passing argument 1 of ‘strlen’ makes pointer from integer without a cast
callbacks.c:424: warning: passing argument 1 of ‘__builtin_strcmp’ makes pointer from integer without a cast
callbacks.c:424: warning: passing argument 1 of ‘strlen’ makes pointer from integer without a cast
callbacks.c:424: warning: passing argument 1 of ‘__builtin_strcmp’ makes pointer from integer without a cast
callbacks.c:424: warning: passing argument 1 of ‘__builtin_strcmp’ makes pointer from integer without a cast
callbacks.c:424: warning: passing argument 1 of ‘__builtin_strcmp’ makes pointer from integer without a cast
callbacks.c:431: warning: passing argument 1 of ‘strlen’ makes pointer from integer without a cast
callbacks.c:431: warning: passing argument 1 of ‘__builtin_strcmp’ makes pointer from integer without a cast
callbacks.c:431: warning: passing argument 1 of ‘strlen’ makes pointer from integer without a cast
callbacks.c:431: warning: passing argument 1 of ‘__builtin_strcmp’ makes pointer from integer without a cast
callbacks.c:431: warning: passing argument 1 of ‘__builtin_strcmp’ makes pointer from integer without a cast
callbacks.c:431: warning: passing argument 1 of ‘__builtin_strcmp’ makes pointer from integer without a cast
callbacks.c:445: error: ‘TRUE’ undeclared (first use in this function)
callbacks.c:454: error: ‘GdkColor’ undeclared (first use in this function)
callbacks.c:454: error: syntax error before ‘color’
callbacks.c:455: error: ‘color’ undeclared (first use in this function)
callbacks.c:456: error: ‘GTK_STATE_NORMAL’ undeclared (first use in this function)
callbacks.c:461:28: error: gdk/gdkkeysyms.h: No such file or directory
callbacks.c: At top level:
callbacks.c:464: error: syntax error before ‘vKeyPressReleaseCallback’
callbacks.c:464: error: syntax error before ‘*’ token
callbacks.c: In function ‘vKeyPressReleaseCallback’:
callbacks.c:466: error: ‘gboolean’ undeclared (first use in this function)
callbacks.c:466: error: syntax error before ‘returnval’
callbacks.c:471: error: ‘event’ undeclared (first use in this function)
callbacks.c:471: error: ‘GDK_q’ undeclared (first use in this function)
callbacks.c:471: error: ‘GDK_Q’ undeclared (first use in this function)
callbacks.c:471: error: ‘only_ctrl_pressed’ undeclared (first use in this function)
callbacks.c:475: error: ‘GDK_Escape’ undeclared (first use in this function)
callbacks.c:483: error: ‘returnval’ undeclared (first use in this function)
make: *** [callbacks.o] Error 1
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-7-10 18:57:08 | 显示全部楼层
Package gtk+-2.0 was not found in the pkg-config search path
你没装gtk+-2.0或装了但找不到
回复 支持 反对

使用道具 举报

发表于 2006-7-10 21:24:20 | 显示全部楼层
如何装?这个包名叫什么?我apt-get install gtk+-2.0或apt-get install gtk2.0都说没有这个包。要用什么源才能装?
已装的包有:
ii  gtk-sopcast                      0.1.21-1                   A p2p stream player.
ii  gtk2-engines-clearlooks          2.6.8-1                    Clearlooks GTK+
2.x engine and theme
ii  gtk2-engines-crux                2.6.8-1                    the Crux theme engine for GTK+ 2.x
ii  gtk2-engines-lighthouseblue      2.6.8-1                    LighthouseBlue theme for GTK+ 2.x
ii  gtk2-engines-mist                2.6.8-1                    flat theme for GTK+ 2.x
ii  gtk2-engines-pixbuf              2.8.18-1                   Pixbuf-based theme for GTK+ 2.x
ii  gtk2-engines-redmond95           2.6.8-1                    Windows-like theme for GTK+ 2.x
ii  gtk2-engines-smooth              2.6.8-1                    Smooth engine for GTK+ 2.x
ii  gtk2-engines-thinice             2.6.8-1                    the ThinIce theme engine for GTK+ 2.x
回复 支持 反对

使用道具 举报

发表于 2006-7-10 21:25:30 | 显示全部楼层
如何装?这个包名叫什么?我apt-get install gtk+-2.0或apt-get install gtk2.0都说没有这个包。要用什么源才能装?
已装的包有:
ii  gtk-sopcast                      0.1.21-1                   A p2p stream player.
ii  gtk2-engines-clearlooks          2.6.8-1                    Clearlooks GTK+
2.x engine and theme
ii  gtk2-engines-crux                2.6.8-1                    the Crux theme engine for GTK+ 2.x
ii  gtk2-engines-lighthouseblue      2.6.8-1                    LighthouseBlue theme for GTK+ 2.x
ii  gtk2-engines-mist                2.6.8-1                    flat theme for GTK+ 2.x
ii  gtk2-engines-pixbuf              2.8.18-1                   Pixbuf-based theme for GTK+ 2.x
ii  gtk2-engines-redmond95           2.6.8-1                    Windows-like theme for GTK+ 2.x
ii  gtk2-engines-smooth              2.6.8-1                    Smooth engine for GTK+ 2.x
ii  gtk2-engines-thinice             2.6.8-1                    the ThinIce theme engine for GTK+ 2.x
回复 支持 反对

使用道具 举报

发表于 2006-7-10 21:39:26 | 显示全部楼层
为什么不能删掉自己的重复贴?
回复 支持 反对

使用道具 举报

发表于 2006-7-10 21:51:08 | 显示全部楼层
可以了,原来是要安装libgtk2.0-dev
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表