static void
refresh_button_clicked_cb (GtkWidget *widget,
			   gpointer   user_data)
{
  GdictDatabaseChooser *chooser = GDICT_DATABASE_CHOOSER (user_data);

  gdict_database_chooser_refresh (chooser);
}
Ejemplo n.º 2
0
static void
sidebar_page_changed_cb (GdictSidebar * sidebar, GtrDictPanel * panel)
{
  GtrDictPanelPrivate *priv = panel->priv;
  const gchar *page_id;
  const gchar *message;

  page_id = gdict_sidebar_current_page (sidebar);

  switch (page_id[0])
    {
    case 's':
      {
        switch (page_id[1])
          {
          case 'p':            /* speller */
            message = _("Double-click on the word to look up");
            if (priv->word)
              gdict_speller_match (GDICT_SPELLER (priv->speller), priv->word);
            break;
          case 't':            /* strat-chooser */
            message = _("Double-click on the matching strategy to use");

            gdict_strategy_chooser_refresh (GDICT_STRATEGY_CHOOSER
                                            (priv->strat_chooser));
            break;
          case 'o':            /* source-chooser */
            message = _("Double-click on the source to use");
            gdict_source_chooser_refresh (GDICT_SOURCE_CHOOSER
                                          (priv->source_chooser));
            break;
          default:
            message = NULL;
          }
      }
      break;
    case 'd':                  /* db-chooser */
      message = _("Double-click on the database to use");

      gdict_database_chooser_refresh (GDICT_DATABASE_CHOOSER
                                      (priv->db_chooser));
      break;
    default:
      message = NULL;
      break;
    }

  if (message && priv->status)
    gtr_statusbar_flash_message (panel->priv->status, 0, "%s", message);
}
Ejemplo n.º 3
0
static void
sidebar_page_changed_cb (GdictSidebar *sidebar,
			 GeditDictPanel *panel)
{
	GeditDictPanelPrivate *priv = panel->priv;
	const gchar *page_id;
	const gchar *message;
	
	page_id = gdict_sidebar_current_page (sidebar);
	
	switch (page_id[0])
	{
		case 's':
		{
			switch (page_id[1])
			{
				case 'p': /* speller */
					message = _("Double-click on the word to look up");
				if (priv->word)
					gdict_speller_match (GDICT_SPELLER (priv->speller),
							     priv->word);
				break;
				case 't': /* strat-chooser */
					message = _("Double-click on the matching strategy to use");
				
					gdict_strategy_chooser_refresh (GDICT_STRATEGY_CHOOSER (priv->strat_chooser));
				break;
				default:
					message = NULL;
			}
		}
		break;
		case 'd': /* db-chooser */
			message = _("Double-click on the database to use");
		
		gdict_database_chooser_refresh (GDICT_DATABASE_CHOOSER (priv->db_chooser));
		break;
		default:
			message = NULL;
		break;
	}
	
	/*if (message && window->status)
	gtk_statusbar_push (GTK_STATUSBAR (window->status), 0, message);*/
}
Ejemplo n.º 4
0
static void
update_dialog_ui (GdictSourceDialog *dialog)
{
  GdictSource *source;
  
  /* TODO - add code to update the contents of the dialog depending
   * on the action; if we are in _CREATE, no action is needed
   */
  switch (dialog->action)
    {
    case GDICT_SOURCE_DIALOG_VIEW:
    case GDICT_SOURCE_DIALOG_EDIT:
      if (!dialog->source_name)
	{
          g_warning ("Attempting to retrieve source, but no "
		     "source name has been defined.  Aborting...");
	  return;
	}
      
      source = gdict_source_loader_get_source (dialog->loader,
		      			       dialog->source_name);
      if (!source)
	{
          g_warning ("Attempting to retrieve source, but no "
		     "source named `%s' was found.  Aborting...",
		     dialog->source_name);
	  return;
	}
      
      g_object_ref (source);
      
      dialog->source = source;
      set_text_to_entry (dialog, "description_entry",
		         gdict_source_get_description (source));

      dialog->transport = gdict_source_get_transport (source);
      gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->transport_combo),
                                (gint) dialog->transport);

      /* set the context for the database and strategy choosers */
      dialog->context = gdict_source_get_context (source);
      if (!dialog->context)
        {
          g_warning ("Attempting to retrieve the context, but "
                     "none was found for source `%s'.",
                     dialog->source_name);
          return;
        }
      
      set_transport_settings (dialog);

      gdict_database_chooser_set_context (GDICT_DATABASE_CHOOSER (dialog->db_chooser),
                                          dialog->context);
      gdict_database_chooser_refresh (GDICT_DATABASE_CHOOSER (dialog->db_chooser));
      gdict_strategy_chooser_set_context (GDICT_STRATEGY_CHOOSER (dialog->strat_chooser),
                                          dialog->context);
      gdict_strategy_chooser_refresh (GDICT_STRATEGY_CHOOSER (dialog->strat_chooser));
      break;
    case GDICT_SOURCE_DIALOG_CREATE:
      /* DICTD transport is default */
      gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->transport_combo), 0);
      g_signal_emit_by_name (dialog->transport_combo, "changed");
      break;
    default:
      g_assert_not_reached ();
      break;
    }
}