Example #1
0
static void
egg_find_bar_get_property (GObject    *object,
                           guint       prop_id,
                           GValue     *value,
                           GParamSpec *pspec)
{
  EggFindBar *find_bar = EGG_FIND_BAR (object);
  EggFindBarPrivate *priv = (EggFindBarPrivate *)find_bar->priv;

  switch (prop_id)
    {
    case PROP_SEARCH_STRING:
      g_value_set_string (value, priv->search_string);
      break;
    case PROP_CASE_SENSITIVE:
      g_value_set_boolean (value, priv->case_sensitive);
      break;
    case PROP_WHOLE_WORDS_ONLY:
      g_value_set_boolean (value, priv->whole_words_only);
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
    }
}
Example #2
0
static void
egg_find_bar_grab_focus (GtkWidget *widget)
{
  EggFindBar *find_bar = EGG_FIND_BAR (widget);
  EggFindBarPrivate *priv = find_bar->priv;

  gtk_widget_grab_focus (priv->find_entry);
}
Example #3
0
static void
previous_clicked_callback (GtkButton *button,
                           void      *data)
{
  EggFindBar *find_bar = EGG_FIND_BAR (data);

  egg_find_bar_emit_previous (find_bar);
}
Example #4
0
static void
whole_words_only_toggled_callback (GtkCheckMenuItem *menu_item,
                                   void             *data)
{
  EggFindBar *find_bar = EGG_FIND_BAR (data);

  egg_find_bar_set_whole_words_only (find_bar, gtk_check_menu_item_get_active (menu_item));
}
Example #5
0
static void
case_sensitive_toggled_callback (GtkCheckMenuItem *menu_item,
                                 void             *data)
{
  EggFindBar *find_bar = EGG_FIND_BAR (data);

  egg_find_bar_set_case_sensitive (find_bar, gtk_check_menu_item_get_active (menu_item));
}
Example #6
0
static void
entry_activate_callback (GtkEntry *entry,
                          void     *data)
{
  EggFindBar *find_bar = EGG_FIND_BAR (data);

  if (find_bar->priv->search_string != NULL)
    egg_find_bar_emit_next (find_bar);
}
Example #7
0
static void
case_sensitive_toggled_callback (GtkToggleToolButton *button,
                                 void                *data)
{
  EggFindBar *find_bar = EGG_FIND_BAR (data);

  egg_find_bar_set_case_sensitive (find_bar,
                                   gtk_toggle_tool_button_get_active (button));
}
Example #8
0
static void
case_sensitive_toggled_callback (GtkCheckButton *button,
                                 void           *data)
{
  EggFindBar *find_bar = EGG_FIND_BAR (data);

  egg_find_bar_set_case_sensitive (find_bar,
                                   gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)));
}
Example #9
0
static void
egg_find_bar_finalize (GObject *object)
{
  EggFindBar *find_bar = EGG_FIND_BAR (object);
  EggFindBarPrivate *priv = (EggFindBarPrivate *)find_bar->priv;

  g_free (priv->search_string);

  G_OBJECT_CLASS (egg_find_bar_parent_class)->finalize (object);
}
Example #10
0
static void
entry_changed_callback (GtkEntry *entry,
                        void     *data)
{
  EggFindBar *find_bar = EGG_FIND_BAR (data);
  char *text;

  /* paranoid strdup because set_search_string() sets
   * the entry text
   */
  text = g_strdup (gtk_entry_get_text (entry));

  egg_find_bar_set_search_string (find_bar, text);
  
  g_free (text);
}
Example #11
0
static void
entry_populate_popup_callback (GtkEntry *entry,
                               GtkMenu  *menu,
                               void     *data)
{
  EggFindBar *find_bar = EGG_FIND_BAR (data);
  GtkWidget  *separator;

  if (!find_bar->priv->case_sensitive_enabled &&
      !find_bar->priv->whole_words_only_enabled)
    return;

  separator = gtk_separator_menu_item_new ();
  gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), separator);
  gtk_widget_show (separator);
  egg_find_bar_entry_populate_popup (find_bar, GTK_WIDGET (menu));
}
Example #12
0
static void
egg_find_bar_hide (GtkWidget *widget)
{
  EggFindBar *bar = EGG_FIND_BAR (widget);
  EggFindBarPrivate *priv = bar->priv;

  if (priv->set_focus_handler != 0)
    {
      GtkWidget *toplevel;

      toplevel = gtk_widget_get_toplevel (widget);

      g_signal_handlers_disconnect_by_func
	(toplevel, (void (*)) G_CALLBACK (set_focus_cb), bar);
      priv->set_focus_handler = 0;
    }

  GTK_WIDGET_CLASS (egg_find_bar_parent_class)->hide (widget);
}
Example #13
0
static void
egg_find_bar_show (GtkWidget *widget)
{
  EggFindBar *bar = EGG_FIND_BAR (widget);
  EggFindBarPrivate *priv = bar->priv;

  GTK_WIDGET_CLASS (egg_find_bar_parent_class)->show (widget);

  if (priv->set_focus_handler == 0)
    {
      GtkWidget *toplevel;

      toplevel = gtk_widget_get_toplevel (widget);

      priv->set_focus_handler =
	g_signal_connect (toplevel, "set-focus",
			  G_CALLBACK (set_focus_cb), bar);
    }
}
Example #14
0
static void
entry_icon_release_callback (GtkEntry            *entry,
                             GtkEntryIconPosition icon_pos,
                             GdkEventButton      *event,
                             void                *data)
{
  EggFindBar *find_bar = EGG_FIND_BAR (data);
  GtkWidget  *menu;

  if (!find_bar->priv->case_sensitive_enabled &&
      !find_bar->priv->whole_words_only_enabled)
    return;

  menu = gtk_menu_new ();
  egg_find_bar_entry_populate_popup (find_bar, menu);
  gtk_widget_show (menu);

  gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
                  event->button, event->time);
}
Example #15
0
static void
egg_find_bar_set_property (GObject      *object,
                           guint         prop_id,
                           const GValue *value,
                           GParamSpec   *pspec)
{
  EggFindBar *find_bar = EGG_FIND_BAR (object);

  switch (prop_id)
    {
    case PROP_SEARCH_STRING:
      egg_find_bar_set_search_string (find_bar, g_value_get_string (value));
      break;
    case PROP_CASE_SENSITIVE:
      egg_find_bar_set_case_sensitive (find_bar, g_value_get_boolean (value));
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
    }
}