AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题

问题[vala](ubuntu)

Martin Hope
personkfl453kmt0
Asked: 2019-04-27 18:18:42 +0800 CST

“gstreamer-player-1.0”的开发包是什么

  • 6

根据 valadoc,gstreamer-player-1存在一个名为的包。但是,我在ubuntu 包搜索中找不到对应的包 。

vala gstreamer
  • 1 个回答
  • 2769 Views
Martin Hope
brpaz
Asked: 2019-01-20 07:10:57 +0800 CST

使用 vala 创建 AppIndicator:找不到包 `appindicator3-0.1'

  • 5

我正在尝试创建一个将创建 AppIndicator 的 Vala 应用程序。

问题是,当我编译我的应用程序时,我收到以下错误:

Package `appindicator3-0.1' not found in specified Vala API directories or GObject-Introspection GIR directories

我像这样编译应用程序:

 valac --pkg appindicator3-0.1 --pkg gtk+-3.0 indicator.vala

我安装了 libappindicator-dev 并安装了 gir1.2-appindicator3-0.1。

我错过了什么?

谢谢你。

indicator vala
  • 1 个回答
  • 2556 Views
Martin Hope
sdaau
Asked: 2018-11-03 07:16:27 +0800 CST

Gnome3 AppIndicator Vala 应用程序无法显示子菜单(它会立即自动关闭)?

  • 2

考虑下面粘贴的源代码test.vala。这是一个简单的应用程序,它应该在顶部栏/面板上显示一个图标,当单击该图标时,它应该显示一个包含一个项目的菜单(打开),当您单击打开时,它应该显示一个包含多个项目的子菜单. 我编译这个:

$ cat /etc/issue
Ubuntu 18.04.1 LTS \n \l
$ uname -a
Linux MyPC 4.15.0-38-generic #41-Ubuntu SMP Wed Oct 10 10:59:38 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
$ printf 'Desktop: %s\nSession: %s\n' "$XDG_CURRENT_DESKTOP" "$GDMSESSION"
Desktop: ubuntu:GNOME
Session: ubuntu
$ gnome-shell --version
GNOME Shell 3.28.3

...我编译:

valac -X -D'GETTEXT_PACKAGE="my-indicator"' -D NEWMETHOD --pkg=gtk+-3.0 --pkg appindicator3-0.1 test.vala

...为此,您还需要安装libappindicator-dev 包。

然后我运行应用程序:

$ ./test 
main() ... 
Main(): ok
Creating MainWindow
^C

...我得到的结果显示在这个动画 gif 上:

出.gif

请注意,显示了 appindicator 图标(如预期的那样),单击它时会显示带有“打开”项的一级菜单(如预期的那样) - 但是当我单击“打开”时,我并没有真正得到子菜单我预计; 相反,它似乎试图打开子菜单,然后立即关闭?

我需要做什么才能让这个应用程序正确打开子菜单?

这里是test.vala:

// build with:
// valac -X -D'GETTEXT_PACKAGE="my-indicator"' --pkg=gtk+-3.0 --pkg appindicator3-0.1 test.vala

// "It's not possible to define a preprocessor symbol inside the Vala code (like with C). The only way to define a symbol is to feed it through the valac option -D."
// valac -X -D'GETTEXT_PACKAGE="my-indicator"' -D NEWMETHOD --pkg=gtk+-3.0 --pkg appindicator3-0.1 test.vala

// see also: https://valadoc.org/gtk+-3.0/Gtk.MenuItem.html

using GLib;
using Gtk;
using AppIndicator;

public Main App;
public const string AppName = "Test";

extern void exit(int exit_code);

public class MyIndicator: GLib.Object{

  protected Indicator indicator;
  protected string icon;
  protected string name;

  public MyIndicator(){

    App.my_indicator = this;

    this.name = "My Indicator";

    this.icon = "account-logged-in"; // looks like a checkmark
    this.indicator = new Indicator("my_indicator", icon, IndicatorCategory.APPLICATION_STATUS);
    indicator.set_status(IndicatorStatus.ACTIVE);

    var menu = new Gtk.Menu();

    // open -------------------------------------
    #if NEWMETHOD
      var item = new Gtk.MenuItem.with_label(_("Open"));
    #else
      var item = new Gtk.ImageMenuItem.with_label(_("Open"));
    #endif
    menu.append(item);
    var item_open = item;

    item.set_reserve_indicator(false);

    item.activate.connect(() => {
      var submenu = new Gtk.Menu();
      submenu.reserve_toggle_size = true;
      //var dummy_window = new Gtk.Window();
      //Gtk.Image icon = null;
      int i;
      for (i = 0; i < 10; i++) {
        #if NEWMETHOD
          var subitem = new Gtk.MenuItem.with_label ( "Exit %d".printf(i) );
        #else
          var subitem = new Gtk.ImageMenuItem.with_label ( "Exit %d".printf(i) );
        #endif
        subitem.set_reserve_indicator(true);
        submenu.append(subitem);
        subitem.activate.connect(() => {
          App.exit_app();
          exit(0);
        });
        //subitem.activate();
      }
      submenu.show_all();

      item_open.set_submenu(submenu);
    });
    item.activate(); // so it shows submenu triangle

    indicator.set_menu(menu);
    menu.show_all();
  }
}


public class Main : GLib.Object{

  public MyIndicator my_indicator;

  public static int main (string[] args) {

    stdout.printf("main() ... \n");
    stdout.flush();
    Gtk.init(ref args);
    App = new Main(args);
    bool success = App.start_application(args);
    App.exit_app();

    return (success) ? 0 : 1;
  }

  public Main(string[] args){
    stdout.printf("Main(): ok\n");
    stdout.flush();
  }

  public bool start_application(string[] args){
    stdout.printf("Creating MainWindow\n");
    stdout.flush();

    new MyIndicator(); // var ind = new MyIndicator();

    //start event loop
    Gtk.main();

    return true;
  }

  public void exit_app (){
    stdout.printf("exit_app()\n");
    stdout.flush();
    Gtk.main_quit ();
  }
}
gnome vala 18.04
  • 1 个回答
  • 270 Views
Martin Hope
user6320
Asked: 2011-01-18 01:30:51 +0800 CST

Vala 和桌面沙发准备好了吗?

  • 3

我已经开始在 Vala 中编写 rss 阅读器,但我不知道我应该使用什么数据库系统,我无法连接到 couchdb 并且 sqlite 工作正常,但我想使用 couchdb 因为 ubuntu 之一。我有最新的更新

public CouchDB.Session session;
    public CouchDB.Database db;
    public string feed_table = "feed";
    public string item_table = "item";
    public struct field {
        string name;
        string val;
    }

    // constructor
    public Database() {
    try {
    this.session = new CouchDB.Session();
     } catch (Error e) {
           stderr.printf ("%s a\n", e.message);
        }

    try {

         this.db = new CouchDB.Database (this.session, "test");
         } catch (Error e) {
           stderr.printf ("%s a\n", e.message);
        }

        try {
        this.session.get_database_info("test");
        } catch (Error e) {
           stderr.printf ("%s aa\n", e.message);
        }

         try {
          var newdoc = new CouchDB.Document ();
        newdoc.set_boolean_field ("awesome", true);
        newdoc.set_string_field ("phone", "555-VALA");
        newdoc.set_double_field ("pi", 3.14159);
        newdoc.set_int_field ("meaning_of_life", 42);
        this.db.put_document (newdoc);    // store document
        } catch (Error e) {
        stderr.printf ("%s aaa\n", e.message);
        } 

报告

$ ./xml_parser rss.xmlCannot connect to destination (127.0.0.1) aa
Cannot connect to destination (127.0.0.1) aaa
vala
  • 1 个回答
  • 476 Views
Martin Hope
Isaiah
Asked: 2010-12-07 20:57:00 +0800 CST

在 Launchpad 中查找使用特定编程语言的项目?

  • 14

在Launchpad.net上,大多数项目都列出了他们的软件使用的编程语言:

替代文字

如果有一种方法可以获取所有使用“X”编程语言的项目的列表,这将是有用的,在我的例子中是Vala。Launchpad 是否提供此功能?是否有任何第三方工具可以做到这一点?

launchpad development vala search
  • 3 个回答
  • 473 Views
Martin Hope
burli
Asked: 2010-10-31 01:00:25 +0800 CST

会有快速的 Vala 模板吗?

  • 9

是否有计划为 Quickly 开发 Vala 模板?会很有趣,因为我认为 Vala 将成为 Gnome 的下一代编程语言。

development application-development vala quickly
  • 1 个回答
  • 562 Views
Martin Hope
bols-i
Asked: 2010-08-30 20:34:54 +0800 CST

我应该为 Vala 使用哪个 IDE?

  • 17

我想标题已经说明了...

programming software-recommendation application-development ide vala
  • 8 个回答
  • 16402 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve