static void
sync_active_char (GucharmapChartable  *chartable,
                  GParamSpec *pspec,
                  GucharmapChartableAccessible *accessible)
{
  GucharmapChartableAccessiblePrivate *priv = GET_PRIVATE (accessible);
  gunichar uc;
  AtkObject *child;
  AtkObject *focus_obj;

  uc = gucharmap_chartable_get_active_character (chartable);

  child = find_object (chartable, uc, ATK_OBJECT (accessible));
  focus_obj = priv->focus_obj;
  if (focus_obj != child)
    {
      if (focus_obj)
        gucharmap_chartable_cell_accessible_remove_state (GUCHARMAP_CHARTABLE_CELL_ACCESSIBLE (focus_obj), ATK_STATE_FOCUSED, FALSE);

      gucharmap_chartable_cell_accessible_add_state (GUCHARMAP_CHARTABLE_CELL_ACCESSIBLE (child), ATK_STATE_FOCUSED, FALSE);
    }

  if (focus_obj)
    g_object_unref (focus_obj);

  priv->focus_obj = child; /* adopts the reference from find_object */

  g_signal_emit_by_name (accessible, "active-descendant-changed", child);
}
示例#2
0
static void
chartable_sync_active_char (GtkWidget *widget,
                            GParamSpec *pspec,
                            GucharmapCharmap *charmap)
{
  GucharmapCharmapPrivate *priv = charmap->priv;
  GString *gs;
  const gchar *temp;
  const gchar **temps;
  gint i;
  gunichar wc;

  wc = gucharmap_chartable_get_active_character (priv->chartable);

  /* Forward the notification */
  g_object_notify (G_OBJECT (charmap), "active-character");

  if (priv->active_page == GUCHARMAP_CHARMAP_PAGE_DETAILS)
    set_details (charmap, wc);

  gs = g_string_sized_new (256);
  g_string_append_printf (gs, "U+%4.4X %s", wc, 
                          gucharmap_get_unicode_name (wc));

#if ENABLE_UNIHAN
  temp = gucharmap_get_unicode_kDefinition (wc);
  if (temp)
    g_string_append_printf (gs, "   %s", temp);
#endif

  temps = gucharmap_get_nameslist_equals (wc);
  if (temps)
    {
      g_string_append_printf (gs, "   = %s", temps[0]);
      for (i = 1;  temps[i];  i++)
        g_string_append_printf (gs, "; %s", temps[i]);
      g_free (temps);
    }

  temps = gucharmap_get_nameslist_stars (wc);
  if (temps)
    {
      g_string_append_printf (gs, "   • %s", temps[0]);
      for (i = 1;  temps[i];  i++)
        g_string_append_printf (gs, "; %s", temps[i]);
      g_free (temps);
    }

  chartable_status_message (charmap, gs->str);
  g_string_free (gs, TRUE);
}
示例#3
0
static void
notebook_switch_page (GtkNotebook *notebook,
                      GtkWidget *page,
                      guint page_num,
                      GucharmapCharmap *charmap)
{
  GucharmapCharmapPrivate *priv = charmap->priv;

  priv->active_page = page_num;

  if (page_num == GUCHARMAP_CHARMAP_PAGE_DETAILS)
    set_details (charmap, gucharmap_chartable_get_active_character (priv->chartable));
  else if (page_num == GUCHARMAP_CHARMAP_PAGE_CHARTABLE)
    {
      GtkTextBuffer *buffer;

      buffer = gtk_text_view_get_buffer (priv->details_view);
      gtk_text_buffer_set_text (buffer, "", 0);
    }

  g_object_notify (G_OBJECT (charmap), "active-page");
}