当前位置: 首页>>代码示例>>C++>>正文


C++ GB_IS_TERMINAL_VIEW函数代码示例

本文整理汇总了C++中GB_IS_TERMINAL_VIEW函数的典型用法代码示例。如果您正苦于以下问题:C++ GB_IS_TERMINAL_VIEW函数的具体用法?C++ GB_IS_TERMINAL_VIEW怎么用?C++ GB_IS_TERMINAL_VIEW使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GB_IS_TERMINAL_VIEW函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: gb_terminal_set_split_view

static void
gb_terminal_set_split_view (IdeLayoutView   *view,
                            gboolean         split_view)
{
  GbTerminalView *self = (GbTerminalView *)view;
  GtkStyleContext *style_context;

  g_assert (GB_IS_TERMINAL_VIEW (self));
  g_return_if_fail (GB_IS_TERMINAL_VIEW (self));

  if (split_view && (self->terminal_bottom != NULL))
    return;

  if (!split_view && (self->terminal_bottom == NULL))
    return;

  if (split_view)
    {
      style_context = gtk_widget_get_style_context (GTK_WIDGET (view));

      self->terminal_bottom = g_object_new (GB_TYPE_TERMINAL,
                                            "audible-bell", FALSE,
                                            "scrollback-lines", G_MAXUINT,
                                            "expand", TRUE,
                                            "visible", TRUE,
                                            NULL);
      gtk_container_add_with_properties (GTK_CONTAINER (self->bottom_container),
                                         GTK_WIDGET (self->terminal_bottom),
                                         "position", 0,
                                         NULL);
      gtk_widget_show (self->bottom_container);

      gb_terminal_view_connect_terminal (self, self->terminal_bottom);
      style_context_changed (style_context, GB_TERMINAL_VIEW (view));

      gtk_widget_grab_focus (GTK_WIDGET (self->terminal_bottom));

      if (!self->bottom_has_spawned)
        {
          self->bottom_has_spawned = TRUE;
          gb_terminal_respawn (self, self->terminal_bottom);
        }
    }
  else
    {
      gtk_container_remove (GTK_CONTAINER (self->bottom_container),
                            GTK_WIDGET (self->terminal_bottom));
      gtk_widget_hide (self->bottom_container);

      self->terminal_bottom = NULL;
      self->bottom_has_focus = FALSE;
      self->bottom_has_spawned = FALSE;
      self->bottom_has_needs_attention = FALSE;
      g_clear_object (&self->save_as_file_bottom);
      gtk_widget_grab_focus (GTK_WIDGET (self->terminal_top));
    }
}
开发者ID:badwolfie,项目名称:gnome-builder,代码行数:57,代码来源:gb-terminal-view.c

示例2: focus_in_event_cb

static gboolean
focus_in_event_cb (VteTerminal    *terminal,
                   GdkEvent       *event,
                   GbTerminalView *self)
{
  const gchar *title;

  g_assert (VTE_IS_TERMINAL (terminal));
  g_assert (GB_IS_TERMINAL_VIEW (self));

  self->bottom_has_focus = (terminal != self->terminal_top);

  title = gb_terminal_get_title (GB_VIEW (self));
  if (self->document)
    gb_terminal_document_set_title (self->document, title);

  if (terminal == self->terminal_top)
    {
      self->top_has_needs_attention = FALSE;
      gb_terminal_set_needs_attention (self, FALSE, GTK_POS_TOP);
    }
  else if (terminal == self->terminal_bottom)
    {
      self->bottom_has_needs_attention = FALSE;
      gb_terminal_set_needs_attention (self, FALSE, GTK_POS_BOTTOM);
    }

  g_object_notify (G_OBJECT (self), "title");

  return GDK_EVENT_PROPAGATE;
}
开发者ID:riadnassiffe,项目名称:gnome-builder,代码行数:31,代码来源:gb-terminal-view.c

示例3: gb_terminal_set_needs_attention

static void
gb_terminal_set_needs_attention (GbTerminalView  *self,
                                 gboolean         needs_attention,
                                 GtkPositionType  position)
{
  GtkWidget *parent;

  g_assert (GB_IS_TERMINAL_VIEW (self));

  parent = gtk_widget_get_parent (GTK_WIDGET (self));

  if (GTK_IS_STACK (parent) &&
      !gtk_widget_in_destruction (GTK_WIDGET (self)) &&
      !gtk_widget_in_destruction (parent))
    {
      if (position == GTK_POS_TOP &&
          !gtk_widget_in_destruction (GTK_WIDGET (self->terminal_top)))
        {
          self->top_has_needs_attention = TRUE;
        }
      else if (position == GTK_POS_BOTTOM &&
               self->terminal_bottom != NULL &&
               !gtk_widget_in_destruction (GTK_WIDGET (self->terminal_bottom)))
        {
          self->bottom_has_needs_attention = TRUE;
        }

      gtk_container_child_set (GTK_CONTAINER (parent), GTK_WIDGET (self),
                               "needs-attention",
                               !!(self->top_has_needs_attention || self->bottom_has_needs_attention) &&
                               needs_attention,
                               NULL);
    }
}
开发者ID:badwolfie,项目名称:gnome-builder,代码行数:34,代码来源:gb-terminal-view.c

示例4: style_context_changed

static void
style_context_changed (GtkStyleContext *style_context,
                       GbTerminalView  *self)
{
  GtkStateFlags state;
  GdkRGBA fg;
  GdkRGBA bg;

  g_assert (GTK_IS_STYLE_CONTEXT (style_context));
  g_assert (GB_IS_TERMINAL_VIEW (self));

  state = gtk_style_context_get_state (style_context);

  G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
  gtk_style_context_get_color (style_context, state, &fg);
  gtk_style_context_get_background_color (style_context, state, &bg);
  G_GNUC_END_IGNORE_DEPRECATIONS;

  if (bg.alpha == 0.0)
    {
      gdk_rgba_parse (&bg, "#f6f7f8");
    }

  vte_terminal_set_colors (self->terminal_top, &fg, &bg,
                           solarized_palette,
                           G_N_ELEMENTS (solarized_palette));

  if (self->terminal_bottom)
    vte_terminal_set_colors (self->terminal_bottom, &fg, &bg,
                             solarized_palette,
                             G_N_ELEMENTS (solarized_palette));
}
开发者ID:badwolfie,项目名称:gnome-builder,代码行数:32,代码来源:gb-terminal-view.c

示例5: gb_terminal_view_get_document

static GbDocument *
gb_terminal_view_get_document (GbView *view)
{
  g_return_val_if_fail (GB_IS_TERMINAL_VIEW (view), NULL);

  return GB_DOCUMENT (GB_TERMINAL_VIEW (view)->document);
}
开发者ID:riadnassiffe,项目名称:gnome-builder,代码行数:7,代码来源:gb-terminal-view.c

示例6: size_allocate_cb

static void
size_allocate_cb (VteTerminal    *terminal,
                  GtkAllocation  *alloc,
                  GbTerminalView *self)
{
  glong width;
  glong height;
  glong columns;
  glong rows;

  g_assert (VTE_IS_TERMINAL (terminal));
  g_assert (alloc != NULL);
  g_assert (GB_IS_TERMINAL_VIEW (self));

  if ((alloc->width == 0) || (alloc->height == 0))
    return;

  width = vte_terminal_get_char_width (terminal);
  height = vte_terminal_get_char_height (terminal);

  if ((width == 0) || (height == 0))
    return;

  columns = alloc->width / width;
  rows = alloc->height / height;

  if ((columns < 2) || (rows < 2))
    return;

  vte_terminal_set_size (terminal, columns, rows);
}
开发者ID:badwolfie,项目名称:gnome-builder,代码行数:31,代码来源:gb-terminal-view.c

示例7: gb_terminal_respawn

static void
gb_terminal_respawn (GbTerminalView *self,
                     VteTerminal    *terminal)
{
  g_autoptr(GPtrArray) args = NULL;
  g_autofree gchar *workpath = NULL;
  GtkWidget *toplevel;
  GError *error = NULL;
  IdeContext *context;
  IdeVcs *vcs;
  GFile *workdir;
  GPid child_pid;
  gint64 now;

  g_assert (GB_IS_TERMINAL_VIEW (self));

  vte_terminal_reset (terminal, TRUE, TRUE);

  toplevel = gtk_widget_get_toplevel (GTK_WIDGET (self));
  if (!IDE_IS_WORKBENCH (toplevel))
    return;

  /* Prevent flapping */
  now = g_get_monotonic_time ();
  if ((now - self->last_respawn) < (G_USEC_PER_SEC / 10))
    return;
  self->last_respawn = now;

  context = ide_workbench_get_context (IDE_WORKBENCH (toplevel));
  vcs = ide_context_get_vcs (context);
  workdir = ide_vcs_get_working_directory (vcs);
  workpath = g_file_get_path (workdir);

  args = g_ptr_array_new_with_free_func (g_free);
  g_ptr_array_add (args, vte_get_user_shell ());
  g_ptr_array_add (args, NULL);

  vte_terminal_spawn_sync (terminal,
                           VTE_PTY_DEFAULT | VTE_PTY_NO_LASTLOG | VTE_PTY_NO_UTMP | VTE_PTY_NO_WTMP,
                           workpath,
                           (gchar **)args->pdata,
                           NULL,
                           G_SPAWN_DEFAULT,
                           NULL,
                           NULL,
                           &child_pid,
                           NULL,
                           &error);

  if (error != NULL)
    {
      g_warning ("%s", error->message);
      g_clear_error (&error);
      return;
    }

  vte_terminal_watch_child (terminal, child_pid);
}
开发者ID:badwolfie,项目名称:gnome-builder,代码行数:58,代码来源:gb-terminal-view.c

示例8: window_title_changed_cb

static void
window_title_changed_cb (VteTerminal    *terminal,
                         GbTerminalView *self)
{
  g_assert (VTE_IS_TERMINAL (terminal));
  g_assert (GB_IS_TERMINAL_VIEW (self));

  g_object_notify (G_OBJECT (self), "title");
}
开发者ID:badwolfie,项目名称:gnome-builder,代码行数:9,代码来源:gb-terminal-view.c

示例9: gb_terminal_grab_focus

static void
gb_terminal_grab_focus (GtkWidget *widget)
{
  GbTerminalView *self = (GbTerminalView *)widget;

  g_assert (GB_IS_TERMINAL_VIEW (self));

  if (self->bottom_has_focus && self->terminal_bottom)
    gtk_widget_grab_focus (GTK_WIDGET (self->terminal_bottom));
  else
    gtk_widget_grab_focus (GTK_WIDGET (self->terminal_top));
}
开发者ID:badwolfie,项目名称:gnome-builder,代码行数:12,代码来源:gb-terminal-view.c

示例10: gb_terminal_create_split

static IdeLayoutView *
gb_terminal_create_split (IdeLayoutView *view)
{
  IdeLayoutView *new_view;

  g_assert (GB_IS_TERMINAL_VIEW (view));

  new_view = g_object_new (GB_TYPE_TERMINAL_VIEW,
                          "visible", TRUE,
                          NULL);

  return new_view;
}
开发者ID:bhurtelashish,项目名称:gnome-builder,代码行数:13,代码来源:gb-terminal-view.c

示例11: child_exited_cb

static void
child_exited_cb (VteTerminal    *terminal,
                 gint            exit_status,
                 GbTerminalView *self)
{
  g_assert (VTE_IS_TERMINAL (terminal));
  g_assert (GB_IS_TERMINAL_VIEW (self));

  if (!ide_widget_action (GTK_WIDGET (self), "view-stack", "close", NULL))
    {
      if (!gtk_widget_in_destruction (GTK_WIDGET (terminal)))
        gb_terminal_respawn (self, terminal);
    }
}
开发者ID:badwolfie,项目名称:gnome-builder,代码行数:14,代码来源:gb-terminal-view.c

示例12: gb_terminal_create_split

static GbView *
gb_terminal_create_split (GbView *view)
{
  GbView *new_view;

  g_assert (GB_IS_TERMINAL_VIEW (view));

  new_view = g_object_new (GB_TYPE_TERMINAL_VIEW,
                          "document", gb_terminal_view_get_document (view),
                          "visible", TRUE,
                          NULL);

  return new_view;
}
开发者ID:riadnassiffe,项目名称:gnome-builder,代码行数:14,代码来源:gb-terminal-view.c

示例13: gb_terminal_get_title

static gchar *
gb_terminal_get_title (IdeLayoutView *view)
{
  const gchar *title = NULL;
  GbTerminalView *self = (GbTerminalView *)view;

  g_assert (GB_IS_TERMINAL_VIEW (self));

  if (self->bottom_has_focus)
    title = vte_terminal_get_window_title (self->terminal_bottom);
  else
    title = vte_terminal_get_window_title (self->terminal_top);

  return g_strdup (title);
}
开发者ID:badwolfie,项目名称:gnome-builder,代码行数:15,代码来源:gb-terminal-view.c

示例14: gb_terminal_get_title

static const gchar *
gb_terminal_get_title (GbView *view)
{
  const gchar *title;
  GbTerminalView *self = (GbTerminalView *)view;

  g_assert (GB_IS_TERMINAL_VIEW (self));

  if (self->bottom_has_focus)
    title = vte_terminal_get_window_title (self->terminal_bottom);
  else
    title = vte_terminal_get_window_title (self->terminal_top);

  return title;
}
开发者ID:riadnassiffe,项目名称:gnome-builder,代码行数:15,代码来源:gb-terminal-view.c

示例15: gb_terminal_realize

static void
gb_terminal_realize (GtkWidget *widget)
{
  GbTerminalView *self = (GbTerminalView *)widget;

  g_assert (GB_IS_TERMINAL_VIEW (self));

  GTK_WIDGET_CLASS (gb_terminal_view_parent_class)->realize (widget);

  if (!self->top_has_spawned)
    {
      self->top_has_spawned = TRUE;
      gb_terminal_respawn (self, self->terminal_top);
    }
}
开发者ID:badwolfie,项目名称:gnome-builder,代码行数:15,代码来源:gb-terminal-view.c


注:本文中的GB_IS_TERMINAL_VIEW函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。