~ubuntu-branches/ubuntu/precise/empathy/precise-proposed-201205180810

« back to all changes in this revision

Viewing changes to libempathy-gtk/empathy-search-bar.c

  • Committer: Bazaar Package Importer
  • Author(s): Brian Curtis, Brian Curtis, Ken VanDine
  • Date: 2011-06-01 10:35:24 UTC
  • mfrom: (1.1.70 upstream) (6.3.44 experimental)
  • Revision ID: james.westby@ubuntu.com-20110601103524-wx3wgp71394730jt
Tags: 3.1.1-1ubuntu1
[ Brian Curtis ]
* Merge with Debian experimental, remaining Ubuntu changes:
* debian/control:
  - Drop geoclue/mapping build-depends (they are in Universe)
  - Add Vcz-Bzr link
  - Add Suggests on telepathy-idle
  - Bump telepathy-butterfly, telepathy-haze to recommends
  - Don't recommend the freedesktop sound theme we have an ubuntu one
  - Add build depend for libunity-dev
* debian/rules:
  - Use autoreconf.mk
  - Disable map and location
* debian/empathy.install:
  - Install message indicator configuration
* debian/indicators/empathy:
  - Message indicator configuration
* debian/patches/01_lpi.patch:
  - Add Launchpad integration
* debian/patches/10_use_notify_osd_icons.patch:
  - Use the notify-osd image for new messages
* debian/patches/34_start_raised_execpt_in_session.patch
  - If not started with the session, we should always raise
* debian/patches/36_chat_window_default_size.patch:
  - Make the default chat window size larger
* debian/patches/37_facebook_default.patch:
  - Make facebook the default chat account type
* debian/patches/38_lp_569289.patch
  - Set freenode as default IRC network for new IRC accounts 
* debian/patches/41_unity_launcher_progress.patch
  - Display file transfer progress in the unity launcher

[ Ken VanDine ]
* debian/control
  - build depend on libgcr-3-dev instead of libgcr-dev
  - dropped build depends for libindicate, we will use telepathy-indicator
  - Depend on dconf-gsettings-backend | gsettings-backend
  - Added a Recommends for telepathy-indicator
* +debian/empathy.gsettings-override
  - Added an override for notifications-focus
* debian/patches/series
  - commented out 23_idomessagedialog_for_voip_and_ft.patch, until ido has 
    been ported to gtk3

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
 
20
#include "config.h"
 
21
 
20
22
#include <glib.h>
21
23
#include <glib-object.h>
 
24
#include <glib/gi18n-lib.h>
22
25
#include <gtk/gtk.h>
23
26
#include <gdk/gdkkeysyms.h>
24
27
 
41
44
 
42
45
  GtkWidget *search_match_case;
43
46
 
 
47
  GtkWidget *search_match_case_toolitem;
 
48
 
44
49
  GtkWidget *search_close;
45
50
  GtkWidget *search_previous;
46
51
  GtkWidget *search_next;
58
63
}
59
64
 
60
65
static void
61
 
empathy_search_bar_size_request (GtkWidget *widget,
62
 
    GtkRequisition *requisition)
 
66
empathy_search_bar_get_preferred_height (GtkWidget *widget,
 
67
    gint *minimun_height,
 
68
    gint *natural_height)
63
69
{
64
70
  GtkBin *bin;
65
71
  GtkWidget *child;
68
74
  child = gtk_bin_get_child (bin);
69
75
 
70
76
  if (child && gtk_widget_get_visible (child))
71
 
    {
72
 
      GtkRequisition child_requisition;
73
 
 
74
 
      gtk_widget_size_request (child, &child_requisition);
75
 
 
76
 
      requisition->width = child_requisition.width;
77
 
      requisition->height = child_requisition.height;
78
 
    }
 
77
      gtk_widget_get_preferred_height (child, minimun_height, natural_height);
79
78
}
80
79
 
81
80
static void
230
229
    GdkEventKey *event,
231
230
    gpointer user_data)
232
231
{
233
 
  if (event->keyval == GDK_Escape)
 
232
  if (event->keyval == GDK_KEY_Escape)
234
233
    {
235
234
      empathy_search_bar_hide (EMPATHY_SEARCH_BAR (widget));
236
235
      return TRUE;
260
259
}
261
260
 
262
261
static void
 
262
empathy_search_bar_match_case_menu_toggled (GtkWidget *check,
 
263
    gpointer user_data)
 
264
{
 
265
  EmpathySearchBarPriv* priv = GET_PRIV ( EMPATHY_SEARCH_BAR (user_data));
 
266
  gboolean match_case;
 
267
 
 
268
  match_case = gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (check));
 
269
 
 
270
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->search_match_case),
 
271
      match_case);
 
272
}
 
273
 
 
274
static gboolean
 
275
empathy_searchbar_create_menu_proxy_cb (GtkToolItem *toolitem,
 
276
    gpointer user_data)
 
277
{
 
278
  EmpathySearchBarPriv* priv = GET_PRIV ( EMPATHY_SEARCH_BAR (user_data));
 
279
  GtkWidget *checkbox_menu;
 
280
  gboolean match_case;
 
281
 
 
282
  checkbox_menu = gtk_check_menu_item_new_with_mnemonic (_("_Match case"));
 
283
  match_case = gtk_toggle_button_get_active (
 
284
      GTK_TOGGLE_BUTTON (priv->search_match_case));
 
285
  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (checkbox_menu),
 
286
      match_case);
 
287
 
 
288
  g_signal_connect (checkbox_menu, "toggled",
 
289
      G_CALLBACK (empathy_search_bar_match_case_menu_toggled), user_data);
 
290
 
 
291
  gtk_tool_item_set_proxy_menu_item (toolitem, "menu-proxy",
 
292
      checkbox_menu);
 
293
 
 
294
  return TRUE;
 
295
}
 
296
 
 
297
static void
263
298
empathy_search_bar_init (EmpathySearchBar * self)
264
299
{
265
300
  gchar *filename;
291
326
      "search_previous", "clicked", empathy_search_bar_previous_cb,
292
327
      "search_next", "clicked", empathy_search_bar_next_cb,
293
328
      "search_match_case", "toggled", empathy_search_bar_match_case_toggled,
 
329
      "search_match_case_toolitem", "create-menu-proxy", empathy_searchbar_create_menu_proxy_cb,
294
330
      NULL);
295
331
 
296
332
  g_signal_connect (G_OBJECT (self), "key-press-event",
311
347
  g_type_class_add_private (gobject_class, sizeof (EmpathySearchBarPriv));
312
348
 
313
349
  /* Neither GtkBin nor GtkContainer seems to do this for us :( */
314
 
  widget_class->size_request = empathy_search_bar_size_request;
 
350
  widget_class->get_preferred_height = empathy_search_bar_get_preferred_height;
315
351
  widget_class->size_allocate = empathy_search_bar_size_allocate;
316
352
}
317
353